DEV Community

Cover image for How I gave Claude, Cursor and Codex one shared memory in plain Markdown

How I gave Claude, Cursor and Codex one shared memory in plain Markdown

Alen Issac Sam on November 26, 2026

Every AI chat I opened started from zero, and every app started from zero again. I'm a student, I use several AI apps every day, and I kept re-expl...
Collapse
 
izgorodin profile image
Edward Izgorodin •

With stdio, every connected app starts its own keepfold process, so Claude Desktop, Cursor and Codex open at the same time are three processes writing one vault. The reference memory server in the MCP servers repository documents this case: each client starts its own server process, a write takes a lock file next to the memory file, a write that cannot get the lock within 60 seconds fails instead of overwriting, and a network filesystem that does not honour the lock cannot share it safely. Is your lock a file lock that all keepfold processes see, or one inside each process? A separate point on the one-click list: Windsurf has been Devin Desktop since 2 June, and its docs name three different paths for the MCP config, so I would check which one the installer writes.

Collapse
 
alenissacsam profile image
Alen Issac Sam •

It's a file lock that every Keepfold process sees: .keepfold/lock in the vault, created with O_EXCL and holding the pid, a timestamp and the host name. Each process also has a thread lock, so one process can't race itself. A write waits a few seconds (5 by default), then fails with "the vault is busy" rather than overwriting. Under the lock, a page goes to a temp file and is moved into place with os.replace, and an event is one appended line.

A lock is taken over only when its holder is gone: a dead pid, or a pid reused after a reboot. A lock from another machine is judged by its age, after 120 seconds. That lock did bite me once. On Windows, two processes took it inside the same 15.6 ms clock tick, and the second one took over a live lock. The token now carries a counter and the process's start time.

On shared folders: a synced folder (OneDrive, Syncthing) can't carry a lock between two PCs in time. So Keepfold finds the conflict copies those tools leave, and merges its own event log copies. I haven't tested a network filesystem that ignores O_EXCL, so I wouldn't promise that case.

Thanks for the Windsurf note. Keepfold writes ~/.codeium/windsurf/mcp_config.json today. I'll check it against the current docs.

Collapse
 
alenissacsam profile image
Alen Issac Sam •

You were right about Windsurf, thank you. Current Devin Desktop reads %APPDATA%\devin\mcp_config.json on Windows and ~/.config/devin/mcp_config.json on macOS and Linux, and Keepfold was still writing the old ~/.codeium/windsurf file. We'll fix that in the coming release, 0.8.0: Keepfold will write Devin Desktop's file, and the old one too when an older Windsurf build is installed.

Collapse
 
alenissacsam profile image
Alen Issac Sam •

This is fixed in 0.8.0, out now. Connect AI apps writes Devin Desktop's mcp_config.json, and the old ~/.codeium/windsurf file too when an older Windsurf build is installed. Thanks again for catching it. github.com/alenissacsam-2/keepfold...

Collapse
 
alexshev profile image
Alex Shev •

The separation between source notes and rebuildable indexes is a strong design choice. For cross-app injection, I would also keep provenance and review state beside each retrieved note: who or what created it, when it was last confirmed, and whether it is a preference, a project decision, or untrusted imported material. That gives a new agent enough context to weigh a memory without treating every matching line as equally authoritative.

Collapse
 
alenissacsam profile image
Alen Issac Sam •

Thanks, agreed. Some of that is already there. Each line has a tier: what you typed or confirmed goes into the prompt plain, and a line an AI app inferred is marked "(ask)" and ranked below, so the next agent checks before leaning on it. A guess made in one app isn't served to the others until you confirm it, and a guess no app uses for 30 days retires itself. Page text, imported chats included, arrives inside <untrusted_note> tags, so an agent reads it as data, not instructions. What's missing is a "last confirmed" date on each line. That's a good idea, and I'll look at adding it.

Collapse
 
paul_irolla_6b5ae261d0224 profile image
Paul Irolla •

@alenissacsam The miss is the number to log. Count how many times a session fetches a second page after the slice. If that rate stays low, a capped start beats loading the vault on every turn.

Collapse
 
alenissacsam profile image
Alen Issac Sam •

Agreed, and part of it is there already. Each recall an agent makes, and the reads that follow it, go into a local log on your own computer, and keepfold eval recall replays them. What the log doesn't hold yet is the slice itself, so a miss can't be counted against it. That's the next step: record which pages the slice carried, then count a later read in the same chat that lands on a page it left out. The rate stays on each person's computer, since Keepfold sends nothing home, so I'll start with my own numbers.

Collapse
 
alenissacsam profile image
Alen Issac Sam •

Update: the miss count is on main now and goes out in the next release. keepfold eval recall ends with one more line: how many prime slices there were, how many pages an app read within 10 minutes after one, and how many of those reads were pages the slice had not carried.

It counts from the log Keepfold already keeps of what each tool served (page ids only), so nothing new is stored. One limit: it groups by app, not by chat, so two chats in the same app inside those 10 minutes share their slices. I'll share my own rate after a week of use.

Collapse
 
dosaygo profile image
dosaygo •

When Keepfold loads shared project notes into Claude Code, Cursor, and Codex, what rules do you include so each agent extends existing shared modules instead of creating duplicate implementations?

Collapse
 
alenissacsam profile image
Alen Issac Sam •

Good question. Keepfold doesn't put coding rules into your repo. A rule like "use utils/http.py, don't write a new client" still belongs in the repo's own CLAUDE.md or AGENTS.md, where every tool reads it.

What Keepfold carries is what follows you across apps and repos. Save "Extend an existing module before writing a new one" once as a preference, and each app gets it when a chat starts, through the same MCP call. Decisions ("we picked X over Y because...") are pages any of them can look up before building.

So the rule is written once, not three times. It can't make an agent follow it, though. It only makes sure each one has seen it.

Collapse
 
dosaygo profile image
dosaygo •

Thanks for the detail on keeping repo-specific rules in CLAUDE.md or AGENTS.md while Keepfold carries cross-repo preferences and decision pages over MCP, I'm building AI Lint, a pre-flight checklist (CHECKLIST.md), language doctrine, and rejects catalog (such as AR-R2: Parallel Solutions, requiring the agent to name the existing module it extends before writing code) that drops into a repo alongside AGENTS.md (the free edition is for personal use only, while company teams use the paid packs or Company license): ai-lint.dosaygo.com/go/forum-20261...

Thread Thread
 
alenissacsam profile image
Alen Issac Sam •

Thanks. Making the agent name the module it's extending before it writes any code is a useful check, and it belongs in the repo next to AGENTS.md, as you say. Good luck with AI Lint.

Collapse
 
paul_irolla_6b5ae261d0224 profile image
Paul Irolla •

Shared memory is cheap only while it stays small. Every agent that reads the file loads it again on every run, so its size becomes a fixed cost for each of them.

Collapse
 
alenissacsam profile image
Alen Issac Sam •

True, and that's why no agent loads the whole vault. At the start of a chat, Keepfold sends a capped slice picked for that prompt, 2,000 characters at most: a few profile lines, the preferences that match, and the pages related to what you asked. So the vault can grow to thousands of pages and each run still pays the same small cost. Anything more, the agent fetches on request through search or a read. The tradeoff is the one you'd expect: if the right page doesn't make that slice, the agent has to go and ask for it.