Setup guide · experimental

Set up Mneme with OpenCode and CI

Use the CI check as your enforcement layer: it works on OpenCode’s changes today with the released mneme-hq 0.11.0. Mneme’s OpenCode adapter is experimental, merged on the main branch after that release, and checks only Python file writes and edits in the terminal CLI. Try it from source if you want to evaluate it, not to rely on it.

Verify: CI checkEnforce: OpenCode adapter, experimentalDiscover: MCP, optional

You’ll end up with: a required CI check that fails any pull request where OpenCode, or anyone else, adds a file that breaks a decision with an activated rule.

Goal

OpenCode is an open-source coding agent that runs in a terminal, an editor extension and a desktop app. Mneme has no released hook for it. What exists is an experimental adapter for the terminal CLI, which is not in any published mneme-hq release. So this setup puts the weight on CI and treats the adapter as optional and unproven.

The example decision is ADR-001, an architecture decision record (ADR) that bans the Celery library.

Prerequisites

  • A git repository with ADR-001’s rule activated: steps 1 to 7 of the Claude Code setup, which need no agent.
  • Permission to add a CI workflow and make it a required check.
  • For the adapter only: OpenCode 2.3.0, the version the adapter was validated on, and a Python codebase.

Tested versions: the CI check ran against mneme-hq 0.11.0, on a local copy of a pull request. We did not run OpenCode or the adapter for this guide.

Configure

1. Add the required CI check

Copy the GitHub Actions workflow or GitLab CI job, commit it with the ADR and the memory file, and make it a required check. This is the layer that enforces ADR-001 on OpenCode’s changes.

2. Optional: give OpenCode the decisions

If your OpenCode setup can start local Model Context Protocol (MCP) servers, register Mneme’s decision server so the agent can look decisions up before it writes. The decision MCP setup has the command and arguments. We have not tested it inside OpenCode.

Expected result

A pull request in which OpenCode added a Celery worker as workers/jobs.py and a Pub/Sub one as workers/publish.py fails the check:

Recorded output
exit=2 workers/jobs.py
exit=0 workers/publish.py

The first file exits 2 and fails the job; the second passes. The CI-only setup shows the JSON verdict.

Experimental adapter

Experimental. Merged on Mneme’s main branch on November 18, 2026, after the 0.11.0 release, and not a supported integration. Installing mneme-hq 0.11.0 does not include it.

The adapter is a plugin for OpenCode’s tool hook, the point where a plugin can inspect a tool call before it runs, in the terminal CLI. In strict mode it makes OpenCode refuse two operations when they break a FORBID_LITERAL rule: writing a new .py file, and editing an existing one, where only the added text is checked.

To evaluate it, you need Mneme’s source at the main branch, both for the plugin in integrations/opencode-plugin and for the Python code it calls. The plugin’s README.md configures it in opencode.json with an absolute authorityPath:

Configuration
{
  "plugins": [
    {
      "package": "/path/to/mneme/integrations/opencode-plugin",
      "options": {
        "authorityPath": "/path/to/authority.json",
        "timeoutMs": 60000
      }
    }
  ]
}

authorityPath is the absolute path to a file you write, authority.json. It names the one decision, decision version and rule you expect the adapter to enforce, so the adapter can tell when the memory file no longer matches what you approved. It is a check on the adapter, not a place to define rules.

To create it, run mneme check --json on a file that breaks the rule and copy five fields from the verdict, like the one in the CI-only setup: decision_id, decision_version_id, rule_id, rule_value, and the path pattern the rule applies to as rule_scope. The plugin README shows the file’s shape with a path-scoped rule; we have not tested it with a rule like ADR-001’s that has no path pattern. The plugin’s README file describes every field; follow it rather than this summary, because main moves.

What is and isn’t enforced

  • Enforced, with the released package: the CI check, on every file a pull request adds or modifies.
  • Experimental adapter, when installed from source: new .py file writes and existing .py file edits in the terminal CLI, for FORBID_LITERAL rules only.
  • Not intercepted by the adapter: overwriting an existing file, non-Python files, multi-edit and patch payloads, shell commands, MCP and custom tools, deletion and rename. It has no end-of-turn check.
  • Fails open: when the adapter can’t evaluate a change, it lets the change through instead of blocking it.
  • Not race-resistant: a file created or swapped between the check and the write is a known bypass.
  • Not covered: the OpenCode editor extension and desktop app.

Troubleshooting

The adapter prints Mneme NOT_PROTECTED

Its setup is invalid, most often the authorityPath or the pinned identifiers, and it lets the change through. Check the file against the plugin’s README.md.

The adapter prints Mneme WARN: warn_mode_violation

It is in warn mode, which reports and never blocks. The warning is a diagnostic, not protection.

CI fails at the memory check

An ADR changed without a re-import. The CI-only setup covers it.

Next layer

Follow the adapter’s progress

The OpenCode adapter is developed in the open-source repository.