OpenConductor — Go TUI managing multiple AI coding agents (Claude Code, OpenCode) in parallel with real PTY terminal emulation and two-layer attention detection.
make build # build binary
make test # tests with race detector
make lint # golangci-lint
make check # fmt + vet + lint + testcmd/openconductor/ Entry point, flag parsing, config/state loading
internal/agent/ AgentAdapter interface + implementations (claude.go, opencode.go)
internal/attention/ L1 heuristics + L2 LLM attention detection + auto-approve
internal/config/ YAML config (AgentType, ApprovalLevel) + ephemeral state (tabs)
internal/session/ PTY lifecycle, vt10x terminal, captureScrollOff, session manager
internal/tui/ Bubble Tea app: app.go (main model), terminal.go, sidebar.go,
scrollback.go, statusbar.go, messages.go, form.go, styles.go
internal/llm/ Multi-provider LLM client (Anthropic, OpenAI, Google)
internal/permission/ Permission classification (L1 patterns + L2 LLM)
internal/telegram/ Bidirectional Telegram bot bridge
internal/notification/ Desktop notifications
internal/bootstrap/ Repo scaffolding with Go templates
internal/logging/ Structured JSON logger (slog)
- SPDX license header:
// SPDX-License-Identifier: MIT+ copyright on every.gofile - Commit prefix:
feat:,fix:,docs:,test:,refactor:,ci:,deps: - Table-driven tests, no global state, explicit dependency passing
- Branch from
master, PR back tomaster
The agent adapter system (internal/agent/agent.go) uses a core interface plus optional extension interfaces:
AgentAdapter(required):Type(),Command(),BootstrapFiles(),ApproveKeystroke(),ApproveSessionKeystroke(),DenyKeystroke()AttentionChecker: Agent-specific heuristics returning(HeuristicResult, *AttentionEvent)ChromeLineFilter: Per-line content filtering for TUI chrome (spinners, status bars)ChromeLayout: Fixed chrome row counts (top/bottom) to exclude from scrollback captureOutputFilter: Stateful preprocessing of raw PTY output before vt10x parsingQuestionResponder: Navigation keystrokes for structured question dialogsHistoryProvider: Load previous conversation history for scrollback pre-populationScreenFilter: Crop agent UI (e.g. OpenCode sidebar) from Telegram screen snapshotsSubmitDelay: Pause between typing text and Enter for event-loop syncImageInputFormatter: Custom formatting for image file paths in Telegram input
Two detection strategies in checkScrollback (internal/tui/app.go):
- Non-alt-screen (Claude Code):
Session.captureScrollOff()runs perVT.Write(). Lines pushed withPushForce(no buffer-wide dedup) to preserve legitimate duplicate content. - Alt-screen (OpenCode): Snapshot-based detection with buffer-wide dedup (
Push) to prevent TUI repaint flooding.pushAltScreenDiffcaptures disappeared content.
Ring buffer capacity: 10,000 lines. Text dedup set maintained for correct eviction on wrap.
go test -race ./... # all tests
go test ./internal/agent/... # agent adapters
go test ./internal/tui/... # TUI rendering, scrollback, selection
go test ./internal/attention/... # attention detection
go test ./internal/config/... # config loading