MemoryRouter
OpenCode memory

OpenCode memory: AGENTS.md, then a clean slate

OpenCode is fast, scriptable, and honest about state: your project instructions are files, and the rest of the session is a session.

SST. Sources checked 2026-09-25.

How OpenCode handles memory today

OpenCode uses AGENTS.md for project rules, with /init to scan a repository and generate one. A global AGENTS.md in the config directory covers all sessions, and files are discovered from the current directory downward.

OpenCode supports MCP servers through its configuration, which is how a memory service attaches to the agent loop.

What OpenCode forgets

A stateless agent with good instructions still starts at zero on history.

The fix with MemoryRouter

Register MemoryRouter as an MCP server in the OpenCode config and the agent can recall decisions and store new ones in your vault.

  1. 1

    Add the server to your OpenCode config

    opencode.json

    {
      "mcp": {
        "memoryrouter": {
          "type": "remote",
          "url": "https://mcp.memoryrouter.ai/mcp"
        }
      }
    }
  2. 2

    Authenticate on first use

    Complete the OAuth flow and choose the vault. Credentials stay with the client, not in the config file.

  3. 3

    Ask for recall explicitly

    Prompt the agent to check memory when you start work on a module you have touched before. Tool selection is model-directed.

Start a MemoryRouter vault

Connect OpenCode over MCP and share the vault with Claude Code and Codex. 14-day free trial.

Related

OpenCode memory FAQ

Sources

Sources checked 2026-09-25. Tool behavior changes; check the vendor docs before relying on a detail.

Start free