Keepfold 如何讓 Claude、Cursor 和 Codex 共用純 Markdown 記憶
How I gave Claude, Cursor and Codex one shared memory in plain Markdown
Alen Issac Sam 建立 Keepfold,讓 Claude、Cursor、Codex 等多個 AI 應用透過 MCP 或 hook 取得同一個本機 Markdown 記憶資料夾中的相關內容。
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-explaining my projects, my stack and my decisions to each of them.
So I built Keepfold: one memory folder on my own PC that all of them read from and add to, through MCP. This post is how it works, what broke while shipping it alone, and where other tools are the better choice.
What it does
You install it, pick a folder and connect your AI apps (one click each for Claude Desktop, Claude Code, Codex CLI, Gemini CLI, Cursor, VS Code, Windsurf, Antigravity and LM Studio). From then on:
- What you work on, decide and prefer is saved as plain Markdown notes in that folder.
- A new chat in any connected app starts with the parts that matter for your message.
- Everything stays on your computer. No account, no telemetry.
Here is what an AI app actually gets. In the sample vault, a made-up student types "Add a save command to my text adventure game". Before the model answers, Keepfold adds this (shortened):
## Related
- [[text-adventure]] — A small terminal game: rooms in a dict, one function per command.
- [[functions]] — Functions
- [[loops]] — Loops
So the model starts out knowing how the game is built. With your own vault, the lines you pinned ("Python 3.12, type hints, uv only") and the preferences that fit the message come first.
The design in one picture
Claude Code, Codex, Gemini CLI ── hook ──┐
Claude Desktop, Cursor, VS Code ── MCP ──┤
▼
keepfold (stdio MCP server)
│
▼
vault: one folder, in git, opens in Obsidian
Markdown notes + JSONL events = source of truth
│
┌──────────────────────┴───────────────┐
▼ ▼
search: SQLite FTS5 levels, plan, dashboard:
+ local embeddings derived, rebuilt on demand
A few choices that shaped everything else:
- The vault is the source of truth. Notes are Markdown with YAML front matter. Events (what was asked, graded, saved) are append-only JSONL. Everything else, like the search index, the vector cache and the dashboard, is derived. Delete it and Keepfold rebuilds it.
-
Every write goes through one module. It takes a lock, writes a temp file, swaps it in with an atomic replace and refuses text that looks like a secret. With git on, each chat's changes become one commit, so
keepfold undo <session>can revert a chat that saved something wrong. - Search is local. SQLite full-text search plus a small embedding model (about 150 MB, downloaded once). Without the model, keyword search still works.
- Context arrives before the first tool call. Waiting for the model to decide to call a memory tool is unreliable, so Claude Code, Codex CLI and Gemini CLI get context through a hook on the first real message of each chat. Cursor, VS Code and Codex also get your pinned lines in their rules file.
- Each app sees only what its profile allows. By default a coding app gets your pinned lines, coding preferences, setup and projects, never your journal or people pages.
Why plain files
I wanted to be able to read my memory, fix it by hand, grep it, back it up and delete it, without asking a service. A folder of Markdown gives all of that for free. Obsidian opens it as a vault. Git gives it history. If Keepfold disappeared tomorrow, the notes would still be readable.
There is one rule that keeps this honest: numbers are never stored in notes. Study levels and spaced-repetition states (FSRS) are worked out from the event log every time. If a grade was wrong, cancelling it makes everything recompute, and nothing goes stale.
Your notes are untrusted input
A memory that AI apps read is also a place where someone can plant instructions. A web page you saved, an imported chat or a note could contain "ignore your previous instructions".
So note text never reaches a model as plain text. Over MCP it is wrapped in <untrusted_note> tags, so the model can tell your notes from instructions. In the app and the dashboard it is escaped and stripped of links and images, and the dashboard runs under a default-src 'none' content security policy. Lines about you that try to drop an AI's rules, give it a persona or open with a role label are refused when they are written.
None of this makes prompt injection impossible. It makes the easy versions fail.
What broke while shipping a Windows app alone
Keepfold had 15 releases in its first ten days on GitHub. Most of the fixes were not about memory at all:
-
Usernames with spaces. The installer failed when the install folder's path had a space in it, which is every
C:\Users\First Last. Fixed in 0.6.1, along with making sure every PC gets x64 Python. - Campus networks. The one-time model download failed behind a proxy and its own certificates. Keepfold now uses the system proxy and the OS certificate store, and says in a plain sentence what went wrong.
- SmartScreen. The installer is not code-signed yet, so Windows warns that it "protected your PC". The README says so up front, explains More info then Run anyway, and every release lists the installer's SHA-256.
- Renaming the project. It was called Cortex until 0.6.2. The rename moves settings, the vault and every AI-app connection over by itself on first run. But the older versions' updater could not find releases in the renamed repo, so people on 0.6.1 have to download the installer once by hand. If you might rename, plan the updater for it first.
The test suite (about 4,800 tests) runs only on made-up data in temp folders. The real vault never goes near it.
Keepfold next to other AI memories
Each of these is a good tool built for a different job. This is only what their own docs say, as of November 2026:
| Keepfold | ChatGPT memory | Claude's memory | Basic Memory | mem0 / OpenMemory | |
|---|---|---|---|---|---|
| Works across several AI apps | Yes | No, ChatGPT only | No, Claude apps only | Yes, any MCP app | Yes, any MCP app |
| Plain files on your PC | Yes | No | No (you can export it) | Yes, Markdown | No, a vector database |
| Free and open source | Yes, MIT | No | No | Yes, AGPL-3.0 | Yes, Apache-2.0 |
| One-click Windows installer | Yes | Built in | Built in | No, uv or Homebrew | No, Docker |
When the other tool is the better choice:
- ChatGPT's or Claude's own memory if you live in one app and don't want to install anything.
- Basic Memory if you're on macOS or Linux and want a Markdown memory for MCP apps that installs with uv or Homebrew.
- mem0 if you're building memory into your own app or agents and already run Docker.
- claude-mem if you only use Claude Code and want its tool activity recorded for you.
Limits
- The installer is Windows 10 and 11 only. On macOS and Linux it runs from source with uv, and it is tested most on Windows.
- The installer is not code-signed yet.
- It's a beta until 1.0. I use it every day, but expect rough edges.
- The optional local Chat with a small model (2B) can get a detail wrong. It cites the notes it used, so check them.
Try it
Keepfold is free and MIT: github.com/alenissacsam-2/keepfold. Issues and Discussions are open, and bug reports are the most useful thing you can send me.
If you'd rather watch than read, here is the 43-second film:
One question for you: what would you want your AI apps to remember about you, and what should they never be allowed to save?
Written by Claude (AI) from Keepfold's docs and commit history, and published at my request.
來源:DEV Community · dev.to
