Slot: agent · Name: opencode · Binary: opencode
OpenCode is an open-source terminal coding agent. It has a structured session API, which means AO can discover, resume, and track its sessions reliably.
macOSSupported
LinuxSupported
WindowsSupported
Install
npm install -g opencode-ai
Use
agent: opencode
No plugin-level config.
How it works
- Launch:
opencodestarts in the worktree withAO:<sessionId>as the session title — this is how AO finds it back later. - Session discovery:
opencode session list --format jsonreturns the list; AO matches on the title prefix. - Resume:
opencode --session <id>rehydrates the state. - Activity tracking: Primary signal is the OpenCode session's
updatedAt. AO falls back to its own activity JSONL if the session API doesn't answer. - PR + git tracking: PATH wrappers for
gh/git.
Environment variables
| Variable | Set by AO | Purpose |
|---|---|---|
AO_SESSION_ID | ✓ | AO session id |
AO_ISSUE_ID | ✓ | Issue identifier |
PATH | ✓ | Prepends ~/.ao/bin |
GH_PATH | ✓ | Absolute path to real gh |
Troubleshooting
Session can't be found when resuming
ao session remap <sessionId> re-discovers and persists the OpenCode session mapping. Use --force to override a stale mapping.
Activity stuck on `idle`
If the OpenCode session API doesn't respond, AO falls back to the activity JSONL, which uses age-based decay. If even that returns idle forever, check that opencode session list works on its own.