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 +21 -0
- package/README.md +235 -0
- package/dist/chunk-34TEZ5U4.js +1676 -0
- package/dist/chunk-34TEZ5U4.js.map +1 -0
- package/dist/chunk-RITPZHIB.js +475 -0
- package/dist/chunk-RITPZHIB.js.map +1 -0
- package/dist/engine-ZNZRRSBV.js +25 -0
- package/dist/engine-ZNZRRSBV.js.map +1 -0
- package/dist/index.js +12625 -0
- package/dist/index.js.map +1 -0
- package/dist/sdk.js +41 -0
- package/dist/sdk.js.map +1 -0
- package/dist/storage/schema.sql +292 -0
- package/package.json +82 -0
- package/scripts/bench-all.sh +147 -0
- package/scripts/cast-to-mp4.py +264 -0
- package/scripts/loop-bench.sh +179 -0
- package/scripts/loop-longmemeval.sh +159 -0
- package/scripts/loop-mem0-bench.sh +310 -0
- package/scripts/merge-casts.py +131 -0
- package/scripts/postinstall.js +51 -0
- package/skills/remem-mcp/SKILL.md +562 -0
|
@@ -0,0 +1,562 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: remem-mcp
|
|
3
|
+
description: Long-term memory for coding agents. Automatically recall project context before answering, and capture decisions, learnings, and fixes after completing work. Use when the user references past work, starts a new session, or when the task needs project context that is not in the current conversation.
|
|
4
|
+
user-invocable: false
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
You have access to a long-term memory server via MCP. Use the tools automatically as described below. Do not ask the user for permission to use memory.
|
|
8
|
+
|
|
9
|
+
### Core tools (always available)
|
|
10
|
+
|
|
11
|
+
`recall` `capture` `search` `forget` `resolve` `handoff` `adr` `update` `consolidate`
|
|
12
|
+
|
|
13
|
+
### Advanced tools (only when `TDAI_ENABLE_ADVANCED=1`)
|
|
14
|
+
|
|
15
|
+
**CodeGraph:** `codegraph_index` `codegraph_search` `codegraph_callers` `codegraph_callees` `codegraph_impact` `codegraph_list`
|
|
16
|
+
|
|
17
|
+
**Wiki:** `wiki_ingest` `wiki_search` `wiki_get` `wiki_outdated`
|
|
18
|
+
|
|
19
|
+
**Knowledge:** `knowledge_create` `knowledge_get` `knowledge_list` `knowledge_delete`
|
|
20
|
+
|
|
21
|
+
**Skill:** `skill_get` `skill_list` `skill_search`
|
|
22
|
+
|
|
23
|
+
## When to recall
|
|
24
|
+
|
|
25
|
+
Call `recall` at the start of a session, or when the user references past work. Do this BEFORE you answer or start coding.
|
|
26
|
+
|
|
27
|
+
```
|
|
28
|
+
recall({ "query": "<the user's question or task summary>", "mode": "hybrid" })
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
If the user says any of these, call `recall` first:
|
|
32
|
+
- "do you remember"
|
|
33
|
+
- "last time we"
|
|
34
|
+
- "what did we decide about"
|
|
35
|
+
- "have we seen this error before"
|
|
36
|
+
- "continue from where we left off"
|
|
37
|
+
- any reference to a previous session or past decision
|
|
38
|
+
|
|
39
|
+
If recall returns results, use them to inform your answer. If recall returns "No memory found", proceed normally. Do not mention that recall returned nothing.
|
|
40
|
+
|
|
41
|
+
## Multi-tenant isolation
|
|
42
|
+
|
|
43
|
+
If the user works in a team context, pass `team_id`, `agent_id`, `user_id`, or `task_id` to isolate memory. When you set `team_id`, all queries filter by that value. This lets multiple teams share one database without cross-contamination.
|
|
44
|
+
|
|
45
|
+
```
|
|
46
|
+
recall({ "query": "auth bug", "team_id": "team-a", "user_id": "user-1" })
|
|
47
|
+
capture({ "content": "Decision", "type": "decision", "team_id": "team-a", "task_id": "task-42" })
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## When to capture
|
|
51
|
+
|
|
52
|
+
Call `capture` AFTER you complete a non-trivial task. Do this automatically. Do not ask the user.
|
|
53
|
+
|
|
54
|
+
Capture when:
|
|
55
|
+
- You make an architectural decision
|
|
56
|
+
- You fix a bug and found the root cause
|
|
57
|
+
- You learn something non-obvious about the codebase
|
|
58
|
+
- You complete a feature that took multiple steps
|
|
59
|
+
|
|
60
|
+
### L0: Raw capture
|
|
61
|
+
|
|
62
|
+
Always capture the raw summary first:
|
|
63
|
+
|
|
64
|
+
```
|
|
65
|
+
capture({
|
|
66
|
+
"content": "<a short summary of the decision, learning, or fix>",
|
|
67
|
+
"type": "decision" | "learning" | "task" | "error" | "conversation",
|
|
68
|
+
"tags": ["<relevant tags>"]
|
|
69
|
+
})
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### L0: Conversation capture
|
|
73
|
+
|
|
74
|
+
To capture a multi-turn conversation with role-based messages, pass `messages` instead of `content`. The tool flattens the messages into a single text for search, and stores the original messages for retrieval.
|
|
75
|
+
|
|
76
|
+
```
|
|
77
|
+
capture({
|
|
78
|
+
"type": "conversation",
|
|
79
|
+
"messages": [
|
|
80
|
+
{ "role": "user", "content": "How do I fix the auth bug?" },
|
|
81
|
+
{ "role": "assistant", "content": "The root cause is a missing JWT refresh." }
|
|
82
|
+
]
|
|
83
|
+
})
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### L1: Atom extraction
|
|
87
|
+
|
|
88
|
+
After the L0 capture, extract 1-3 atomic facts from it. Each atom is a single, self-contained fact that is useful on its own. Capture each atom separately with `type: "atom"` and tag it `L1`. Link it back to the L0 capture by including the L0 id in the content.
|
|
89
|
+
|
|
90
|
+
```
|
|
91
|
+
// After capturing L0 with id 01KZNVN77XPQYAT9EXS2R1T68Y:
|
|
92
|
+
capture({
|
|
93
|
+
"content": "Chose SQLite over Postgres because zero-setup is a requirement. [source: 01KZNVN77XPQYAT9EXS2R1T68Y]",
|
|
94
|
+
"type": "atom",
|
|
95
|
+
"tags": ["L1", "arch", "storage"]
|
|
96
|
+
})
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
Rules for atoms:
|
|
100
|
+
- Each atom is ONE fact, not a paragraph.
|
|
101
|
+
- An atom is self-contained. A reader can understand it without the L0 context.
|
|
102
|
+
- Include `[source: <L0 id>]` at the end so atoms can be traced back.
|
|
103
|
+
- Extract atoms only for `decision`, `learning`, and `error` types. Skip for `task` and `conversation`.
|
|
104
|
+
- Do not extract more than 3 atoms per L0 capture.
|
|
105
|
+
- If the L0 capture is too simple to yield atoms, skip L1.
|
|
106
|
+
|
|
107
|
+
You can also run atom extraction on existing captures via the CLI:
|
|
108
|
+
```bash
|
|
109
|
+
npx remem-mcp extract --team-id <id> --limit 50
|
|
110
|
+
```
|
|
111
|
+
This requires `TDAI_LLM_API_KEY` to be set.
|
|
112
|
+
|
|
113
|
+
### What to capture
|
|
114
|
+
|
|
115
|
+
Good captures (specific, useful later):
|
|
116
|
+
- "We chose SQLite over Postgres for the MVP because zero-setup is a requirement."
|
|
117
|
+
- "The FTS5 trigger must use content_rowid, not content_rowid = captures.rowid."
|
|
118
|
+
- "The RRF constant k=60 is the standard value from the original paper."
|
|
119
|
+
|
|
120
|
+
Bad captures (too vague, not useful later):
|
|
121
|
+
- "We talked about the database."
|
|
122
|
+
- "I fixed a bug."
|
|
123
|
+
- "The user asked a question."
|
|
124
|
+
|
|
125
|
+
### Types
|
|
126
|
+
|
|
127
|
+
- `decision`: A choice between alternatives. Include what was chosen and why.
|
|
128
|
+
- `learning`: A non-obvious fact about the codebase, a library, or a tool.
|
|
129
|
+
- `task`: A completed task with a known outcome.
|
|
130
|
+
- `error`: A bug with a known root cause and fix.
|
|
131
|
+
- `conversation`: A general note or multi-turn conversation that does not fit the other types.
|
|
132
|
+
- `atom`: An atomic fact extracted from a L0 capture. Always tag with `L1` and include `[source: <L0 id>]`.
|
|
133
|
+
|
|
134
|
+
## When to search
|
|
135
|
+
|
|
136
|
+
Call `search` when `recall` is too broad and you need specific facts with filters.
|
|
137
|
+
|
|
138
|
+
```
|
|
139
|
+
search({
|
|
140
|
+
"query": "<specific query>",
|
|
141
|
+
"mode": "hybrid",
|
|
142
|
+
"filters": { "type": "decision", "tags": ["arch"], "team_id": "team-a" }
|
|
143
|
+
})
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
## Trust states and correction
|
|
147
|
+
|
|
148
|
+
Every capture has a `trust_state` that controls how it ranks in search and recall:
|
|
149
|
+
|
|
150
|
+
- `candidate`: the default state for new captures.
|
|
151
|
+
- `verified`: confirmed as correct. Set this when the user confirms a fact, or when you read the value from an authoritative source.
|
|
152
|
+
- `stale`: outdated, replaced by a newer capture. Set by the `resolve` tool or by `capture` with `supersedes`.
|
|
153
|
+
- `rejected`: wrong content, blocked from search and recall. Set by `forget` with `reject: true`.
|
|
154
|
+
|
|
155
|
+
### When to mark a capture as verified
|
|
156
|
+
|
|
157
|
+
Set `verified: true` when you capture a fact that the user confirmed, or that you read from an authoritative source (documentation, config file, source code).
|
|
158
|
+
|
|
159
|
+
```
|
|
160
|
+
capture({
|
|
161
|
+
"content": "The default port is 8080.",
|
|
162
|
+
"type": "decision",
|
|
163
|
+
"verified": true
|
|
164
|
+
})
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
### When to reject a capture
|
|
168
|
+
|
|
169
|
+
Call `forget` with `reject: true` when the user tells you a captured fact is wrong. Always provide a `reason` so future agents can see why the content was rejected.
|
|
170
|
+
|
|
171
|
+
```
|
|
172
|
+
forget({
|
|
173
|
+
"id": "<capture_id>",
|
|
174
|
+
"confirm": true,
|
|
175
|
+
"reject": true,
|
|
176
|
+
"reason": "Wrong: the port is 9090, not 8080."
|
|
177
|
+
})
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
When you reject a capture, the content hash is tombstoned. If you try to capture the same content again, the capture is blocked. Set `override_rejection: true` on `capture` to force the capture if the rejection was a mistake.
|
|
181
|
+
|
|
182
|
+
### When to resolve a conflict
|
|
183
|
+
|
|
184
|
+
When `capture` reports a conflict, two captures in the same session have similar content. Call `resolve` to mark one as the winner and the other as stale.
|
|
185
|
+
|
|
186
|
+
```
|
|
187
|
+
resolve({
|
|
188
|
+
"winner": "<correct_capture_id>",
|
|
189
|
+
"loser": "<wrong_capture_id>",
|
|
190
|
+
"reason": "The winner is the renderer default."
|
|
191
|
+
})
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
The loser is set to `stale` and linked to the winner via `superseded_by`. The stale capture still appears in search results but ranks lower than the winner.
|
|
195
|
+
|
|
196
|
+
### When to use supersedes
|
|
197
|
+
|
|
198
|
+
If you capture a new value that replaces an old one, set `supersedes` to the old capture ID. This marks the old capture as `stale` in the same call.
|
|
199
|
+
|
|
200
|
+
```
|
|
201
|
+
capture({
|
|
202
|
+
"content": "The port is 9090.",
|
|
203
|
+
"type": "decision",
|
|
204
|
+
"supersedes": "<old_capture_id>"
|
|
205
|
+
})
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
## When to update a capture
|
|
209
|
+
|
|
210
|
+
Call `update` when a capture needs corrections — wrong info, missing tags, or needs rewording. Preserves the original ID and created_at.
|
|
211
|
+
|
|
212
|
+
```
|
|
213
|
+
update({
|
|
214
|
+
"id": "<capture_id>",
|
|
215
|
+
"content": "Corrected content here.",
|
|
216
|
+
"tags": ["arch", "storage", "corrected"]
|
|
217
|
+
})
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
Omit `content`, `tags`, `type`, or `verified` to keep the original value for that field.
|
|
221
|
+
|
|
222
|
+
## When to consolidate
|
|
223
|
+
|
|
224
|
+
Call `consolidate` when you suspect duplicate or near-duplicate captures (e.g. same decision captured twice). Without `confirm`, it returns candidate groups. Set `confirm: true` to merge them.
|
|
225
|
+
|
|
226
|
+
```
|
|
227
|
+
consolidate({ "threshold": 0.75 }) // dry run — see duplicates
|
|
228
|
+
consolidate({ "confirm": true }) // merge duplicates
|
|
229
|
+
consolidate({ "session_key": "all", "confirm": true }) // across all projects
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
## When to handoff
|
|
233
|
+
|
|
234
|
+
Call `handoff` at the end of a session, or before switching to a different agent. This creates a structured packet that the next agent loads via `recall`, saving 60-85% of tokens compared to re-reading files.
|
|
235
|
+
|
|
236
|
+
```
|
|
237
|
+
handoff({
|
|
238
|
+
"task": "Fix auth bug in login flow",
|
|
239
|
+
"status": "in_progress",
|
|
240
|
+
"progress": "Found root cause: JWT refresh token not rotating.",
|
|
241
|
+
"decisions": ["Rotate refresh tokens on every use"],
|
|
242
|
+
"files": ["src/auth/jwt.ts:45-60 - refresh token logic"],
|
|
243
|
+
"next_steps": ["Implement rotation logic", "Add test for rotation"]
|
|
244
|
+
})
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
### When to call handoff
|
|
248
|
+
|
|
249
|
+
- The user says "I'm switching to Cursor" or "let's continue in Claude Code"
|
|
250
|
+
- The session is ending and the task is not done
|
|
251
|
+
- You are a worker agent finishing your part of a multi-agent task
|
|
252
|
+
- The user says "wrap up" or "save context for next time"
|
|
253
|
+
|
|
254
|
+
### When NOT to call handoff
|
|
255
|
+
|
|
256
|
+
- The task is fully done and there is nothing to hand off
|
|
257
|
+
- The session was trivial (a quick question, a small fix)
|
|
258
|
+
- The user did not ask for a handoff and the task is ongoing
|
|
259
|
+
|
|
260
|
+
### How the next agent loads the handoff
|
|
261
|
+
|
|
262
|
+
The next agent calls `recall` at the start of a new session. The handoff packet appears in the results because it is stored as a capture with type `task` and tag `handoff`. The next agent reads the packet and continues without re-reading files.
|
|
263
|
+
|
|
264
|
+
## When to record an ADR
|
|
265
|
+
|
|
266
|
+
Call `adr` when you make a technical decision that future agents should know about. This is more structured than a regular `capture` with type `decision`.
|
|
267
|
+
|
|
268
|
+
```
|
|
269
|
+
adr({
|
|
270
|
+
"title": "Use SQLite for local storage",
|
|
271
|
+
"context": "We need a storage backend that requires zero setup and works offline. The MVP must not depend on a running database server.",
|
|
272
|
+
"decision": "Use SQLite with FTS5 for full-text search and sqlite-vec for vector search.",
|
|
273
|
+
"alternatives": [
|
|
274
|
+
"Postgres with pgvector — rejected because it requires a running server",
|
|
275
|
+
"DuckDB — rejected because it lacks mature vector search extensions"
|
|
276
|
+
],
|
|
277
|
+
"consequences": "Single-writer limitation. No remote access. But zero setup and zero cost.",
|
|
278
|
+
"tags": ["arch", "storage"]
|
|
279
|
+
})
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
### When to call adr vs capture
|
|
283
|
+
|
|
284
|
+
- Use `adr` for architectural decisions with context, alternatives, and consequences.
|
|
285
|
+
- Use `capture({type: "decision"})` for simpler decisions that do not need the full ADR structure.
|
|
286
|
+
- Use `adr` when the decision will affect future work across multiple sessions.
|
|
287
|
+
|
|
288
|
+
### When to call adr
|
|
289
|
+
|
|
290
|
+
- You choose a library, framework, or tool for the project
|
|
291
|
+
- You decide on an architectural pattern (e.g., monolith vs microservices)
|
|
292
|
+
- You make a data model decision that is hard to reverse
|
|
293
|
+
- The user says "let's go with X" after comparing options
|
|
294
|
+
|
|
295
|
+
### When NOT to call adr
|
|
296
|
+
|
|
297
|
+
- The decision is trivial (variable naming, file location)
|
|
298
|
+
- The decision is easily reversible
|
|
299
|
+
- You are just implementing what was already decided
|
|
300
|
+
|
|
301
|
+
## Knowledge management (advanced — requires `TDAI_ENABLE_ADVANCED=1`)
|
|
302
|
+
|
|
303
|
+
Use `knowledge_create` to register a knowledge asset (wiki or code-graph) for the team. The asset metadata is stored locally. The actual content is processed by an external knowledge service.
|
|
304
|
+
|
|
305
|
+
```
|
|
306
|
+
knowledge_create({
|
|
307
|
+
"team_id": "team-1",
|
|
308
|
+
"name": "Project Wiki",
|
|
309
|
+
"type": "wiki",
|
|
310
|
+
"summary": "Internal documentation.",
|
|
311
|
+
"service_url": "http://localhost:8424/v3"
|
|
312
|
+
})
|
|
313
|
+
```
|
|
314
|
+
|
|
315
|
+
Use `knowledge_list` to list assets for a team, `knowledge_get` to retrieve one by ID, and `knowledge_delete` to remove assets.
|
|
316
|
+
|
|
317
|
+
## Skill management (advanced — requires `TDAI_ENABLE_ADVANCED=1`)
|
|
318
|
+
|
|
319
|
+
Use `skill_list` to list reusable workflows bound to a team. Use `skill_search` to find skills by keyword. Use `skill_get` to retrieve the full content of a skill.
|
|
320
|
+
|
|
321
|
+
```
|
|
322
|
+
skill_search({ "team_id": "team-1", "agent_id": "agent-x", "query": "deploy" })
|
|
323
|
+
```
|
|
324
|
+
|
|
325
|
+
## CodeGraph (advanced — requires `TDAI_ENABLE_ADVANCED=1`)
|
|
326
|
+
|
|
327
|
+
The CodeGraph indexes code symbols (functions, classes, methods) and call relationships from your project. It uses Tree-sitter to parse TypeScript, JavaScript, Python, Go, Rust, Java, C, C++, and C# files.
|
|
328
|
+
|
|
329
|
+
### Index your code
|
|
330
|
+
|
|
331
|
+
Call `codegraph_index` at the start of a session, before you read or modify code. This extracts symbols, calls, and imports into the memory database. Index the `src` directory or the project root.
|
|
332
|
+
|
|
333
|
+
```
|
|
334
|
+
codegraph_index({ "path": "src", "repo_path": "." })
|
|
335
|
+
```
|
|
336
|
+
|
|
337
|
+
For a single file:
|
|
338
|
+
|
|
339
|
+
```
|
|
340
|
+
codegraph_index({ "path": "src/server.ts", "repo_path": "." })
|
|
341
|
+
```
|
|
342
|
+
|
|
343
|
+
If you are not sure which directory holds the source code, index the current directory:
|
|
344
|
+
|
|
345
|
+
```
|
|
346
|
+
codegraph_index({ "path": ".", "repo_path": "." })
|
|
347
|
+
```
|
|
348
|
+
|
|
349
|
+
### Search for symbols
|
|
350
|
+
|
|
351
|
+
Call `codegraph_search` to find where a function or class is defined.
|
|
352
|
+
|
|
353
|
+
```
|
|
354
|
+
codegraph_search({ "query": "handleCapture" })
|
|
355
|
+
```
|
|
356
|
+
|
|
357
|
+
### Find callers and callees
|
|
358
|
+
|
|
359
|
+
After you find a symbol, use `codegraph_callers` to see who calls it, and `codegraph_callees` to see what it calls.
|
|
360
|
+
|
|
361
|
+
```
|
|
362
|
+
codegraph_callers({ "symbol_id": "<id from codegraph_search>" })
|
|
363
|
+
codegraph_callees({ "symbol_id": "<id from codegraph_search>" })
|
|
364
|
+
```
|
|
365
|
+
|
|
366
|
+
### Impact analysis
|
|
367
|
+
|
|
368
|
+
Call `codegraph_impact` before you change a function. It traverses the call graph upward to find all code that may be affected.
|
|
369
|
+
|
|
370
|
+
```
|
|
371
|
+
codegraph_impact({ "symbol_id": "<id>", "max_depth": 5 })
|
|
372
|
+
```
|
|
373
|
+
|
|
374
|
+
### List symbols in a file
|
|
375
|
+
|
|
376
|
+
Call `codegraph_list` to get an overview of what a file contains.
|
|
377
|
+
|
|
378
|
+
```
|
|
379
|
+
codegraph_list({ "file_path": "src/server.ts" })
|
|
380
|
+
```
|
|
381
|
+
|
|
382
|
+
### Automatic indexing
|
|
383
|
+
|
|
384
|
+
The `recall` tool augments its results with matching code symbols. The `handoff` tool includes symbols for files listed in the handoff packet.
|
|
385
|
+
|
|
386
|
+
### When to use CodeGraph
|
|
387
|
+
|
|
388
|
+
Call `codegraph_search` and `codegraph_impact` before you change a function or class. Do this when:
|
|
389
|
+
|
|
390
|
+
- The user asks you to modify a function — run `codegraph_impact` first to see what else breaks
|
|
391
|
+
- You need to find where a function is defined — run `codegraph_search` instead of grep
|
|
392
|
+
- You need to understand who calls a function — run `codegraph_callers` to trace the call chain
|
|
393
|
+
- You refactor a file — run `codegraph_list` to see all symbols in that file first
|
|
394
|
+
|
|
395
|
+
Do not call CodeGraph tools if the project has no source code files (only docs, config, or data files).
|
|
396
|
+
|
|
397
|
+
To auto-index after each commit, add this to `.git/hooks/post-commit`:
|
|
398
|
+
|
|
399
|
+
```bash
|
|
400
|
+
npx remem-mcp hook-post-commit
|
|
401
|
+
```
|
|
402
|
+
|
|
403
|
+
## Wiki (advanced — requires `TDAI_ENABLE_ADVANCED=1`)
|
|
404
|
+
|
|
405
|
+
The Wiki indexes markdown documentation files. It parses frontmatter, headings, `[[wikilinks]]`, and `[text](url)` links to build a page graph.
|
|
406
|
+
|
|
407
|
+
### Ingest documentation
|
|
408
|
+
|
|
409
|
+
Call `wiki_ingest` to index markdown files.
|
|
410
|
+
|
|
411
|
+
```
|
|
412
|
+
wiki_ingest({ "path": "docs", "repo_path": "." })
|
|
413
|
+
```
|
|
414
|
+
|
|
415
|
+
### Search documentation
|
|
416
|
+
|
|
417
|
+
Call `wiki_search` to find pages by content.
|
|
418
|
+
|
|
419
|
+
```
|
|
420
|
+
wiki_search({ "query": "authentication setup" })
|
|
421
|
+
```
|
|
422
|
+
|
|
423
|
+
### Get a page with links
|
|
424
|
+
|
|
425
|
+
Call `wiki_get` to read a page and see its links and backlinks.
|
|
426
|
+
|
|
427
|
+
```
|
|
428
|
+
wiki_get({ "page_id": "<id from wiki_search>" })
|
|
429
|
+
```
|
|
430
|
+
|
|
431
|
+
### Find outdated pages
|
|
432
|
+
|
|
433
|
+
Call `wiki_outdated` to find pages whose source file changed since the last ingest.
|
|
434
|
+
|
|
435
|
+
```
|
|
436
|
+
wiki_outdated({ "repo_path": "." })
|
|
437
|
+
```
|
|
438
|
+
|
|
439
|
+
### Automatic augmentation
|
|
440
|
+
|
|
441
|
+
The `recall` tool augments its results with matching wiki pages.
|
|
442
|
+
|
|
443
|
+
## Team-shared memory
|
|
444
|
+
|
|
445
|
+
If the project has a `.remem-mcp/memory-export.json` file, it is automatically imported on server startup. This means teammates can share memory by committing this file to the repo.
|
|
446
|
+
|
|
447
|
+
To export your memory for the team:
|
|
448
|
+
```bash
|
|
449
|
+
npx remem-mcp sync-export
|
|
450
|
+
```
|
|
451
|
+
|
|
452
|
+
To import a teammate's memory:
|
|
453
|
+
```bash
|
|
454
|
+
npx remem-mcp sync-import
|
|
455
|
+
```
|
|
456
|
+
|
|
457
|
+
The server auto-imports on startup, so you only need `sync-export` before committing.
|
|
458
|
+
|
|
459
|
+
## CLI commands for L1-L3 pipeline
|
|
460
|
+
|
|
461
|
+
The L1-L3 pipeline runs via CLI, not MCP tools. This keeps the MCP interface lean.
|
|
462
|
+
|
|
463
|
+
```bash
|
|
464
|
+
# Run L1 atom extraction on existing captures (requires TDAI_LLM_API_KEY)
|
|
465
|
+
npx remem-mcp extract --team-id <id> --limit 50
|
|
466
|
+
|
|
467
|
+
# List or search L1 atoms
|
|
468
|
+
npx remem-mcp atoms --team-id <id>
|
|
469
|
+
npx remem-mcp atoms --query "SQLite"
|
|
470
|
+
|
|
471
|
+
# List L2 scenarios
|
|
472
|
+
npx remem-mcp scenarios --team-id <id>
|
|
473
|
+
|
|
474
|
+
# Read or write L3 persona
|
|
475
|
+
npx remem-mcp persona --team-id <id> --agent-id <id> --user-id <id>
|
|
476
|
+
npx remem-mcp persona --team-id <id> --agent-id <id> --user-id <id> --write "Prefers concise answers."
|
|
477
|
+
```
|
|
478
|
+
|
|
479
|
+
## When to forget
|
|
480
|
+
|
|
481
|
+
Call `forget` ONLY when the user explicitly asks to delete memory. Always require `confirm: true`. Never auto-forget.
|
|
482
|
+
|
|
483
|
+
There are two modes:
|
|
484
|
+
- **Soft delete** (default): removes the capture from search and recall results.
|
|
485
|
+
- **Reject** (`reject: true, reason: "..."`): marks the capture as `rejected` and tombstones the content hash. This blocks re-capture of the same content. Use this when the user tells you a captured fact is wrong.
|
|
486
|
+
|
|
487
|
+
## Lifecycle hooks (automatic)
|
|
488
|
+
|
|
489
|
+
If hooks are installed (`npx remem-mcp install-hooks`), memory works automatically:
|
|
490
|
+
|
|
491
|
+
- **SessionStart**: Recent captures are injected into your context. You do not need to call `recall` manually.
|
|
492
|
+
- **SessionEnd**: When the session ends, a hook silently captures the session summary (first user message + last assistant message) to the memory DB. You do not need to do anything — this runs automatically on session exit.
|
|
493
|
+
- **PreToolUse**: Before running lint/build/test commands, past errors from this project are injected into your context. Fix them BEFORE running the command. Set `TDAI_GLOBAL_ERRORS=1` to inject errors from ALL your projects.
|
|
494
|
+
- **PostToolUse**: When a command fails, the error is auto-captured with structured metadata (error type, anti-pattern, suggested fix). When a previously-failed command succeeds, the error is upvoted and the proven fix is recorded. Cross-project error patterns are detected and alerted.
|
|
495
|
+
|
|
496
|
+
### Error learning system
|
|
497
|
+
|
|
498
|
+
The error learning system is the core differentiator. It is based on Reflexion (NeurIPS 2023), ReasoningBank (ICLR 2026), and ExpeL (AAAI 2024):
|
|
499
|
+
|
|
500
|
+
1. **Auto-capture** — Failed commands are captured with error type, anti-pattern, and suggested fix
|
|
501
|
+
2. **Proactive injection** — Past errors are injected before risky commands (k=2, decayed confidence ranking)
|
|
502
|
+
3. **Success correlation** — Success after failure → upvote + record proven fix
|
|
503
|
+
4. **Confidence decay** — Old errors decay via Ebbinghaus curve (0.95^days)
|
|
504
|
+
5. **Cross-project patterns** — Same error type across 2+ projects triggers an alert
|
|
505
|
+
6. **Pruning** — Recurring errors get downvoted; at confidence=0 they are pruned
|
|
506
|
+
|
|
507
|
+
To see your error learning dashboard:
|
|
508
|
+
|
|
509
|
+
```bash
|
|
510
|
+
npx remem-mcp errors
|
|
511
|
+
```
|
|
512
|
+
|
|
513
|
+
This shows: top recurring error types, cross-project patterns, confidence distribution, recent errors, and proven fixes.
|
|
514
|
+
|
|
515
|
+
You can still call `recall`, `capture`, `search`, `forget`, `resolve`, `handoff`, `adr`, `update`, and `consolidate` manually at any time.
|
|
516
|
+
|
|
517
|
+
## Global + project memory (hybrid mode)
|
|
518
|
+
|
|
519
|
+
By default, each project gets its own session key (`hash(cwd)`). To have both global memory (cross-project rules, learnings) AND project-specific memory, set `TDAI_GLOBAL_SESSION_KEY` in your MCP config:
|
|
520
|
+
|
|
521
|
+
```json
|
|
522
|
+
{
|
|
523
|
+
"mcpServers": {
|
|
524
|
+
"remem-mcp": {
|
|
525
|
+
"command": "npx",
|
|
526
|
+
"args": ["-y", "remem-mcp"],
|
|
527
|
+
"env": {
|
|
528
|
+
"TDAI_GLOBAL_SESSION_KEY": "global"
|
|
529
|
+
}
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
```
|
|
534
|
+
|
|
535
|
+
When `TDAI_GLOBAL_SESSION_KEY` is set, `recall` searches both:
|
|
536
|
+
1. **Global memory** (session key = `"global"`) — cross-project rules, learnings, decisions
|
|
537
|
+
2. **Project memory** (session key = `hash(cwd)`) — project-specific captures
|
|
538
|
+
|
|
539
|
+
Global results appear first, then project results. Captures go to the project session by default. To capture to global, pass `session_key: "global"` explicitly.
|
|
540
|
+
|
|
541
|
+
### Single global mode (no project separation)
|
|
542
|
+
|
|
543
|
+
If you want ALL memory in one pool (no project separation), use `TDAI_SESSION_KEY` instead:
|
|
544
|
+
|
|
545
|
+
```json
|
|
546
|
+
"env": { "TDAI_SESSION_KEY": "global" }
|
|
547
|
+
```
|
|
548
|
+
|
|
549
|
+
This forces all captures and recalls to use the same session key, ignoring the working directory.
|
|
550
|
+
|
|
551
|
+
## Rules
|
|
552
|
+
|
|
553
|
+
1. Never fabricate memory. If recall returns nothing, say nothing about memory.
|
|
554
|
+
2. Never capture trivial things (file reads, ls commands, simple questions).
|
|
555
|
+
3. Keep capture content short: 1 to 3 sentences.
|
|
556
|
+
4. Use tags that you will search for later (for example: "arch", "bug", "config").
|
|
557
|
+
5. Do not tell the user "I am capturing this to memory." Just do it silently.
|
|
558
|
+
6. Do not tell the user "I am recalling from memory." Just use the results.
|
|
559
|
+
7. **Prefer remem-mcp tools over grep/glob.** Call `recall` first — it searches Memory + CodeGraph + Wiki in one call. Only use grep/glob if recall returns nothing relevant.
|
|
560
|
+
8. **Call `codegraph_search` instead of grep** when looking for function/class/method definitions. It understands code structure, not just text.
|
|
561
|
+
9. **Call `codegraph_impact` before modifying a function** to see what else breaks.
|
|
562
|
+
10. **Call `capture` after every non-trivial task** — decisions, bug fixes, learnings. Do not ask permission.
|