@codemem/mcp 0.20.0-alpha.5 → 0.20.0-alpha.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/dist/index.js +17 -9
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { MemoryStore, VERSION, dedupeOrderedIds, projectClause, resolveDbPath, resolveProject, toJson } from "@codemem/core";
|
|
2
|
+
import { MemoryStore, VERSION, dedupeOrderedIds, projectClause, resolveDbPath, resolveProject, storeVectors, toJson } from "@codemem/core";
|
|
3
3
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
4
4
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
5
5
|
import { z } from "zod";
|
|
@@ -185,7 +185,7 @@ async function main() {
|
|
|
185
185
|
}, async (args) => {
|
|
186
186
|
try {
|
|
187
187
|
const filters = buildFilters(args);
|
|
188
|
-
return jsonContent(store.explain(args.query ?? null, args.ids ?? null, args.limit, filters));
|
|
188
|
+
return jsonContent(store.explain(args.query ?? null, args.ids ?? null, args.limit, filters, { includePackContext: args.include_pack_context }));
|
|
189
189
|
} catch (err) {
|
|
190
190
|
return errorContent(err instanceof Error ? err.message : String(err));
|
|
191
191
|
}
|
|
@@ -342,7 +342,7 @@ async function main() {
|
|
|
342
342
|
project: z.string().optional().describe("Project identifier")
|
|
343
343
|
}, async (args) => {
|
|
344
344
|
try {
|
|
345
|
-
|
|
345
|
+
const result = store.db.transaction(() => {
|
|
346
346
|
const now = nowIso();
|
|
347
347
|
const user = process.env.USER ?? "unknown";
|
|
348
348
|
const cwd = process.cwd();
|
|
@@ -352,8 +352,16 @@ async function main() {
|
|
|
352
352
|
const sessionId = Number(sessionInfo.lastInsertRowid);
|
|
353
353
|
const memId = store.remember(sessionId, args.kind, args.title, args.body, args.confidence);
|
|
354
354
|
store.db.prepare("UPDATE sessions SET ended_at = ?, metadata_json = ? WHERE id = ?").run(nowIso(), toJson({ mcp: true }), sessionId);
|
|
355
|
-
return
|
|
356
|
-
|
|
355
|
+
return {
|
|
356
|
+
memId,
|
|
357
|
+
title: args.title,
|
|
358
|
+
body: args.body
|
|
359
|
+
};
|
|
360
|
+
})();
|
|
361
|
+
try {
|
|
362
|
+
await storeVectors(store.db, result.memId, result.title, result.body);
|
|
363
|
+
} catch {}
|
|
364
|
+
return jsonContent({ id: result.memId });
|
|
357
365
|
} catch (err) {
|
|
358
366
|
return errorContent(err instanceof Error ? err.message : String(err));
|
|
359
367
|
}
|
|
@@ -419,11 +427,11 @@ async function main() {
|
|
|
419
427
|
persistence: {
|
|
420
428
|
when: ["Milestones (task done, key decision, new facts learned).", "Notable regressions or follow-ups that should be remembered."],
|
|
421
429
|
how: [
|
|
422
|
-
"Use memory.remember with kind decision/
|
|
430
|
+
"Use memory.remember with kind decision/discovery/change/exploration.",
|
|
423
431
|
"Keep titles short and bodies high-signal.",
|
|
424
432
|
"ALWAYS pass the project parameter if known."
|
|
425
433
|
],
|
|
426
|
-
examples: ["memory.remember(kind=\"decision\", title=\"Switch to async cache\", body=\"...why...\", project=\"my-service\")", "memory.remember(kind=\"
|
|
434
|
+
examples: ["memory.remember(kind=\"decision\", title=\"Switch to async cache\", body=\"...why...\", project=\"my-service\")", "memory.remember(kind=\"change\", title=\"Fixed retry loop\", body=\"...impact...\", project=\"my-service\")"]
|
|
427
435
|
},
|
|
428
436
|
forget: {
|
|
429
437
|
when: ["Accidental or sensitive data stored in memory items.", "Obsolete or incorrect items that should no longer surface."],
|
|
@@ -448,7 +456,7 @@ async function main() {
|
|
|
448
456
|
"",
|
|
449
457
|
"Persistence:",
|
|
450
458
|
"- On milestones (task done, key decision, new facts learned), call memory.remember.",
|
|
451
|
-
"- Use kind=decision for tradeoffs, kind=
|
|
459
|
+
"- Use kind=decision for tradeoffs, kind=change for outcomes, kind=discovery/exploration for useful findings.",
|
|
452
460
|
"- Keep titles short and bodies high-signal.",
|
|
453
461
|
"- ALWAYS pass the project parameter if known.",
|
|
454
462
|
"",
|
|
@@ -460,7 +468,7 @@ async function main() {
|
|
|
460
468
|
"- memory.timeline(memory_id=123)",
|
|
461
469
|
"- memory.get_observations([123, 456])",
|
|
462
470
|
"- memory.remember(kind=\"decision\", title=\"Use async cache\", body=\"Chose async cache to avoid lock contention in X.\", project=\"my-service\")",
|
|
463
|
-
"- memory.remember(kind=\"
|
|
471
|
+
"- memory.remember(kind=\"change\", title=\"Fixed retry loop\", body=\"Root cause was Y; added guard in Z.\", project=\"my-service\")",
|
|
464
472
|
"- memory.forget(123)"
|
|
465
473
|
].join("\n")
|
|
466
474
|
});
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../src/project-scope.ts","../src/index.ts"],"sourcesContent":["import { type MemoryFilters, resolveProject } from \"@codemem/core\";\n\nexport function resolveDefaultProject(): string | null {\n\tconst project = process.env.CODEMEM_PROJECT?.trim();\n\treturn project || resolveProject(process.cwd());\n}\n\nexport function buildFilters(\n\traw: Record<string, unknown>,\n\tdefaultProject = resolveDefaultProject(),\n): MemoryFilters | undefined {\n\tconst filters: MemoryFilters = {};\n\tlet hasAny = false;\n\n\tconst explicitProject = typeof raw.project === \"string\" ? raw.project.trim() : undefined;\n\tconst resolvedProject = explicitProject || defaultProject || undefined;\n\tif (resolvedProject) {\n\t\tfilters.project = resolvedProject;\n\t\thasAny = true;\n\t}\n\n\tfor (const key of [\n\t\t\"kind\",\n\t\t\"visibility\",\n\t\t\"include_visibility\",\n\t\t\"exclude_visibility\",\n\t\t\"include_workspace_ids\",\n\t\t\"exclude_workspace_ids\",\n\t\t\"include_workspace_kinds\",\n\t\t\"exclude_workspace_kinds\",\n\t\t\"include_actor_ids\",\n\t\t\"exclude_actor_ids\",\n\t\t\"include_trust_states\",\n\t\t\"exclude_trust_states\",\n\t\t\"ownership_scope\",\n\t\t\"personal_first\",\n\t\t\"trust_bias\",\n\t\t\"widen_shared_when_weak\",\n\t\t\"widen_shared_min_personal_results\",\n\t\t\"widen_shared_min_personal_score\",\n\t] as const) {\n\t\tconst val = raw[key];\n\t\tif (val !== undefined && val !== null) {\n\t\t\t(filters as Record<string, unknown>)[key] = val;\n\t\t\thasAny = true;\n\t\t}\n\t}\n\n\treturn hasAny ? filters : undefined;\n}\n","#!/usr/bin/env node\n\n/**\n * @codemem/mcp — MCP stdio server.\n *\n * Runs as a separate process spawned by the host (OpenCode/Claude).\n * Owns its own better-sqlite3 connection. Communicates via stdio JSON-RPC.\n *\n * Port of codemem/mcp_server.py — all 13 tools.\n */\n\nimport {\n\tdedupeOrderedIds,\n\ttype MemoryItemResponse,\n\ttype MemoryResult,\n\tMemoryStore,\n\tprojectClause,\n\tresolveDbPath,\n\ttoJson,\n\tVERSION,\n} from \"@codemem/core\";\nimport { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\";\nimport { StdioServerTransport } from \"@modelcontextprotocol/sdk/server/stdio.js\";\nimport { z } from \"zod\";\nimport { buildFilters, resolveDefaultProject } from \"./project-scope.js\";\n\n// ---------------------------------------------------------------------------\n// Static data\n// ---------------------------------------------------------------------------\n\nconst MEMORY_KINDS: Record<string, string> = {\n\tdiscovery: \"Something learned about the codebase, architecture, or tools\",\n\tchange: \"A code change that was made\",\n\tfeature: \"A new feature that was implemented\",\n\tbugfix: \"A bug that was found and fixed\",\n\trefactor: \"Code that was refactored or restructured\",\n\tdecision: \"A design or architecture decision\",\n\texploration: \"An experiment or investigation (may not have shipped)\",\n};\n\n// ---------------------------------------------------------------------------\n// Shared zod filter schema (spread into each tool that accepts filters)\n// ---------------------------------------------------------------------------\n\nconst filterSchema = {\n\tkind: z.string().optional().describe(\"Filter by memory kind\"),\n\tproject: z.string().optional().describe(\"Filter by project scope (matches sessions.project)\"),\n\tvisibility: z.array(z.string()).optional(),\n\tinclude_visibility: z.array(z.string()).optional(),\n\texclude_visibility: z.array(z.string()).optional(),\n\tinclude_workspace_ids: z.array(z.string()).optional(),\n\texclude_workspace_ids: z.array(z.string()).optional(),\n\tinclude_workspace_kinds: z.array(z.string()).optional(),\n\texclude_workspace_kinds: z.array(z.string()).optional(),\n\tinclude_actor_ids: z.array(z.string()).optional(),\n\texclude_actor_ids: z.array(z.string()).optional(),\n\tinclude_trust_states: z.array(z.string()).optional(),\n\texclude_trust_states: z.array(z.string()).optional(),\n\townership_scope: z.string().optional(),\n\tpersonal_first: z.union([z.boolean(), z.string()]).optional(),\n\ttrust_bias: z.string().optional(),\n\twiden_shared_when_weak: z.union([z.boolean(), z.string()]).optional(),\n\twiden_shared_min_personal_results: z.number().int().optional(),\n\twiden_shared_min_personal_score: z.number().optional(),\n};\n\n// ---------------------------------------------------------------------------\n// Helpers\n// ---------------------------------------------------------------------------\n\nconst defaultProject = resolveDefaultProject();\n\n/** Wrap a JSON result into the MCP text content envelope. */\nfunction jsonContent(data: unknown) {\n\treturn { content: [{ type: \"text\" as const, text: JSON.stringify(data) }] };\n}\n\n/** Wrap an error message into the MCP text content envelope. */\nfunction errorContent(message: string) {\n\treturn { content: [{ type: \"text\" as const, text: JSON.stringify({ error: message }) }] };\n}\n\n/** ISO timestamp. */\nfunction nowIso(): string {\n\treturn new Date().toISOString();\n}\n\n/**\n * Fetch multiple memory items by ID. Returns items in ID order, skipping\n * missing IDs. Implemented directly since MemoryStore doesn't have getMany.\n */\nfunction getMany(store: MemoryStore, ids: number[]): MemoryItemResponse[] {\n\tif (ids.length === 0) return [];\n\tconst results: MemoryItemResponse[] = [];\n\tfor (const id of ids) {\n\t\tconst item = store.get(id);\n\t\tif (item) results.push(item);\n\t}\n\treturn results;\n}\n\n// ---------------------------------------------------------------------------\n// Server bootstrap\n// ---------------------------------------------------------------------------\n\nasync function main() {\n\tconst dbPath = resolveDbPath();\n\tconst store = new MemoryStore(dbPath);\n\n\tconst server = new McpServer({ name: \"codemem\", version: VERSION });\n\n\t// -------------------------------------------------------------------\n\t// 1. memory_search\n\t// -------------------------------------------------------------------\n\tserver.tool(\n\t\t\"memory_search\",\n\t\t\"Search memories by text query. Returns full body text for each match.\",\n\t\t{\n\t\t\tquery: z.string().describe(\"Search query\"),\n\t\t\tlimit: z.number().int().min(1).max(50).default(5).describe(\"Max results\"),\n\t\t\t...filterSchema,\n\t\t},\n\t\tasync (args) => {\n\t\t\ttry {\n\t\t\t\tconst filters = buildFilters(args);\n\t\t\t\tconst items = store.search(args.query, args.limit, filters);\n\t\t\t\treturn jsonContent({\n\t\t\t\t\titems: items.map((m: MemoryResult) => ({\n\t\t\t\t\t\tid: m.id,\n\t\t\t\t\t\ttitle: m.title,\n\t\t\t\t\t\tkind: m.kind,\n\t\t\t\t\t\tbody: m.body_text,\n\t\t\t\t\t\tconfidence: m.confidence,\n\t\t\t\t\t\tscore: m.score,\n\t\t\t\t\t\tsession_id: m.session_id,\n\t\t\t\t\t\tmetadata: m.metadata,\n\t\t\t\t\t})),\n\t\t\t\t});\n\t\t\t} catch (err) {\n\t\t\t\treturn errorContent(err instanceof Error ? err.message : String(err));\n\t\t\t}\n\t\t},\n\t);\n\n\t// -------------------------------------------------------------------\n\t// 2. memory_search_index\n\t// -------------------------------------------------------------------\n\tserver.tool(\n\t\t\"memory_search_index\",\n\t\t\"Search memories by text query. Returns compact index entries (no body) for browsing.\",\n\t\t{\n\t\t\tquery: z.string().describe(\"Search query\"),\n\t\t\tlimit: z.number().int().min(1).max(50).default(8).describe(\"Max results\"),\n\t\t\t...filterSchema,\n\t\t},\n\t\tasync (args) => {\n\t\t\ttry {\n\t\t\t\tconst filters = buildFilters(args);\n\t\t\t\tconst items = store.search(args.query, args.limit, filters);\n\t\t\t\treturn jsonContent({\n\t\t\t\t\titems: items.map((m: MemoryResult) => ({\n\t\t\t\t\t\tid: m.id,\n\t\t\t\t\t\tkind: m.kind,\n\t\t\t\t\t\ttitle: m.title,\n\t\t\t\t\t\tscore: m.score,\n\t\t\t\t\t\tcreated_at: m.created_at,\n\t\t\t\t\t\tsession_id: m.session_id,\n\t\t\t\t\t\tmetadata: m.metadata,\n\t\t\t\t\t})),\n\t\t\t\t});\n\t\t\t} catch (err) {\n\t\t\t\treturn errorContent(err instanceof Error ? err.message : String(err));\n\t\t\t}\n\t\t},\n\t);\n\n\t// -------------------------------------------------------------------\n\t// 3. memory_timeline\n\t// -------------------------------------------------------------------\n\tserver.tool(\n\t\t\"memory_timeline\",\n\t\t\"Get a chronological window of memories around an anchor (by ID or query).\",\n\t\t{\n\t\t\tquery: z.string().optional().describe(\"Search query to find anchor\"),\n\t\t\tmemory_id: z.number().int().optional().describe(\"Anchor memory ID\"),\n\t\t\tdepth_before: z.number().int().min(0).default(3).describe(\"Items before anchor\"),\n\t\t\tdepth_after: z.number().int().min(0).default(3).describe(\"Items after anchor\"),\n\t\t\t...filterSchema,\n\t\t},\n\t\tasync (args) => {\n\t\t\ttry {\n\t\t\t\tconst filters = buildFilters(args);\n\t\t\t\tconst items = store.timeline(\n\t\t\t\t\targs.query ?? null,\n\t\t\t\t\targs.memory_id ?? null,\n\t\t\t\t\targs.depth_before,\n\t\t\t\t\targs.depth_after,\n\t\t\t\t\tfilters,\n\t\t\t\t);\n\t\t\t\treturn jsonContent({ items });\n\t\t\t} catch (err) {\n\t\t\t\treturn errorContent(err instanceof Error ? err.message : String(err));\n\t\t\t}\n\t\t},\n\t);\n\n\t// -------------------------------------------------------------------\n\t// 4. memory_explain\n\t// -------------------------------------------------------------------\n\tserver.tool(\n\t\t\"memory_explain\",\n\t\t\"Explain search results with detailed scoring breakdown.\",\n\t\t{\n\t\t\tquery: z.string().optional().describe(\"Search query\"),\n\t\t\tids: z.array(z.number().int()).max(200).optional().describe(\"Specific memory IDs to explain\"),\n\t\t\tlimit: z.number().int().min(1).max(50).default(10).describe(\"Max results\"),\n\t\t\tinclude_pack_context: z.boolean().default(false).describe(\"Include formatted pack context\"),\n\t\t\t...filterSchema,\n\t\t},\n\t\tasync (args) => {\n\t\t\ttry {\n\t\t\t\tconst filters = buildFilters(args);\n\t\t\t\tconst result = store.explain(args.query ?? null, args.ids ?? null, args.limit, filters);\n\t\t\t\treturn jsonContent(result);\n\t\t\t} catch (err) {\n\t\t\t\treturn errorContent(err instanceof Error ? err.message : String(err));\n\t\t\t}\n\t\t},\n\t);\n\n\t// -------------------------------------------------------------------\n\t// 5. memory_expand\n\t// -------------------------------------------------------------------\n\tserver.tool(\n\t\t\"memory_expand\",\n\t\t\"Fetch memories by ID with surrounding timeline context.\",\n\t\t{\n\t\t\tids: z\n\t\t\t\t.array(z.union([z.number(), z.string()]))\n\t\t\t\t.max(200)\n\t\t\t\t.describe(\"Memory IDs to expand\"),\n\t\t\tdepth_before: z.number().int().min(0).default(3).describe(\"Timeline items before\"),\n\t\t\tdepth_after: z.number().int().min(0).default(3).describe(\"Timeline items after\"),\n\t\t\tinclude_observations: z.boolean().default(false).describe(\"Include full observation details\"),\n\t\t\tproject: z.string().optional().describe(\"Project scope filter\"),\n\t\t},\n\t\tasync (args) => {\n\t\t\ttry {\n\t\t\t\t// Python: project if project is not None else default_project\n\t\t\t\t// Explicit \"\" clears project scoping; only fall back to default when undefined.\n\t\t\t\tconst resolvedProject =\n\t\t\t\t\targs.project !== undefined ? args.project.trim() || null : defaultProject || null;\n\t\t\t\tconst filters = resolvedProject ? { project: resolvedProject } : undefined;\n\t\t\t\tconst { clause: projectFilterClause, params: projectFilterParams } = resolvedProject\n\t\t\t\t\t? projectClause(resolvedProject)\n\t\t\t\t\t: { clause: \"\", params: [] as string[] };\n\t\t\t\tconst { ordered: orderedIds, invalid: invalidIds } = dedupeOrderedIds(args.ids);\n\t\t\t\tconst errors: Array<Record<string, unknown>> = [];\n\n\t\t\t\tif (invalidIds.length > 0) {\n\t\t\t\t\terrors.push({\n\t\t\t\t\t\tcode: \"INVALID_ARGUMENT\",\n\t\t\t\t\t\tfield: \"ids\",\n\t\t\t\t\t\tmessage: \"some ids are not valid integers\",\n\t\t\t\t\t\tids: invalidIds,\n\t\t\t\t\t});\n\t\t\t\t}\n\n\t\t\t\tconst missingNotFound: number[] = [];\n\t\t\t\tconst missingProjectMismatch: number[] = [];\n\t\t\t\tconst anchors: MemoryItemResponse[] = [];\n\t\t\t\tconst timelineItems: MemoryItemResponse[] = [];\n\t\t\t\tconst timelineSeen = new Set<number>();\n\t\t\t\tconst sessionScopeMatches = new Map<number, boolean>();\n\n\t\t\t\tfor (const memoryId of orderedIds) {\n\t\t\t\t\tconst item = store.get(memoryId);\n\t\t\t\t\tif (!item || !item.active) {\n\t\t\t\t\t\tmissingNotFound.push(memoryId);\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\n\t\t\t\t\tconst sessionId = item.session_id;\n\t\t\t\t\tif (resolvedProject && projectFilterClause && sessionId > 0) {\n\t\t\t\t\t\tif (!sessionScopeMatches.has(sessionId)) {\n\t\t\t\t\t\t\tconst row = store.db\n\t\t\t\t\t\t\t\t.prepare(`SELECT 1 FROM sessions WHERE id = ? AND ${projectFilterClause}`)\n\t\t\t\t\t\t\t\t.get(sessionId, ...projectFilterParams);\n\t\t\t\t\t\t\tsessionScopeMatches.set(sessionId, row != null);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (!sessionScopeMatches.get(sessionId)) {\n\t\t\t\t\t\t\tmissingProjectMismatch.push(memoryId);\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\t\t\t\t\t} else if (resolvedProject && projectFilterClause && sessionId <= 0) {\n\t\t\t\t\t\tmissingProjectMismatch.push(memoryId);\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\n\t\t\t\t\tanchors.push(item);\n\n\t\t\t\t\tconst expanded = store.timeline(\n\t\t\t\t\t\tnull,\n\t\t\t\t\t\tmemoryId,\n\t\t\t\t\t\targs.depth_before,\n\t\t\t\t\t\targs.depth_after,\n\t\t\t\t\t\tfilters,\n\t\t\t\t\t);\n\t\t\t\t\tfor (const expandedItem of expanded) {\n\t\t\t\t\t\tconst expandedId = expandedItem.id;\n\t\t\t\t\t\tif (expandedId <= 0 || timelineSeen.has(expandedId)) continue;\n\t\t\t\t\t\ttimelineSeen.add(expandedId);\n\t\t\t\t\t\ttimelineItems.push(expandedItem);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (missingNotFound.length > 0) {\n\t\t\t\t\terrors.push({\n\t\t\t\t\t\tcode: \"NOT_FOUND\",\n\t\t\t\t\t\tfield: \"ids\",\n\t\t\t\t\t\tmessage: \"some requested ids were not found\",\n\t\t\t\t\t\tids: missingNotFound,\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\tif (missingProjectMismatch.length > 0) {\n\t\t\t\t\terrors.push({\n\t\t\t\t\t\tcode: \"PROJECT_MISMATCH\",\n\t\t\t\t\t\tfield: \"project\",\n\t\t\t\t\t\tmessage: \"some requested ids are outside the requested project scope\",\n\t\t\t\t\t\tids: missingProjectMismatch,\n\t\t\t\t\t});\n\t\t\t\t}\n\n\t\t\t\t// Collect full observations if requested\n\t\t\t\tlet observations: MemoryItemResponse[] = [];\n\t\t\t\tif (args.include_observations) {\n\t\t\t\t\tconst observationSeen = new Set<number>();\n\t\t\t\t\tconst observationIds: number[] = [];\n\t\t\t\t\tfor (const item of [...anchors, ...timelineItems]) {\n\t\t\t\t\t\tif (item.id > 0 && !observationSeen.has(item.id)) {\n\t\t\t\t\t\t\tobservationSeen.add(item.id);\n\t\t\t\t\t\t\tobservationIds.push(item.id);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tobservations = getMany(store, observationIds);\n\t\t\t\t}\n\n\t\t\t\treturn jsonContent({\n\t\t\t\t\tanchors,\n\t\t\t\t\ttimeline: timelineItems,\n\t\t\t\t\tobservations,\n\t\t\t\t\tmissing_ids: orderedIds.filter(\n\t\t\t\t\t\t(memoryId: number) =>\n\t\t\t\t\t\t\tmissingNotFound.includes(memoryId) || missingProjectMismatch.includes(memoryId),\n\t\t\t\t\t),\n\t\t\t\t\terrors,\n\t\t\t\t\tmetadata: {\n\t\t\t\t\t\tproject: resolvedProject,\n\t\t\t\t\t\trequested_ids_count: orderedIds.length,\n\t\t\t\t\t\treturned_anchor_count: anchors.length,\n\t\t\t\t\t\ttimeline_count: timelineItems.length,\n\t\t\t\t\t\tinclude_observations: args.include_observations,\n\t\t\t\t\t},\n\t\t\t\t});\n\t\t\t} catch (err) {\n\t\t\t\treturn errorContent(err instanceof Error ? err.message : String(err));\n\t\t\t}\n\t\t},\n\t);\n\n\t// -------------------------------------------------------------------\n\t// 6. memory_get\n\t// -------------------------------------------------------------------\n\tserver.tool(\n\t\t\"memory_get\",\n\t\t\"Fetch a single memory item by ID.\",\n\t\t{\n\t\t\tmemory_id: z.number().int().describe(\"Memory ID\"),\n\t\t},\n\t\tasync (args) => {\n\t\t\ttry {\n\t\t\t\tconst item = store.get(args.memory_id);\n\t\t\t\tif (!item) return errorContent(\"not_found\");\n\t\t\t\treturn jsonContent(item);\n\t\t\t} catch (err) {\n\t\t\t\treturn errorContent(err instanceof Error ? err.message : String(err));\n\t\t\t}\n\t\t},\n\t);\n\n\t// -------------------------------------------------------------------\n\t// 7. memory_get_observations\n\t// -------------------------------------------------------------------\n\tserver.tool(\n\t\t\"memory_get_observations\",\n\t\t\"Fetch multiple memory items by their IDs.\",\n\t\t{\n\t\t\tids: z.array(z.number().int()).max(200).describe(\"Memory IDs to fetch\"),\n\t\t},\n\t\tasync (args) => {\n\t\t\ttry {\n\t\t\t\tconst items = getMany(store, args.ids);\n\t\t\t\treturn jsonContent({ items });\n\t\t\t} catch (err) {\n\t\t\t\treturn errorContent(err instanceof Error ? err.message : String(err));\n\t\t\t}\n\t\t},\n\t);\n\n\t// -------------------------------------------------------------------\n\t// 8. memory_recent\n\t// -------------------------------------------------------------------\n\tserver.tool(\n\t\t\"memory_recent\",\n\t\t\"Return recent memories, newest first.\",\n\t\t{\n\t\t\tlimit: z.number().int().min(1).max(100).default(8).describe(\"Max results\"),\n\t\t\t...filterSchema,\n\t\t},\n\t\tasync (args) => {\n\t\t\ttry {\n\t\t\t\tconst filters = buildFilters(args);\n\t\t\t\tconst items = store.recent(args.limit, filters);\n\t\t\t\treturn jsonContent({ items });\n\t\t\t} catch (err) {\n\t\t\t\treturn errorContent(err instanceof Error ? err.message : String(err));\n\t\t\t}\n\t\t},\n\t);\n\n\t// -------------------------------------------------------------------\n\t// 9. memory_pack\n\t// -------------------------------------------------------------------\n\tserver.tool(\n\t\t\"memory_pack\",\n\t\t\"Build a formatted memory pack from search results — quick one-shot context block.\",\n\t\t{\n\t\t\tcontext: z.string().describe(\"Context description to search for\"),\n\t\t\tlimit: z.number().int().min(1).max(50).optional().describe(\"Max items to include\"),\n\t\t\t...filterSchema,\n\t\t},\n\t\tasync (args) => {\n\t\t\ttry {\n\t\t\t\tconst filters = buildFilters(args);\n\t\t\t\tconst result = await store.buildMemoryPackAsync(\n\t\t\t\t\targs.context,\n\t\t\t\t\targs.limit ?? undefined,\n\t\t\t\t\tnull,\n\t\t\t\t\tfilters,\n\t\t\t\t);\n\t\t\t\treturn jsonContent(result);\n\t\t\t} catch (err) {\n\t\t\t\treturn errorContent(err instanceof Error ? err.message : String(err));\n\t\t\t}\n\t\t},\n\t);\n\n\t// -------------------------------------------------------------------\n\t// 10. memory_remember\n\t// -------------------------------------------------------------------\n\tserver.tool(\n\t\t\"memory_remember\",\n\t\t\"Create a new memory. Use for milestones, decisions, and notable facts.\",\n\t\t{\n\t\t\tkind: z\n\t\t\t\t.enum([\"discovery\", \"change\", \"feature\", \"bugfix\", \"refactor\", \"decision\", \"exploration\"])\n\t\t\t\t.describe(\"Memory kind\"),\n\t\t\ttitle: z.string().describe(\"Short title\"),\n\t\t\tbody: z.string().describe(\"Body text (high-signal content)\"),\n\t\t\tconfidence: z.number().min(0).max(1).default(0.5).describe(\"Confidence 0-1\"),\n\t\t\tproject: z.string().optional().describe(\"Project identifier\"),\n\t\t},\n\t\tasync (args) => {\n\t\t\ttry {\n\t\t\t\t// Create a transient session + memory in a transaction for atomicity.\n\t\t\t\t// TS store doesn't have startSession/endSession yet, so\n\t\t\t\t// we insert the session row directly. Wrapped in transaction to\n\t\t\t\t// prevent orphaned sessions if remember() fails.\n\t\t\t\tconst result = store.db.transaction(() => {\n\t\t\t\t\tconst now = nowIso();\n\t\t\t\t\tconst user = process.env.USER ?? \"unknown\";\n\t\t\t\t\tconst cwd = process.cwd();\n\t\t\t\t\tconst project = args.project ?? process.env.CODEMEM_PROJECT ?? null;\n\n\t\t\t\t\tconst sessionInfo = store.db\n\t\t\t\t\t\t.prepare(\n\t\t\t\t\t\t\t`INSERT INTO sessions(started_at, ended_at, cwd, project, user, tool_version, metadata_json)\n\t\t\t\t\t\t\t VALUES (?, ?, ?, ?, ?, ?, ?)`,\n\t\t\t\t\t\t)\n\t\t\t\t\t\t.run(now, now, cwd, project, user, \"mcp-ts\", toJson({ mcp: true }));\n\t\t\t\t\tconst sessionId = Number(sessionInfo.lastInsertRowid);\n\n\t\t\t\t\tconst memId = store.remember(\n\t\t\t\t\t\tsessionId,\n\t\t\t\t\t\targs.kind,\n\t\t\t\t\t\targs.title,\n\t\t\t\t\t\targs.body,\n\t\t\t\t\t\targs.confidence,\n\t\t\t\t\t);\n\n\t\t\t\t\t// End the session\n\t\t\t\t\tstore.db\n\t\t\t\t\t\t.prepare(\"UPDATE sessions SET ended_at = ?, metadata_json = ? WHERE id = ?\")\n\t\t\t\t\t\t.run(nowIso(), toJson({ mcp: true }), sessionId);\n\n\t\t\t\t\treturn memId;\n\t\t\t\t})();\n\n\t\t\t\treturn jsonContent({ id: result });\n\t\t\t} catch (err) {\n\t\t\t\treturn errorContent(err instanceof Error ? err.message : String(err));\n\t\t\t}\n\t\t},\n\t);\n\n\t// -------------------------------------------------------------------\n\t// 11. memory_forget\n\t// -------------------------------------------------------------------\n\tserver.tool(\n\t\t\"memory_forget\",\n\t\t\"Soft-delete a memory item. Use for incorrect or sensitive data.\",\n\t\t{\n\t\t\tmemory_id: z.number().int().describe(\"Memory ID to forget\"),\n\t\t},\n\t\tasync (args) => {\n\t\t\ttry {\n\t\t\t\tstore.forget(args.memory_id);\n\t\t\t\treturn jsonContent({ status: \"ok\" });\n\t\t\t} catch (err) {\n\t\t\t\treturn errorContent(err instanceof Error ? err.message : String(err));\n\t\t\t}\n\t\t},\n\t);\n\n\t// -------------------------------------------------------------------\n\t// 12. memory_schema\n\t// -------------------------------------------------------------------\n\tserver.tool(\n\t\t\"memory_schema\",\n\t\t\"Return the memory schema — kinds, fields, and available filters.\",\n\t\t{},\n\t\tasync () => {\n\t\t\treturn jsonContent({\n\t\t\t\tkinds: Object.keys(MEMORY_KINDS),\n\t\t\t\tkind_descriptions: MEMORY_KINDS,\n\t\t\t\tfields: {\n\t\t\t\t\ttitle: \"short text\",\n\t\t\t\t\tbody: \"long text\",\n\t\t\t\t\tsubtitle: \"short text\",\n\t\t\t\t\tfacts: \"list<string>\",\n\t\t\t\t\tnarrative: \"long text\",\n\t\t\t\t\tconcepts: \"list<string>\",\n\t\t\t\t\tfiles_read: \"list<string>\",\n\t\t\t\t\tfiles_modified: \"list<string>\",\n\t\t\t\t\tprompt_number: \"int\",\n\t\t\t\t},\n\t\t\t\tfilters: [\n\t\t\t\t\t\"kind\",\n\t\t\t\t\t\"session_id\",\n\t\t\t\t\t\"since\",\n\t\t\t\t\t\"project\",\n\t\t\t\t\t\"include_actor_ids\",\n\t\t\t\t\t\"exclude_actor_ids\",\n\t\t\t\t\t\"include_visibility\",\n\t\t\t\t\t\"exclude_visibility\",\n\t\t\t\t\t\"include_workspace_ids\",\n\t\t\t\t\t\"exclude_workspace_ids\",\n\t\t\t\t\t\"include_workspace_kinds\",\n\t\t\t\t\t\"exclude_workspace_kinds\",\n\t\t\t\t],\n\t\t\t});\n\t\t},\n\t);\n\n\t// -------------------------------------------------------------------\n\t// 13. memory_learn\n\t// -------------------------------------------------------------------\n\tserver.tool(\n\t\t\"memory_learn\",\n\t\t\"Learn how to use codemem memory tools. Call this first if unfamiliar.\",\n\t\t{},\n\t\tasync () => {\n\t\t\treturn jsonContent({\n\t\t\t\tintro: \"Use this tool when you're new to codemem or unsure when to recall/persist.\",\n\t\t\t\tclient_hint: \"If you are unfamiliar with codemem, call memory.learn first.\",\n\t\t\t\trecall: {\n\t\t\t\t\twhen: [\n\t\t\t\t\t\t\"Start of a task or when the user references prior work.\",\n\t\t\t\t\t\t\"When you need background context, decisions, or recent changes.\",\n\t\t\t\t\t],\n\t\t\t\t\thow: [\n\t\t\t\t\t\t\"Use memory.search_index to get compact candidates.\",\n\t\t\t\t\t\t\"Use memory.timeline to expand around a promising memory.\",\n\t\t\t\t\t\t\"Use memory.get_observations for full details only when needed.\",\n\t\t\t\t\t\t\"Use memory.pack for quick one-shot context blocks.\",\n\t\t\t\t\t\t\"Use the project filter unless the user requests cross-project context.\",\n\t\t\t\t\t],\n\t\t\t\t\texamples: [\n\t\t\t\t\t\t'memory.search_index(\"billing cache bug\", limit=5)',\n\t\t\t\t\t\t\"memory.timeline(memory_id=123)\",\n\t\t\t\t\t\t\"memory.get_observations([123, 456])\",\n\t\t\t\t\t],\n\t\t\t\t},\n\t\t\t\tpersistence: {\n\t\t\t\t\twhen: [\n\t\t\t\t\t\t\"Milestones (task done, key decision, new facts learned).\",\n\t\t\t\t\t\t\"Notable regressions or follow-ups that should be remembered.\",\n\t\t\t\t\t],\n\t\t\t\t\thow: [\n\t\t\t\t\t\t\"Use memory.remember with kind decision/observation/note.\",\n\t\t\t\t\t\t\"Keep titles short and bodies high-signal.\",\n\t\t\t\t\t\t\"ALWAYS pass the project parameter if known.\",\n\t\t\t\t\t],\n\t\t\t\t\texamples: [\n\t\t\t\t\t\t'memory.remember(kind=\"decision\", title=\"Switch to async cache\", body=\"...why...\", project=\"my-service\")',\n\t\t\t\t\t\t'memory.remember(kind=\"observation\", title=\"Fixed retry loop\", body=\"...impact...\", project=\"my-service\")',\n\t\t\t\t\t],\n\t\t\t\t},\n\t\t\t\tforget: {\n\t\t\t\t\twhen: [\n\t\t\t\t\t\t\"Accidental or sensitive data stored in memory items.\",\n\t\t\t\t\t\t\"Obsolete or incorrect items that should no longer surface.\",\n\t\t\t\t\t],\n\t\t\t\t\thow: [\n\t\t\t\t\t\t\"Call memory.forget(id) to mark the item inactive.\",\n\t\t\t\t\t\t\"Prefer forgetting over overwriting to preserve auditability.\",\n\t\t\t\t\t],\n\t\t\t\t\texamples: [\"memory.forget(123)\"],\n\t\t\t\t},\n\t\t\t\tprompt_hint:\n\t\t\t\t\t\"At task start: call memory.search_index; during work: memory.timeline + memory.get_observations; at milestones: memory.remember.\",\n\t\t\t\trecommended_system_prompt: [\n\t\t\t\t\t\"Trigger policy (1-liner): If the user references prior work or starts a task,\",\n\t\t\t\t\t\"immediately call memory.search_index; then use memory.timeline + memory.get_observations;\",\n\t\t\t\t\t\"at milestones, call memory.remember; use memory.forget for incorrect/sensitive items.\",\n\t\t\t\t\t\"\",\n\t\t\t\t\t\"System prompt:\",\n\t\t\t\t\t\"You have access to codemem MCP tools. If unfamiliar, call memory.learn first.\",\n\t\t\t\t\t\"\",\n\t\t\t\t\t\"Recall:\",\n\t\t\t\t\t\"- Start of any task: call memory.search_index with a concise task query.\",\n\t\t\t\t\t'- If prior work is referenced (\"as before\", \"last time\", \"we already did…\", \"regression\"),',\n\t\t\t\t\t\" call memory.search_index or memory.timeline.\",\n\t\t\t\t\t\"- Use memory.get_observations only after filtering IDs.\",\n\t\t\t\t\t\"- Prefer project-scoped queries unless the user asks for cross-project.\",\n\t\t\t\t\t\"\",\n\t\t\t\t\t\"Persistence:\",\n\t\t\t\t\t\"- On milestones (task done, key decision, new facts learned), call memory.remember.\",\n\t\t\t\t\t\"- Use kind=decision for tradeoffs, kind=observation for outcomes, kind=note for small useful facts.\",\n\t\t\t\t\t\"- Keep titles short and bodies high-signal.\",\n\t\t\t\t\t\"- ALWAYS pass the project parameter if known.\",\n\t\t\t\t\t\"\",\n\t\t\t\t\t\"Safety:\",\n\t\t\t\t\t\"- Use memory.forget(id) for incorrect or sensitive items.\",\n\t\t\t\t\t\"\",\n\t\t\t\t\t\"Examples:\",\n\t\t\t\t\t'- memory.search_index(\"billing cache bug\")',\n\t\t\t\t\t\"- memory.timeline(memory_id=123)\",\n\t\t\t\t\t\"- memory.get_observations([123, 456])\",\n\t\t\t\t\t'- memory.remember(kind=\"decision\", title=\"Use async cache\", body=\"Chose async cache to avoid lock contention in X.\", project=\"my-service\")',\n\t\t\t\t\t'- memory.remember(kind=\"observation\", title=\"Fixed retry loop\", body=\"Root cause was Y; added guard in Z.\", project=\"my-service\")',\n\t\t\t\t\t\"- memory.forget(123)\",\n\t\t\t\t].join(\"\\n\"),\n\t\t\t});\n\t\t},\n\t);\n\n\t// -------------------------------------------------------------------\n\t// Connect and handle shutdown\n\t// -------------------------------------------------------------------\n\tconst transport = new StdioServerTransport();\n\n\tconst shutdown = () => {\n\t\ttry {\n\t\t\tstore.close();\n\t\t} catch {\n\t\t\t// Best effort — process is exiting\n\t\t}\n\t\tprocess.exit(0);\n\t};\n\n\tprocess.on(\"SIGINT\", shutdown);\n\tprocess.on(\"SIGTERM\", shutdown);\n\n\tawait server.connect(transport);\n}\n\nmain().catch((err) => {\n\tconsole.error(\"codemem MCP server failed to start:\", err);\n\tprocess.exit(1);\n});\n"],"mappings":";;;;;;AAEA,SAAgB,wBAAuC;AAEtD,QADgB,QAAQ,IAAI,iBAAiB,MAAM,IACjC,eAAe,QAAQ,KAAK,CAAC;;AAGhD,SAAgB,aACf,KACA,iBAAiB,uBAAuB,EACZ;CAC5B,MAAM,UAAyB,EAAE;CACjC,IAAI,SAAS;CAGb,MAAM,mBADkB,OAAO,IAAI,YAAY,WAAW,IAAI,QAAQ,MAAM,GAAG,KAAA,MACpC,kBAAkB,KAAA;AAC7D,KAAI,iBAAiB;AACpB,UAAQ,UAAU;AAClB,WAAS;;AAGV,MAAK,MAAM,OAAO;EACjB;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;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OAAO,KAAK,UAAU;AAC5B,UAAO,YAAY,EAAE,QAAQ,MAAM,CAAC;WAC5B,KAAK;AACb,UAAO,aAAa,eAAe,QAAQ,IAAI,UAAU,OAAO,IAAI,CAAC;;GAGvE;AAKD,QAAO,KACN,iBACA,oEACA,EAAE,EACF,YAAY;AACX,SAAO,YAAY;GAClB,OAAO,OAAO,KAAK,aAAa;GAChC,mBAAmB;GACnB,QAAQ;IACP,OAAO;IACP,MAAM;IACN,UAAU;IACV,OAAO;IACP,WAAW;IACX,UAAU;IACV,YAAY;IACZ,gBAAgB;IAChB,eAAe;IACf;GACD,SAAS;IACR;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;GACD,CAAC;GAEH;AAKD,QAAO,KACN,gBACA,yEACA,EAAE,EACF,YAAY;AACX,SAAO,YAAY;GAClB,OAAO;GACP,aAAa;GACb,QAAQ;IACP,MAAM,CACL,2DACA,kEACA;IACD,KAAK;KACJ;KACA;KACA;KACA;KACA;KACA;IACD,UAAU;KACT;KACA;KACA;KACA;IACD;GACD,aAAa;IACZ,MAAM,CACL,4DACA,+DACA;IACD,KAAK;KACJ;KACA;KACA;KACA;IACD,UAAU,CACT,mHACA,mHACA;IACD;GACD,QAAQ;IACP,MAAM,CACL,wDACA,6DACA;IACD,KAAK,CACJ,qDACA,+DACA;IACD,UAAU,CAAC,qBAAqB;IAChC;GACD,aACC;GACD,2BAA2B;IAC1B;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA,CAAC,KAAK,KAAK;GACZ,CAAC;GAEH;CAKD,MAAM,YAAY,IAAI,sBAAsB;CAE5C,MAAM,iBAAiB;AACtB,MAAI;AACH,SAAM,OAAO;UACN;AAGR,UAAQ,KAAK,EAAE;;AAGhB,SAAQ,GAAG,UAAU,SAAS;AAC9B,SAAQ,GAAG,WAAW,SAAS;AAE/B,OAAM,OAAO,QAAQ,UAAU;;AAGhC,MAAM,CAAC,OAAO,QAAQ;AACrB,SAAQ,MAAM,uCAAuC,IAAI;AACzD,SAAQ,KAAK,EAAE;EACd"}
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../src/project-scope.ts","../src/index.ts"],"sourcesContent":["import { type MemoryFilters, resolveProject } from \"@codemem/core\";\n\nexport function resolveDefaultProject(): string | null {\n\tconst project = process.env.CODEMEM_PROJECT?.trim();\n\treturn project || resolveProject(process.cwd());\n}\n\nexport function buildFilters(\n\traw: Record<string, unknown>,\n\tdefaultProject = resolveDefaultProject(),\n): MemoryFilters | undefined {\n\tconst filters: MemoryFilters = {};\n\tlet hasAny = false;\n\n\tconst explicitProject = typeof raw.project === \"string\" ? raw.project.trim() : undefined;\n\tconst resolvedProject = explicitProject || defaultProject || undefined;\n\tif (resolvedProject) {\n\t\tfilters.project = resolvedProject;\n\t\thasAny = true;\n\t}\n\n\tfor (const key of [\n\t\t\"kind\",\n\t\t\"visibility\",\n\t\t\"include_visibility\",\n\t\t\"exclude_visibility\",\n\t\t\"include_workspace_ids\",\n\t\t\"exclude_workspace_ids\",\n\t\t\"include_workspace_kinds\",\n\t\t\"exclude_workspace_kinds\",\n\t\t\"include_actor_ids\",\n\t\t\"exclude_actor_ids\",\n\t\t\"include_trust_states\",\n\t\t\"exclude_trust_states\",\n\t\t\"ownership_scope\",\n\t\t\"personal_first\",\n\t\t\"trust_bias\",\n\t\t\"widen_shared_when_weak\",\n\t\t\"widen_shared_min_personal_results\",\n\t\t\"widen_shared_min_personal_score\",\n\t] as const) {\n\t\tconst val = raw[key];\n\t\tif (val !== undefined && val !== null) {\n\t\t\t(filters as Record<string, unknown>)[key] = val;\n\t\t\thasAny = true;\n\t\t}\n\t}\n\n\treturn hasAny ? filters : undefined;\n}\n","#!/usr/bin/env node\n\n/**\n * @codemem/mcp — MCP stdio server.\n *\n * Runs as a separate process spawned by the host (OpenCode/Claude).\n * Owns its own better-sqlite3 connection. Communicates via stdio JSON-RPC.\n *\n * Port of codemem/mcp_server.py — all 13 tools.\n */\n\nimport {\n\tdedupeOrderedIds,\n\ttype MemoryItemResponse,\n\ttype MemoryResult,\n\tMemoryStore,\n\tprojectClause,\n\tresolveDbPath,\n\tstoreVectors,\n\ttoJson,\n\tVERSION,\n} from \"@codemem/core\";\nimport { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\";\nimport { StdioServerTransport } from \"@modelcontextprotocol/sdk/server/stdio.js\";\nimport { z } from \"zod\";\nimport { buildFilters, resolveDefaultProject } from \"./project-scope.js\";\n\n// ---------------------------------------------------------------------------\n// Static data\n// ---------------------------------------------------------------------------\n\nconst MEMORY_KINDS: Record<string, string> = {\n\tdiscovery: \"Something learned about the codebase, architecture, or tools\",\n\tchange: \"A code change that was made\",\n\tfeature: \"A new feature that was implemented\",\n\tbugfix: \"A bug that was found and fixed\",\n\trefactor: \"Code that was refactored or restructured\",\n\tdecision: \"A design or architecture decision\",\n\texploration: \"An experiment or investigation (may not have shipped)\",\n};\n\n// ---------------------------------------------------------------------------\n// Shared zod filter schema (spread into each tool that accepts filters)\n// ---------------------------------------------------------------------------\n\nconst filterSchema = {\n\tkind: z.string().optional().describe(\"Filter by memory kind\"),\n\tproject: z.string().optional().describe(\"Filter by project scope (matches sessions.project)\"),\n\tvisibility: z.array(z.string()).optional(),\n\tinclude_visibility: z.array(z.string()).optional(),\n\texclude_visibility: z.array(z.string()).optional(),\n\tinclude_workspace_ids: z.array(z.string()).optional(),\n\texclude_workspace_ids: z.array(z.string()).optional(),\n\tinclude_workspace_kinds: z.array(z.string()).optional(),\n\texclude_workspace_kinds: z.array(z.string()).optional(),\n\tinclude_actor_ids: z.array(z.string()).optional(),\n\texclude_actor_ids: z.array(z.string()).optional(),\n\tinclude_trust_states: z.array(z.string()).optional(),\n\texclude_trust_states: z.array(z.string()).optional(),\n\townership_scope: z.string().optional(),\n\tpersonal_first: z.union([z.boolean(), z.string()]).optional(),\n\ttrust_bias: z.string().optional(),\n\twiden_shared_when_weak: z.union([z.boolean(), z.string()]).optional(),\n\twiden_shared_min_personal_results: z.number().int().optional(),\n\twiden_shared_min_personal_score: z.number().optional(),\n};\n\n// ---------------------------------------------------------------------------\n// Helpers\n// ---------------------------------------------------------------------------\n\nconst defaultProject = resolveDefaultProject();\n\n/** Wrap a JSON result into the MCP text content envelope. */\nfunction jsonContent(data: unknown) {\n\treturn { content: [{ type: \"text\" as const, text: JSON.stringify(data) }] };\n}\n\n/** Wrap an error message into the MCP text content envelope. */\nfunction errorContent(message: string) {\n\treturn { content: [{ type: \"text\" as const, text: JSON.stringify({ error: message }) }] };\n}\n\n/** ISO timestamp. */\nfunction nowIso(): string {\n\treturn new Date().toISOString();\n}\n\n/**\n * Fetch multiple memory items by ID. Returns items in ID order, skipping\n * missing IDs. Implemented directly since MemoryStore doesn't have getMany.\n */\nfunction getMany(store: MemoryStore, ids: number[]): MemoryItemResponse[] {\n\tif (ids.length === 0) return [];\n\tconst results: MemoryItemResponse[] = [];\n\tfor (const id of ids) {\n\t\tconst item = store.get(id);\n\t\tif (item) results.push(item);\n\t}\n\treturn results;\n}\n\n// ---------------------------------------------------------------------------\n// Server bootstrap\n// ---------------------------------------------------------------------------\n\nasync function main() {\n\tconst dbPath = resolveDbPath();\n\tconst store = new MemoryStore(dbPath);\n\n\tconst server = new McpServer({ name: \"codemem\", version: VERSION });\n\n\t// -------------------------------------------------------------------\n\t// 1. memory_search\n\t// -------------------------------------------------------------------\n\tserver.tool(\n\t\t\"memory_search\",\n\t\t\"Search memories by text query. Returns full body text for each match.\",\n\t\t{\n\t\t\tquery: z.string().describe(\"Search query\"),\n\t\t\tlimit: z.number().int().min(1).max(50).default(5).describe(\"Max results\"),\n\t\t\t...filterSchema,\n\t\t},\n\t\tasync (args) => {\n\t\t\ttry {\n\t\t\t\tconst filters = buildFilters(args);\n\t\t\t\tconst items = store.search(args.query, args.limit, filters);\n\t\t\t\treturn jsonContent({\n\t\t\t\t\titems: items.map((m: MemoryResult) => ({\n\t\t\t\t\t\tid: m.id,\n\t\t\t\t\t\ttitle: m.title,\n\t\t\t\t\t\tkind: m.kind,\n\t\t\t\t\t\tbody: m.body_text,\n\t\t\t\t\t\tconfidence: m.confidence,\n\t\t\t\t\t\tscore: m.score,\n\t\t\t\t\t\tsession_id: m.session_id,\n\t\t\t\t\t\tmetadata: m.metadata,\n\t\t\t\t\t})),\n\t\t\t\t});\n\t\t\t} catch (err) {\n\t\t\t\treturn errorContent(err instanceof Error ? err.message : String(err));\n\t\t\t}\n\t\t},\n\t);\n\n\t// -------------------------------------------------------------------\n\t// 2. memory_search_index\n\t// -------------------------------------------------------------------\n\tserver.tool(\n\t\t\"memory_search_index\",\n\t\t\"Search memories by text query. Returns compact index entries (no body) for browsing.\",\n\t\t{\n\t\t\tquery: z.string().describe(\"Search query\"),\n\t\t\tlimit: z.number().int().min(1).max(50).default(8).describe(\"Max results\"),\n\t\t\t...filterSchema,\n\t\t},\n\t\tasync (args) => {\n\t\t\ttry {\n\t\t\t\tconst filters = buildFilters(args);\n\t\t\t\tconst items = store.search(args.query, args.limit, filters);\n\t\t\t\treturn jsonContent({\n\t\t\t\t\titems: items.map((m: MemoryResult) => ({\n\t\t\t\t\t\tid: m.id,\n\t\t\t\t\t\tkind: m.kind,\n\t\t\t\t\t\ttitle: m.title,\n\t\t\t\t\t\tscore: m.score,\n\t\t\t\t\t\tcreated_at: m.created_at,\n\t\t\t\t\t\tsession_id: m.session_id,\n\t\t\t\t\t\tmetadata: m.metadata,\n\t\t\t\t\t})),\n\t\t\t\t});\n\t\t\t} catch (err) {\n\t\t\t\treturn errorContent(err instanceof Error ? err.message : String(err));\n\t\t\t}\n\t\t},\n\t);\n\n\t// -------------------------------------------------------------------\n\t// 3. memory_timeline\n\t// -------------------------------------------------------------------\n\tserver.tool(\n\t\t\"memory_timeline\",\n\t\t\"Get a chronological window of memories around an anchor (by ID or query).\",\n\t\t{\n\t\t\tquery: z.string().optional().describe(\"Search query to find anchor\"),\n\t\t\tmemory_id: z.number().int().optional().describe(\"Anchor memory ID\"),\n\t\t\tdepth_before: z.number().int().min(0).default(3).describe(\"Items before anchor\"),\n\t\t\tdepth_after: z.number().int().min(0).default(3).describe(\"Items after anchor\"),\n\t\t\t...filterSchema,\n\t\t},\n\t\tasync (args) => {\n\t\t\ttry {\n\t\t\t\tconst filters = buildFilters(args);\n\t\t\t\tconst items = store.timeline(\n\t\t\t\t\targs.query ?? null,\n\t\t\t\t\targs.memory_id ?? null,\n\t\t\t\t\targs.depth_before,\n\t\t\t\t\targs.depth_after,\n\t\t\t\t\tfilters,\n\t\t\t\t);\n\t\t\t\treturn jsonContent({ items });\n\t\t\t} catch (err) {\n\t\t\t\treturn errorContent(err instanceof Error ? err.message : String(err));\n\t\t\t}\n\t\t},\n\t);\n\n\t// -------------------------------------------------------------------\n\t// 4. memory_explain\n\t// -------------------------------------------------------------------\n\tserver.tool(\n\t\t\"memory_explain\",\n\t\t\"Explain search results with detailed scoring breakdown.\",\n\t\t{\n\t\t\tquery: z.string().optional().describe(\"Search query\"),\n\t\t\tids: z.array(z.number().int()).max(200).optional().describe(\"Specific memory IDs to explain\"),\n\t\t\tlimit: z.number().int().min(1).max(50).default(10).describe(\"Max results\"),\n\t\t\tinclude_pack_context: z.boolean().default(false).describe(\"Include formatted pack context\"),\n\t\t\t...filterSchema,\n\t\t},\n\t\tasync (args) => {\n\t\t\ttry {\n\t\t\t\tconst filters = buildFilters(args);\n\t\t\t\tconst result = store.explain(args.query ?? null, args.ids ?? null, args.limit, filters, {\n\t\t\t\t\tincludePackContext: args.include_pack_context,\n\t\t\t\t});\n\t\t\t\treturn jsonContent(result);\n\t\t\t} catch (err) {\n\t\t\t\treturn errorContent(err instanceof Error ? err.message : String(err));\n\t\t\t}\n\t\t},\n\t);\n\n\t// -------------------------------------------------------------------\n\t// 5. memory_expand\n\t// -------------------------------------------------------------------\n\tserver.tool(\n\t\t\"memory_expand\",\n\t\t\"Fetch memories by ID with surrounding timeline context.\",\n\t\t{\n\t\t\tids: z\n\t\t\t\t.array(z.union([z.number(), z.string()]))\n\t\t\t\t.max(200)\n\t\t\t\t.describe(\"Memory IDs to expand\"),\n\t\t\tdepth_before: z.number().int().min(0).default(3).describe(\"Timeline items before\"),\n\t\t\tdepth_after: z.number().int().min(0).default(3).describe(\"Timeline items after\"),\n\t\t\tinclude_observations: z.boolean().default(false).describe(\"Include full observation details\"),\n\t\t\tproject: z.string().optional().describe(\"Project scope filter\"),\n\t\t},\n\t\tasync (args) => {\n\t\t\ttry {\n\t\t\t\t// Python: project if project is not None else default_project\n\t\t\t\t// Explicit \"\" clears project scoping; only fall back to default when undefined.\n\t\t\t\tconst resolvedProject =\n\t\t\t\t\targs.project !== undefined ? args.project.trim() || null : defaultProject || null;\n\t\t\t\tconst filters = resolvedProject ? { project: resolvedProject } : undefined;\n\t\t\t\tconst { clause: projectFilterClause, params: projectFilterParams } = resolvedProject\n\t\t\t\t\t? projectClause(resolvedProject)\n\t\t\t\t\t: { clause: \"\", params: [] as string[] };\n\t\t\t\tconst { ordered: orderedIds, invalid: invalidIds } = dedupeOrderedIds(args.ids);\n\t\t\t\tconst errors: Array<Record<string, unknown>> = [];\n\n\t\t\t\tif (invalidIds.length > 0) {\n\t\t\t\t\terrors.push({\n\t\t\t\t\t\tcode: \"INVALID_ARGUMENT\",\n\t\t\t\t\t\tfield: \"ids\",\n\t\t\t\t\t\tmessage: \"some ids are not valid integers\",\n\t\t\t\t\t\tids: invalidIds,\n\t\t\t\t\t});\n\t\t\t\t}\n\n\t\t\t\tconst missingNotFound: number[] = [];\n\t\t\t\tconst missingProjectMismatch: number[] = [];\n\t\t\t\tconst anchors: MemoryItemResponse[] = [];\n\t\t\t\tconst timelineItems: MemoryItemResponse[] = [];\n\t\t\t\tconst timelineSeen = new Set<number>();\n\t\t\t\tconst sessionScopeMatches = new Map<number, boolean>();\n\n\t\t\t\tfor (const memoryId of orderedIds) {\n\t\t\t\t\tconst item = store.get(memoryId);\n\t\t\t\t\tif (!item || !item.active) {\n\t\t\t\t\t\tmissingNotFound.push(memoryId);\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\n\t\t\t\t\tconst sessionId = item.session_id;\n\t\t\t\t\tif (resolvedProject && projectFilterClause && sessionId > 0) {\n\t\t\t\t\t\tif (!sessionScopeMatches.has(sessionId)) {\n\t\t\t\t\t\t\tconst row = store.db\n\t\t\t\t\t\t\t\t.prepare(`SELECT 1 FROM sessions WHERE id = ? AND ${projectFilterClause}`)\n\t\t\t\t\t\t\t\t.get(sessionId, ...projectFilterParams);\n\t\t\t\t\t\t\tsessionScopeMatches.set(sessionId, row != null);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (!sessionScopeMatches.get(sessionId)) {\n\t\t\t\t\t\t\tmissingProjectMismatch.push(memoryId);\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\t\t\t\t\t} else if (resolvedProject && projectFilterClause && sessionId <= 0) {\n\t\t\t\t\t\tmissingProjectMismatch.push(memoryId);\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\n\t\t\t\t\tanchors.push(item);\n\n\t\t\t\t\tconst expanded = store.timeline(\n\t\t\t\t\t\tnull,\n\t\t\t\t\t\tmemoryId,\n\t\t\t\t\t\targs.depth_before,\n\t\t\t\t\t\targs.depth_after,\n\t\t\t\t\t\tfilters,\n\t\t\t\t\t);\n\t\t\t\t\tfor (const expandedItem of expanded) {\n\t\t\t\t\t\tconst expandedId = expandedItem.id;\n\t\t\t\t\t\tif (expandedId <= 0 || timelineSeen.has(expandedId)) continue;\n\t\t\t\t\t\ttimelineSeen.add(expandedId);\n\t\t\t\t\t\ttimelineItems.push(expandedItem);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (missingNotFound.length > 0) {\n\t\t\t\t\terrors.push({\n\t\t\t\t\t\tcode: \"NOT_FOUND\",\n\t\t\t\t\t\tfield: \"ids\",\n\t\t\t\t\t\tmessage: \"some requested ids were not found\",\n\t\t\t\t\t\tids: missingNotFound,\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\tif (missingProjectMismatch.length > 0) {\n\t\t\t\t\terrors.push({\n\t\t\t\t\t\tcode: \"PROJECT_MISMATCH\",\n\t\t\t\t\t\tfield: \"project\",\n\t\t\t\t\t\tmessage: \"some requested ids are outside the requested project scope\",\n\t\t\t\t\t\tids: missingProjectMismatch,\n\t\t\t\t\t});\n\t\t\t\t}\n\n\t\t\t\t// Collect full observations if requested\n\t\t\t\tlet observations: MemoryItemResponse[] = [];\n\t\t\t\tif (args.include_observations) {\n\t\t\t\t\tconst observationSeen = new Set<number>();\n\t\t\t\t\tconst observationIds: number[] = [];\n\t\t\t\t\tfor (const item of [...anchors, ...timelineItems]) {\n\t\t\t\t\t\tif (item.id > 0 && !observationSeen.has(item.id)) {\n\t\t\t\t\t\t\tobservationSeen.add(item.id);\n\t\t\t\t\t\t\tobservationIds.push(item.id);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tobservations = getMany(store, observationIds);\n\t\t\t\t}\n\n\t\t\t\treturn jsonContent({\n\t\t\t\t\tanchors,\n\t\t\t\t\ttimeline: timelineItems,\n\t\t\t\t\tobservations,\n\t\t\t\t\tmissing_ids: orderedIds.filter(\n\t\t\t\t\t\t(memoryId: number) =>\n\t\t\t\t\t\t\tmissingNotFound.includes(memoryId) || missingProjectMismatch.includes(memoryId),\n\t\t\t\t\t),\n\t\t\t\t\terrors,\n\t\t\t\t\tmetadata: {\n\t\t\t\t\t\tproject: resolvedProject,\n\t\t\t\t\t\trequested_ids_count: orderedIds.length,\n\t\t\t\t\t\treturned_anchor_count: anchors.length,\n\t\t\t\t\t\ttimeline_count: timelineItems.length,\n\t\t\t\t\t\tinclude_observations: args.include_observations,\n\t\t\t\t\t},\n\t\t\t\t});\n\t\t\t} catch (err) {\n\t\t\t\treturn errorContent(err instanceof Error ? err.message : String(err));\n\t\t\t}\n\t\t},\n\t);\n\n\t// -------------------------------------------------------------------\n\t// 6. memory_get\n\t// -------------------------------------------------------------------\n\tserver.tool(\n\t\t\"memory_get\",\n\t\t\"Fetch a single memory item by ID.\",\n\t\t{\n\t\t\tmemory_id: z.number().int().describe(\"Memory ID\"),\n\t\t},\n\t\tasync (args) => {\n\t\t\ttry {\n\t\t\t\tconst item = store.get(args.memory_id);\n\t\t\t\tif (!item) return errorContent(\"not_found\");\n\t\t\t\treturn jsonContent(item);\n\t\t\t} catch (err) {\n\t\t\t\treturn errorContent(err instanceof Error ? err.message : String(err));\n\t\t\t}\n\t\t},\n\t);\n\n\t// -------------------------------------------------------------------\n\t// 7. memory_get_observations\n\t// -------------------------------------------------------------------\n\tserver.tool(\n\t\t\"memory_get_observations\",\n\t\t\"Fetch multiple memory items by their IDs.\",\n\t\t{\n\t\t\tids: z.array(z.number().int()).max(200).describe(\"Memory IDs to fetch\"),\n\t\t},\n\t\tasync (args) => {\n\t\t\ttry {\n\t\t\t\tconst items = getMany(store, args.ids);\n\t\t\t\treturn jsonContent({ items });\n\t\t\t} catch (err) {\n\t\t\t\treturn errorContent(err instanceof Error ? err.message : String(err));\n\t\t\t}\n\t\t},\n\t);\n\n\t// -------------------------------------------------------------------\n\t// 8. memory_recent\n\t// -------------------------------------------------------------------\n\tserver.tool(\n\t\t\"memory_recent\",\n\t\t\"Return recent memories, newest first.\",\n\t\t{\n\t\t\tlimit: z.number().int().min(1).max(100).default(8).describe(\"Max results\"),\n\t\t\t...filterSchema,\n\t\t},\n\t\tasync (args) => {\n\t\t\ttry {\n\t\t\t\tconst filters = buildFilters(args);\n\t\t\t\tconst items = store.recent(args.limit, filters);\n\t\t\t\treturn jsonContent({ items });\n\t\t\t} catch (err) {\n\t\t\t\treturn errorContent(err instanceof Error ? err.message : String(err));\n\t\t\t}\n\t\t},\n\t);\n\n\t// -------------------------------------------------------------------\n\t// 9. memory_pack\n\t// -------------------------------------------------------------------\n\tserver.tool(\n\t\t\"memory_pack\",\n\t\t\"Build a formatted memory pack from search results — quick one-shot context block.\",\n\t\t{\n\t\t\tcontext: z.string().describe(\"Context description to search for\"),\n\t\t\tlimit: z.number().int().min(1).max(50).optional().describe(\"Max items to include\"),\n\t\t\t...filterSchema,\n\t\t},\n\t\tasync (args) => {\n\t\t\ttry {\n\t\t\t\tconst filters = buildFilters(args);\n\t\t\t\tconst result = await store.buildMemoryPackAsync(\n\t\t\t\t\targs.context,\n\t\t\t\t\targs.limit ?? undefined,\n\t\t\t\t\tnull,\n\t\t\t\t\tfilters,\n\t\t\t\t);\n\t\t\t\treturn jsonContent(result);\n\t\t\t} catch (err) {\n\t\t\t\treturn errorContent(err instanceof Error ? err.message : String(err));\n\t\t\t}\n\t\t},\n\t);\n\n\t// -------------------------------------------------------------------\n\t// 10. memory_remember\n\t// -------------------------------------------------------------------\n\tserver.tool(\n\t\t\"memory_remember\",\n\t\t\"Create a new memory. Use for milestones, decisions, and notable facts.\",\n\t\t{\n\t\t\tkind: z\n\t\t\t\t.enum([\"discovery\", \"change\", \"feature\", \"bugfix\", \"refactor\", \"decision\", \"exploration\"])\n\t\t\t\t.describe(\"Memory kind\"),\n\t\t\ttitle: z.string().describe(\"Short title\"),\n\t\t\tbody: z.string().describe(\"Body text (high-signal content)\"),\n\t\t\tconfidence: z.number().min(0).max(1).default(0.5).describe(\"Confidence 0-1\"),\n\t\t\tproject: z.string().optional().describe(\"Project identifier\"),\n\t\t},\n\t\tasync (args) => {\n\t\t\ttry {\n\t\t\t\t// Create a transient session + memory in a transaction for atomicity.\n\t\t\t\t// TS store doesn't have startSession/endSession yet, so\n\t\t\t\t// we insert the session row directly. Wrapped in transaction to\n\t\t\t\t// prevent orphaned sessions if remember() fails.\n\t\t\t\tconst result = store.db.transaction(() => {\n\t\t\t\t\tconst now = nowIso();\n\t\t\t\t\tconst user = process.env.USER ?? \"unknown\";\n\t\t\t\t\tconst cwd = process.cwd();\n\t\t\t\t\tconst project = args.project ?? process.env.CODEMEM_PROJECT ?? null;\n\n\t\t\t\t\tconst sessionInfo = store.db\n\t\t\t\t\t\t.prepare(\n\t\t\t\t\t\t\t`INSERT INTO sessions(started_at, ended_at, cwd, project, user, tool_version, metadata_json)\n\t\t\t\t\t\t\t VALUES (?, ?, ?, ?, ?, ?, ?)`,\n\t\t\t\t\t\t)\n\t\t\t\t\t\t.run(now, now, cwd, project, user, \"mcp-ts\", toJson({ mcp: true }));\n\t\t\t\t\tconst sessionId = Number(sessionInfo.lastInsertRowid);\n\n\t\t\t\t\tconst memId = store.remember(\n\t\t\t\t\t\tsessionId,\n\t\t\t\t\t\targs.kind,\n\t\t\t\t\t\targs.title,\n\t\t\t\t\t\targs.body,\n\t\t\t\t\t\targs.confidence,\n\t\t\t\t\t);\n\n\t\t\t\t\t// End the session\n\t\t\t\t\tstore.db\n\t\t\t\t\t\t.prepare(\"UPDATE sessions SET ended_at = ?, metadata_json = ? WHERE id = ?\")\n\t\t\t\t\t\t.run(nowIso(), toJson({ mcp: true }), sessionId);\n\n\t\t\t\t\treturn { memId, title: args.title, body: args.body };\n\t\t\t\t})();\n\n\t\t\t\ttry {\n\t\t\t\t\tawait storeVectors(store.db, result.memId, result.title, result.body);\n\t\t\t\t} catch {\n\t\t\t\t\t// Non-fatal — memory writes should succeed even if embeddings are unavailable\n\t\t\t\t}\n\n\t\t\t\treturn jsonContent({ id: result.memId });\n\t\t\t} catch (err) {\n\t\t\t\treturn errorContent(err instanceof Error ? err.message : String(err));\n\t\t\t}\n\t\t},\n\t);\n\n\t// -------------------------------------------------------------------\n\t// 11. memory_forget\n\t// -------------------------------------------------------------------\n\tserver.tool(\n\t\t\"memory_forget\",\n\t\t\"Soft-delete a memory item. Use for incorrect or sensitive data.\",\n\t\t{\n\t\t\tmemory_id: z.number().int().describe(\"Memory ID to forget\"),\n\t\t},\n\t\tasync (args) => {\n\t\t\ttry {\n\t\t\t\tstore.forget(args.memory_id);\n\t\t\t\treturn jsonContent({ status: \"ok\" });\n\t\t\t} catch (err) {\n\t\t\t\treturn errorContent(err instanceof Error ? err.message : String(err));\n\t\t\t}\n\t\t},\n\t);\n\n\t// -------------------------------------------------------------------\n\t// 12. memory_schema\n\t// -------------------------------------------------------------------\n\tserver.tool(\n\t\t\"memory_schema\",\n\t\t\"Return the memory schema — kinds, fields, and available filters.\",\n\t\t{},\n\t\tasync () => {\n\t\t\treturn jsonContent({\n\t\t\t\tkinds: Object.keys(MEMORY_KINDS),\n\t\t\t\tkind_descriptions: MEMORY_KINDS,\n\t\t\t\tfields: {\n\t\t\t\t\ttitle: \"short text\",\n\t\t\t\t\tbody: \"long text\",\n\t\t\t\t\tsubtitle: \"short text\",\n\t\t\t\t\tfacts: \"list<string>\",\n\t\t\t\t\tnarrative: \"long text\",\n\t\t\t\t\tconcepts: \"list<string>\",\n\t\t\t\t\tfiles_read: \"list<string>\",\n\t\t\t\t\tfiles_modified: \"list<string>\",\n\t\t\t\t\tprompt_number: \"int\",\n\t\t\t\t},\n\t\t\t\tfilters: [\n\t\t\t\t\t\"kind\",\n\t\t\t\t\t\"session_id\",\n\t\t\t\t\t\"since\",\n\t\t\t\t\t\"project\",\n\t\t\t\t\t\"include_actor_ids\",\n\t\t\t\t\t\"exclude_actor_ids\",\n\t\t\t\t\t\"include_visibility\",\n\t\t\t\t\t\"exclude_visibility\",\n\t\t\t\t\t\"include_workspace_ids\",\n\t\t\t\t\t\"exclude_workspace_ids\",\n\t\t\t\t\t\"include_workspace_kinds\",\n\t\t\t\t\t\"exclude_workspace_kinds\",\n\t\t\t\t],\n\t\t\t});\n\t\t},\n\t);\n\n\t// -------------------------------------------------------------------\n\t// 13. memory_learn\n\t// -------------------------------------------------------------------\n\tserver.tool(\n\t\t\"memory_learn\",\n\t\t\"Learn how to use codemem memory tools. Call this first if unfamiliar.\",\n\t\t{},\n\t\tasync () => {\n\t\t\treturn jsonContent({\n\t\t\t\tintro: \"Use this tool when you're new to codemem or unsure when to recall/persist.\",\n\t\t\t\tclient_hint: \"If you are unfamiliar with codemem, call memory.learn first.\",\n\t\t\t\trecall: {\n\t\t\t\t\twhen: [\n\t\t\t\t\t\t\"Start of a task or when the user references prior work.\",\n\t\t\t\t\t\t\"When you need background context, decisions, or recent changes.\",\n\t\t\t\t\t],\n\t\t\t\t\thow: [\n\t\t\t\t\t\t\"Use memory.search_index to get compact candidates.\",\n\t\t\t\t\t\t\"Use memory.timeline to expand around a promising memory.\",\n\t\t\t\t\t\t\"Use memory.get_observations for full details only when needed.\",\n\t\t\t\t\t\t\"Use memory.pack for quick one-shot context blocks.\",\n\t\t\t\t\t\t\"Use the project filter unless the user requests cross-project context.\",\n\t\t\t\t\t],\n\t\t\t\t\texamples: [\n\t\t\t\t\t\t'memory.search_index(\"billing cache bug\", limit=5)',\n\t\t\t\t\t\t\"memory.timeline(memory_id=123)\",\n\t\t\t\t\t\t\"memory.get_observations([123, 456])\",\n\t\t\t\t\t],\n\t\t\t\t},\n\t\t\t\tpersistence: {\n\t\t\t\t\twhen: [\n\t\t\t\t\t\t\"Milestones (task done, key decision, new facts learned).\",\n\t\t\t\t\t\t\"Notable regressions or follow-ups that should be remembered.\",\n\t\t\t\t\t],\n\t\t\t\t\thow: [\n\t\t\t\t\t\t\"Use memory.remember with kind decision/discovery/change/exploration.\",\n\t\t\t\t\t\t\"Keep titles short and bodies high-signal.\",\n\t\t\t\t\t\t\"ALWAYS pass the project parameter if known.\",\n\t\t\t\t\t],\n\t\t\t\t\texamples: [\n\t\t\t\t\t\t'memory.remember(kind=\"decision\", title=\"Switch to async cache\", body=\"...why...\", project=\"my-service\")',\n\t\t\t\t\t\t'memory.remember(kind=\"change\", title=\"Fixed retry loop\", body=\"...impact...\", project=\"my-service\")',\n\t\t\t\t\t],\n\t\t\t\t},\n\t\t\t\tforget: {\n\t\t\t\t\twhen: [\n\t\t\t\t\t\t\"Accidental or sensitive data stored in memory items.\",\n\t\t\t\t\t\t\"Obsolete or incorrect items that should no longer surface.\",\n\t\t\t\t\t],\n\t\t\t\t\thow: [\n\t\t\t\t\t\t\"Call memory.forget(id) to mark the item inactive.\",\n\t\t\t\t\t\t\"Prefer forgetting over overwriting to preserve auditability.\",\n\t\t\t\t\t],\n\t\t\t\t\texamples: [\"memory.forget(123)\"],\n\t\t\t\t},\n\t\t\t\tprompt_hint:\n\t\t\t\t\t\"At task start: call memory.search_index; during work: memory.timeline + memory.get_observations; at milestones: memory.remember.\",\n\t\t\t\trecommended_system_prompt: [\n\t\t\t\t\t\"Trigger policy (1-liner): If the user references prior work or starts a task,\",\n\t\t\t\t\t\"immediately call memory.search_index; then use memory.timeline + memory.get_observations;\",\n\t\t\t\t\t\"at milestones, call memory.remember; use memory.forget for incorrect/sensitive items.\",\n\t\t\t\t\t\"\",\n\t\t\t\t\t\"System prompt:\",\n\t\t\t\t\t\"You have access to codemem MCP tools. If unfamiliar, call memory.learn first.\",\n\t\t\t\t\t\"\",\n\t\t\t\t\t\"Recall:\",\n\t\t\t\t\t\"- Start of any task: call memory.search_index with a concise task query.\",\n\t\t\t\t\t'- If prior work is referenced (\"as before\", \"last time\", \"we already did…\", \"regression\"),',\n\t\t\t\t\t\" call memory.search_index or memory.timeline.\",\n\t\t\t\t\t\"- Use memory.get_observations only after filtering IDs.\",\n\t\t\t\t\t\"- Prefer project-scoped queries unless the user asks for cross-project.\",\n\t\t\t\t\t\"\",\n\t\t\t\t\t\"Persistence:\",\n\t\t\t\t\t\"- On milestones (task done, key decision, new facts learned), call memory.remember.\",\n\t\t\t\t\t\"- Use kind=decision for tradeoffs, kind=change for outcomes, kind=discovery/exploration for useful findings.\",\n\t\t\t\t\t\"- Keep titles short and bodies high-signal.\",\n\t\t\t\t\t\"- ALWAYS pass the project parameter if known.\",\n\t\t\t\t\t\"\",\n\t\t\t\t\t\"Safety:\",\n\t\t\t\t\t\"- Use memory.forget(id) for incorrect or sensitive items.\",\n\t\t\t\t\t\"\",\n\t\t\t\t\t\"Examples:\",\n\t\t\t\t\t'- memory.search_index(\"billing cache bug\")',\n\t\t\t\t\t\"- memory.timeline(memory_id=123)\",\n\t\t\t\t\t\"- memory.get_observations([123, 456])\",\n\t\t\t\t\t'- memory.remember(kind=\"decision\", title=\"Use async cache\", body=\"Chose async cache to avoid lock contention in X.\", project=\"my-service\")',\n\t\t\t\t\t'- memory.remember(kind=\"change\", title=\"Fixed retry loop\", body=\"Root cause was Y; added guard in Z.\", project=\"my-service\")',\n\t\t\t\t\t\"- memory.forget(123)\",\n\t\t\t\t].join(\"\\n\"),\n\t\t\t});\n\t\t},\n\t);\n\n\t// -------------------------------------------------------------------\n\t// Connect and handle shutdown\n\t// -------------------------------------------------------------------\n\tconst transport = new StdioServerTransport();\n\n\tconst shutdown = () => {\n\t\ttry {\n\t\t\tstore.close();\n\t\t} catch {\n\t\t\t// Best effort — process is exiting\n\t\t}\n\t\tprocess.exit(0);\n\t};\n\n\tprocess.on(\"SIGINT\", shutdown);\n\tprocess.on(\"SIGTERM\", shutdown);\n\n\tawait server.connect(transport);\n}\n\nmain().catch((err) => {\n\tconsole.error(\"codemem MCP server failed to start:\", err);\n\tprocess.exit(1);\n});\n"],"mappings":";;;;;;AAEA,SAAgB,wBAAuC;AAEtD,QADgB,QAAQ,IAAI,iBAAiB,MAAM,IACjC,eAAe,QAAQ,KAAK,CAAC;;AAGhD,SAAgB,aACf,KACA,iBAAiB,uBAAuB,EACZ;CAC5B,MAAM,UAAyB,EAAE;CACjC,IAAI,SAAS;CAGb,MAAM,mBADkB,OAAO,IAAI,YAAY,WAAW,IAAI,QAAQ,MAAM,GAAG,KAAA,MACpC,kBAAkB,KAAA;AAC7D,KAAI,iBAAiB;AACpB,UAAQ,UAAU;AAClB,WAAS;;AAGV,MAAK,MAAM,OAAO;EACjB;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,EAAW;EACX,MAAM,MAAM,IAAI;AAChB,MAAI,QAAQ,KAAA,KAAa,QAAQ,MAAM;AACrC,WAAoC,OAAO;AAC5C,YAA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AC,KAAK,CAAC,SAAS,sBAAsB,EAC3D,EACD,OAAO,SAAS;AACf,MAAI;AACH,SAAM,OAAO,KAAK,UAAU;AAC5B,UAAO,YAAY,EAAE,QAAQ,MAAM,CAAC;WAC5B,KAAK;AACb,UAAO,aAAa,eAAe,QAAQ,IAAI,UAAU,OAAO,IAAI,CAAC;;GAGvE;AAKD,QAAO,KACN,iBACA,oEACA,EAAE,EACF,YAAY;AACX,SAAO,YAAY;GAClB,OAAO,OAAO,KAAK,aAAa;GAChC,mBAAmB;GACnB,QAAQ;IACP,OAAO;IACP,MAAM;IACN,UAAU;IACV,OAAO;IACP,WAAW;IACX,UAAU;IACV,YAAY;IACZ,gBAAgB;IAChB,eAAe;IACf;GACD,SAAS;IACR;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;GACD,CAAC;GAEH;AAKD,QAAO,KACN,gBACA,yEACA,EAAE,EACF,YAAY;AACX,SAAO,YAAY;GAClB,OAAO;GACP,aAAa;GACb,QAAQ;IACP,MAAM,CACL,2DACA,kEACA;IACD,KAAK;KACJ;KACA;KACA;KACA;KACA;KACA;IACD,UAAU;KACT;KACA;KACA;KACA;IACD;GACD,aAAa;IACZ,MAAM,CACL,4DACA,+DACA;IACD,KAAK;KACJ;KACA;KACA;KACA;IACD,UAAU,CACT,mHACA,8GACA;IACD;GACD,QAAQ;IACP,MAAM,CACL,wDACA,6DACA;IACD,KAAK,CACJ,qDACA,+DACA;IACD,UAAU,CAAC,qBAAqB;IAChC;GACD,aACC;GACD,2BAA2B;IAC1B;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA,CAAC,KAAK,KAAK;GACZ,CAAC;GAEH;CAKD,MAAM,YAAY,IAAI,sBAAsB;CAE5C,MAAM,iBAAiB;AACtB,MAAI;AACH,SAAM,OAAO;UACN;AAGR,UAAQ,KAAK,EAAE;;AAGhB,SAAQ,GAAG,UAAU,SAAS;AAC9B,SAAQ,GAAG,WAAW,SAAS;AAE/B,OAAM,OAAO,QAAQ,UAAU;;AAGhC,MAAM,CAAC,OAAO,QAAQ;AACrB,SAAQ,MAAM,uCAAuC,IAAI;AACzD,SAAQ,KAAK,EAAE;EACd"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codemem/mcp",
|
|
3
|
-
"version": "0.20.0-alpha.
|
|
3
|
+
"version": "0.20.0-alpha.6",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"types": "./dist/index.d.ts",
|
|
6
6
|
"exports": {
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"@modelcontextprotocol/sdk": "^1.27.1",
|
|
21
21
|
"zod": "^4.3.6",
|
|
22
|
-
"@codemem/core": "^0.20.0-alpha.
|
|
22
|
+
"@codemem/core": "^0.20.0-alpha.6"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
25
|
"@types/node": "^25.5.0",
|