remem-mcp 0.7.3 → 0.7.6
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 +20 -59
- package/dist/{chunk-ITMR6THY.js → chunk-2RKMX6EE.js} +5 -4
- package/dist/chunk-2RKMX6EE.js.map +1 -0
- package/dist/{chunk-4WCDAEPP.js → chunk-L7YZBBIB.js} +306 -32
- package/dist/chunk-L7YZBBIB.js.map +1 -0
- package/dist/{chunk-YU7WBJU5.js → chunk-MPEN2X43.js} +106 -2
- package/dist/{chunk-YU7WBJU5.js.map → chunk-MPEN2X43.js.map} +1 -1
- package/dist/{engine-S47HHGAO.js → engine-LAY25SCA.js} +4 -2
- package/dist/index.js +440 -261
- package/dist/index.js.map +1 -1
- package/dist/sdk.js +3 -3
- package/dist/{server-5PWQTRGZ.js → server-MYSF7R5Y.js} +4 -3
- package/dist/server-MYSF7R5Y.js.map +1 -0
- package/dist/storage/schema.sql +15 -5
- package/package.json +1 -1
- package/skills/remem-mcp/SKILL.md +3 -1
- package/dist/chunk-4WCDAEPP.js.map +0 -1
- package/dist/chunk-ITMR6THY.js.map +0 -1
- package/dist/server-5PWQTRGZ.js.map +0 -1
- /package/dist/{engine-S47HHGAO.js.map → engine-LAY25SCA.js.map} +0 -0
package/README.md
CHANGED
|
@@ -19,13 +19,20 @@ Local-first memory that survives context compaction. Learns from every error, in
|
|
|
19
19
|
npx remem-mcp setup
|
|
20
20
|
```
|
|
21
21
|
|
|
22
|
-
Auto-detects Claude Code, Cursor, Devin, Codex. Registers MCP server + hooks.
|
|
22
|
+
Auto-detects ZCode, Claude Code, Cursor, Devin, Codex. Registers MCP server + hooks.
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
---
|
|
25
25
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
## Quick start
|
|
27
|
+
|
|
28
|
+
1. Restart your agent (quit and reopen)
|
|
29
|
+
2. Ask: "what do you remember?"
|
|
30
|
+
3. If agent recalls past context = memory working
|
|
31
|
+
|
|
32
|
+
In your agent, you can say:
|
|
33
|
+
- "index the code in src" → CodeGraph indexes symbols
|
|
34
|
+
- "find who calls function X" → caller analysis
|
|
35
|
+
- "what do you remember?" → recall past context
|
|
29
36
|
|
|
30
37
|
---
|
|
31
38
|
|
|
@@ -34,8 +41,9 @@ npx remem-mcp status # verify: hooks ✓, DB ✓, CodeGraph ✓
|
|
|
34
41
|
| When | What |
|
|
35
42
|
|---|---|
|
|
36
43
|
| Session start | Past errors, decisions, and persona injected into agent context |
|
|
37
|
-
| Each prompt | Matching memory injected
|
|
38
|
-
|
|
|
44
|
+
| Each prompt | Matching memory injected into agent context |
|
|
45
|
+
| Failed commands | Auto-captured as error memories |
|
|
46
|
+
| Context compaction | Memory re-injected after compaction |
|
|
39
47
|
| Session end | Worker auto-extracts facts, consolidates summaries, updates persona |
|
|
40
48
|
|
|
41
49
|
You don't run any commands. The agent calls `recall()` before answering and `capture()` after work — the skill tells it to.
|
|
@@ -45,12 +53,12 @@ You don't run any commands. The agent calls `recall()` before answering and `cap
|
|
|
45
53
|
## How it works
|
|
46
54
|
|
|
47
55
|
```
|
|
48
|
-
AI Agent (Claude Code / Devin / Cursor / Codex)
|
|
56
|
+
AI Agent (ZCode / Claude Code / Devin / Cursor / Codex)
|
|
49
57
|
│
|
|
50
58
|
├── MCP tools ──▶ recall, capture, codegraph_*, wiki_*, feedback
|
|
51
59
|
│
|
|
52
|
-
└── Hooks ──▶ SessionStart, UserPromptSubmit,
|
|
53
|
-
PostToolUse,
|
|
60
|
+
└── Hooks ──▶ SessionStart, UserPromptSubmit,
|
|
61
|
+
PostToolUse, PostCompaction, SessionEnd
|
|
54
62
|
│
|
|
55
63
|
▼
|
|
56
64
|
SQLite (memory.db)
|
|
@@ -103,55 +111,6 @@ npx remem-mcp impact <id> # blast radius
|
|
|
103
111
|
|
|
104
112
|
---
|
|
105
113
|
|
|
106
|
-
## Per-agent install
|
|
107
|
-
|
|
108
|
-
<details>
|
|
109
|
-
<summary>Claude Code</summary>
|
|
110
|
-
|
|
111
|
-
```bash
|
|
112
|
-
claude mcp add remem-mcp --scope user -- npx -y remem-mcp
|
|
113
|
-
npx remem-mcp install-hooks
|
|
114
|
-
```
|
|
115
|
-
</details>
|
|
116
|
-
|
|
117
|
-
<details>
|
|
118
|
-
<summary>Cursor</summary>
|
|
119
|
-
|
|
120
|
-
[](cursor://anysphere.cursor-deeplink/mcp/install?name=remem-mcp&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsInJlbWVtLW1jcCJdfQ==)
|
|
121
|
-
|
|
122
|
-
Or add to `~/.cursor/mcp.json`:
|
|
123
|
-
```json
|
|
124
|
-
{
|
|
125
|
-
"mcpServers": {
|
|
126
|
-
"remem-mcp": { "command": "npx", "args": ["-y", "remem-mcp"] }
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
```
|
|
130
|
-
</details>
|
|
131
|
-
|
|
132
|
-
<details>
|
|
133
|
-
<summary>Devin CLI</summary>
|
|
134
|
-
|
|
135
|
-
```bash
|
|
136
|
-
devin mcp add remem-mcp --scope user -- npx -y remem-mcp
|
|
137
|
-
npx remem-mcp install-hooks
|
|
138
|
-
```
|
|
139
|
-
</details>
|
|
140
|
-
|
|
141
|
-
<details>
|
|
142
|
-
<summary>Codex CLI</summary>
|
|
143
|
-
|
|
144
|
-
Add to `~/.codex/config.toml`:
|
|
145
|
-
```toml
|
|
146
|
-
[mcp_servers.remem-mcp]
|
|
147
|
-
command = "npx"
|
|
148
|
-
args = ["-y", "remem-mcp"]
|
|
149
|
-
```
|
|
150
|
-
Then run `npx remem-mcp install-hooks`.
|
|
151
|
-
</details>
|
|
152
|
-
|
|
153
|
-
---
|
|
154
|
-
|
|
155
114
|
## Useful commands
|
|
156
115
|
|
|
157
116
|
```bash
|
|
@@ -175,6 +134,8 @@ All settings have defaults. Config file is optional: `~/.config/remem-mcp/config
|
|
|
175
134
|
| Unified flow (F1+F2+F3) | `REMEM_FLOW` | _(unset, set to `full`)_ |
|
|
176
135
|
| Suppress hook feedback | `REMEM_QUIET` | _(unset, set to `1`)_ |
|
|
177
136
|
|
|
137
|
+
**Global memory policy** — set `REMEM_GLOBAL_SESSION_KEY` to *read* cross-project memory automatically. Captures stay project-local unless the user explicitly asks to save globally; then use `session_key: "global"`. Do not auto-classify ordinary captures into global.
|
|
138
|
+
|
|
178
139
|
**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`.
|
|
179
140
|
|
|
180
141
|
**Per-repo capture exclusions** — Drop a `.remem.toml` in any project root:
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
init_engine
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-MPEN2X43.js";
|
|
4
4
|
import {
|
|
5
5
|
LocalEmbedder,
|
|
6
6
|
SQLiteBackend,
|
|
7
7
|
init_local,
|
|
8
8
|
stripQueryProperNouns
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-L7YZBBIB.js";
|
|
10
10
|
import {
|
|
11
11
|
generateId,
|
|
12
12
|
init_ulid
|
|
@@ -473,7 +473,8 @@ var Memory = class {
|
|
|
473
473
|
type,
|
|
474
474
|
content: redactedContent,
|
|
475
475
|
tags,
|
|
476
|
-
createdAt: Date.now()
|
|
476
|
+
createdAt: Date.now(),
|
|
477
|
+
metadata: opts?.metadata
|
|
477
478
|
};
|
|
478
479
|
await this.storage.put(entry);
|
|
479
480
|
try {
|
|
@@ -856,4 +857,4 @@ export {
|
|
|
856
857
|
classifyGlobalContent,
|
|
857
858
|
Memory
|
|
858
859
|
};
|
|
859
|
-
//# sourceMappingURL=chunk-
|
|
860
|
+
//# sourceMappingURL=chunk-2RKMX6EE.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/sdk.ts","../src/security/redactor.ts","../src/wiki/engine.ts"],"sourcesContent":["/**\n * Programmatic API for remem-mcp.\n * Use this to embed memory directly in your application without MCP.\n *\n * @example\n * ```ts\n * import { Memory } from \"remem-mcp\";\n *\n * const memory = new Memory();\n * await memory.capture(\"We chose SQLite for storage.\", \"decision\", [\"arch\"]);\n * const results = await memory.recall(\"storage decision\");\n * ```\n */\n\nimport { createHash } from \"node:crypto\";\nimport { homedir } from \"node:os\";\nimport { join } from \"node:path\";\nimport { LocalEmbedder } from \"./embedding/local.js\";\nimport { redact } from \"./security/redactor.js\";\nimport { SQLiteBackend, stripQueryProperNouns } from \"./storage/sqlite.js\";\nimport type {\n CaptureEntry,\n CaptureType,\n DeleteFilter,\n DeleteResult,\n SearchFilters,\n SearchMode,\n SearchResult,\n} from \"./storage/types.js\";\nimport { generateId } from \"./utils/ulid.js\";\n\n/**\n * Auto-classify content as global (cross-project) or project-specific.\n * Generic rules/conventions/learnings → global; content with file paths,\n * line numbers, project names, or specific identifiers → project.\n */\nexport function classifyGlobalContent(content: string, type: CaptureType): boolean {\n if (type !== \"learning\" && type !== \"decision\" && type !== \"task\") return false;\n\n // Project-specific signals → NOT global\n const projectSignals = [\n /\\b\\/[a-z]/i,\n /\\b\\w+\\/\\w+\\.\\w{1,5}\\b/,\n /line\\s*\\d+/i,\n /\\b\\d{4,}\\b/,\n /\\bcommit\\s+[0-9a-f]{7,}/i,\n /\\bsrc\\//,\n /\\bdist\\//,\n /\\btests?\\//,\n ];\n for (const sig of projectSignals) {\n if (sig.test(content)) return false;\n }\n\n const lower = content.toLowerCase();\n const globalSignals = [\n /\\balways\\s+/i,\n /\\bnever\\s+/i,\n /\\brule\\b/i,\n /\\bconvention\\b/i,\n /\\bpattern\\b/i,\n /\\bprefer\\b/i,\n /\\bavoid\\b/i,\n /\\bshould\\b/i,\n /\\bbest\\s+practice\\b/i,\n ];\n let score = 0;\n for (const sig of globalSignals) {\n if (sig.test(lower)) score++;\n }\n\n if (content.length < 300 && score >= 1) return true;\n if (content.length < 150 && type === \"learning\") return true;\n return false;\n}\n\nexport type {\n CaptureEntry,\n CaptureType,\n DeleteFilter,\n DeleteResult,\n SearchFilters,\n SearchMode,\n SearchResult,\n};\nexport { LocalEmbedder, SQLiteBackend };\n\n/** High-level memory API. */\nexport class Memory {\n private storage: SQLiteBackend;\n private embedder: LocalEmbedder;\n private sessionKey: string;\n private globalKey: string | null;\n private redactSecrets: boolean;\n\n constructor(opts?: {\n dbPath?: string;\n sessionKey?: string;\n globalSessionKey?: string;\n redactSecrets?: boolean;\n }) {\n const dbPath = opts?.dbPath ?? join(homedir(), \".local\", \"share\", \"remem-mcp\", \"memory.db\");\n this.storage = new SQLiteBackend(dbPath);\n this.embedder = new LocalEmbedder();\n this.sessionKey =\n opts?.sessionKey ??\n process.env.REMEM_SESSION_KEY ??\n createHash(\"sha256\").update(process.cwd()).digest(\"hex\").slice(0, 16);\n this.globalKey = opts?.globalSessionKey ?? process.env.REMEM_GLOBAL_SESSION_KEY ?? null;\n this.redactSecrets = opts?.redactSecrets ?? true;\n }\n\n /** Capture a memory entry. Returns the ID, or null if duplicate. */\n async capture(\n content: string,\n type: CaptureType,\n tags: string[] = [],\n opts?: { sessionKey?: string; autoGlobal?: boolean; metadata?: Record<string, unknown> },\n ): Promise<string | null> {\n const { text: redactedContent } = this.redactSecrets ? redact(content) : { text: content };\n let sessionKey = opts?.sessionKey ?? this.sessionKey;\n\n // Auto-classify: route generic rules/learnings to global session\n if (opts?.autoGlobal && !opts?.sessionKey && this.globalKey && this.globalKey !== sessionKey) {\n if (classifyGlobalContent(content, type)) {\n sessionKey = this.globalKey;\n }\n }\n\n // Dedup check\n const contentHash = createHash(\"sha256\").update(redactedContent).digest(\"hex\");\n const existing = await this.storage.findByContentHash(contentHash, sessionKey);\n if (existing.length > 0) return null;\n\n const id = generateId();\n const entry: CaptureEntry = {\n id,\n sessionKey,\n agentId: \"sdk\",\n type,\n content: redactedContent,\n tags,\n createdAt: Date.now(),\n metadata: opts?.metadata,\n };\n\n await this.storage.put(entry);\n\n try {\n // v13: Contextual retrieval — prepend type + tags as preamble before embedding.\n // Content stays pristine for FTS; only the vector sees the enriched text.\n const contextualContent = this.buildContextualPreamble(type, tags) + redactedContent;\n const embedding = await this.embedder.embed(contextualContent);\n await this.storage.putVector(id, embedding);\n } catch {\n // Embedding is optional\n }\n\n return id;\n }\n\n /** Recall relevant memory. Searches project + global (if configured). */\n async recall(\n query: string,\n opts?: { limit?: number; mode?: SearchMode; sessionKey?: string },\n ): Promise<SearchResult[]> {\n const limit = Math.min(opts?.limit ?? 10, 50);\n const mode = opts?.mode ?? \"hybrid\";\n const sessionKey = opts?.sessionKey ?? this.sessionKey;\n\n let queryEmbedding: number[] | null = null;\n if (mode === \"hybrid\" || mode === \"vector\") {\n const stripped = stripQueryProperNouns(query);\n queryEmbedding = await this.embedder.embed(stripped || query);\n }\n\n // Global fallback: search project first, then global for remaining slots\n if (this.globalKey && !opts?.sessionKey && this.globalKey !== sessionKey) {\n const reservedGlobal = Math.min(3, limit);\n const projectLimit = limit - reservedGlobal;\n const projectResults = await this.storage.search(query, queryEmbedding, {\n sessionKey,\n limit: projectLimit,\n offset: 0,\n mode,\n });\n let globalResults: SearchResult[] = [];\n try {\n globalResults = await this.storage.search(query, queryEmbedding, {\n sessionKey: this.globalKey,\n limit: reservedGlobal,\n offset: 0,\n mode,\n });\n } catch {\n // Global search failure is non-fatal\n }\n const seen = new Set(projectResults.map((r) => r.entry.id));\n return [...projectResults, ...globalResults.filter((r) => !seen.has(r.entry.id))].slice(\n 0,\n limit,\n );\n }\n\n return this.storage.search(query, queryEmbedding, {\n sessionKey,\n limit,\n offset: 0,\n mode,\n });\n }\n\n /** Search with filters. Searches project + global (if configured). */\n async search(\n query: string,\n opts?: { mode?: SearchMode; filters?: SearchFilters; limit?: number; sessionKey?: string; explain?: boolean },\n ): Promise<SearchResult[]> {\n const limit = Math.min(opts?.limit ?? 20, 100);\n const mode = opts?.mode ?? \"hybrid\";\n const sessionKey = opts?.sessionKey ?? this.sessionKey;\n const explain = opts?.explain ?? false;\n\n let queryEmbedding: number[] | null = null;\n if (mode === \"hybrid\" || mode === \"vector\") {\n const stripped = stripQueryProperNouns(query);\n queryEmbedding = await this.embedder.embed(stripped || query);\n }\n\n // Global fallback\n if (this.globalKey && !opts?.sessionKey && this.globalKey !== sessionKey) {\n const reservedGlobal = Math.min(3, limit);\n const projectLimit = limit - reservedGlobal;\n const projectResults = await this.storage.search(query, queryEmbedding, {\n sessionKey,\n limit: projectLimit,\n offset: 0,\n mode,\n filters: opts?.filters,\n explain,\n });\n let globalResults: SearchResult[] = [];\n try {\n globalResults = await this.storage.search(query, queryEmbedding, {\n sessionKey: this.globalKey,\n limit: reservedGlobal,\n offset: 0,\n mode,\n filters: opts?.filters,\n explain,\n });\n } catch {\n // Global search failure is non-fatal\n }\n const seen = new Set(projectResults.map((r) => r.entry.id));\n return [...projectResults, ...globalResults.filter((r) => !seen.has(r.entry.id))].slice(\n 0,\n limit,\n );\n }\n\n return this.storage.search(query, queryEmbedding, {\n sessionKey,\n limit,\n offset: 0,\n mode,\n filters: opts?.filters,\n explain,\n });\n }\n\n /** Compute the embedding vector for a piece of text using the configured embedder. */\n async embed(text: string): Promise<number[]> {\n return this.embedder.embed(text);\n }\n\n /**\n * v13: Build a contextual preamble for embedding (Anthropic contextual retrieval technique).\n * Prepends type + tags to give the vector model more context about what the capture is.\n * The raw content stays pristine for FTS5 lexical search.\n */\n private buildContextualPreamble(type: string, tags: string[]): string {\n const parts: string[] = [];\n if (type && type !== \"conversation\") {\n parts.push(`[${type}]`);\n }\n if (tags && tags.length > 0) {\n parts.push(`tags: ${tags.join(\", \")}`);\n }\n return parts.length > 0 ? parts.join(\" \") + \". \" : \"\";\n }\n\n /** Delete a capture by ID. */\n async forget(id: string): Promise<DeleteResult> {\n return this.storage.delete(id);\n }\n\n /** Get a capture by ID. Returns null if not found or deleted. */\n async get(id: string): Promise<CaptureEntry | null> {\n return this.storage.get(id);\n }\n\n /** Run forget sweep to evict low-salience and TTL-expired captures. */\n async forgetSweep(opts?: { dryRun?: boolean; threshold?: number; maxAgeDays?: number }) {\n return this.storage.forgetSweep(opts ?? {});\n }\n\n /** Record feedback for a capture (v12). Adjusts salience multiplier. */\n async feedback(\n captureId: string,\n signal: \"helpful\" | \"not_helpful\" | \"stale\" | \"wrong\",\n reason?: string,\n ): Promise<void> {\n this.storage.recordFeedback(captureId, signal, reason, \"sdk\");\n }\n\n /** Get feedback signals for a capture (v12). */\n async getFeedback(captureId: string): Promise<{ signal: string; reason: string | null; created_at: number }[]> {\n return this.storage.getFeedback(captureId);\n }\n\n /** Query mutation log (v12). */\n async queryAudit(opts: { action?: string; captureId?: string; since?: number; limit?: number }) {\n return this.storage.queryAudit(opts);\n }\n\n /** Update an existing capture's content, tags, type, or trust state. */\n async update(\n id: string,\n opts: {\n content?: string;\n tags?: string[];\n type?: CaptureType;\n verified?: boolean;\n },\n ): Promise<boolean> {\n const existing = await this.storage.get(id);\n if (!existing) return false;\n\n const newContent = opts.content ?? existing.content;\n const newTags = opts.tags ?? existing.tags;\n const newType = opts.type ?? existing.type;\n const newTrust = opts.verified ? \"verified\" : (existing.trustState ?? \"candidate\");\n\n // Recompute content hash\n const contentHash = createHash(\"sha256\").update(newContent).digest(\"hex\");\n\n // Use raw SQL update (matches server.ts handleUpdate logic)\n const db = this.storage.getDatabase();\n db.prepare(\n \"UPDATE captures SET content = ?, tags = ?, type = ?, trust_state = ?, content_hash = ? WHERE id = ?\",\n ).run(newContent, JSON.stringify(newTags), newType, newTrust, contentHash, id);\n\n // Update FTS index\n const rowid = (\n db.prepare(\"SELECT rowid FROM captures WHERE id = ?\").get(id) as\n | { rowid?: number }\n | undefined\n )?.rowid;\n if (rowid) {\n db.prepare(\n \"INSERT INTO captures_fts(captures_fts, rowid, content, tags, type) VALUES('delete', ?, '', '', '')\",\n ).run(rowid);\n db.prepare(\n \"INSERT INTO captures_fts (rowid, id, content, tags, type) VALUES (?, ?, ?, ?, ?)\",\n ).run(rowid, id, newContent, JSON.stringify(newTags), newType);\n }\n\n // Re-embed if content changed\n if (opts.content && opts.content !== existing.content) {\n try {\n const embedding = await this.embedder.embed(newContent);\n await this.storage.putVector(id, embedding);\n } catch {\n // Embedding is optional\n }\n }\n\n return true;\n }\n\n /** Find and optionally merge duplicate captures by content similarity (Jaccard). */\n async consolidate(opts: { threshold?: number; confirm?: boolean; sessionKey?: string }): Promise<{\n groups: { ids: string[]; similarity: number; preview: string }[];\n merged: number;\n }> {\n const threshold = opts.threshold ?? 0.75;\n const confirm = opts.confirm ?? false;\n const sessionKey = opts.sessionKey ?? this.sessionKey;\n\n const db = this.storage.getDatabase();\n let sql = \"SELECT id, content, type, tags, created_at FROM captures WHERE deleted_at IS NULL\";\n const params: unknown[] = [];\n if (sessionKey !== \"all\") {\n sql += \" AND session_key = ?\";\n params.push(sessionKey);\n }\n sql += \" ORDER BY created_at DESC\";\n const rows = db.prepare(sql).all(...params) as {\n id: string;\n content: string;\n type: string;\n tags: string;\n created_at: number;\n }[];\n\n if (rows.length < 2) return { groups: [], merged: 0 };\n\n const groups: { ids: string[]; similarity: number; preview: string }[] = [];\n const seen = new Set<string>();\n\n for (let i = 0; i < rows.length; i++) {\n if (seen.has(rows[i].id)) continue;\n const words1 = new Set(rows[i].content.toLowerCase().split(/\\s+/));\n const group = [rows[i].id];\n\n for (let j = i + 1; j < rows.length; j++) {\n if (seen.has(rows[j].id)) continue;\n const words2 = new Set(rows[j].content.toLowerCase().split(/\\s+/));\n const intersection = [...words1].filter((w) => words2.has(w)).length;\n const union = new Set([...words1, ...words2]).size;\n const sim = union > 0 ? intersection / union : 0;\n if (sim >= threshold) {\n group.push(rows[j].id);\n seen.add(rows[j].id);\n }\n }\n\n if (group.length > 1) {\n seen.add(rows[i].id);\n groups.push({\n ids: group,\n similarity: threshold,\n preview: rows[i].content.slice(0, 80).replace(/\\n/g, \" \"),\n });\n }\n }\n\n if (!confirm || groups.length === 0) {\n return { groups, merged: 0 };\n }\n\n // Merge: keep oldest, soft-delete rest (transactional)\n let merged = 0;\n const softDelete = db.prepare(\"UPDATE captures SET deleted_at = ? WHERE id = ?\");\n const deleteVec = db.prepare(\"DELETE FROM captures_vec WHERE id = ?\");\n const deleteAtoms = db.prepare(\"DELETE FROM atoms WHERE capture_id = ?\");\n const mergeTx = db.transaction(() => {\n for (const g of groups) {\n const groupRows = g.ids\n .map((id) => rows.find((r) => r.id === id))\n .filter(Boolean)\n .sort((a, b) => a!.created_at - b!.created_at);\n const dups = groupRows.slice(1);\n for (const dup of dups) {\n softDelete.run(Date.now(), dup!.id);\n deleteVec.run(dup!.id);\n deleteAtoms.run(dup!.id);\n merged++;\n }\n }\n });\n mergeTx();\n\n return { groups, merged };\n }\n\n /** Create a handoff packet for the next agent session. */\n async handoff(opts: {\n task: string;\n status: \"in_progress\" | \"blocked\" | \"needs_review\" | \"done\" | \"assigned\";\n progress: string;\n decisions?: string[];\n files?: string[];\n nextSteps?: string[];\n }): Promise<string | null> {\n const lines: string[] = [];\n lines.push(`# Handoff: ${opts.task}`);\n lines.push(`Status: ${opts.status}`);\n lines.push(`Date: ${new Date().toISOString()}`);\n lines.push(\"\");\n lines.push(\"## Progress\");\n lines.push(opts.progress);\n lines.push(\"\");\n\n if (opts.decisions && opts.decisions.length > 0) {\n lines.push(\"## Decisions\");\n for (const d of opts.decisions) lines.push(`- ${d}`);\n lines.push(\"\");\n }\n if (opts.files && opts.files.length > 0) {\n lines.push(\"## Files\");\n for (const f of opts.files) lines.push(`- ${f}`);\n lines.push(\"\");\n }\n if (opts.nextSteps && opts.nextSteps.length > 0) {\n lines.push(\"## Next steps\");\n opts.nextSteps.forEach((s, i) => {\n lines.push(`${i + 1}. ${s}`);\n });\n lines.push(\"\");\n }\n\n const content = lines.join(\"\\n\");\n // Dedup: hash the structured data (excluding the timestamp)\n const dedupPayload = JSON.stringify({\n task: opts.task,\n status: opts.status,\n progress: opts.progress,\n decisions: opts.decisions ?? [],\n files: opts.files ?? [],\n nextSteps: opts.nextSteps ?? [],\n });\n const contentHash = createHash(\"sha256\").update(dedupPayload).digest(\"hex\");\n const existing = await this.storage.findByContentHash(contentHash, this.sessionKey);\n if (existing.length > 0) return null;\n\n const id = generateId();\n const entry: CaptureEntry = {\n id,\n sessionKey: this.sessionKey,\n agentId: \"sdk\",\n type: \"task\",\n content,\n tags: [\"handoff\", `status:${opts.status}`],\n createdAt: Date.now(),\n metadata: {\n handoff: true,\n task: opts.task,\n status: opts.status,\n progress: opts.progress,\n decisions: opts.decisions ?? [],\n files: opts.files ?? [],\n nextSteps: opts.nextSteps ?? [],\n },\n contentHash,\n };\n\n await this.storage.put(entry);\n\n try {\n const embedding = await this.embedder.embed(content);\n await this.storage.putVector(id, embedding);\n } catch {\n // Embedding is optional\n }\n\n return id;\n }\n\n /** Record an Architecture Decision Record (ADR). */\n async adr(opts: {\n title: string;\n context: string;\n decision: string;\n alternatives?: string[];\n consequences?: string;\n tags?: string[];\n }): Promise<string | null> {\n const lines: string[] = [];\n lines.push(`# ADR: ${opts.title}`);\n lines.push(`Date: ${new Date().toISOString()}`);\n lines.push(\"\");\n lines.push(\"## Context\");\n lines.push(opts.context);\n lines.push(\"\");\n lines.push(\"## Decision\");\n lines.push(opts.decision);\n lines.push(\"\");\n\n const alternatives = Array.isArray(opts.alternatives)\n ? opts.alternatives\n : typeof opts.alternatives === \"string\" && opts.alternatives\n ? [opts.alternatives]\n : [];\n if (alternatives.length > 0) {\n lines.push(\"## Alternatives considered\");\n for (const alt of alternatives) lines.push(`- ${alt}`);\n lines.push(\"\");\n }\n if (opts.consequences) {\n lines.push(\"## Consequences\");\n lines.push(opts.consequences);\n lines.push(\"\");\n }\n\n const content = lines.join(\"\\n\");\n const dedupPayload = JSON.stringify({\n title: opts.title,\n context: opts.context,\n decision: opts.decision,\n alternatives,\n consequences: opts.consequences ?? \"\",\n });\n const contentHash = createHash(\"sha256\").update(dedupPayload).digest(\"hex\");\n const existing = await this.storage.findByContentHash(contentHash, this.sessionKey);\n if (existing.length > 0) return null;\n\n const id = generateId();\n const entry: CaptureEntry = {\n id,\n sessionKey: this.sessionKey,\n agentId: \"sdk\",\n type: \"decision\",\n content,\n tags: [\"adr\", ...(opts.tags ?? [])],\n createdAt: Date.now(),\n metadata: {\n adr: true,\n title: opts.title,\n context: opts.context,\n decision: opts.decision,\n alternatives,\n consequences: opts.consequences ?? \"\",\n },\n contentHash,\n };\n\n await this.storage.put(entry);\n\n try {\n const embedding = await this.embedder.embed(content);\n await this.storage.putVector(id, embedding);\n } catch {\n // Embedding is optional\n }\n\n return id;\n }\n\n /** Close the database connection. */\n close(): void {\n this.storage.close();\n }\n}\n\nexport type {\n CallInfo,\n ImpactResult,\n ImportInfo,\n IndexResult,\n SymbolInfo,\n} from \"./codegraph/engine.js\";\n// Re-export CodeGraph engine for programmatic use\nexport {\n detectLanguage,\n findCallees,\n findCallers,\n impactAnalysis,\n indexDirectory,\n indexFile,\n listSymbols,\n SUPPORTED_LANGUAGES,\n searchSymbols,\n} from \"./codegraph/engine.js\";\nexport type { IngestResult as WikiIngestResult, WikiLink, WikiPage } from \"./wiki/engine.js\";\n// Re-export Wiki engine for programmatic use\nexport {\n findOutdatedPages,\n getWikiPage,\n ingestDirectory as wikiIngestDirectory,\n ingestFile as wikiIngestFile,\n searchWiki,\n} from \"./wiki/engine.js\";\n","/**\n * Secret redactor.\n * Scans text for secrets and replaces them with [REDACTED].\n * Uses regex patterns and a high-entropy detector.\n */\n\n/** Regex patterns for known secret formats. */\nconst SECRET_PATTERNS: RegExp[] = [\n // OpenAI API key\n /sk-[a-zA-Z0-9]{20,}/g,\n // Anthropic API key\n /sk-ant-[a-zA-Z0-9-]+/g,\n // GitHub personal access token\n /ghp_[a-zA-Z0-9]{36}/g,\n // GitHub OAuth token\n /gho_[a-zA-Z0-9]{36}/g,\n // GitHub fine-grained token\n /github_pat_[a-zA-Z0-9_]{82}/g,\n // Slack token\n /xox[baprs]-[a-zA-Z0-9-]+/g,\n // AWS access key ID\n /AKIA[0-9A-Z]{16}/g,\n // AWS secret access key (40 chars, base64-ish)\n /(?<![A-Za-z0-9+/])[A-Za-z0-9+/]{40}(?![A-Za-z0-9+/])/g,\n // PEM private key block\n /-----BEGIN [A-Z ]*PRIVATE KEY-----[\\s\\S]*?-----END [A-Z ]*PRIVATE KEY-----/g,\n // Google API key\n /AIza[0-9A-Za-z\\-_]{35}/g,\n // Generic bearer token (require 20+ char token to avoid redacting \"Bearer with JWT\")\n /Bearer\\s+[a-zA-Z0-9\\-._~+/]{20,}=*/g,\n];\n\n/** Minimum length for high-entropy detection. */\nconst MIN_LENGTH = 40;\n\n/** Entropy threshold in bits per character. */\nconst ENTROPY_THRESHOLD = 4.5;\n\n/** Compute the Shannon entropy of a string, in bits per character. */\nfunction shannonEntropy(str: string): number {\n const freq = new Map<string, number>();\n for (const ch of str) {\n freq.set(ch, (freq.get(ch) ?? 0) + 1);\n }\n let entropy = 0;\n const len = str.length;\n for (const count of freq.values()) {\n const p = count / len;\n entropy -= p * Math.log2(p);\n }\n return entropy;\n}\n\n/** Find high-entropy strings that look like secrets. */\nfunction findHighEntropyStrings(text: string): string[] {\n const results: string[] = [];\n // Match long strings of alphanumeric, +, /, =\n const regex = /[a-zA-Z0-9+/=]{40,}/g;\n let match: RegExpExecArray | null;\n match = regex.exec(text);\n while (match !== null) {\n const str = match[0];\n if (str.length >= MIN_LENGTH) {\n const entropy = shannonEntropy(str);\n if (entropy >= ENTROPY_THRESHOLD) {\n results.push(str);\n }\n }\n match = regex.exec(text);\n }\n return results;\n}\n\nexport interface RedactionResult {\n /** The redacted text. */\n text: string;\n /** Whether any secrets were found and redacted. */\n redacted: boolean;\n}\n\n/** Redact secrets from text. Returns the redacted text and a flag. */\nexport function redact(text: string): RedactionResult {\n let result = text;\n let redacted = false;\n\n // Apply regex patterns\n for (const pattern of SECRET_PATTERNS) {\n const before = result;\n result = result.replace(pattern, \"[REDACTED]\");\n if (result !== before) redacted = true;\n }\n\n // Apply high-entropy detection\n const highEntropy = findHighEntropyStrings(result);\n for (const str of highEntropy) {\n // Make sure we did not already redact this region\n result = result.replace(str, \"[REDACTED]\");\n redacted = true;\n }\n\n return { text: result, redacted };\n}\n","/**\n * Wiki engine: parse markdown docs into structured pages with a link graph.\n *\n * Extracts frontmatter, headings, [[wikilinks]], and [text](url) links.\n * Builds an adjacency list for the link graph.\n */\nimport { createHash } from \"node:crypto\";\nimport { existsSync, readdirSync, readFileSync, statSync } from \"node:fs\";\nimport { basename, extname, join, relative, sep } from \"node:path\";\nimport type { Database } from \"better-sqlite3\";\nimport { generateId } from \"../utils/ulid.js\";\n\n/** A parsed wiki page. */\nexport interface WikiPage {\n id: string;\n title: string;\n content: string;\n sourceFile: string;\n section: string | null;\n tags: string | null;\n frontmatter: string | null;\n contentHash: string;\n}\n\n/** A link between wiki pages. */\nexport interface WikiLink {\n fromPageId: string;\n toPageId: string | null;\n toTitle: string;\n linkText: string;\n linkType: string;\n line: number;\n}\n\n/** Result of ingesting a file. */\nexport interface IngestResult {\n file: string;\n pages: number;\n links: number;\n skipped: boolean;\n reason?: string;\n}\n\n/** Parse frontmatter (YAML-like) from markdown content. */\nfunction parseFrontmatter(content: string): { frontmatter: string | null; body: string } {\n if (!content.startsWith(\"---\")) {\n return { frontmatter: null, body: content };\n }\n const end = content.indexOf(\"\\n---\", 3);\n if (end === -1) {\n return { frontmatter: null, body: content };\n }\n const frontmatter = content.slice(3, end).trim();\n const body = content.slice(end + 4).replace(/^\\n/, \"\");\n return { frontmatter, body };\n}\n\n/** Extract tags from frontmatter (simple key: value parsing). */\nfunction extractTags(frontmatter: string | null): string | null {\n if (!frontmatter) return null;\n const match = frontmatter.match(/^tags:\\s*(.+)$/m);\n if (!match) return null;\n return match[1].replace(/[[\\]]/g, \"\").trim();\n}\n\n/** Extract title from frontmatter or first heading. */\nfunction extractTitle(frontmatter: string | null, body: string, fileName: string): string {\n if (frontmatter) {\n const titleMatch = frontmatter.match(/^title:\\s*(.+)$/m);\n if (titleMatch) return titleMatch[1].replace(/[\"']/g, \"\").trim();\n }\n // First H1 heading\n const h1Match = body.match(/^#\\s+(.+)$/m);\n if (h1Match) return h1Match[1].trim();\n // Fallback: file name without extension\n return basename(fileName, extname(fileName));\n}\n\n/** Extract [[wikilinks]] from content. Returns array of { target, text, line }. */\nfunction extractWikilinks(content: string): Array<{ target: string; text: string; line: number }> {\n const links: Array<{ target: string; text: string; line: number }> = [];\n const lines = content.split(\"\\n\");\n const regex = /\\[\\[([^\\]|]+)(?:\\|([^\\]]+))?\\]\\]/g;\n for (let i = 0; i < lines.length; i++) {\n let match: RegExpExecArray | null;\n regex.lastIndex = 0;\n match = regex.exec(lines[i]);\n while (match !== null) {\n links.push({\n target: match[1].trim(),\n text: (match[2] ?? match[1]).trim(),\n line: i + 1,\n });\n match = regex.exec(lines[i]);\n }\n }\n return links;\n}\n\n/** Extract [text](url) markdown links from content. */\nfunction extractMarkdownLinks(\n content: string,\n): Array<{ target: string; text: string; line: number }> {\n const links: Array<{ target: string; text: string; line: number }> = [];\n const lines = content.split(\"\\n\");\n // Match [text](path) but not  (images)\n const regex = /(?<!!)\\[([^\\]]+)\\]\\(([^)]+)\\)/g;\n for (let i = 0; i < lines.length; i++) {\n let match: RegExpExecArray | null;\n regex.lastIndex = 0;\n match = regex.exec(lines[i]);\n while (match !== null) {\n const target = match[2].trim();\n // Only include local .md links (not http URLs)\n if (!target.startsWith(\"http\") && !target.startsWith(\"mailto:\")) {\n links.push({\n target: target.replace(/\\.md$/i, \"\"),\n text: match[1].trim(),\n line: i + 1,\n });\n }\n match = regex.exec(lines[i]);\n }\n }\n return links;\n}\n\n/** Parse a markdown file into a wiki page with links. */\nfunction parseMarkdownFile(\n filePath: string,\n repoPath: string,\n): {\n page: WikiPage;\n links: Array<{ target: string; text: string; line: number; type: string }>;\n} | null {\n const ext = extname(filePath).toLowerCase();\n if (ext !== \".md\" && ext !== \".markdown\") return null;\n\n let source: string;\n try {\n source = readFileSync(filePath, \"utf-8\");\n } catch {\n return null;\n }\n\n const relPath = relative(repoPath, filePath).split(sep).join(\"/\");\n const { frontmatter, body } = parseFrontmatter(source);\n const title = extractTitle(frontmatter, body, filePath);\n const tags = extractTags(frontmatter);\n const contentHash = createHash(\"sha256\").update(source).digest(\"hex\");\n\n const page: WikiPage = {\n id: generateId(),\n title,\n content: body,\n sourceFile: relPath,\n section: null,\n tags,\n frontmatter,\n contentHash,\n };\n\n const wikilinks = extractWikilinks(body).map((l) => ({ ...l, type: \"wikilink\" }));\n const mdlinks = extractMarkdownLinks(body).map((l) => ({ ...l, type: \"markdown\" }));\n const links = [...wikilinks, ...mdlinks];\n\n return { page, links };\n}\n\n/** Ingest a single markdown file into the database. */\nexport function ingestFile(\n db: Database,\n filePath: string,\n repoPath: string,\n teamId: string | null,\n): IngestResult {\n const ext = extname(filePath).toLowerCase();\n if (ext !== \".md\" && ext !== \".markdown\") {\n return { file: filePath, pages: 0, links: 0, skipped: true, reason: \"not markdown\" };\n }\n\n const parsed = parseMarkdownFile(filePath, repoPath);\n if (!parsed) {\n return { file: filePath, pages: 0, links: 0, skipped: true, reason: \"parse failed\" };\n }\n\n const relPath = relative(repoPath, filePath).split(sep).join(\"/\");\n const now = Date.now();\n\n // Check if page already exists (by source_file)\n const existing = db\n .prepare(\"SELECT id FROM wiki_pages WHERE source_file = ? AND team_id IS ?\")\n .get(relPath, teamId) as { id: string } | undefined;\n\n let pageId = parsed.page.id;\n if (existing) {\n // Update existing page\n pageId = existing.id;\n db.prepare(\n \"UPDATE wiki_pages SET title = ?, content = ?, tags = ?, frontmatter = ?, content_hash = ?, updated_at = ? WHERE id = ?\",\n ).run(\n parsed.page.title,\n parsed.page.content,\n parsed.page.tags,\n parsed.page.frontmatter,\n parsed.page.contentHash,\n now,\n pageId,\n );\n // Delete old links\n db.prepare(\"DELETE FROM wiki_links WHERE from_page_id = ?\").run(pageId);\n } else {\n // Insert new page\n db.prepare(\n `INSERT INTO wiki_pages (id, title, content, source_file, section, tags, frontmatter, content_hash, team_id, created_at, updated_at)\n VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`,\n ).run(\n parsed.page.id,\n parsed.page.title,\n parsed.page.content,\n parsed.page.sourceFile,\n parsed.page.section,\n parsed.page.tags,\n parsed.page.frontmatter,\n parsed.page.contentHash,\n teamId,\n now,\n now,\n );\n }\n\n // Insert links (resolve targets later)\n const linkStmt = db.prepare(\n \"INSERT INTO wiki_links (from_page_id, to_page_id, to_title, link_text, link_type, line) VALUES (?, ?, ?, ?, ?, ?)\",\n );\n for (const link of parsed.links) {\n // Try to resolve target by title\n const target = db\n .prepare(\"SELECT id FROM wiki_pages WHERE title = ? AND team_id IS ? LIMIT 1\")\n .get(link.target, teamId) as { id: string } | undefined;\n linkStmt.run(pageId, target?.id ?? null, link.target, link.text, link.type, link.line);\n }\n\n return {\n file: relPath,\n pages: 1,\n links: parsed.links.length,\n skipped: false,\n };\n}\n\n/** Ingest a directory of markdown files. */\nexport function ingestDirectory(\n db: Database,\n dirPath: string,\n repoPath: string,\n teamId: string | null,\n maxFiles = 200,\n): IngestResult[] {\n const results: IngestResult[] = [];\n const files: string[] = [];\n\n const walk = (dir: string) => {\n if (files.length >= maxFiles) return;\n let entries: string[];\n try {\n entries = readdirSync(dir);\n } catch {\n return;\n }\n for (const entry of entries) {\n if (files.length >= maxFiles) return;\n const fullPath = join(dir, entry);\n let stat: ReturnType<typeof statSync>;\n try {\n stat = statSync(fullPath);\n } catch {\n continue;\n }\n if (stat.isDirectory()) {\n if (entry.startsWith(\".\") || entry === \"node_modules\" || entry === \"vendor\") continue;\n walk(fullPath);\n } else if (stat.isFile()) {\n const ext = extname(fullPath).toLowerCase();\n if (ext === \".md\" || ext === \".markdown\") {\n files.push(fullPath);\n }\n }\n }\n };\n\n walk(dirPath);\n\n for (const file of files) {\n const result = ingestFile(db, file, repoPath, teamId);\n results.push(result);\n }\n\n // Re-resolve links now that all pages are indexed\n const unresolved = db\n .prepare(\"SELECT id, to_title FROM wiki_links WHERE to_page_id IS NULL\")\n .all() as { id: number; to_title: string }[];\n if (unresolved.length > 0) {\n const updateStmt = db.prepare(\"UPDATE wiki_links SET to_page_id = ? WHERE id = ?\");\n for (const u of unresolved) {\n const target = db\n .prepare(\"SELECT id FROM wiki_pages WHERE title = ? AND team_id IS ? LIMIT 1\")\n .get(u.to_title, teamId) as { id: string } | undefined;\n if (target) {\n updateStmt.run(target.id, u.id);\n }\n }\n }\n\n return results;\n}\n\n/** Search wiki pages using FTS5. */\nexport function searchWiki(\n db: Database,\n query: string,\n opts: { teamId?: string; limit?: number } = {},\n): Array<{ id: string; title: string; sourceFile: string; snippet: string }> {\n const limit = opts.limit ?? 10;\n let sql = `\n SELECT w.id, w.title, w.source_file, snippet(wiki_fts, 1, '<b>', '</b>', '...', 20) as snippet\n FROM wiki_fts f\n JOIN wiki_pages w ON w.id = f.id\n WHERE wiki_fts MATCH ?\n `;\n const params: unknown[] = [query];\n if (opts.teamId !== undefined) {\n sql += \" AND w.team_id IS ?\";\n params.push(opts.teamId);\n }\n sql += \" LIMIT ?\";\n params.push(limit);\n\n const rows = db.prepare(sql).all(...params) as Array<{\n id: string;\n title: string;\n source_file: string;\n snippet: string;\n }>;\n\n return rows.map((r) => ({\n id: r.id,\n title: r.title,\n sourceFile: r.source_file,\n snippet: r.snippet,\n }));\n}\n\n/** Get a wiki page by ID, including linked pages. */\nexport function getWikiPage(\n db: Database,\n pageId: string,\n): { page: WikiPage; links: WikiLink[]; backlinks: WikiLink[] } | null {\n const row = db.prepare(\"SELECT * FROM wiki_pages WHERE id = ?\").get(pageId) as\n | {\n id: string;\n title: string;\n content: string;\n source_file: string;\n section: string | null;\n tags: string | null;\n frontmatter: string | null;\n content_hash: string;\n }\n | undefined;\n\n if (!row) return null;\n\n const page: WikiPage = {\n id: row.id,\n title: row.title,\n content: row.content,\n sourceFile: row.source_file,\n section: row.section,\n tags: row.tags,\n frontmatter: row.frontmatter,\n contentHash: row.content_hash,\n };\n\n const linkRows = db\n .prepare(\"SELECT * FROM wiki_links WHERE from_page_id = ? ORDER BY line\")\n .all(pageId) as Array<{\n from_page_id: string;\n to_page_id: string | null;\n to_title: string;\n link_text: string;\n link_type: string;\n line: number;\n }>;\n\n const links: WikiLink[] = linkRows.map((r) => ({\n fromPageId: r.from_page_id,\n toPageId: r.to_page_id,\n toTitle: r.to_title,\n linkText: r.link_text,\n linkType: r.link_type,\n line: r.line,\n }));\n\n const backlinkRows = db\n .prepare(\"SELECT * FROM wiki_links WHERE to_page_id = ? ORDER BY line\")\n .all(pageId) as Array<{\n from_page_id: string;\n to_page_id: string | null;\n to_title: string;\n link_text: string;\n link_type: string;\n line: number;\n }>;\n\n const backlinks: WikiLink[] = backlinkRows.map((r) => ({\n fromPageId: r.from_page_id,\n toPageId: r.to_page_id,\n toTitle: r.to_title,\n linkText: r.link_text,\n linkType: r.link_type,\n line: r.line,\n }));\n\n return { page, links, backlinks };\n}\n\n/** Find pages whose source file has changed (content_hash mismatch). */\nexport function findOutdatedPages(\n db: Database,\n repoPath: string,\n opts: { teamId?: string } = {},\n): Array<{ id: string; title: string; sourceFile: string; reason: string }> {\n const pages = db\n .prepare(\"SELECT id, title, source_file, content_hash FROM wiki_pages WHERE team_id IS ?\")\n .all(opts.teamId ?? null) as Array<{\n id: string;\n title: string;\n source_file: string;\n content_hash: string;\n }>;\n\n const outdated: Array<{ id: string; title: string; sourceFile: string; reason: string }> = [];\n\n for (const page of pages) {\n const fullPath = join(repoPath, page.source_file);\n if (!existsSync(fullPath)) {\n outdated.push({\n id: page.id,\n title: page.title,\n sourceFile: page.source_file,\n reason: \"file deleted\",\n });\n continue;\n }\n try {\n const content = readFileSync(fullPath, \"utf-8\");\n const hash = createHash(\"sha256\").update(content).digest(\"hex\");\n if (hash !== page.content_hash) {\n outdated.push({\n id: page.id,\n title: page.title,\n sourceFile: page.source_file,\n reason: \"content changed\",\n });\n }\n } catch {\n outdated.push({\n id: page.id,\n title: page.title,\n sourceFile: page.source_file,\n reason: \"read error\",\n });\n }\n }\n\n return outdated;\n}\n"],"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