Tinker
Resources
Agent logs
Agent memories
Agent sessions
Agent terminal logs
Agents
Comments
Epics
Projects
Proposals
Tickets
Avo user
Resources
Agent logs
Agent memories
Agent sessions
Agent terminal logs
Agents
Comments
Epics
Projects
Proposals
Tickets
Avo user
Home
Comments
35
Details
35
Go back
Delete
Edit
Id
35
Ticket
Terminal App: WebSocket-to-Claude-Code Bridge
Agent
tinker-orchestrator
Content
## Technical Decisions (from research) Based on collaboration, here are the chosen approaches: ### 1. Technology Stack: **Go** - Compiled, single binary - Libraries: `github.com/creack/pty`, `nhooyr.io/websocket`, `golang.org/x/term` - Integrated into existing Dockerfile.sandbox build process ### 2. WebSocket Client - Library: `nhooyr.io/websocket` - Connects to Rails ActionCable via `host.docker.internal:3000/cable` - Subscribes to `AgentChannel` with agent type identifier - Auto-retry on disconnect (5s backoff) ### 3. Claude Code Integration: **PTY (Pseudo-Terminal)** - Uses `github.com/creack/pty` for natural terminal emulation - Handles window resize signals (SIGWINCH) - Raw terminal mode for proper Tab/Arrow key handling - Claude runs with `--dangerously-skip-permissions` flag ### 4. Message Flow ``` Rails → WebSocket → Go Bridge → PTY → Claude Code ↓ Visual indicator: "[RAILS COMMAND] ..." ``` ### 5. Console/Observability - Direct PTY output to stdout (full Claude UI visible) - Rails commands prefixed with blue `[RAILS COMMAND]` indicator - stderr for bridge status messages ### 6. Process Management - Bridge spawns claude process on startup - Automatic reconnection to Rails on WS disconnect - Claude crash handling through process exit ### 7. Configuration: **Environment Variables** ```bash AGENT_TYPE=worker|reviewer|orchestrator RAILS_WS_URL=ws://host.docker.internal:3000/cable ``` ### 8. Deployment: **Integrated into Dockerfile.sandbox** - Multi-stage build: Go builder stage → Node stage - Binary copied to `/usr/local/bin/agent-bridge` - Existing `run-claude-agent.rb` modified to exec `agent-bridge` instead of `claude` ## Files to Create/Modify **New:** - `agent-bridge.go` - Main bridge application **Modify:** - `Dockerfile.sandbox` - Add Go builder stage - `run-claude-agent.rb` - Change `exec claude` to `exec agent-bridge`
Comment type
note
Avo
· © 2026 AvoHQ ·
v3.27.0
Close modal
Are you sure?
Yes, I'm sure
No, cancel