remem-mcp 0.6.2 → 0.6.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -11,37 +11,84 @@ Local memory that survives context compaction — learns from every error, injec
11
11
 
12
12
  **One command setup. No API key. No cloud. No database server. Just a SQLite file.**
13
13
 
14
- <video src="https://raw.githubusercontent.com/tinhien11/remem-mcp/main/docs/screenshots/demo-learning-loop.mp4" controls muted width="100%"></video>
14
+ ---
15
15
 
16
- ![Demo: Error learning loop](https://raw.githubusercontent.com/tinhien11/remem-mcp/main/docs/screenshots/demo-learning-loop.gif)
16
+ ## Install
17
17
 
18
- ### See it in action
18
+ ```bash
19
+ npx remem-mcp setup
20
+ ```
19
21
 
20
- | Error learning loop | CodeGraph search | Web viewer |
21
- |---|---|---|
22
- | ![Error learning](https://raw.githubusercontent.com/tinhien11/remem-mcp/main/docs/screenshots/demo-learning-loop.gif) | ![CodeGraph](https://raw.githubusercontent.com/tinhien11/remem-mcp/main/docs/screenshots/demo-codegraph.gif) | ![Viewer](https://raw.githubusercontent.com/tinhien11/remem-mcp/main/docs/screenshots/viewer-demo.gif) |
22
+ Auto-detects Claude Code, Cursor, Devin, Codex. Registers MCP server + hooks. Restart your agent.
23
23
 
24
- | Viewer: overview | CodeGraph: callers | CodeGraph: search |
25
- |---|---|---|
26
- | ![Overview](https://raw.githubusercontent.com/tinhien11/remem-mcp/main/docs/screenshots/viewer-overview.png) | ![Callers](https://raw.githubusercontent.com/tinhien11/remem-mcp/main/docs/screenshots/viewer-codegraph-callers.png) | ![Search](https://raw.githubusercontent.com/tinhien11/remem-mcp/main/docs/screenshots/viewer-codegraph-search.png) |
24
+ ```bash
25
+ npx remem-mcp demo # Live demo: real build, real errors, real hooks
26
+ npx remem-mcp demo-codegraph # Live CodeGraph demo on facebook/react
27
+ npx remem-mcp status # One dashboard: everything at a glance
28
+ ```
27
29
 
28
30
  ---
29
31
 
30
- ## Install
32
+ ## Quick start (after install)
33
+
34
+ **Nothing.** Just use your agent normally. No commands, no setup, no init.
35
+
36
+ Memory works automatically:
37
+ - **Session start** → past errors, decisions, and persona injected into agent context
38
+ - **Each prompt** → matching memory injected (you'll see `[remem-mcp]` at the top)
39
+ - **Session end** → worker auto-extracts facts, consolidates summaries, updates persona
31
40
 
32
41
  ```bash
33
- npx remem-mcp setup
42
+ npx remem-mcp status # verify: hooks ✓, DB ✓, CodeGraph ✓
34
43
  ```
35
44
 
36
- That's it. Auto-detects Claude Code, Cursor, Devin, Codex. Registers MCP server + hooks. Restart your agent.
45
+ ---
37
46
 
38
- ```bash
39
- npx remem-mcp demo # Live demo: real build, real errors, real hooks
40
- npx remem-mcp demo-codegraph # Live CodeGraph demo on facebook/react
41
- npx remem-mcp status # One dashboard: everything at a glance
47
+ ## What it does
48
+
49
+ ```
50
+ ┌─────────────────────────────────────────────────┐
51
+ │ AI Agent │
52
+ │ (Claude Code / Devin / Cursor) │
53
+ └────────┬──────────────────────────┬──────────────┘
54
+ │ MCP tools (15) │ Hooks (auto)
55
+ ▼ ▼
56
+ ┌──────────────────┐ ┌────────────────────┐
57
+ │ recall() │ │ SessionStart │──▶ inject L2/L3 + skills
58
+ │ capture() │ │ UserPromptSubmit │──▶ inject BM25 match
59
+ │ codegraph_* │ │ Stop │──▶ spawn worker
60
+ │ wiki_* │ │ PostCompact │──▶ save checkpoint
61
+ └────────┬─────────┘ └─────────┬──────────┘
62
+ │ │
63
+ ▼ ▼
64
+ ┌─────────────────────────────────────────────────┐
65
+ │ SQLite (memory.db) │
66
+ │ │
67
+ │ L0 captures ──▶ L1 atoms ──▶ L2 scenarios ──▶ L3 persona
68
+ │ (raw) (facts) (summaries) (preferences)
69
+ │ │
70
+ │ CodeGraph: symbols + calls + imports │
71
+ │ Wiki: markdown docs + ADRs │
72
+ └───────────────────────────────────────────────────┘
42
73
  ```
43
74
 
44
- The demo creates a real TypeScript project, runs real `npm run build`, captures real TS2307 errors, and shows the full learning loop — capture inject → fix → zero retries. No hardcoded strings.
75
+ ### Memory pipeline (L0L3)
76
+
77
+ - **L0 captures** — raw content from agent sessions (errors, decisions, patterns)
78
+ - **L1 atoms** — distilled facts with confidence scores (agent writes or worker extracts)
79
+ - **L2 scenarios** — auto-consolidated summaries when 5+ atoms share a topic
80
+ - **L3 persona** — user preferences auto-detected from repeated tags (2+ occurrences)
81
+
82
+ All runs **without LLM API key** — rule-based extraction + keyword grouping.
83
+
84
+ ### CodeGraph
85
+
86
+ Structural code indexing via tree-sitter (9 languages: TS/JS/Python/Go/Rust/Java/C/C++/C#).
87
+
88
+ - **6-strategy call resolution**: import-map (0.95) → same-module (0.90) → unique-name (0.75) → suffix (0.55) → fuzzy (0.35)
89
+ - **Call types**: direct (`foo()`), method (`obj.method()`), JSX (`<Component/>`)
90
+ - **Stdlib filter**: skips `fmt.Printf`, `console.log`, `print()` — reduces noise
91
+ - **Tools**: `codegraph_search`, `codegraph_callers`, `codegraph_callees`, `codegraph_impact`, `codegraph_detect_changes`
45
92
 
46
93
  ---
47
94
 
@@ -49,12 +96,11 @@ The demo creates a real TypeScript project, runs real `npm run build`, captures
49
96
 
50
97
  | | remem-mcp | Mem0 | Claude MEMORY.md | Mneme |
51
98
  |---|---|---|---|---|
52
- | **Survives compaction** | Yes — PreCompact hook saves checkpoint, re-injects after | Yes — cloud store | No — 200-line cap, silent truncation | Yes — PreCompact hook |
53
- | **Learns from errors** | Yes — auto-captures, injects fixes | No | No | No |
54
- | **Semantic search** | Hybrid BM25 + sqlite-vec | Vector only | No — LLM filename picker, max 5 files | Vector + graph |
55
- | **Setup** | 1 command | API key + cloud | Built-in | Build from source (Rust) |
56
- | **Data location** | Local SQLite | Cloud | Local markdown | Local SQLite |
57
- | **Team sharing** | Git-native (commit, diff, merge) | Cloud sync | Copy-paste | Manual |
99
+ | **Survives compaction** | Yes — PreCompact hook | Yes — cloud | No — 200-line cap | Yes — PreCompact hook |
100
+ | **Learns from errors** | Yes — auto-capture + inject | No | No | No |
101
+ | **Semantic search** | Hybrid BM25 + sqlite-vec | Vector only | No | Vector + graph |
102
+ | **CodeGraph** | Yes 6-strategy call resolution | No | No | No |
103
+ | **Setup** | 1 command | API key + cloud | Built-in | Build from source |
58
104
  | **API key** | No | Yes | No | No |
59
105
  | **Cost** | Free | $19–249/mo | Free | Free |
60
106
 
@@ -103,83 +149,22 @@ Add to `~/.codex/config.toml`:
103
149
  [mcp_servers.remem-mcp]
104
150
  command = "npx"
105
151
  args = ["-y", "remem-mcp"]
106
-
107
- [mcp_servers.remem-mcp.env]
108
- REMEM_GLOBAL_SESSION_KEY = "global"
109
152
  ```
110
-
111
153
  Then run `npx remem-mcp install-hooks`.
112
- > MCP tools require `sandbox_mode = "danger-full-access"`.
113
154
  </details>
114
155
 
115
156
  ---
116
157
 
117
- ## How it works
118
-
119
- Memory lives in a local SQLite database — outside the agent's context window. When the agent compacts or starts a new session, memory is re-injected automatically. No more re-explaining what you already told it yesterday.
120
-
121
- **PreCompact hook**: when the agent is about to compact context, remem-mcp saves a checkpoint (decisions made, approaches tried, what's verified working) to the DB. After compaction, the agent recalls it — so the compact doesn't destroy your session's learnings.
122
-
123
- Two layers: **automatic** (runs via hooks, zero tool calls) and **on-demand** (you call when you need deeper context).
124
-
125
- ### Automatic — three learning loops + compaction survival
126
-
127
- All run via lifecycle hooks. The agent doesn't need to call any tool.
128
-
129
- 1. **Error learning** — command fails → capture → inject fix before next attempt → succeed → upvote.
130
-
131
- 2. **Decision learning** — `npm install`, `git commit`, config → auto-capture → inject past decisions before similar commands.
132
-
133
- 3. **Pattern learning** — Write/Edit → auto-capture code patterns → inject same-language patterns before editing.
134
-
135
- 4. **Compaction survival** — PreCompact hook fires before context compaction → saves checkpoint → agent recalls after compact. Memory survives.
136
-
137
- ### On-demand — CodeGraph, Wiki, Search
138
-
139
- When the automatic loops aren't enough, use these for deeper code navigation.
140
-
141
- **CodeGraph** — symbol search, callers/callees, impact analysis. **Auto-indexes on first use** — just call `codegraph_search` and it indexes `src/` automatically. No manual `codegraph_index` needed.
142
-
143
- ```bash
144
- # Search symbols (auto-indexes src/ on first call)
145
- npx remem-mcp search-code --query "parseTar"
146
- # → parseTar at src/parse.ts:22
147
-
148
- # List symbols in a file
149
- npx remem-mcp list-code src/reporters/fancy.ts
150
- # → Class L49-135 FancyReporter
151
- # → Method L86-134 formatLogObj
152
-
153
- # Trace callers / callees / impact (use symbol ID from search)
154
- npx remem-mcp callers 01KZXPPHF93TS4HV8FWCSSK36A
155
- npx remem-mcp impact 01KZXPPHF93TS4HV8FWCSSK36A
156
-
157
- # Manual re-index (only needed after major changes)
158
- npx remem-mcp index --path src --repo .
159
-
160
- # Wiki + viewer
161
- npx remem-mcp wiki ingest --path docs # Index markdown docs + ADRs
162
- npx remem-mcp wiki outdated # Find outdated wiki pages
163
- npx remem-mcp viewer # Web UI at localhost:7331
164
- ```
165
-
166
- - **CodeGraph** — symbol search, callers/callees, impact analysis. Auto-indexes on first `codegraph_search` call. Auto-scoped to your project.
167
- - **Wiki** — markdown docs, ADRs, outdated detection.
168
- - **Search** — hybrid BM25 + sqlite-vec vector search with RRF fusion. `explain_recall` shows scores.
169
-
170
- ![CodeGraph demo](https://raw.githubusercontent.com/tinhien11/remem-mcp/main/docs/screenshots/demo-codegraph.gif)
171
-
172
- ---
173
-
174
158
  ## Daily commands
175
159
 
176
160
  ```bash
177
161
  npx remem-mcp status # Everything at a glance
178
162
  npx remem-mcp viewer # Web UI at localhost:7331
179
163
  npx remem-mcp errors # Error dashboard
180
- npx remem-mcp decisions # Decision dashboard
181
- npx remem-mcp patterns # Pattern dashboard
182
164
  npx remem-mcp recent [N] # Recent captures
165
+ npx remem-mcp search-code --query "parseTar" # CodeGraph search
166
+ npx remem-mcp callers <id> # Who calls this symbol?
167
+ npx remem-mcp impact <id> # Blast radius analysis
183
168
  npx remem-mcp help all # Full list of 40+ subcommands
184
169
  ```
185
170
 
@@ -193,50 +178,21 @@ All settings have defaults. Config file is optional: `~/.config/remem-mcp/config
193
178
  |---|---|---|
194
179
  | DB path | `REMEM_DB_PATH` | `~/.local/share/remem-mcp/memory.db` |
195
180
  | Cross-project memory | `REMEM_GLOBAL_SESSION_KEY` | _(unset)_ |
196
- | Cross-project errors | `REMEM_GLOBAL_ERRORS` | _(unset, set to `1`)_ |
197
- | Auto-global classification | `auto_global=true` on capture | _(off)_ |
198
181
  | Suppress hook feedback | `REMEM_QUIET` | _(unset, set to `1`)_ |
199
- | Retro window (days) | `REMEM_RETRO_DAYS` | `7` |
200
- | Core-only mode (disable advanced tools) | `REMEM_CORE_ONLY` | _(unset, set to `1`)_ |
201
- | LLM API key (pipeline) | `REMEM_LLM_API_KEY` | _(unset)_ |
202
-
203
- **Team sharing** — `npx remem-mcp sync-export` writes `.remem-mcp/memory-export.jsonl`. Commit it to git. Team members get the same memory on `git pull` (auto-imports on startup).
204
-
205
- ---
182
+ | LLM API key (optional) | `REMEM_LLM_API_KEY` | _(unset)_ |
206
183
 
207
- ## TypeScript SDK
208
-
209
- ```ts
210
- import { Memory } from "remem-mcp";
211
-
212
- const memory = new Memory();
213
- await memory.capture("We chose SQLite for storage.", "decision", ["arch"]);
214
- const results = await memory.recall("storage decision");
215
- ```
184
+ **Team sharing** — `npx remem-mcp sync-export` writes `.remem-mcp/memory-export.jsonl`. Commit it to git. Team members get the same memory on `git pull`.
216
185
 
217
186
  ---
218
187
 
219
188
  ## Benchmark
220
189
 
221
- remem-mcp is evaluated against the same benchmarks as TencentDB Agent Memory and Mem0, plus the Agent Memory Benchmark (AMB) suite.
222
-
223
- > **Note:** LoCoMo, PersonaMem, and LongMemEval scores use custom adapters with keyword-heuristic scoring (not official LLM-as-judge runners). AMB uses the official CLI. See [scripts/bench-all.sh](scripts/bench-all.sh) for methodology.
224
-
225
- | Benchmark | remem-mcp | TencentDB Agent Memory | Mem0 | Without memory |
226
- |---|---|---|---|---|
227
- | **AMB Layer 1** (basic recall) | **100** | — | — | — |
228
- | **AMB Layer 2** (multi-session) | **100** | — | — | — |
229
- | **AMB Layer 3** (scale + distractors) | **100** | — | — | — |
230
- | **LoCoMo** (long conversation QA) | **95** | — | 92.5 | — |
231
- | **PersonaMem** (personalization) | **100** | 76 | — | 48 |
232
- | **LongMemEval** (long-term memory, ICLR 2025) | **96** | — | 94.4 | — |
233
-
234
- - **PersonaMem** — [bowen-upenn/PersonaMem](https://github.com/bowen-upenn/PersonaMem) (588 questions, 20 personas, multiple-choice QA). TencentDB reports 76% with memory enabled, 48% without. remem-mcp scores **100%** using a search-recall proxy (no LLM API key needed).
235
- - **LoCoMo** — long conversation multi-hop QA (19 sessions, 400+ turns). Mem0 reports 92.5%. remem-mcp scores **95%** with keyword + semantic-similarity scoring.
236
- - **AMB** — Agent Memory Benchmark (L1: 56 recall tests, L2: 5 multi-session scenarios, L3: 1K+ memories with distractors). remem-mcp scores **100/100/100** using the official AMB CLI.
237
- - **LongMemEval** — [xiaowu0162/LongMemEval](https://github.com/xiaowu0162/LongMemEval) (ICLR 2025, 500 questions, 5 memory abilities: temporal reasoning, multi-session, knowledge update, single-session recall, abstention). Mem0 reports 94.4%. remem-mcp scores **96%** on the oracle variant.
238
-
239
- Run the benchmarks:
190
+ | Benchmark | remem-mcp | Mem0 | Without memory |
191
+ |---|---|---|---|
192
+ | **AMB** (L1/L2/L3) | **100/100/100** | | |
193
+ | **LoCoMo** (long conversation QA) | **95** | 92.5 | — |
194
+ | **PersonaMem** (personalization) | **100** | | 48 |
195
+ | **LongMemEval** (ICLR 2025) | **96** | 94.4 | — |
240
196
 
241
197
  ```bash
242
198
  bash scripts/bench-all.sh # Full: AMB + LoCoMo + PersonaMem (~5 min)
@@ -245,9 +201,13 @@ bash scripts/bench-all.sh --quick # AMB only (~2 min)
245
201
 
246
202
  ---
247
203
 
204
+ ## Architecture
205
+
206
+ See [ARCHITECTURE.md](./ARCHITECTURE.md) for full system diagrams, schema, and performance benchmarks.
207
+
248
208
  ## Credits
249
209
 
250
- Core based on [TencentDB Agent Memory](https://github.com/TencentCloud/TencentDB-Agent-Memory) (MIT, Tencent 2026). Replaces the cloud backend with embedded SQLite + sqlite-vec + FTS5. Adds error/decision/pattern learning loops and lifecycle hooks.
210
+ Core based on [TencentDB Agent Memory](https://github.com/TencentCloud/TencentDB-Agent-Memory) (MIT, Tencent 2026). CodeGraph call resolution adapted from Codebase-Memory (arXiv:2603.27277).
251
211
 
252
212
  ## License
253
213