AgentsOpen SourceFreeActiveMachine-verified· intermediate · ~15 min setup

One shared memory for every coding agent: prove the configs actually point at the same server

Wire a Markdown memory MCP server (Basic Memory or an Obsidian MCP) into Claude Code, Cursor and Cline, and prove with CI that all three resolve to one server, that a write-the-memory house rule exists, and that the vault is under git before any agent gets write access.

by Shilpa Mitra· verified today· v1.0.0

Run this workflow

CI-verified, 2/2 fixtures passing.

Build this with your agent

One copy-paste hands Claude Code, Codex, or Cursor the full recipe, steps included, nothing to fetch.

Intended Use

Anyone jumping between Claude Code, Cursor and Cline (and Codex) who wants one shared memory instead of copy-pasting context. CI scaffolds each agent's MCP config plus a git-tracked vault, then asserts all three configs reference an identical server spec (same command+args or same URL), that a memory-write policy note exists, and that the vault is a git work tree. No install, no agent call, no key. The agents reading/writing notes and the model deciding when to save are fenced.

Not for

  • Assuming the memory is shared because you configured each agent, divergent server commands or store paths silently give you N separate memories, which is exactly what this check catches
  • Automatic continuous memory, MCP writes when you tell it or a skill does, so the write-the-memory house rule is load-bearing, not optional
  • Roo Code, it was archived around May 2026, use Cline instead (the post's own correction)
  • Trusting a note because it is in memory, retrieval confidently surfaces stale notes, so structure and prune them
  • Shipping a modified Basic Memory as a network service without reading AGPL-3.0, an Obsidian 0BSD/MIT MCP server is the permissive alternative

The Stack

Tested Against

github.com/basicmachines-co/basic-memory (2026-07)git@2.30+node@20

Side effects & data flow

Network
none, local only
Writes
./vault/, ./.mcp.json, ./.cursor/mcp.json, ./cline_mcp_settings.json
Credentials
none required

Prerequisites

  • git ≥ 2.30 for the vault work tree
  • For real use: the memory MCP server installed (uv tool install basic-memory) and each agent's MCP config pointed at it

Steps

  1. 1

    Scaffold each agent's MCP config + a git vault, then assert one shared brain

    Write the same memory server into three agents' configs, put a write-the-memory policy note in the vault, and git-init the vault. The check fails loudly if any agent points at a different server (memory would not be shared), if the write policy is missing (MCP will not auto-journal), or if the vault is not under git (write access with no undo). Change one server command and the identity check trips, which is the whole point.

    rm -rf vault .cursor .mcp.json cline_mcp_settings.json
    mkdir -p vault/memory .cursor
    SERVER='{ "mcpServers": { "basic-memory": { "command": "uvx", "args": ["basic-memory", "mcp"] } } }'
    printf '%s' "$SERVER" > .mcp.json
    printf '%s' "$SERVER" > .cursor/mcp.json
    printf '%s' "$SERVER" > cline_mcp_settings.json
    cat > vault/memory/policy.md <<'MD'
    # House rule: write what we decide to memory
    When we make a decision or learn a project fact, save a short note here so the
    next agent inherits it. Do not assume "it is in memory" means "it is current".
    MD
    git -C vault init -q && git -C vault add -A && git -C vault -c user.email=a@b.c -c user.name=x commit -qm init
    
    git -C vault rev-parse --is-inside-work-tree >/dev/null 2>&1 || { echo "BAD: vault is not a git work tree; grant write access only to a version-controlled store"; exit 1; }
    
    node -e '
    const fs = require("fs");
    const agents = { "Claude Code": ".mcp.json", "Cursor": ".cursor/mcp.json", "Cline": "cline_mcp_settings.json" };
    const SERVER = "basic-memory";
    function spec(s) { if (!s) return null; if (s.url) return "url:" + s.url; return "cmd:" + s.command + " " + ((s.args || []).join(" ")); }
    const specs = [];
    for (const name of Object.keys(agents)) {
      const srv = (JSON.parse(fs.readFileSync(agents[name], "utf8")).mcpServers || {})[SERVER];
      if (!srv) { console.log("BAD: " + name + " has no " + SERVER + " MCP server configured"); process.exit(1); }
      specs.push(spec(srv));
    }
    const uniq = Array.from(new Set(specs));
    if (uniq.length !== 1) { console.log("BAD: agents resolve to DIFFERENT servers, memory is not shared: " + JSON.stringify(specs)); process.exit(1); }
    if (!fs.existsSync("vault/memory/policy.md")) { console.log("BAD: no memory-write house rule; MCP does not auto-journal"); process.exit(1); }
    console.log("shared-memory OK: 3 agents (Claude Code, Cursor, Cline) all resolve to one server [" + uniq[0] + "]; write-the-memory policy present; vault is git-tracked. The model deciding WHEN to save is fenced");
    '
  2. 2

    Point the agents at the server and run for real (the model steps, not checked by CI)

    Install the server (uv tool install basic-memory, or run an Obsidian MCP server over your existing vault), then add the validated config to each agent (Claude Code /ide or .mcp.json, Cursor and Cline MCP settings; Codex uses the same server via its config.toml). Ask an agent to save a decision, then open a different agent and confirm it reads the same note. Whether the agent actually journals what matters, and whether a recalled note is still current, are the fenced parts, no green check can promise either.

Eval, 2 fixtures

Last passed: verified today
  • shared-okcontainstimeout 30s · max $0

    Expected: shared-memory OK: 3 agents (Claude Code, Cursor, Cline) all resolve to one server [cmd:uvx basic-memory mcp]; write-the-memory policy present; vault is git-tracked. The model deciding WHEN to save is fenced

  • clean-exitexit_codetimeout 30s · max $0

    Expected: 0

Results

The fix for re-explaining your project to every agent is not a connect-everything app, it is one MCP server over a folder of Markdown notes that every MCP-capable agent reads and writes. But "they share one memory" is a property of the config, not a hope: it only holds if each agent points at the SAME server. This recipe makes that a check. It also encodes the two honest catches the post names: MCP does not silently journal, so a write-the-memory house rule has to exist, and giving an agent write access to your vault is file-write access to your knowledge base, so the vault must be in git for instant undo before you turn an agent loose on it.

Did this work for you?

Our CI checks the setup runs. You tell us if the whole thing worked. Tell us straight.

Related workflows

Liked this workflow?

Get new verified workflows in WebAfterAI, three issues a week (Tue, Thu, Sat).