Guides
How do I share memory between Claude Code and Codex?
Connect Claude Code and Codex to the same private memory store, keep repository rules in shared files, and verify retrieval from a fresh session.
Run npx @cairn-ink/memory setup and choose Cloud to share memory automatically between Claude Code and Codex. One browser sign-in connects both tools, and a memory ID links the same project across them. Choose Local for explicit memory tools on one computer without an account. Verify sharing from a fresh session in the other client.
How do I set up automatic sharing?
Cairn.ink Memory provides an installer for both clients. Install Node 22.16 or later and make sure the Claude Code and Codex CLIs are on your path. Then run:
npx @cairn-ink/memory setup
Choose Cloud at the first-install location question. If you already know which mode you want, the direct command is:
npx @cairn-ink/memory setup --cloud
The installer finds both tools and asks about new connections; approve both. Before confirming shared memory, fully close Claude Code and Codex and wait for their background work to finish. Follow the displayed browser sign-in and one-time code. A first installation of both tools uses one browser grant for cairn.ink.
Cloud mode gives both tools automatic conversation capture and prompt recall: relevant saved context can be brought into later prompts. A memory ID connects the same project across tools. Setup keeps existing IDs; if two independent IDs already exist, it asks you to choose and preserves the other key as a backup after successful sign-in and validation. Follow that choice carefully when updating an older installation.
Reopen the clients after setup. In Codex, review and allow the four Cairn hooks in /hooks. Hooks are client actions attached to session events; they provide the automatic integration alongside callable MCP tools. These steps follow the installer README at the released commit.
How do I check that both tools share memory?
Start with the local installation report:
npx @cairn-ink/memory status
Then make a real save-and-read check. Use personal scope first so the initial test is independent of project matching. In Claude Code, ask:
Use remember_memory to save this in personal scope:
For the fictional Harbor demo, I want review summaries to start with test results.
Show the Memory ID and Source Receipt returned by the tool.
Check the tool response and keep its identifier and Source Receipt for comparison. A Memory is private user-owned context; its Source Receipt contains the source excerpt and client metadata. Open a fresh Codex session without pasting the saved answer and ask:
Use recall_memory to find my review-summary preference for the Harbor demo.
Show the returned Memory ID and Source Receipt, or report no matching result.
Compare the returned identifier and source. Repeat in the reverse direction if both clients will save context. This tests the explicit shared store. To check automatic behavior as well, give one client a harmless preference in ordinary conversation, let its turn and background work finish, then ask about it in a fresh session in the other client. Inspect what was actually captured and recalled.
After the personal test succeeds, try project-private context in the same project using the installer-linked identity. Keep a short record of which client saved each test and which retrieved it. That makes a later account or scope mismatch easier to diagnose.
How can I control automatic capture and recall?
Cloud conversations are saved after best-effort local masking. Each prompt sends a masked, length-limited copy for recall. Read the privacy controls before enabling this for your work.
For a paired installation, these controls use the installed Codex integration and share its capture pause with Claude:
npx @cairn-ink/memory pause
npx @cairn-ink/memory resume
npx @cairn-ink/memory prompt-recall-off --client codex
npx @cairn-ink/memory config --codex-daily-cap 300
Paused conversations are skipped rather than backfilled. Turning off Codex prompt recall keeps automatic capture and MCP tools available; use prompt-recall-on --client codex with the same command prefix to restore it. Codex defaults to 200 automatic captures per day; existing installations retain their stored cap. If today's counter already exists, a cap change takes effect at the next daily reset. Claude's quota is independent. Automated Codex runs are excluded from capture and prompt recall by default.
What if I want Local without an account?
At the initial setup question, choose Local, or run:
npx @cairn-ink/memory setup --local
npx @cairn-ink/memory status
Both clients use the same database and owner on this computer, registered as cairn-local. The default database is ~/.cairn-memory/data/memory.sqlite. Local is free, needs no account, and provides explicit tools without automatic capture or cross-computer sync.
Saving and inspecting work without a model key. For a first persistence check, save a harmless test record and inspect it from the other client's fresh session:
Use inspect_memory to list saved Memories, then inspect the test Memory.
Show its ID, content and receipt from the tool response.
Semantic recall needs a configured model key and can send selected text to its provider. Linux/WSL is the tested local installer environment; macOS is untested and native Windows requires WSL. Keep backups before changing an existing installation, and follow the printed transition instructions when switching modes; setup does not migrate memories between Local and Cloud.
Can I use explicit hosted tools only?
For a manual setup without automatic capture, Claude Code can add the HTTP server and authenticate through browser OAuth in /mcp:
claude mcp add --transport http --scope user cairn https://cairn.ink/api/mcp
Codex's documented token alternative is below. Create the token yourself at https://cairn.ink/settings/tokens and supply it outside the repository; the shown value is a placeholder:
export CAIRN_MCP_TOKEN='your-token-from-cairn.ink'
codex mcp add cairn --url https://cairn.ink/api/mcp --bearer-token-env-var CAIRN_MCP_TOKEN
codex mcp list
Restart Codex from the environment containing that variable. These commands come from the release README, with client syntax covered by the Claude Code MCP reference and Codex MCP guide, accessed 2026-11-12.
Where should shared project rules and limits live?
Keep maintained project rules in AGENTS.md, as described in the Codex instruction guide. Claude Code can import that file from an adjacent CLAUDE.md, following its memory documentation, both accessed 2026-11-12:
@AGENTS.md
Preserve existing instructions when adding the import. Put current versions and build commands in maintained project files; use private Memory for reusable personal context. Team knowledge belongs in reviewed files or Knowledge Cards, whose publication is a separate human-authorized act.
For troubleshooting, check server, account, scope and the setup-linked project identity. status reads local state; it does not verify remote service or hooks. A Source Receipt explains origin, so compare remembered technical facts with their current source before changing code.
Use the connection guide to set up the path that fits your workflow.
Frequently asked questions
- Do I need a server to share project rules?
- No. A maintained AGENTS.md can hold shared project instructions. An adjacent CLAUDE.md can import it for Claude Code.
- Can both tools use the same local database?
- Cairn.ink Memory local setup documents a shared database and owner for Claude Code and Codex on the same computer. It has no automatic capture or cross-computer sync.
- How do I enable automatic sharing?
- Run npx @cairn-ink/memory setup and choose Cloud. Approve both detected clients and complete one browser sign-in. The installer links the project identity and sets up automatic capture and prompt recall.
- How do I check cross-tool retrieval?
- A fresh session in the second client must call the memory tool and return the same saved identifier and source, without being given the saved answer.