How OpenCode Works: A Go Agent Harness
0:00 / 0:00
How OpenCode Works: A Go Agent Harness
780
780
OpenCode is a compact Go coding CLI — and almost everything interesting happens *around*
the model call, in the harness layer.
We trace one prompt end to end: a session-scoped model↔tool loop (three exits), bash and
file tools that attach diffs + LSP diagnostics, every message and file mutation persisted
to one SQLite db with versioned snapshots (the real rollback), and manual summary-anchor
context truncation.
In this video:
- The session-scoped ReAct loop (no-tool finish / cancel / permission denied)
- bash + edit tools (timeouts, truncation, diagnostics)
- SQLite persistence + versioned file history (rollback)
- Manual summary-anchor context truncation
- The honest caveat: no sandbox — policy is not a boundary
Grounded in the staged Go source.
Subscribe for more agent-harness deep dives.
#OpenCode #AgentHarness #Golang