Persistent memory across Claude Code sessions
Index your notes, decisions, and past work into a local search engine. Pull the relevant pieces into any Claude Code session with one command: /recall.
What you'll have when you're done
A laptop where Claude Code remembers what you already know. You point a tool called QMD at a folder of markdown notes: your Obsidian vault, your meeting summaries, your project docs, last quarter's strategy memos. QMD builds a local search index in under a minute. Then inside any Claude Code session, you type /recall <topic> and Claude pulls the most relevant chunks of your past thinking into the conversation before you write a single sentence.
No re-pasting files. No "as I mentioned last time." No re-explaining the architecture or the strategy or the customer history for the eighth time.
The whole thing runs locally on your laptop. Nothing goes to the cloud. Setup takes 30 minutes the first time and zero minutes thereafter.
Why this matters
You are paying the same context tax every Claude Code session: 5-15 minutes re-orienting the model on a codebase, a memo, a board doc, a pricing model. Across a week, that is two to three hours you spend typing things you have already typed.
The deeper cost is worse. Because re-orienting is annoying, you avoid starting new sessions. You jam everything into one bloated thread until it slows to a crawl, then you give up and lose the thread entirely. Persistent memory removes the friction. Sessions become disposable. The knowledge compounds in one searchable place instead of dying in 400 abandoned tabs.
This is the difference between Claude Code as a clever toy and Claude Code as an operator's tool.
What you need first
- A Mac or Linux laptop. Windows works through WSL (Windows Subsystem for Linux) but adds setup steps this article does not cover. If you are on Windows, do this on a Mac if you can borrow one for the afternoon.
- An Anthropic account with Claude Code installed. Claude Code is the official command-line tool Anthropic ships. It runs on your laptop and lets Claude read and write files in a folder you give it access to. Install at claude.ai/code.
- 30 minutes of uninterrupted time.
- Terminal. Terminal is the black-text app on your Mac that runs commands. On Mac it is in Applications → Utilities → Terminal, or hit Cmd+Space and type "Terminal."
- A folder of notes you want indexed. This can be your Obsidian vault, a folder of meeting notes, your project documentation, last quarter's memos. Anything you write down or save as markdown (
.md) files. If you do not have one yet, create a folder called~/notesand drop a few markdown files in it (export from Notion, save your meeting summaries, etc.) before starting.
You do not need: Homebrew, a paid Mem0 account, a vector database, an OpenAI key, or any cloud service. This is all local.
Step-by-step
You are installing two things and writing one short configuration file:
- QMD (Query Markup Documents). An open-source local search tool by Shopify CEO Tobi Lütke. Indexes any folder of markdown files and returns hybrid (semantic + keyword) search results in under a second. Runs entirely on your laptop.
/recall. A custom slash command inside Claude Code that takes your current question, runs QMD search on your indexed notes, and feeds the top results back into the conversation.
You install QMD first, point it at your notes folder, build the index, then create the /recall command. Total: 30 minutes.
Step 1Confirm Claude Code is working
Before installing anything new, confirm Claude Code itself runs.
- Open Terminal.
- Run:
claude --version
- You should see a version number print out. If you see "command not found," install or reinstall Claude Code from claude.ai/code and try again.
Step 2Install QMD
QMD installs via Bun, a fast JavaScript runtime. (You do not need to know what Bun is. It is just the installer mechanism here.)
- Install Bun. In Terminal:
curl -fsSL https://bun.sh/install | bash
This downloads and installs Bun. The script will print instructions at the end about adding Bun to your PATH (the list of places your shell looks for commands).
- Add Bun to your PATH. Add this line to your shell config file. If you use
zsh(the default on modern Macs), the file is~/.zshrc. If you usebash, it is~/.bashrc.
echo 'export PATH="$HOME/.bun/bin:$PATH"' >> ~/.zshrc
- Reload your shell so the change takes effect:
source ~/.zshrc
- Install QMD globally:
bun install -g https://github.com/tobi/qmd
- Verify QMD installed:
qmd --version
You should see a version number. If you see "command not found," the PATH change in step 2-3 did not stick. Close Terminal completely, reopen it, and try qmd --version again.
Step 3Index your notes folder
QMD works by adding a collection (a folder of markdown files) and then embedding it (building the search index). You only do this once per folder; future updates are incremental.
- Move into the folder you want indexed. Replace
~/noteswith the actual path to your notes: your Obsidian vault, your meeting-notes folder, wherever your markdown lives.
cd ~/notes
- Add the folder as a QMD collection:
qmd collection add . --name workspace --mask "**/*.md"
Translation: "Add the current folder (.) as a collection called workspace. Index every .md file in it, including subfolders."
- Build the search index:
qmd embed
This reads every markdown file and builds the local search index. The first run can take a minute or two if you have hundreds of notes; subsequent runs only update changed files.
- Test the search. Run a quick query against your collection:
qmd search "any topic you remember writing about"
You should see relevant snippets from your notes returned in seconds. If you do, the search layer works.
Step 4Wire up the /recall slash command
Custom slash commands in Claude Code are reusable prompts you can trigger with /name inside any session. You are going to create one called /recall that runs the QMD search on your current question.
Claude Code supports two formats for custom commands. The simpler legacy format is what we'll use here: a single markdown file.
- Create the commands folder (if it does not exist):
mkdir -p ~/.claude/commands
The ~/.claude/ folder is a hidden folder in your home directory. Claude Code reads custom commands from inside it.
- Create the recall command file:
nano ~/.claude/commands/recall.md
nano is a simple text editor that runs in Terminal. It opens an empty file.
- Paste this content into the editor (the frontmatter at the top is required; everything below the second
---is the prompt body):
---
description: Run QMD semantic search on the current question and feed results back into the session
argument-hint: [query]
---
Run a QMD search for relevant context using the user's current question.
User question: $ARGUMENTS
Search and summarize the most relevant results, then continue helping with the original request, citing which note each fact came from.
Save and exit nano: hit
Ctrl+O, thenEnterto save, thenCtrl+Xto exit.Open a new Claude Code session (Claude Code auto-detects new commands; no restart needed):
claude
- Test the command. Inside the session, type:
/recall pricing assumptions
(Replace pricing assumptions with any topic you know is in your notes.) Claude should run the search, find relevant chunks, and produce a brief summary citing which notes each fact came from. If it does, the full loop is working.
Step 5Use it on a real project
The setup is now in place. To make it stick:
- Pick one real project you have used Claude Code on. A pricing model, a draft memo, a config file, anything.
- Open a fresh Claude Code session in that project's folder.
- Before asking your first real question, type
/recall <topic>. For example:/recall pricing assumptionsor/recall last quarter's strategy review. - Watch what Claude pulls in. Notice what is useful and what is noise.
After three or four real uses, you will have a feel for how to phrase recalls. The skill is not in the install. The skill is in remembering to start every session with /recall.
How you'll know it's working
Inside any new Claude Code session, /recall <any topic from your notes> should return a brief summary with citations to specific notes within 2-3 seconds. If it does, the full loop works.
You can also verify QMD directly. Run:
qmd search "any topic"
You should see ranked snippets from your indexed notes in well under a second.
When it breaks
/recallreturns "no results found." Your QMD index may be empty or stale. Move into the folder you indexed (cd ~/notesor wherever) and runqmd embedagain to rebuild it.qmd: command not found. Bun's PATH change has not taken effect. Close Terminal completely, reopen it, and tryqmd --version. If it still fails, re-run theecho 'export PATH=...'line from Step 2.claude --versionsays "command not found." Claude Code is not installed or not in your PATH. Reinstall from claude.ai/code. Close and reopen Terminal after installing.The
/recallcommand does nothing inside Claude Code. Claude Code did not pick up your custom command file. Confirm the file is at~/.claude/commands/recall.mdand contains both the frontmatter (the lines between---) and a body. Exit the session (/exit) and start a fresh one (claude).Search returns the wrong notes. QMD is matching keywords but not intent. Reword your recall: instead of
/recall pricing, try/recall pricing model for the Q3 board deck. Specificity beats brevity here.You want Claude Code's own past sessions indexed too. Claude Code does not export sessions to markdown by default. There is a community tool called
sync-claude-sessionsthat auto-exports them; search for it on GitHub if you want that piece. Once exported, point QMD at the export folder the same way you pointed it at your notes folder.
Where this fits in your harness
Persistent memory is the foundation layer. Once Claude Code can pull from everything you have already written down, every other workflow on top of it gets cheaper: skills you teach the model stick, decisions you make once stop getting re-litigated, and the cost of starting a new session drops to near zero.
This is the first move in the harness. The next moves (connectors that let Claude read your inbox and CRM, project-specific instructions that travel with a folder, autonomous routines that run on schedule) only pay off once you have memory in place. Build this weekend. Layer the rest in the weeks after.
Get three workflows like this every Thursday
The Thursday 3 is a free weekly email. Three workflows that put you in the top 1% of CEOs. 90-second read. Every card links back to a step-by-step guide like this one.
Get the newsletter →The architecture behind this workflow.
A 270-page operator's manual for the harness Andrew runs Headphones.com and Lantern.is on. Memory, skills, connectors, and the 90-day roadmap.
Get the book · $99