Dispatches local agentic runs (OpenCode sessions or claude -p) and reads OpenCode's local session store. The root README's OpenCode Run Dispatch section covers how a run is routed and executed, and the workflow-agentic skill covers modes, model selection and consultation patterns.
oc_run- dispatch a run, sync (block and return the reply and session id) or async (return a run id). Provider-prefixed models (openai/...) run through OpenCode, bare claude ids or aliases throughclaude -p.oc_get_run_status- one async run's status, failure kind and error, and the quota window that refused it.oc_find_run- look up an async run by thelabelit was dispatched with.oc_stop_run- stop a running async run's process group after verifying its pid, and mark itstopped.oc_wait_runs- block until every listed async run is terminal or the timeout passes.oc_get_session- read a session's message parts from the local OpenCode database, from the start or the end.oc_list_sessions- local OpenCode sessions, most recently updated first.oc_search_sessions- search local OpenCode sessions by title or message content.
No credential of its own; each run uses a login held elsewhere.
- OpenCode runs (
openai/...models) use the OpenCode provider credentials, for exampleopencode auth login openaiin a terminal or/connectin the TUI, and the OpenCode background service (opencode service start). - Claude runs spawn
claude -p, which uses Claude Code's own login and the user's~/.claude/settings.jsonpermissions. - The session tools read
opencode.dbdirectly.
From Claude Code, a claude-model run needs only a logged-in claude; an openai/... run still needs OpenCode installed, logged in to the provider, and its service running.
Each path comes from an environment variable, falling back to the default.
| Variable | Default | Purpose |
|---|---|---|
OPENCODE_BIN |
opencode (resolved from PATH) |
The opencode binary |
NODE_BIN |
node (resolved from PATH) |
The Node binary that runs the session runner |
CLAUDE_BIN |
claude (resolved from PATH) |
The claude binary (claude-model runs) |
OPENCODE_DB |
~/.local/share/opencode/opencode.db |
SQLite database path (OpenCode's own variable); relative to OpenCode's data directory |
OPENCODE_ASYNC_LOG_DIR |
~/.local/share/opencode/oc-async-runs |
Where async run logs are written (both runners) |
OPENCODE_RUN_REGISTRY_PATH |
~/.local/share/opencode/oc-async-runs.json |
Where the async run registry lives (both runners) |
node dist/modules/opencode/session-runner.js <spec.json> is the session runner oc_run starts for an OpenCode run; it is not meant to be run by hand.
generate-claude-agents.ts renders the profiles of opencode.json as Claude Code agent files in src/agents/ (pnpm run agents:generate; services/claude-agent-profile.service.ts holds the mapping), and agent-profiles.spec.ts fails when the committed files differ from what it renders.
agent-profiles.spec.ts lives here too: it holds every agent name, command pin, tool and skill that opencode.json, the commands and the skills name to the config.
- Claude Code: the bridge loads it (
isInClaudeCode: trueinsrc/modules/registry.ts). - OpenCode: only
orchestratorallowsoc_*(opencode.json).