remem-mcp 0.5.17

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 tin
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,235 @@
1
+ # remem-mcp
2
+
3
+ [![npm version](https://img.shields.io/npm/v/remem-mcp.svg)](https://www.npmjs.com/package/remem-mcp)
4
+ [![GitHub stars](https://img.shields.io/github/stars/tinhien11/remem-mcp.svg)](https://github.com/tinhien11/remem-mcp)
5
+
6
+ > Your coding agent stops repeating the same mistakes.
7
+
8
+ Local memory that survives context compaction — learns from every error, injects fixes before the next attempt, and syncs to your git repo so your whole team shares it.
9
+
10
+ <video src="https://raw.githubusercontent.com/tinhien11/remem-mcp/main/docs/screenshots/demo-learning-loop.mp4" controls muted width="100%"></video>
11
+
12
+ ![Demo (GIF)](https://raw.githubusercontent.com/tinhien11/remem-mcp/main/docs/screenshots/demo-learning-loop.gif)
13
+
14
+ ---
15
+
16
+ ## Install
17
+
18
+ ```bash
19
+ npx remem-mcp setup
20
+ ```
21
+
22
+ That's it. Auto-detects Claude Code, Cursor, Devin, Codex. Registers MCP server + hooks. Restart your agent.
23
+
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
+ ```
29
+
30
+ 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 → upvote → cross-project inheritance. No hardcoded strings.
31
+
32
+ ---
33
+
34
+ ## Why it's different
35
+
36
+ | | remem-mcp | Mem0 | Claude MEMORY.md | Mneme |
37
+ |---|---|---|---|---|
38
+ | **Survives compaction** | Yes — PreCompact hook saves checkpoint, re-injects after | Yes — cloud store | No — 200-line cap, silent truncation | Yes — PreCompact hook |
39
+ | **Learns from errors** | Yes — auto-captures, injects fixes | No | No | No |
40
+ | **Semantic search** | Hybrid BM25 + sqlite-vec | Vector only | No — LLM filename picker, max 5 files | Vector + graph |
41
+ | **Setup** | 1 command | API key + cloud | Built-in | Build from source (Rust) |
42
+ | **Data location** | Local SQLite | Cloud | Local markdown | Local SQLite |
43
+ | **Team sharing** | Git-native (commit, diff, merge) | Cloud sync | Copy-paste | Manual |
44
+ | **API key** | No | Yes | No | No |
45
+ | **Cost** | Free | $19–249/mo | Free | Free |
46
+
47
+ ---
48
+
49
+ ## Per-agent install
50
+
51
+ <details>
52
+ <summary>Claude Code</summary>
53
+
54
+ ```bash
55
+ claude mcp add remem-mcp --scope user -- npx -y remem-mcp
56
+ npx remem-mcp install-hooks
57
+ ```
58
+ </details>
59
+
60
+ <details>
61
+ <summary>Cursor</summary>
62
+
63
+ [![Install in Cursor](https://img.shields.io/badge/Cursor-Install-blue)](cursor://anysphere.cursor-deeplink/mcp/install?name=remem-mcp&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsInRkYWktbWVtb3J5LW1jcCJdfQ==)
64
+
65
+ Or add to `~/.cursor/mcp.json`:
66
+ ```json
67
+ {
68
+ "mcpServers": {
69
+ "remem-mcp": { "command": "npx", "args": ["-y", "remem-mcp"] }
70
+ }
71
+ }
72
+ ```
73
+ </details>
74
+
75
+ <details>
76
+ <summary>Devin CLI</summary>
77
+
78
+ ```bash
79
+ devin mcp add remem-mcp --scope user -- npx -y remem-mcp
80
+ npx remem-mcp install-hooks
81
+ ```
82
+ </details>
83
+
84
+ <details>
85
+ <summary>Codex CLI</summary>
86
+
87
+ Add to `~/.codex/config.toml`:
88
+ ```toml
89
+ [mcp_servers.remem-mcp]
90
+ command = "npx"
91
+ args = ["-y", "remem-mcp"]
92
+
93
+ [mcp_servers.remem-mcp.env]
94
+ TDAI_GLOBAL_SESSION_KEY = "global"
95
+ ```
96
+
97
+ Then run `npx remem-mcp install-hooks`.
98
+ > MCP tools require `sandbox_mode = "danger-full-access"`.
99
+ </details>
100
+
101
+ ---
102
+
103
+ ## How it works
104
+
105
+ 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.
106
+
107
+ **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.
108
+
109
+ Two layers: **automatic** (runs via hooks, zero tool calls) and **on-demand** (you call when you need deeper context).
110
+
111
+ ### Automatic — three learning loops + compaction survival
112
+
113
+ All run via lifecycle hooks. The agent doesn't need to call any tool.
114
+
115
+ 1. **Error learning** — command fails → capture → inject fix before next attempt → succeed → upvote.
116
+
117
+ 2. **Decision learning** — `npm install`, `git commit`, config → auto-capture → inject past decisions before similar commands.
118
+
119
+ 3. **Pattern learning** — Write/Edit → auto-capture code patterns → inject same-language patterns before editing.
120
+
121
+ 4. **Compaction survival** — PreCompact hook fires before context compaction → saves checkpoint → agent recalls after compact. Memory survives.
122
+
123
+ ### On-demand — CodeGraph, Wiki, Search
124
+
125
+ When the automatic loops aren't enough, use these for deeper code navigation.
126
+
127
+ ```bash
128
+ # 1. Index your codebase (one-time, rerun after major changes)
129
+ npx remem-mcp index --path src --repo .
130
+
131
+ # 2. Search symbols (auto-scoped to current directory)
132
+ npx remem-mcp search-code --query "parseTar"
133
+ # → parseTar at src/parse.ts:22
134
+
135
+ # 3. List symbols in a file
136
+ npx remem-mcp list-code src/reporters/fancy.ts
137
+ # → Class L49-135 FancyReporter
138
+ # → Method L86-134 formatLogObj
139
+
140
+ # 4. Trace callers / callees / impact (use symbol ID from step 2)
141
+ npx remem-mcp callers 01KZXPPHF93TS4HV8FWCSSK36A
142
+ npx remem-mcp impact 01KZXPPHF93TS4HV8FWCSSK36A
143
+
144
+ # Wiki + viewer
145
+ npx remem-mcp wiki ingest --path docs # Index markdown docs + ADRs
146
+ npx remem-mcp wiki outdated # Find outdated wiki pages
147
+ npx remem-mcp viewer # Web UI at localhost:7331
148
+ ```
149
+
150
+ - **CodeGraph** — symbol search, callers/callees, impact analysis. Auto-scoped to your project — no cross-project contamination.
151
+ - **Wiki** — markdown docs, ADRs, outdated detection.
152
+ - **Search** — hybrid BM25 + sqlite-vec vector search with RRF fusion. `explain_recall` shows scores.
153
+
154
+ ![CodeGraph demo](https://raw.githubusercontent.com/tinhien11/remem-mcp/main/docs/screenshots/demo-codegraph.gif)
155
+
156
+ ---
157
+
158
+ ## Daily commands
159
+
160
+ ```bash
161
+ npx remem-mcp status # Everything at a glance
162
+ npx remem-mcp viewer # Web UI at localhost:7331
163
+ npx remem-mcp errors # Error dashboard
164
+ npx remem-mcp decisions # Decision dashboard
165
+ npx remem-mcp patterns # Pattern dashboard
166
+ npx remem-mcp recent [N] # Recent captures
167
+ npx remem-mcp help all # Full list of 40+ subcommands
168
+ ```
169
+
170
+ ---
171
+
172
+ ## Configuration
173
+
174
+ All settings have defaults. Config file is optional: `~/.config/remem-mcp/config.json`.
175
+
176
+ | Setting | Env var | Default |
177
+ |---|---|---|
178
+ | DB path | `TDAI_DB_PATH` | `~/.local/share/remem-mcp/memory.db` |
179
+ | Cross-project memory | `TDAI_GLOBAL_SESSION_KEY` | _(unset)_ |
180
+ | Cross-project errors | `TDAI_GLOBAL_ERRORS` | _(unset, set to `1`)_ |
181
+ | Suppress hook feedback | `TDAI_QUIET` | _(unset, set to `1`)_ |
182
+ | Retro window (days) | `TDAI_RETRO_DAYS` | `7` |
183
+ | Core-only mode (disable advanced tools) | `TDAI_CORE_ONLY` | _(unset, set to `1`)_ |
184
+ | LLM API key (pipeline) | `TDAI_LLM_API_KEY` | _(unset)_ |
185
+
186
+ **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).
187
+
188
+ ---
189
+
190
+ ## TypeScript SDK
191
+
192
+ ```ts
193
+ import { Memory } from "remem-mcp";
194
+
195
+ const memory = new Memory();
196
+ await memory.capture("We chose SQLite for storage.", "decision", ["arch"]);
197
+ const results = await memory.recall("storage decision");
198
+ ```
199
+
200
+ ---
201
+
202
+ ## Benchmark
203
+
204
+ remem-mcp is evaluated against the same benchmarks as TencentDB Agent Memory, plus the Agent Memory Benchmark (AMB) suite.
205
+
206
+ | Benchmark | remem-mcp | TencentDB Agent Memory | Without memory |
207
+ |---|---|---|---|
208
+ | **AMB Layer 1** (basic recall) | **100** | — | — |
209
+ | **AMB Layer 2** (multi-session) | **100** | — | — |
210
+ | **AMB Layer 3** (scale + distractors) | **100** | — | — |
211
+ | **LoCoMo** (long conversation QA) | **85** | — | — |
212
+ | **PersonaMem** (personalization) | **80** | 76 | 48 |
213
+ | **LongMemEval** (long-term memory, ICLR 2025) | **92** | — | — |
214
+
215
+ - **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 **80%** using a search-recall proxy (no LLM API key needed).
216
+ - **LoCoMo** — long conversation multi-hop QA (19 sessions, 400+ turns). remem-mcp scores **85%** with keyword-heuristic scoring.
217
+ - **AMB** — Agent Memory Benchmark (L1: 56 recall tests, L2: 5 multi-session scenarios, L3: 1K+ memories with distractors). remem-mcp scores **100/100/100**.
218
+ - **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). remem-mcp scores **92%** on the oracle variant.
219
+
220
+ Run the benchmarks:
221
+
222
+ ```bash
223
+ bash scripts/bench-all.sh # Full: AMB + LoCoMo + PersonaMem (~5 min)
224
+ bash scripts/bench-all.sh --quick # AMB only (~2 min)
225
+ ```
226
+
227
+ ---
228
+
229
+ ## Credits
230
+
231
+ 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.
232
+
233
+ ## License
234
+
235
+ MIT. See [LICENSE](./LICENSE).