memex
Make Claude smarter about you.
npm install -g @evan-moon/memex
Make Claude smarter about you.
Local-first second brain that connects to Claude via MCP. Notes are stored as plain Markdown and indexed with a local ML model, fully offline, no API keys, nothing leaves your machine.
The problem
Claude is only as smart as what's in the conversation. Your decisions, your context, your thinking, invisible unless you paste them in every time.
You: What did we decide about the auth approach last sprint?
Claude: I don't have context from previous conversations...
The fix
You: What did we decide about the auth approach last sprint?
Claude: [memex Β· search_notes Β· "auth approach decision"]
Found 2 notes:
Auth Architecture Decision Apr 14 #auth #backend
βββββββββββββββββββββββββββββββββββββββββββββββββββββ
Chose JWT + refresh tokens over sessions. Rationale:
stateless design fits horizontal scaling plan.
Based on your April 14th note: you went with JWT +
refresh tokens. Tom also flagged keeping auth decoupled
from payment logic, separate bounded contexts.
Claude searches your notes before answering and saves insights at the end of every conversation, automatically, without being asked.
Install
npm install -g @evan-moon/memex
Connect your apps:
This registers memex with every MCP client on this machine β Claude, Claude Code, Codex, Cursor β by writing each one's own config file. Restart the clients afterwards. The same thing is one button in the app: run memex ui and open Connect, which also shows which apps can already reach memex.
That's it. On first run, the embedding model (~450MB) downloads once to ~/.memex/models/.
Auto-recall (optional)
Turns retrieval from something Claude has to decide to do into something that just happens. Every prompt you type is semantically searched against your notes, and the top 3 titles are injected as context before Claude answers β the same way native memory works. Claude then pulls full notes with get_note when a title looks relevant.
A background daemon keeps the embedding model warm (~/.memex/recall.sock), so a lookup costs ~30ms instead of the ~1.5s a cold CLI search spends loading the model. It idles out after 2 hours.
Cost: ~200MB resident while warm, plus up to 3 note titles of context per prompt. Remove with memex recall uninstall.
Features
- Semantic search, finds notes by meaning, not just keywords. Multilingual (Korean + English), runs fully offline via
multilingual-e5-base
- Hybrid retrieval, vector search + BM25 full-text + tag matching, fused via Reciprocal Rank Fusion
- Chunk-level embeddings, long notes are split into ~340-token passages and embedded individually, so an answer buried on page three is as findable as one in the opening paragraph. Search returns the passage that matched, not the note's first lines
- Cross-encoder reranking (opt-in,
MEMEX_RERANK=1), retrieves twice as many candidates and reorders them with bge-reranker-v2-m3. Worth ~+20pp hit@1 on the golden set, at ~1.8s per search β off by default because auto-recall and the CLI are built around instant lookups
- Date filter, narrow search to a time range with
--from / --to
- Note layers, every note is
past (immutable record), state (mutable plan), or rule (Claude behaviour guide). Past notes refuse updates; rule notes auto-inject into Claude's system prompt
- Flashback, save and search automatically surface older notes from a different folder that are semantically related, "you wrote about this 124 days ago in a different context"
- Desktop view,
memex ui opens the vault by topic and splits each one into what still stands and what has gone out of date β corrected by a later note, or a plan with newer records piled up behind it
- Inference engine, deterministic signals surface un-synthesized patterns (cross-year arcs, stale state notes, tag revivals); you promote good ones into inferences (hypotheses with provenance) that auto-invalidate when their source notes change. No LLM in the core
- MCP server, Claude searches and saves automatically. No extra CLAUDE.md setup needed
- Auto-recall, opt-in hook that searches your notes on every prompt and injects the hits before Claude answers, so recall never depends on Claude remembering to look
- Duplicate detection,
save_note warns when a semantically similar note already exists, nudging Claude to update rather than create
- Backlinks, link notes with
[[Title]] syntax; get_note shows which notes reference it
- Series collapse, a dated work log ("β¦ 2026-07-20", "β¦ 2026-07-23") takes at most two slots on a result page, and search reports how many more it held back
- Amendments, a correction records what it corrects (
amends), so search flags the superseded note and points at the newest fix instead of returning a claim you already know is wrong
- Digest,
memex digest summarises notes saved in the last N days, grouped by folder
- CLI, add, search, tag, browse, and index notes from the terminal
- Obsidian-compatible, notes saved as
.md files; works alongside existing vaults
- Local DB, SQLite +
sqlite-vec at ~/.memex/memex.db
CLI
# Add notes
memex add # interactive prompt (asks for layer)
memex add --title "Note title" --content "..." --layer past
memex add --title "Note title" --file ./note.md --layer state
memex add --title "Note title" --content "..." --folder work/people/tom --layer past
memex add --title "Note title" --content "..." -T typescript -T architecture --layer past
# Layers
memex layer # distribution of past / state / rule
memex layer <id> state # move a note to a different layer
# Search
memex search "semantic search query" # multilingual
memex search "knowledge management" --limit 10 # multilingual: matches Korean/Japanese notes too
memex search "query" --tag typescript # filter by tag
memex search "query" --from 2026-04-01 # notes since a date
memex search "query" --from 2026-04-01 --to 2026-04-30
# Browse
memex list # recent 10 notes
memex list --limit 20
memex show <id>
memex tags # all tags with counts
memex related <id> # semantically related notes
memex digest # last 7 days + signals + inferences
memex digest --days 30 # summary of last 30 days
# Insights (inference engine)
memex signals # detect un-synthesized patterns
memex signals --type hidden_arc # one type only
memex signals dismiss <id> # triage (also: snooze)
memex signals mint <signalId> # print evidence bundle to synthesize
memex signals mint <signalId> --title "..." --summary "..." --confidence 0.7
memex inferences # list inferences (auto-flags stale)
memex schedule # print cron/launchd snippet (no daemon)
# Edit / delete
memex edit <id>
memex delete <id>
memex delete --yes <id> # skip confirmation
# Index external directories
memex source add ~/Documents/My\ Notes # register a vault
memex source list
memex source remove ~/Documents/My\ Notes
memex index # scan vault + all sources
memex index --force # re-index everything
memex reembed # re-embed with current model
# Config
memex config show
memex config set vault-path ~/Documents/Second\ Brain
# MCP
memex mcp install # register with every MCP client on this machine
# Auto-recall
memex recall install # search notes on every prompt, inject hits
memex recall uninstall # remove the hook
memex mcp path # print MCP binary path
MCP server
Claude, Claude Code, Codex, Cursor
Or from the app: memex ui, then Connect.
Both write each client's own config file and leave the servers already in it alone. If a client still runs an older copy of memex, both repoint it. memex mcp path prints the server path for a client memex does not know about yet.
Available tools