opencode-console, published to npm as @opencode/console, connects Claude Code, Pi, Codex, DeepSeek Harness,
Hermes Agent and OpenClaw to an OpenCode Console workspace and enforces its policies on their tool calls. It ships as a
Node bundle (script/build.ts) and as eleven signed standalone binaries (script/compile.ts). The default branch is
dev, and every push to it publishes a dev build. Beta and stable releases are dispatched from dev (release.yml).
src/index.ts: the CLI's entry point, where every command starts.src/console-client.ts,src/contract.ts: Console's API.contract.tsholds every wire schema and header name the CLI reads or sends, published as@opencode/console/contract.src/event-watch.ts,src/event-watch-tool.ts: the event watch wire contract and which tool calls start a watch, published as subpaths too. Console's server builds on them, so they import nothing buteffect.src/watches.tsandsrc/*-watches.ts: event watches for each agent.src/policy-evaluator.ts: policy decisions, made by@opencode/core's engine, the same one OpenCode uses.src/claude-code*.ts,src/codex*.ts,src/pi*.ts,src/deepseek-harness.ts,src/dsh-plugin.ts,src/hermes*.ts,src/openclaw*.ts: each agent's setup, hook or in-process plugin.src/credentials.ts,src/store.ts: the sign-in and the CLI's data directory.src/install.ts,src/update/: where setup installs the CLI, self-update, signature checks and rollback.install,install.ps1: the standalone installers, fromproductiononraw.githubusercontent.comuntil Console serves them athttps://opencode.ai/console/install[.ps1](RELEASING.md, "The installers")..github/release/: the release scripts. Jobs holding secrets run only these.test/support/: the stand-in Console and release service every test runs against.
- Hooks fail closed. Any error in a policy hook exits 2 and blocks the tool call; never let a crash allow one.
- No secret goes into an agent's config files. Agents get the CLI's absolute path and ask it for tokens (
token,mcp-headers) at run time. - The data directory is
0700and the files the store writes0600. Token refreshes run under the store's cross-process lock (ConsoleStore.locked), since several hooks refresh at once. @opencode/coremakes every policy decision. Don't add a second evaluator or special-case a rule here.- The workspace config Console serves (
/api/v2/config) is standard OpenCode config. Read it as that; never expect a Console-only key in it. - Edits to an agent's JSON, TOML or YAML keep the user's comments, order and own keys, and
setup <agent> --removeputs back exactly what was there. src/contract.tsandsrc/event-watch.tschange only in step with Console. Additive fields are safe, since the CLI reads leniently; renaming or retyping one breaks every install already out there.- A stable or beta build follows only
https://anoma.ly/releaseand runs only Anomaly-signed binaries.
- TypeScript on Effect 4. Run
bun run check(oxfmt, oxlint, tsc) andbun run testbefore you commit. - Commit messages and pull request titles use
type(scope): summary; CONTRIBUTING.md lists the types. - Each module exports its own namespace on its first line:
export * as ConsoleStore from "./store". - No
any, no aliased or star imports, no default exports. Preferconst, early returns and type inference. - Comments explain constraints and surprises, not what the next line does.
bun run test. Tests live intest/, shared helpers intest/support/.- Every test runs against
test/support/console.tsandtest/support/release.tson127.0.0.1with a temporaryHOME. Never reach a real Console or a real agent config. - A test is done when it can fail: break the behavior it names, watch it go red, then restore the code.
script/e2e/run.shandscript/e2e/signed.shrun the compiled binary end to end on Linux x64. Run them on a disposable machine before changing the updater, the installers or.github/release/.
Pull requests squash-merge into dev, and every push to dev publishes a dev build. Stable and beta are dispatched
on dev with a bump (patch by default, minor or major) of the latest vX.Y.Z tag; see RELEASING.md. Nothing
commits a version back, so package.json's version isn't the release's. dev reaches production, which serves the
installers, through the promotion pull request, merged with a merge commit. Changes under .github/ need a code
owner's review, which repository admins may skip when merging a pull request; required Checks and the merge methods
apply to everyone, and only admins and maintainers may merge into production.