
memhole
io.github.nanafy/memhole
Search every chat with your coding agents by meaning and keyword. Local, no LLM at write time.
Documentation
Search the saved text of your Claude Code, Codex, pi and opencode chats, with the original words and dates.
On your own machine. No account, no API key.
Install • Scoreboard • Features • Repeats • How it works • Benchmarks • Reference • Changelog • Docs • memhole.dev

A scene from memhole.dev, with an example chat. Scroll the page to play it yourself.
Search old conversations without pasting them into the next session.
It indexes the session files your agent already writes and hands it a search tool over all of them. A month later you ask "what did we decide about the cache?" and it just finds the turn.
One SQLite file on your machine. No API key. No AI rewrites what you said. Search runs on your CPU.
The scoreboard
First on real coding sessions. First on a 23,867-chat pile. Tied for first on the standard test.
I ran memhole against three other memory tools. Same questions, 3 passes each, every tool set up the way it ships.
The same numbers as a table
| Right answers | memhole | MemPalace | agentmemory | deja-vu |
|---|---|---|---|---|
| Real coding sessions, 90 runs | 80 | 73 | 68 | 64 |
| 23,867 chats in one index, 90 runs | 56 | 41 | 36 | 43 |
| LongMemEval, 180 runs | 166 | 166 | 135 | 159 |
Each tool answered through its own MCP server. The method, and what the scores can't tell you, is in the benchmarks.
Why memhole
- It finds the turn. On the 479 LongMemEval questions that have an answer to find, the right turn makes the shortlist 99.5% of the time. That's over 246,738 turns.
- It keeps digging. Deep search tells the agent how to look again. On the hard questions that took it from 42% of the evidence to 98.6%.
- Fewer calls, same answer. With 23,867 chats in the index it needed 2.5 tool calls per answer. The slowest tool needed 5.
- It notices what you keep asking. Ask for the same thing in ten chats and it offers to save it as a skill, a rule or a note.
- Automatic indexing. It downloads its models and indexes saved sessions. In Codex, trust the hooks to keep indexing after each turn.
- It takes the big files. In the head-to-head it indexed every session file. Three of them were over half a gigabyte each.
- Your words, with dates. Every hit is the exact turn and when it was said. Sort by newest or oldest, or search one week.
- It outlives the files. Claude Code deletes old sessions. The index keeps them.
- More than chats. Your notes, PDFs and tool output go in too.
- Yours. Sync between your machines through a server you run. Delete a turn and it leaves the index on every one of them.
Works with your agent
| Agent | How it connects | What you get |
|---|---|---|
| Claude Code | plugin | the search tools, a timeline at the start of every session, repeats offers, @mem references and the /memhole pane |
| Codex | plugin, plus its hooks once you trust them | 11 of the 12 memory tools, the timeline, and six skills including checkpoint, save, repeats and search |
| pi | memhole mcp and memhole hooks add pi | the same tools, indexed after every reply |
| opencode | memhole mcp and memhole hooks add opencode | the same tools, indexed after every reply |
| Cursor and anything that takes an MCP server | memhole mcp | the same search tools |
| Your terminal | memhole "what did we decide about the cache" | the same index, from a shell |
Features by agent
All connected agents search the same local index, including supported agents' chats, notes and PDFs. Reading an agent's saved chats and adding features inside that agent are separate capabilities.
| Feature | Claude Code | Codex | pi / opencode | Other MCP clients |
|---|---|---|---|---|
| The 12 memory tools | Yes | All but memory_forget | All but memory_forget, through MCP | Through MCP; client must expose the tools |
| Reads this agent's saved chats | Yes | Yes | Yes, both readers | No reader for other agents |
| Indexes after replies | Plugin; every reply on 2.1.287+ | Trusted hooks | Install the indexing add-on | At MCP startup or run memhole index |
| Previous-session timeline | Yes | Trusted startup hook | No automatic injection | No automatic injection |
| Restores memory references after compaction | Yes | Trusted hooks | No | No |
Numeric and quoted @mem: prompt references | 2.1.287+ | Trusted prompt hook; tool fallback on deadline | Use the memory tools | Use the memory tools |
| Bundled setup, private, checkpoint, save, repeats and search skills | Yes | Yes | No bundled skills | No bundled skills |
| Repeats tools and saved files through the CLI | Yes | Yes | Yes | Yes |
| Repeats inbox | Pane with automatic drafting on 2.1.287+ | On-demand drafting and review in chat, reminders with trusted hooks | Shared MCP tools | Shared MCP tools |
| Search pane and saved-files pane | 2.1.287+ | Results in chat | Results through tools | Results through tools |
| Memory-usage indication | 2.1.287+ footer | Trusted Stop hook | No | No |
| Removes a turn from its original chat file | Yes | Index-only deletion | Index-only deletion, with sync on | No reader |
What has been tested: Claude Code has plugin/mod tests and daily use. See Codex status for Windows checks of the installed plugin, the repeats inbox, and trusted lifecycle hooks. For pi 1.4.0 and opencode 1.19.5, the October 31–November 1 runs exercised real programs on Windows and Linux (WSL): MCP search, saved-chat ingestion and the indexing add-ons. Those were short smoke chats with scripted model replies, not long working sessions. Their saved files also have repeatable pi, opencode and add-on tests. Other versions and native macOS pi/opencode runs have not been verified. Cursor and other MCP clients have connection examples, but no recorded native acceptance test here.
Install
Two install commands. Codex also asks you to trust the hooks.
Claude Code:
claude plugin marketplace add nanafy/memhole
claude plugin install memhole@nanafy
Codex:
codex plugin marketplace add nanafy/memhole
codex plugin add memhole@nanafy
You don't run an indexer or edit a config file. Once its local server starts, memhole:
- Installs its dependencies and downloads its search models; the first start needs network access and can take a few minutes.
- Indexes supported session files still on disk, in the background. GPU use depends on your hardware and indexing settings.
- Keeps indexing as you chat through the agent's hooks; in Codex those hooks must be trusted.
Use memhole's setup skill to choose which agents to read and which notes folders to add.
In the Codex CLI, select the skill from /skills. The defaults read all supported agents' saved
sessions, and search follows the configured visibility rules.
It needs Node 22 or newer.
In Codex, open /hooks and trust memhole's hooks to enable the session timeline, prompt references,
indexing after turns, and repeats reminders. The tools and skills are available after installation.
A chat without a workspace binding may need memory_setup before it can read memory.
These commands install from this GitHub marketplace. OpenAI's public plugin directory currently
does not accept plugins containing lifecycle hooks; see
OpenAI's plugin packaging requirements.
If you previously installed mem@nanafy, run codex plugin remove mem@nanafy
first, or both load. Restart Codex after installation, and review the new hooks in /hooks.
Using pi, opencode, Cursor or something else?
Install the memhole command. It searches the same
index from a terminal, and memhole mcp gives any agent that takes an MCP server the same tools:
npm i -g memhole
memhole index # reads your chats in the background; the first time takes a while
memhole "what did we decide about the cache"
Then add memhole mcp as a server. In pi that's one command,
pi mcp add memhole --exposure direct -- memhole mcp. Without --exposure direct, pi hides the tools from
the model and reaches them only from its own code-mode scripts. In opencode it goes in opencode.json:
{ "mcp": { "memhole": { "type": "local", "command": ["memhole", "mcp"] } } }
Every time memhole mcp starts, it indexes in the background and downloads the models if they're
missing, the same as the plugin does. It reads Claude Code, Codex, pi and opencode chats and your notes
folders. With sync on, every machine gets the same index.
To index and sync after every reply, the way the plugin does in Claude Code and Codex, add the add-on for your agent once:
memhole hooks add pi # a pi extension, in ~/.pi/agent/extensions
memhole hooks add opencode # an opencode plugin, in ~/.config/opencode/plugins
Restart the agent, or run /reload in pi. After each reply it runs memhole index, which indexes the new
chat in the background and syncs when this machine is logged in. memhole hooks shows which are on, and
memhole hooks remove pi takes one away. Without the add-on, a pi or opencode chat waits for the next
index: the next time memhole mcp starts, or the next Claude Code or Codex reply on that machine.
Features
Search
Ask it the vague way or paste the exact error. Both land.
memory_search does a meaning search and a keyword search at the same time, so a vague question and
an exact error like ECONNRESET both land. You can filter by project, agent, source and date.
Deep search (the default) also tells the agent how to keep digging: rephrase, walk the timeline, collect everything before answering. On 18 hard benchmark questions that found 98.6% of the evidence.
memory_zoom opens a hit with the turns around it. memory_about takes a file, a file.ts:127
line, a ticket or a PR and shows available code, git history and matching indexed discussions,
with coverage limits in its response.
memory_rerank ranks hits from a few searches against one question.
Repeats
Ask for the same thing in chat after chat, and memhole tells you, once a week at most, so you can save it.
memhole groups every message you've typed by meaning. When one ask shows up in three or more chats, your agent can read those chats with you and draft a file for it:
- a workflow, a skill with the steps the agent follows,
- a rule, a standing instruction it always obeys,
- or a note, a question you keep asking, with its answer.
How it goes:
- The inbox offers unanswered repeats from at least ten chats with an ask in the last thirty days, using public evidence. Claude Code and Codex share drafts, Unsure flags, and answers when they use the same local memhole data folder.
- In Claude Code (2.1.287+),
/memhole repeatsopens the pane. Claude drafts after the weekly check. The pane shows drafts, items in use, and the stash. In a terminal,memhole savedlists saved files and waiting drafts. - Ask Codex to review your memhole repeats, or select the repeats skill from
/skillsin the CLI. Codex drafts new candidates during review. Trusted hooks can show a weekly reminder. Ask for Why, View, Save, Dismiss, or Undo by group ID. Each agent uses its own skill and rule locations when you approve a save.
Continuity and shortcuts
Start a session with a timeline of the previous one.
Claude Code gets everything below. The ones marked 2.1.287 need that version or newer.
In Codex, the search skill shows results in chat. Trusted hooks provide the session timeline, prompt references, memory-usage messages, and continuity across compaction. The pane, its Zoom and Insert buttons, and the footer are Claude Code features.
- With trusted startup hooks and indexed history for the project, a session starts with a quick timeline of the previous one. The checkpoint skill guides the agent through checking it against your git branch and the index; the quality of that reconstruction depends on the model.
- When a long chat gets compacted, Codex restores up to 30 visible memory hit references and short excerpts; the agent can zoom them for the full text.
- The save skill drafts a skill or standing rule from something you keep repeating, and saves it after you approve the text and destination.
- (2.1.287)
@mem:4211in a prompt hands over that hit and the turns around it.@mem:"some words"hands over the top five. - (2.1.287)
/memhole some wordsopens a pane of hits with Zoom and Insert buttons. - (2.1.287) A footer shows when it's indexing, and a line under each answer says how much memory it used, or that it used none when you asked about past work.
Notes and PDFs
Point it at your vault. Your notes get searched next to your chats.
memhole folders add "~/notes/vault"
Any folder of .md, .markdown or .txt notes works, or just drop stuff in ~/mem, which setup
can make for you. Edits and deletes get picked up. PDFs go in their own search lane so they don't
crowd your chats out. Ask the agent about a document, or search with --source document.
Tool output
The file it read and the command it ran can be searchable too.
You can index file reads, command output and app results too. They get their own lane that a normal search skips. Known secret formats can be blanked, and output you didn't make searchable can be deleted after however many days you pick.
Privacy
Remove a turn from search. Source-file deletion depends on the agent.
memhole rm 4211 # Claude Code: remove a turn from the index and session file
memhole hide 4211 # keep it, but never show it
memhole private ~/journal # sessions run in this folder only show in private mode
Ask the agent to mark the chat private or use memhole's private skill. The agent can also mark it private when the conversation turns personal.
How delete works for Codex, pi and opencode turns
For Codex, pi and opencode, rm with sync enabled removes the turn from the index and syncs a
tombstone. The original session file retains the text. Use hide to exclude a turn from search
while keeping it in the index.
To delete a Codex turn from this machine's index without sync, run
memhole rm <id> --codex-index-only. It asks first (or pass --yes), doesn't touch the rollout,
and keeps a tombstone so a later sweep can't bring the turn back. It refuses Claude ids. If sync is
set up, the delete reaches your other machines too.
Sync across machines
One memory on every machine you code on. The server is yours.
memhole sync serve # on the machine that keeps the shared index
memhole sync add-user sam # prints sam's account token, once
memhole sync login https://sync.example.com # on each of their machines; asks for that token
Run Claude Code on a few machines and they share one index. At the end of each sweep a machine sends what's new and pulls what the others sent, so a chat from your laptop turns up in a search on your desktop, marked with the machine it came from. Every machine keeps a full copy and searches it locally. Only text travels; each machine embeds what it pulls with its own model.
Deletes, hides and private marks reach every machine. Notes folders and tool output stay home unless
you turn on syncNotes or syncTools. The server can read what it holds, so run it somewhere you
trust and put HTTPS in front of it before another machine connects. A Docker image with Caddy in front
sets up the HTTPS for you (Run the server with Docker).
memhole sync status shows where things stand, and the reference
has the rest.
How it works
New turns get indexed when a Claude Code session ends (after every turn on 2.1.287). Codex indexes at server startup and, with trusted hooks, after prompts and completed turns. Long turns are split into passages, and each one gets an EmbeddingGemma vector plus a BM25 keyword entry. A search hits both, merges them with RRF, and a small cross-encoder reorders the top results. Indexing can use a GPU if you have one. Search doesn't need one.
Since the original text is always kept, a better embedding model later can just rebuild the index.
Benchmarks
First or tied for first in every head-to-head I ran. The scoreboard has the scores against MemPalace, agentmemory and deja-vu.
On LongMemEval (500 questions, 246,738 turns indexed), 99.5% of the evidence makes it into the shortlist. On a 100-question subset the agent got 94 right, and 79 of those needed no judge to score. Against MemPalace's shipped product on the same 432 questions, memhole put the right session in its top 10 for 99.5% and MemPalace for 97.9%.
Every number, how it was measured, where it stops, and the commands to rerun the recall test are in docs/BENCHMARKS.md.
Codex status
On Windows, the installed plugin smoke test with Codex CLI 0.171.0 loaded all six skills and 11 MCP tools, read a synthetic index, and exercised staging, evidence, preview, save, dismiss, and undo in the repeats inbox. A separate packaged-hook fixture verified the repeats reminder after a completed sweep.
Earlier Windows checks with Codex CLI 0.167.1 covered trusted lifecycle hooks, automatic indexing,
private spans, prompt references, and manual compaction. See Codex parity status
for the historical runs and what remains to verify.
Codex marketplace installs use a compact plugin bundle. Dependencies and models are prepared
outside it, so normal use leaves the approved bundle unchanged. New plugin versions still need
the normal review in /hooks; installation does not grant hook trust.
The details: folders, session files, hooks and older versions
Private folders need to know which folder a chat runs in, and the server itself runs from the plugin's
folder. So it gets the folder from the trusted hooks or from the header Codex saves with each session,
and a client can pass MCP roots too. For a throwaway chat with no roots and no trusted hooks, tell it
with memory_setup({workspacePath: "<absolute workspace path>"}). If it can't tell, you get an error
that says what to do, so it never quietly treats the plugin's folder as yours.
Codex keeps normal chats in ~/.codex/sessions/YYYY/MM/DD/rollout-*.jsonl and archived ones in
~/.codex/archived_sessions. memhole reads both, and its own index lives at
~/.memhole/memory.db (~/.memory-search/memory.db if you had memhole before 1.7.0). Compressed .jsonl.zst sessions get read when your Node has zstd built
in (checked on Node 22.23.2). Older Node reports them as skipped.
With trusted hooks, the prompt, Stop and SessionEnd hooks request background indexing, even while another writer is busy. A hook timeout or force-close can interrupt that request; the next server start catches up from the saved rollout. Codex caps SessionEnd at three seconds, so prompt and Stop hooks also request indexing during the chat. Indexing runs in the background, so new text can take a bit to show up.
If you turn on app-output search, the trusted hooks also keep the nested MCP text that code mode leaves out of the rollout. That only starts once you turn it on, skips images and audio, and blanks secrets first if you asked for that. Codex parity status has how it's built and tested.
Older versions stored some Codex assistant replies as harness text. The next sweep makes them
searchable. It backs up the index once first (memory.db.pre-codex-rows.bak) and keeps their ids and
text.
Docs
- Reference: every tool, flag and setting
- Benchmarks: every number and how it was measured
- Setup internals: how the plugin is wired
- Changelog
Runs on Windows x64, Linux x64, Linux arm64 and macOS on Apple Silicon, and every release gets tested on all four. Intel Macs and Windows on ARM aren't supported since a dependency has no build for them. Needs Node 22 or newer.
Contributing
Pull requests are welcome. Read the contributor agreement and tick the box for it in your pull request's description. It lets the commercial license cover your code too, and you keep your copyright.
License
Free for personal use, and for charities, schools, public research and government, under the PolyForm Noncommercial License 1.0.0. A company with fewer than 100 people and under $1M revenue a year (2019 dollars, adjusted for inflation) uses it free too, under the PolyForm Small Business License 1.0.0. A larger company needs a paid commercial license. Email hello@memhole.dev with your company's name and how many people will use it.
memholenpm install memhole