MimirDocumentationSign in
Documentation

9 agents · all agents

Connect OpenCode

OpenCode talks to Mimir over the Model Context Protocol at https://mimir.johansen.foo/mcp. The token is an API key from Settings → API keys in the Mimir app; export it as MIMIR_TOKEN before starting the agent.

1. Add the server

File: opencode.json (project or ~/.config/opencode/opencode.json)

json
{
"$schema": "https://opencode.ai/config.json",
"mcp": {
"mimir": {
"type": "remote",
"url": "https://mimir.johansen.foo/mcp",
"enabled": true,
"headers": {
"Authorization": "Bearer ${env:MIMIR_TOKEN}"
}
}
}
}

2. Verify

Ask the agent to run memory_tree. It should list the projects your token can see, or nothing at all on a fresh install — either answer proves the connection works.

3. Tell it how to behave

Paste this into the agent's rules or instructions file, once per machine.

text
You have a long-term memory store called Mimir.
At the start of a session, call memory_digest with the current repository to load what is already known.
Before answering a question about this project's conventions, call memory_search with a path_prefix (for example "conventions").
When you learn something durable — a decision, a convention, a gotcha — call memory_write with a path that says where it belongs.
Do not store secrets, tokens or customer data.

Notes

  • The plugin package registers mimir_digest and mimir_remember; ask the agent to call mimir_digest first, or use the MCP config above by hand.
  • Set MIMIR_TOKEN in your shell before starting OpenCode.
  • Run `npx @mojoaar/opencode-mimir ingest .` once per project so the first session starts informed.