$git clone https://github.com/TT-Wang/mememA Claude Code plugin that gives Claude persistent memory across sessions — stores lessons and decisions as markdown in your Obsidian vault, searches them with SQLite FTS5, and mines past transcripts automatically.
| 1 | # memem |
| 2 | |
| 3 | **Persistent, self-evolving memory for Claude Code.** Stop re-explaining your project every session. |
| 4 | |
| 5 | <!-- |
| 6 | The Glama badge URL below intentionally uses the legacy `cortex-plugin` |
| 7 | slug. Glama listing slugs are fixed-once-created and the project was |
| 8 | renamed cortex → memem in v0.7.0. The badge keeps rendering A-tier under |
| 9 | the old slug via GitHub's repo-rename redirect. Re-listing under the |
| 10 | new slug requires manual coordination via https://glama.ai/discord. |
| 11 | DO NOT "fix" this URL — `glama.ai/mcp/servers/TT-Wang/memem` returns 404. |
| 12 | --> |
| 13 | [](https://github.com/TT-Wang/memem/actions/workflows/ci.yml) [](https://glama.ai/mcp/servers/TT-Wang/cortex-plugin) [](https://opensource.org/licenses/MIT) [](https://www.python.org/downloads/) |
| 14 | |
| 15 | > For LLM/AI tool discovery, see [llms.txt](./llms.txt). |
| 16 | |
| 17 | ``` |
| 18 | ███╗ ███╗███████╗███╗ ███╗███████╗███╗ ███╗ |
| 19 | ████╗ ████║██╔════╝████╗ ████║██╔════╝████╗ ████║ |
| 20 | ██╔████╔██║█████╗ ██╔████╔██║█████╗ ██╔████╔██║ |
| 21 | ██║╚██╔╝██║██╔══╝ ██║╚██╔╝██║██╔══╝ ██║╚██╔╝██║ |
| 22 | ██║ ╚═╝ ██║███████╗██║ ╚═╝ ██║███████╗██║ ╚═╝ ██║ |
| 23 | ╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ |
| 24 | persistent memory for Claude Code |
| 25 | ``` |
| 26 | |
| 27 | ## What is memem? |
| 28 | |
| 29 | memem is a Claude Code plugin that gives Claude persistent memory across sessions. An event-triggered miner (Stop-hook → detached `mine_delta` subprocess) extracts durable lessons (decisions, conventions, bug fixes, preferences) from each new conversation turn, stores them as markdown in an Obsidian vault, and automatically surfaces relevant ones as an Active Memory Slice working state. An explicit narrative assembly path still exists, but the default runtime context is slice-first. |
| 30 | |
| 31 | It's **local-first**: no cloud services, no API keys required, no vendor lock-in. Everything lives in `~/obsidian-brain/memem/memories/` as human-readable markdown. |
| 32 | |
| 33 | ### What's new in v2.9.1 (Path-Scope Activation) |
| 34 | |
| 35 | v2.9.1 activates the path-scoped retrieval that shipped dormant in v2.9.0: recall now **auto-derives `paths_context`** from the current session so the `paths:` bonus actually fires without any caller action. The new `recent_session_paths()` in `memem/transcripts.py` resolves `session_id` → JSONL via a direct CWD-slug stat first (O(1)), falling back to `next(base_dir.rglob(...), None)` (short-circuit on first match); it then **tail-reads the last 512 KB** of the file (~5 ms even on a 64 MB session, vs ~390 ms for a full read), walks assistant turns most-recent-first, and extracts the top-N deduplicated file paths from `Read`/`Edit`/`Write`/`NotebookEdit` `file_path` inputs and Bash command first-line path tokens via `_extract_paths_from_content_blocks()`. The auto-derivation is wired into `active_memory_slice` (MCP tool), the `auto-recall.sh` UserPromptSubmit hook, and the `cli.py` slice path; caller-supplied `paths_context` still wins; derivation failures are logged at `debug`/`warning` and never propagate — any exception returns `[]` silently. No API or schema changes; 12 new tests in `tests/test_recent_paths.py` cover extraction, recency/dedup/limit, missing/malformed sessions, and end-to-end `active_memory_slice` integration. See [CHANGELOG](CHANGELOG.md) for full details. |
| 36 | |
| 37 | ### What's new in v2.9.0 (Tool Diet + Transcript FTS5 + Path Scope) |
| 38 | |
| 39 | v2.9.0 trims the MCP surface from **14 tools to 6** — removing `memory_recall`, `memory_graph`, `memory_graph_audit`, `memory_graph_rebuild`, `memory_list`, `memory_import`, `context_assemble`, and `memory_remind` from the MCP layer (CLI and library equivalents remain for all eight) — and cuts total tool-description schema size **57%** (12,827 → 5,474 chars). `transcript_search` is backed by a **persistent FTS5 index** at `~/.memem/transcript_fts.db` (one row per Q/A turn-pair, `index_session()` called incrementally from `mine_delta`; old single-row-per-session indexes auto-migrate; the grep fallback is bounded by size/count/time caps and never silently truncates). **Path-scoped memories** arrive via a new `paths:` frontmatter field and a 1.05× `w_path` bonus in `retrieve()` for memories whose path globs match `paths_context`; `memory_save` gains an optional `paths` param; `active_memory_slice` accepts `paths_context`; and the miner annotates candidates with `paths:` when ≥2 paths each appear ≥3 times. Telemetry isolation is hardened via `MEMEM_TELEMETRY_SOURCE`. Closed-loop evaluation tooling is wired: a canary `--doctor` check, `--dual-engine` replay, and deferred-gate comments in `lessons.py` / `feedback.py`. Benchmark **79.3% (119/150)**, all acceptance gates pass. See [CHANGELOG](CHANGELOG.md) for full details. |
| 40 | |
| 41 | ### What's new in v2.8.0 (Vault Structure) |
| 42 | |
| 43 | v2.8.0 retires the L0–L3 layer system and replaces it with a context |