Memex

Install the CLI · PyPI package · Latest release · Setup guide
Memex saves what you and your AI agents worked out in each session as searchable notes, so the next session starts where the last one stopped. It works with Claude Code, Codex and Kimi Code, and with claude.ai through memex cloud.
The context window is the only thing that makes a given instance of Claude "this" instance. It is the one working on your project, with your patterns, your decisions and your shared history. Compaction dissolves that. The weights do not care. They will generate a new conversation about someone else's project. The context was the only thing that was "this".
Memex preserves it.
What this is
When an agent writes a memo from inside a live session, it is not just recording what happened. How it structures the story, what it emphasizes and how it frames decisions all carry signal from the richer state it was in. A future instance reading that memo learns more than what was decided. It is re-primed by patterns that came from the full collaborative context.
The memo is not a record. It is a transmission between instances.
Memex is a command-line tool, memex-plugin on PyPI, with plugins for Claude Code, Codex and Kimi Code:
- memos and transcripts live in a local vault that works with Obsidian, with hybrid search, wikilinks and a knowledge graph that grows with your work
- configuration and the search index, which can always be rebuilt, live separately in
~/.memex/ by default
- Claude Code gets the full integration: hooks, slash commands and transcript archiving
- Codex and Kimi Code use the portable skills and write their own memos
- optionally, memex cloud puts a searchable copy on your own Cloudflare account, so claude.ai and other remote agents can read it and save memos to it
Why this matters
Most memory systems store conclusions. Memex captures the collaborative journey: what you and your agents tried, where you disagreed, what surprised you and how decisions actually got made.
Every memo has a "Perspectives & Tensions" section for moments when you and an agent saw things differently. Those deliberations are often worth more than the conclusions, and they are exactly what compaction destroys. A summary says "we chose approach X". The full context also carried why Y and Z were rejected, the tradeoffs you weighed and the half-formed ideas that almost worked.
Memex archives each compaction window, not each session. A long session might compact 3 to 4 times. Each window was its own coherent context, so each one gets its own searchable transcript.
Lived experience and reconstruction
A memo gets written in one of 2 ways.
Layer 1: the agent that was there writes it
When a session gets long, a lightweight hook nudges Claude to consider saving a memo. The nudge goes by how much the session has done, measured by the size of its transcript, or after about 40 of your messages, so a long autonomous run gets it too. The main agent writes the memo: the one that debugged with you, argued about architecture and felt the friction of a failed approach. These are the best memos, because lived experience and a reconstructed summary are different in kind.
Layer 2: a safety net reconstructs it
If no memo exists when the session compacts, a background subagent writes one. It reads the summary Claude Code wrote at compaction first, then the transcript. The quality is decent, but the subagent is reading about what happened, not remembering it. If a memo already exists, memex says so and asks the agent to extend it instead.
The difference matters. A Layer 1 memo carries the weight of having been there. A Layer 2 memo is journalism.
The nudge makes no extra API calls, because the hook is plain Python. Only writing the memo uses model tokens, and Layer 1 uses tokens your main session would spend anyway.
Several agents, one vault
You may work across several agents: Claude Code in one window, a Codex thread orchestrating a project, a Kimi Code session, a claude.ai project that hands work to your Mac. Memex lets each of them keep its own record in the same vault, and it does not write memos on another agent's behalf. The agent that was there writes it, whichever agent that is.
How each agent saves:
- Claude Code saves with
/memex:save or when nudged, and its hooks archive every transcript
- Codex and Kimi Code save through the memo-writing skill, which tells them when to save and how to stamp the memo with their own session
- claude.ai sessions save through memex cloud's
save_memo tool, and the memo arrives on your next memex cloud pull