Integration · OpenCode 7 min read

# OpenCode Governance

OpenCode runs an open-source coding agent across the terminal, an IDE extension, and a desktop app, with a plugin system of execution and session hooks. Mneme registers on those hooks — advisory at the edit, blocking before commit — so the same architectural decisions hold on every surface the agent acts through.

By Theo Valmis·June 2026

## 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 enforces the architectural intent those surfaces have no opinion about — identically, wherever the agent is working.

## The integration surface: OpenCode's plugin hooks

OpenCode exposes a plugin system with hooks at the points where governance belongs. A Mneme plugin, installed under `.opencode/plugins/`, registers on these hooks and runs `mneme check` against the team's recorded decisions, returning explainable PASS, WARN, or FAIL findings — each carrying the decision id that produced it.

OpenCode hook | Mneme action | Mode
--- | --- | ---
tool.execute.before | Check the proposed change against decisions before it runs | Advisory or blocking
tool.execute.after / file.edited | Verify the change that landed; surface violations with the decision id | Advisory
session.idle | Run a governance pass over the session's changes | Advisory
before git commit / push | Block changes that violate a recorded architectural decision | Blocking
session compaction | Inject a compact governance summary so decisions survive long sessions | Context

## Advisory at the edit, blocking at the boundary

The right enforcement mode depends on the surface. While an agent is editing, an advisory check keeps flow intact — it surfaces a finding and the decision behind it without halting work. At the boundaries that matter — before a commit, before a push — a blocking check refuses to let a change that violates an architectural decision proceed. This mirrors how Mneme works everywhere: governance before the change lands, with strict enforcement reserved for the points of no return.

## Continuity across long, parallel sessions

OpenCode documents compaction hooks designed to preserve task state, decisions, modified files, and multi-agent dependencies across longer sessions. That aligns closely with the distinction at the heart of Mneme: the difference between remembering a decision and enforcing it. Compaction keeps the relevant decisions present as a session grows; Mneme makes those decisions binding. Parallel sessions on the same project see the same compiled constraints, so two agents working at once do not drift apart.

## Where this sits in the stack

OpenCode is the harness; Mneme is the governance layer that runs alongside it. They are different layers of the runtime stack and they compose: OpenCode decides how the agent executes across terminal, IDE, and desktop, and Mneme decides whether the resulting changes respect the architecture. The full argument for why a capable harness still needs this layer is in Harness Engineering Still Needs Governance.

OpenCode runs the agent across every surface. Mneme keeps the same architectural decisions enforced across all of them.

## Frequently asked questions

What is OpenCode?+
OpenCode is an open-source coding agent that runs in the terminal, as an IDE extension, and as a desktop app. It supports parallel agent sessions on the same project, works with a large number of model providers, and exposes a plugin system with hooks for tool execution and session lifecycle events.
How does Mneme integrate with OpenCode?+
OpenCode's plugin system exposes hooks including tool.execute.before, tool.execute.after, file.edited, session.created, session.idle, and session.diff, plus custom tools and project-level plugins under .opencode/plugins/. A Mneme plugin registers on those hooks and runs mneme check, returning explainable PASS, WARN, or FAIL findings with the decision that produced them.
Is this advisory or blocking?+
Both, depending on the hook. An advisory check can run after relevant file edits or when a session becomes idle, surfacing findings without interrupting flow. A blocking check can run before git commit or git push, refusing to proceed when a change violates a recorded architectural decision. The mode is yours to set per surface.
Why govern OpenCode if it already runs the agent well?+
Running the agent well is execution; keeping the architecture coherent is governance. OpenCode coordinates tool calls, parallel sessions, and long-running work across the terminal, IDE, and desktop. Mneme enforces the architectural decisions those surfaces have no opinion about, so the same constraints hold no matter which surface the agent is acting through.
Related governance concepts

- Execution Surfaces

  Terminal, IDE, and desktop are three surfaces where the same decisions must hold.

- Governance Propagation

  One compiled set of constraints, enforced identically across every surface and session.

- Runtime Governance

  Enforcement across long-running, parallel agent sessions.

- Governance Before Generation

  Check the change before it lands, not after it ships.

Related reading

- Harness Engineering Still Needs Governance

  A capable execution layer is not a governed one.

- Governance Across Heterogeneous Coding Agents

  One decision corpus, enforced across every agent and tool.

- Claude Code Governance

  The same hook-level enforcement, wired into Claude Code.

- All integrations

  Where Mneme plugs into your coding-agent stack.