Keeping a Personal Memory for AI Agents Current
In my last post I described a personal memory layer: local models read my exported conversations, pull out what's worth remembering, store it in an Obsidian vault on my Mac, and serve only what I've approved to my agents over MCP. I ended with a next step: keep those memories up to date without me doing the work.
This post is about that step. The same problem shows up in companies trying to give agents shared knowledge: what to capture, what has already been seen, and who decides what an agent can read.
The problem with "just re-export"
Version one ran on manual exports. Every week or two I'd download my ChatGPT and Claude data, run sync.py, and wait. Two things made that inefficient:
- Every export is my whole history. A Claude export doesn't say "here's what's new since last time." It hands over all 490 conversations again, most of them unchanged.
- Extraction is slow. A local 27B model reads each conversation at roughly 2 to 3 minutes per chunk. If one long chat gets a few new messages, re-reading the whole thing to find one new memory is a waste.
So "incremental" had to mean two things: on the ingest side, knowing which conversations are new, which grew and which are unchanged; and on the extraction side, reading only the messages the model hasn't seen yet.
Here's what the pipeline looks like now. Teal parts are new in this round; a dashed teal border marks existing parts that changed.
| Capture path | How it arrives | Effort from me |
|---|---|---|
| Official exports (ChatGPT, Claude) | sync.py picks up the zip from Downloads |
Click "export" every week or two |
| Claude Code and Codex sessions | A launchd job snapshots idle sessions every 15 minutes | None |
save_memory |
Any connected assistant saves one fact mid-chat | Say "save this to my vault" |
| Built, then shelved | — |
A word on that last row: I had Claude build a Chrome extension that pulled new chats through my own logged-in session, and it worked. But Anthropic's and OpenAI's consumer terms both prohibit automated extraction, so I dropped it. Should ChatGPT and Claude let you download your own chats through an API? That's a question for another day.
Part 1: Ingest that knows what it has seen
Ingest turns each conversation into one Markdown note. To make it incremental, it needed a reliable answer to one question per conversation: have I seen this exact thing before? Three things got in the way:
- Exports bring back everything. Old conversations arrive again with every export, so ingest has to recognise them and do nothing.
- The same ID can come from two sources. ChatGPT, Claude, Claude Code and Codex each have their own IDs. The old code keyed conversations by bare ID and stopped the whole import if two collided.
- The same conversation can arrive in a different shape. The old check hashed the raw JSON. Any extra field, from a new capture path or a format change, made an unchanged chat look changed.
The fix is an import ledger (the code calls it the manifest): a file with one entry per conversation, recording what ingest has already seen. Two changes matter.
- Key by
source:id, soclaude:7f3a…andchatgpt:7f3a…are different conversations. - Add a
content_hash: a fingerprint of only what was said. Ingest reduces each message to four things (message ID, sender, time, visible text) and hashes that list. Extra fields, reordered keys or a different JSON shape don't change it. New or edited messages do.
A real entry from my import ledger, before and after the migration. body_hash is what protects notes I edited in Obsidian; it didn't change.
With that in place, every incoming conversation goes through the same short set of questions:
The two rules I care most about aren't new, but they matter more now that imports happen often. A note I deleted stays deleted: every export contains my entire history, so if ingest recreated missing notes, anything I removed would come back every week. And a note I edited is never overwritten: a new version goes to a conflict folder instead.
Part 2: Extraction that picks up where it left off
The second half is the extraction watermark: one number saved per conversation, recording how many messages the model has already read.
On the next run, extraction hashes the first watermark messages of the current version and compares that with what it stored last time:
- They match, so the old part is untouched and the chat only grew. The model reads only the messages after the watermark.
- They don't match, so something earlier changed: an edit, a branch switch, a deleted message. The safe move is to re-read the whole chat.
The model also gets the two messages just before the watermark, as context. Without them it would see "Add streak reminders before you ship" with no idea what app we're talking about. Anything it tries to cite from those context messages is dropped, so they can't create duplicate memories.
A conversation that grows by a few messages a day now costs one short model call instead of a full re-read. That's what made capturing Claude Code and Codex sessions practical: they grow constantly. The first full extraction of 107 sessions took a few hours; after policy and my review, the memories my agents can see went from 328 to 654. Every run since only reads what's new.
Part 3: Saving a memory mid-conversation
Extraction works after the fact. Sometimes I want to say "remember this" in the moment, in whatever app I'm using. That's save_memory, a write tool on the same MCP gateway that serves my memories.
What it does is deliberately small. A save never touches the vault directly. The gateway checks the text (a length cap, rate limits and a check for anything that looks like a credential), drops it in a private queue, and a 15-minute job files it as a private note in my memory inbox. Policy can never auto-approve a save; I approve each one myself.
Each app gets its own write-only token. A leaked token can add notes to my review queue, but it can't read a single memory. I can revoke one app without touching the others, and every call is logged with the token's name.
Each app connects differently, so each gets its own route:
Part 4: The Obsidian connector detour
Partway through, the Grok Bot Mac and iPhone app added a native Obsidian connector that reads an Obsidian folder directly, no server needed. I tried it. Pointed at the approved-only folder, it read fine, but it always has write access, so I had Claude add an inbox folder for its saves. To use it on my phone, I synced the folder to the Obsidian app through iCloud, which meant another copy of my memories to keep in sync. Each fix added a moving part, so I compared the two:
| MCP gateway | Obsidian connector | |
|---|---|---|
| What the agent can read | Search results, about 5 per query | The whole folder |
| What it can write | Only save_memory, checked on the spot |
Any file; staying in inbox/ relies on an instruction |
| Revoking a memory | Gone on the next request | Gone once iCloud syncs to each device |
| Logging | Every read and save, per client | None |
| Works with | Claude, ChatGPT, Codex, Grok Bot, any MCP client | Only apps with an Obsidian connector |
The connector's one real advantage was working while my Mac is asleep, and that was easier to fix at the source: my Mac now never sleeps, restarts after a power cut, and opens Tailscale at login. So I went back to MCP and disconnected the connector.
The connector is more convenient. MCP is more controllable, and control is the point of this project.
Beyond personal memory
The idea isn't only personal. Companies face the same question with agents: what knowledge to keep, how to keep it current, and who decides what an agent sees. LangChain's knowledge factory is one example: a curator agent keeps a company's shared knowledge for its agents up to date, in effect an enterprise memory. The pieces I care most about here, local storage and a human approving what agents can read, are the ones worth carrying over.
The code is on GitHub if you want to follow along or adapt it.