Skip to main content

Persistent session memory for Claude Code — local SQLite, no LLMs, no network

Project description

memex

Every Claude Code session starts without knowing what you built last time — which files you changed, what decisions you made, what broke. You re-explain. Claude re-reads. You start over.

memex keeps a structured log of every session. Claude reads it at the start of the next one.

No cloud. No LLM extraction. No cost per save. Just local SQLite and two commands to install.

Install

pip install mcp-memex
memex install

Restart Claude Code. That's it.

What gets saved

Each entry has structure — not a blob of text:

mem_save(
    task="Replaced JWT auth with session cookies",
    files=["src/auth.py", "src/middleware.py"],
    decisions=["Session cookies over JWT — simpler, no token refresh needed"],
    warnings=["Redis required — app won't start without REDIS_URL set"],
    tags=["auth", "sessions"]
)

Claude calls mem_save when it finishes something meaningful. You can also just tell it: "save what we just did."

What Claude sees at session start

=== memex: session context (db: my_project.db) ===

--- Recent (2) ---
[1] #4 — 2026-06-14T10:32
  Task      : Replaced JWT auth with session cookies
  Files     : src/auth.py, src/middleware.py
  Decision  : Session cookies over JWT — simpler, no token refresh needed
  Warning   : Redis required — app won't start without REDIS_URL set
  Tags      : auth, sessions

[2] #3 — 2026-06-13T15:10
  Task      : Added rate limiting to /api/login
  Files     : src/middleware.py
  Warning   : Rate limiter is in-memory per process — resets on restart
  Tags      : auth, rate-limiting

Claude calls mem_load automatically at the start of every session. It returns the most recent entries plus any entries that match what you're working on — by keyword and by file path.

Browse from the terminal

You don't need to be inside Claude to look at your history:

memex list                  # recent entries for this project
memex list --tag auth       # filter by tag
memex search "rate limit"   # full-text search

Five MCP tools

Tool What it does
mem_load Called at session start — returns recent + relevant entries
mem_save Saves a structured entry after meaningful work
mem_search Full-text search across all entries
mem_list Lists entries, optionally filtered by tag
mem_delete Removes a stale entry by id

Why not just CLAUDE.md?

CLAUDE.md is for static project documentation — architecture, conventions, how to run tests. It doesn't change much and it isn't session-aware.

memex captures what's changing session to session: what you built yesterday, the decision you made this morning, the warning you discovered an hour ago. It's the difference between "here's the project" and "here's what happened last time."

Memory is scoped per project

Each project gets its own SQLite database at ~/.memex/<project>.db based on the working directory. Sessions from different projects never mix.

Configuration

Set these in the MCP env block in ~/.claude.json if you need to override defaults:

Variable Default Description
MEMEX_DIR ~/.memex Where DBs are stored
MEMEX_GLOBAL 0 Set to 1 to share one DB across all projects
MEMEX_RECENT 5 Max recent entries loaded per session
MEMEX_MATCHED 5 Max FTS-matched entries loaded per session

Uninstall

memex remove
pip uninstall mcp-memex

Memory DBs are kept at ~/.memex/ — delete that directory manually if you want to wipe everything.

Requirements

  • Python 3.10+
  • mcp package (installed automatically)
  • SQLite with FTS5 (standard since Python 3.8)
  • Claude Code CLI

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mcp_memex-0.1.1.tar.gz (10.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mcp_memex-0.1.1-py3-none-any.whl (12.2 kB view details)

Uploaded Python 3

File details

Details for the file mcp_memex-0.1.1.tar.gz.

File metadata

  • Download URL: mcp_memex-0.1.1.tar.gz
  • Upload date:
  • Size: 10.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.4

File hashes

Hashes for mcp_memex-0.1.1.tar.gz
Algorithm Hash digest
SHA256 7303c7e5975375cee78438bf93ea841fe449639ef289c00d026f30f4d2713a85
MD5 cbed858feb018f5d47ba5ba1a92cf45b
BLAKE2b-256 24f2ff83df302c9001a7d6be87b5fcde6f9e61db375ae9a7c8686dcbccbd0c0a

See more details on using hashes here.

File details

Details for the file mcp_memex-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: mcp_memex-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 12.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.4

File hashes

Hashes for mcp_memex-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 43df0e278476276727eb5222796d25db67feab93373ed12142db50f23df2008e
MD5 7e83700c48adc716d90fd89988a89dda
BLAKE2b-256 2b1d0f2dbd334b0248d01342af34f4c98e653171e95538a9efcb1f3336b8f467

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page