OpenCode is a multi-surface coding agent

OpenCode is an open-source coding agent that does not live in a single place. It runs in the terminal, as an IDE extension, and as a desktop app, supports parallel agent sessions on the same project, and connects to a large range of model providers. It is, in the vocabulary we use for this stack, a harness: the execution layer that coordinates tool calls, state, and the agent loop across more than one surface.

That breadth is exactly why governance matters here. The more surfaces an agent acts through, the more places an architectural decision can quietly fail to apply. A rule enforced in the terminal but not in the desktop app is not a rule.

OpenCode coordinates execution across surfaces. Mneme’s adapter attaches to the terminal CLI only. Coverage there does not imply coverage in the IDE extension or the desktop app.

The integration surface: OpenCode's tool hook

OpenCode’s plugin system exposes an execute.before hook that fires before a tool mutates files. This adapter registers on that hook in the terminal CLI only; it is not wired into the IDE extension or the desktop app. It runs mneme check against the team’s recorded decisions, and a confirmed literal-rule violation makes OpenCode refuse the change. What is merged is narrower than the hook surface: two Python operations on the terminal CLI.

Hook / operationMneme actionStatus
write — new .py fileChecked before the write; a block makes OpenCode refuse itMerged: new-file write
edit — existing .py fileChecks only the lines the edit adds; a block makes OpenCode refuse itMerged: existing-file edit
after-execution and session-idle hooksNo advisory pass is wiredNot implemented
session compactionEvaluated and closed — the completed experiment returned a NULL verdict (no measurable effect)Closed (NULL verdict)

Source versus release. The adapter is merged on main. It is not part of the published mneme-hq 0.11.0 package, so installing that release does not provide OpenCode coverage. Until a release includes it, treat this as source-level capability, not a shipped package feature.

Only one rule type is evaluated. The adapter checks FORBID_LITERAL rules, which forbid a specific string. Other rule types are not covered.

Trying it from source

  1. Install Mneme (Python 3.11 or newer) from the repository. The adapter is validated on OpenCode 2.3.0 with the V2 plugin API.
  2. Register integrations/opencode-plugin from the Mneme repository in your project’s opencode.json plugins array. Set its authorityPath option to an authority.json file, which pins the exact decision, version and rule you expect.
  3. Make sure the repository has recorded decisions. Only FORBID_LITERAL rules are evaluated.

There is no packaged install for the adapter yet.

Modes: strict and warn

In strict mode, the default, a confirmed literal-rule violation blocks: the plugin throws and OpenCode refuses the write or edit. In warn mode the same evaluation proceeds and the plugin prints Mneme WARN: warn_mode_violation. The warning is a diagnostic, not protection. There is no advisory check after a change lands, and no end-of-turn or session-boundary pass.

Compaction: evaluated, closed as NULL

OpenCode documents compaction hooks designed to preserve task state, decisions, modified files, and multi-agent dependencies across longer sessions. We ran a controlled experiment injecting governance summaries through compaction; it completed with a NULL verdict (no measurable effect on outcomes) and was closed evidence-only, without adoption. The distinction at the heart of Mneme still stands: the difference between remembering a decision and enforcing it. But we will not claim a compaction-based context capability that validation did not support.

Where this sits in the stack

OpenCode is the harness; Mneme is the decision and control layer that runs alongside it. They are different layers of the runtime stack and they compose: OpenCode decides how the agent executes, and Mneme decides whether the resulting change respects the architecture. That composition is implemented for other agents (Claude Code, Claude Agent SDK, Google Antigravity) and for the terminal CLI here, where it remains experimental. The full argument for why a capable harness still needs this layer is in Harness Engineering Still Needs Governance.

Status: experimental. The adapter is merged on main but is not in the published mneme-hq 0.11.0 package, and it is not a supported integration. Race resistance has not been established: a file swapped between the check and the write is a known bypass. The host does not supply the call identifier the evidence format requires, so the adapter records no evidence claim (its audit record stays incomplete by design). If you need enforcement now, use a supported integration or a CI gate.