Why AI coding sessions lose context
AI assistants remember more than they used to: Claude Code reads CLAUDE.md, ChatGPT keeps
memories, and a long context holds a lot. What none of them keeps well is the state of work in
progress: what was decided an hour ago, what was tried and failed, what is half done. That lives in
the session that did the work. When its context fills or it ends, the next session starts without
it, and a different assistant never had it at all.
The usual fix is a handoff file: before a session ends, it writes HANDOFF.md, and the next session
reads it first. That works for one file. After a few weeks there are thirty: QA-HANDOFF-v2.md up
to v12, a fixes file per round, a handoff per feature, copied into every branch. The next session
finds three copies of each, cannot tell which is current, and reads the stale one.
One brain for every assistant, without building one
PlaxorStack turns that folder of handoffs into one searchable brain: a semantic search model that finds a passage by meaning, hosted for you and reachable over MCP. There is no embedding model, vector database or retrieval server of your own to build.
- Context shared across assistants. Because the knowledge base is accessible through MCP, a handoff written in Claude Code in the evening is found by Cursor or ChatGPT in the morning.
- Less repeated work. The next session searches for its topic and starts from the last handoff, rather than rereading the code to find out where things stand.
- Versions handled for you. A search returns the newest version of each handoff. Older versions stay in the brain, marked as no longer the latest.
- No infrastructure to maintain. The search model, hosting, keys and metering are ours to run.
How it fits together
Your handoffs stay Markdown files in your repository. The brain is a searchable copy of them, kept in step by a hook, and every assistant you connect searches the same copy.
Building a searchable AI memory from Markdown
You keep writing handoffs as Markdown files in a handoffs folder. A small script, md2brain.py
(Python 3, standard library only), turns the folder into passages:
| It reads | It sends to the brain |
|---|---|
| Each heading's section, cut at paragraphs into short pieces | One passage per piece, with its file, title and section |
version in the front matter, or a name such as checkout_v3.md |
version, and is_latest set to yes only on the highest version of each document |
Links to other Markdown files, including [[wiki links]] |
related_files, so a passage says what else to read |
| Anything that looks like a password, token or key | A [REDACTED] marker in its place, by default |
A handoff file names its document and version in its front matter. This is one of the 30 handoffs from the video, written for a class-booking app called NestBook:
---
date: 2026-11-17
project: NestBook
doc: refund-rules
version: 3
---
# Session handoff 20: Refund rules, version 3 (no-shows and late cancels)
## Decisions
- REFUND RULE v3 (replaces v2): Flex members get a full refund up to 2 hours
before the start. Standard members get a full refund up to 24 hours before,
and 50 percent up to 2 hours before. ...
## Open questions
...
Versions 1 and 2 of refund-rules are older files in the same folder, with the same doc and a
lower version.
How to build persistent AI memory with PlaxorStack
Get the script and the hook from the md2brain gist.
Build the first brain. Run
python3 md2brain.py ./handoffs --project NestBook --max-chars 1200. It writesproject_brain.csv. In PlaxorStack, under Machine Learning, Natural Language Processing, choose Semantic Search, upload the CSV and press Build index.Keep it in sync. Create an API key for the brain, turn on adding documents for it, and set it as
SEARCH_API_KEY. Add the gist's hook to.claude/settings.json: it runsmd2brain.py ./handoffs --push <model id>when Claude finishes a reply, sends only the files that changed, and removes the ones you deleted or renamed. The hook synchronizes handoff files; it does not write them. You, or the assistant following yourCLAUDE.md, write the handoff. On Windows, usepythonorpyin place ofpython3. A push that sends one new handoff prints:
Connect your assistants to
https://api.plaxorstack.com/mcp. Give each one its own key, so one can be revoked without breaking the others.Claude Code:
claude mcp add --transport http project-brain "https://api.plaxorstack.com/mcp" \ --header "X-Api-Key: <your key>"Cursor: add the server to
~/.cursor/mcp.json, the file in your home folder, so the key never lands in a repository:{ "mcpServers": { "project-brain": { "url": "https://api.plaxorstack.com/mcp", "headers": { "X-Api-Key": "<your key>" } } } }claude.ai, Claude Desktop and ChatGPT: add the address as a custom connector and leave the client id and secret empty. In ChatGPT, connectors are added in developer mode. Which Claude and ChatGPT plans offer custom connectors is up to Anthropic and OpenAI, so check yours. You sign in to PlaxorStack and choose one subscription; the connector sees only that one. A connector signs in to search and ask, not to add documents, so writing stays with the key in step 3.
Tell the assistant to look first. In Claude Code that is a few lines in
CLAUDE.md, and in Cursor the same text as a project rule:
## Handoffs
Before starting on a topic, call search_<your brain> with the topic and the
filter {"is_latest": "yes"}, and read what comes back before reading code.
When ending a session that leaves work open, update the handoff in
handoffs/<topic>.md, raising its version. Never write secrets, connection
strings, host names or customer data in a handoff.
The developer docs list every tool and client setup, and the MCP server from your Markdown docs use case walks through the semantic search model itself.
What a search returns
A NestBook session about to change refunds calls search_ with its topic and the filter, before it
opens any code:
{ "query": "current refund rule and what is still open", "filter": { "is_latest": "yes" }, "top": 5 }
It gets back the closest passages with their columns. The first one, shortened here (the score is illustrative):
{ "id": "2026-11-17-s20-refund-rules-v3.md#3", "score": 0.68,
"payload": { "doc": "refund-rules", "version": "3", "is_latest": "yes",
"date": "2026-11-17", "section": "Session handoff 20: ... > Decisions" },
"text": "... > Decisions. REFUND RULE v3 (replaces v2): Flex members get a full
refund up to 2 hours before the start. Standard members get a full refund
up to 24 hours before, and 50 percent up to 2 hours before..." }
Versions 1 and 2 of the rule are still in the brain, marked is_latest = no, and the filter leaves
them out. The assistant starts from the rule that holds today, not the one it happened to open first.
What it saved: one question, six runs
We asked Claude Code (Opus 5.5) the same question about the 30 NestBook handoffs: what is the current refund rule, and what is still open. Three times it read the files itself, and three times it searched the brain:

| Average of 3 runs | Reading the files | Searching the brain |
|---|---|---|
| Input tokens | 447,382 | 212,730 (52% fewer) |
| Time to answer | 34.5 s | 20.0 s |
| Model calls | 10 | 5 |
| Current rule (version 3) right | 3 of 3 | 3 of 3 |
| Open refund questions found, of 2 | none, in every run | 2, 1 and 1 |
Both found the current rule. Reading the files, Claude concluded every time that nothing about refunds was still open. The two open questions are not in the refund-rules handoffs: one is in an incident report about a double refund, the other in the handoff for the admin dashboard. A search by meaning returns the passages that ask about refunds wherever they sit, so the brain found one or both of them. Six runs on one question is a small test, not a benchmark, but it shows where the difference comes from: fewer files read, and the right passages among them.
Versions, branches and deleted files
- A new version. Raise
versionin the front matter, or name the filerefund-rules_v4.md. When it reaches the brain, the passages of the older version are markedis_latest = no. - The same handoff on two branches. Versions are compared within one
projectanddoc. Two files that both say version 3 of the same doc are both the latest, and a search returns both. Two copies of the same file name replace each other, and the last one pushed wins. Give a branch's handoff its owndocname, or raise the version when you merge. - Deleted and renamed files. The next push removes the passages of a file you deleted, and of a
file's old name after a rename. If the deleted file held the newest version, the version before it
becomes the latest again. The script removes only what it has pushed itself, so a file deleted
before the first push stays until you remove it with
deleteFilesand its path, through theadd_to_tool or the documents API. Keepingdoc:in the front matter means a rename does not start a new document.
Best practices, security, and usage
- Keep passages short. The search model reads about the first 180 words of each passage, which is why the script cuts passages at 1,200 characters.
- Search before ask. The brain also has an
ask_tool that answers in a few lines with sources. A coding assistant reads passages well on its own, sosearch_is enough, and anask_answer written by an LLM also counts as a chat message. - Metered per call. Each search counts as one prediction, and so does each new or changed passage the hook sends. Files that did not change are skipped and cost nothing.
- Secret redaction is best effort. It catches the common shapes of keys, tokens and passwords, not every one, and whatever it misses is sent as written. Do not rely on it: no secrets, no host names and no customers' data in a handoff.
- Access is per subscription. An API key, or a signed-in connector, reaches every model on its subscription, not only the brain, so anyone holding one can search your handoffs. Keep the brain on a subscription whose members and keys should read them. Adding documents is a separate switch on a key, which only the subscription's owner or an admin can turn on.
- Handoffs are for work in flight. How your team works, its conventions and rules, still
belongs in
CLAUDE.mdor your docs. The brain holds where each piece of work stands.
Shared context, whichever assistant you open
The expensive part of switching sessions, or assistants, is rarely the typing. It is the time the new one spends finding out what the last one knew. A brain built from your handoffs turns that into one search: the newest handoff for the topic, from whichever assistant wrote it, with the older versions out of the way and no retrieval stack to run.
Build your first MCP-powered knowledge base: start a free trial, no card needed. Take the script and the hook from the md2brain gist, turn your handoff folder into a brain, and connect it to the assistant you use. For more ways to put a model behind an assistant, see your model in Claude and ChatGPT.