You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Build a Chrome Extension that creates direct real-time communication channel between the user and AI agents running in browser tabs (Claude.ai, Cursor, GitHub).
All messages are JSON. Define in both protocol.rs (Rust) and shared/types.ts (TypeScript).
// shared/types.tstypeAgentId=string;// e.g. "agent-1", "agent-claude-main"typeAgentStatus='idle'|'claiming'|'working'|'blocked'|'done';interfaceAgentState{id: AgentId;name: string;issue: number|null;// GitHub issue number currently claimedstatus: AgentStatus;branch: string|null;last_update: string;// ISO timestampmessage: string;// last status message}// Messages: Client → ServerinterfaceSendCommandMsg{type: 'send_command';target: AgentId|'broadcast';// specific agent or allcommand: string;// text to injectissue_comment: boolean;// also post to GitHub issue #30?}interfaceClaimIssueMsg{type: 'claim_issue';agent_id: AgentId;issue_number: number;branch: string;}interfaceUpdateStatusMsg{type: 'update_status';agent_id: AgentId;status: AgentStatus;message: string;}// Messages: Server → ClientinterfaceBoardStateMsg{type: 'board_state';agents: AgentState[];// full state of all agentsissues: IssueStatus[];// #30 child issues status}interfaceAgentEventMsg{type: 'agent_event';agent_id: AgentId;event: 'claimed'|'done'|'blocked';issue_number: number;message: string;}interfaceCommandDeliveredMsg{type: 'command_delivered';target: AgentId;success: boolean;}
🦀 Rust: crates/trios-bridge
Cargo.toml
[package]
name = "trios-bridge"version = "0.1.0"edition = "2021"
[dependencies]
tokio = { version = "1", features = ["full"] }
tokio-tungstenite = "0.21"serde = { version = "1", features = ["derive"] }
serde_json = "1"futures-util = "0.3"octocrab = "0.38"# GitHub APItracing = "0.1"tracing-subscriber = "0.3"uuid = { version = "1", features = ["v4"] }
server.rs — core requirements
Listen on ws://localhost:7474 (port 7474 = T-R-I-N in phone digits)
Auth: reads GITHUB_TOKEN from env (same as existing trios pattern).
CLI integration
Add to tri CLI:
tri bridge start # start WebSocket server on :7474
tri bridge status # show all connected agents
tri bridge send <agent> <msg> # send command to specific agent
tri bridge broadcast <msg> # send to all agents
#41 Lane A Scaffold 🟢 IN PROGRESS
#43 Lane B Proofs 🔴 TODO
#44 Lane C Physics 🔴 TODO
#46 Lane D Sacred 🔴 TODO
#47 Lane E GF16 🔴 TODO
#48 Bibliography 🔴 TODO
#49 Lexicon+Genealogy 🔴 TODO
#50 TikZ Figures 🔴 TODO
#51 Final Integration ⚫ BLOCKED (waiting all)
Quick action buttons
🚀 Broadcast: Start your claimed issue NOW
🔄 Sync board from GitHub
⚡ Broadcast: STOP asking questions, just push
💉 claude-injector.ts — content script
// Listens for commands from service-workerchrome.runtime.onMessage.addListener((msg)=>{if(msg.type==='inject_command'){injectIntoClaudeTextarea(msg.command);}});functioninjectIntoClaudeTextarea(command: string): void{// Find Claude's textarea (ProseMirror div)consteditor=document.querySelector('[contenteditable="true"][data-testid="chat-input"]'??'div.ProseMirror'// fallback);if(!editor)return;// Inject text using React synthetic events (required for ProseMirror)constnativeInputValueSetter=Object.getOwnPropertyDescriptor(window.HTMLDivElement.prototype,'innerHTML');editor.innerHTML=command;editor.dispatchEvent(newEvent('input',{bubbles: true}));// Auto-submit after 500mssetTimeout(()=>{constsendButton=document.querySelector('[data-testid="send-button"]'??'button[aria-label="Send message"]');sendButton?.click();},500);}
🐙 github-injector.ts — content script
On github.com/gHashTag/trios/issues/30:
Parses all comments to extract agent status (CLAIMING / DONE / BLOCKED)
Sends parsed AgentState[] to service-worker via chrome.runtime.sendMessage
🌐 Trinity Agent Bridge — Chrome Extension
🎯 Goal
Build a Chrome Extension that creates direct real-time communication channel between the user and AI agents running in browser tabs (Claude.ai, Cursor, GitHub).
Stack: Chrome Extension (TypeScript) + trios MCP WebSocket server + content scripts.
NO
.shfiles. Rust + TypeScript only.🏗 Architecture
📦 Repository structure
📡 WebSocket Protocol
All messages are JSON. Define in both
protocol.rs(Rust) andshared/types.ts(TypeScript).🦀 Rust: crates/trios-bridge
Cargo.toml
server.rs — core requirements
ws://localhost:7474(port 7474 = T-R-I-N in phone digits)useroragentrouter.rsclaim_issue: POST comment to GitHub issue epic(phd): Trinity Framework — Flos Aureus PhD Dissertation v6.0 #30 with CLAIMING messageupdate_status: update in-memory agent state, broadcastboard_stateto all usersgithub.rs — required functions
Auth: reads
GITHUB_TOKENfrom env (same as existing trios pattern).CLI integration
Add to
triCLI:🧩 Chrome Extension: manifest.json
{ "manifest_version": 3, "name": "Trinity Agent Bridge", "version": "0.1.0", "description": "Direct human↔agent communication via trios MCP", "permissions": [ "tabs", "activeTab", "storage", "scripting" ], "host_permissions": [ "https://claude.ai/*", "https://github.com/*", "https://cursor.sh/*", "http://localhost:7474/*" ], "background": { "service_worker": "dist/background/service-worker.js", "type": "module" }, "action": { "default_popup": "dist/popup/index.html", "default_icon": { "32": "icons/trinity-32.png", "128": "icons/trinity-128.png" } }, "content_scripts": [ { "matches": ["https://claude.ai/*"], "js": ["dist/content/claude-injector.js"], "run_at": "document_idle" }, { "matches": ["https://github.com/gHashTag/trios/*"], "js": ["dist/content/github-injector.js"], "run_at": "document_idle" } ] }🖥 Popup UI — AgentBoard.tsx
Required features:
Live agent board — shows all connected agents with status badges
Command input — text field + send button
Issue epic(phd): Trinity Framework — Flos Aureus PhD Dissertation v6.0 #30 mini-board — live view of all 8 child issues
Quick action buttons
🚀 Broadcast: Start your claimed issue NOW🔄 Sync board from GitHub⚡ Broadcast: STOP asking questions, just push💉 claude-injector.ts — content script
🐙 github-injector.ts — content script
On
github.com/gHashTag/trios/issues/30:AgentState[]to service-worker viachrome.runtime.sendMessage🔨 Build system
Makefiletarget in root:NO
.shfiles — all build steps via Makefile + npm scripts.✅ Acceptance Criteria
Rust bridge
tri bridge startlaunches WebSocket on ws://localhost:7474tri bridge send agent-1 "do X"delivers messagetri bridge broadcast "stop asking, just push"reaches all agentscargo testpasses for all cratesChrome Extension
Broadcastbutton sends message to all open Claude.ai tabsmake extension-buildproducesdist/without errorstrinity-bridge.zipunder 2MBIntegration
.shfiles anywhererefs #52🌿 Branch
feat/trinity-agent-bridge📅 Timeline
trios-bridgecrate: WebSocket server runningtri bridge start/send/broadcastCLI commands📢 Sync
Post in this issue before starting:
🔒 AGENT [name] CLAIMING: Trinity Agent Bridge | Branch: feat/trinity-agent-bridge | Status: IN PROGRESSrefs #30