00 | Start here: OpenCode Architecture overview
Sunil Tiwari · Oct 29, 2026 · 3 min read
A study notebook built on OpenCode Architecture, the five-part series by Vinoth Govindarajan in The Agent Stack. All experiments and findings are his; these notes expand them, check them against OpenCode's source and add diagrams.
What this series is about
OpenCode is an open-source AI coding agent. Most write-ups describe what an agent like it can do. Vinoth asks a sharper question in every part: when the agent says it is done, what actually happened? He answers with controlled experiments against a pinned release (OpenCode v1.18.30, commit 3104c14), using a scripted provider so the model never varies, and he publishes every run in a companion lab (vingov/the-agent-stack-labs).
Each part follows one request a little further through the system:

The five parts
| Part | Chapter (note + diagrams canvas) | Question it answers |
| 1 | 01 · Clients, Sessions and the Coding Loop | What turns "fix this bug" into a patch you can verify? |
| 2 | 02 · Repository Context and Compaction | What reaches the model when the repo is larger than the conversation? |
| 3 | 03 · Tool Execution and Permission Boundaries | What did you actually approve? |
| 4 | 04 · Subagents and Shared Work | What crosses the boundary when an agent delegates? |
| 5 | 05 · Snapshots, Recovery and Patch Verification | When work stops midway, what can recovery undo? |
The thread running through all five
- "Done" has layers. A finished request, a finished tool loop, a changed file and an accepted patch are different states (Part 1).
- The model only sees what was put in front of it. Rules are found by searching upward, attachments are frozen at send time, and compaction can drop the nearby rule first (Part 2).
- An approval is broader than it looks. In v1, a remembered "always" could beat a configured deny, and an edit does not re-read the file after waiting for permission (Part 3).
- Delegation creates a new conversation, not a clone. The worker gets the prompt, not the history, shares the checkout, and returns only its last text (Part 4).
- Recovery restores what was recorded, not what happened. Snapshots miss writes made by other processes, and a stopped request can leave a child process running (Part 5).
Versions
Vinoth's experiments use OpenCode v1.18.30; the v1 line is still released (v1.19.5) and his findings hold there. OpenCode v2 (on main, v2.2.1) has moved the runtime to packages/core and changed some behaviour, most notably: a configured deny now always wins over saved approvals, and subagents no longer copy the parent session's permission rules. Each note ends with a short "what changed in v2" line where it matters.
How to read this notebook
Read the parts in order; each starts with an overview diagram, follows Vinoth's sections, then ends with What to steal (a checklist for building your own agent), a Quick self-check, and links to the exact source files. Each chapter is a project: the note and a canvas with the chapter's map and every diagram, side by side in Split view.
Credit
Series, experiments, numbers and checklists: Vinoth Govindarajan, The Agent Stack · LinkedIn · GitHub. Subscribe to The Agent Stack for the original posts.