@edihasaj/recall 0.7.1 → 0.8.0

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.
@@ -30,7 +30,7 @@ import {
30
30
  scanAndStore,
31
31
  sessionEndFallback,
32
32
  signalOutcomeFallback
33
- } from "./chunk-PG2ZVVAT.js";
33
+ } from "./chunk-2G5DMOVA.js";
34
34
  import {
35
35
  DEFAULT_LEASE_SECONDS,
36
36
  TaskClaimConflictError,
@@ -51,7 +51,7 @@ import {
51
51
  releaseTask,
52
52
  rollbackMemory,
53
53
  submitTask
54
- } from "./chunk-PH6YNVHR.js";
54
+ } from "./chunk-BMWLHPLS.js";
55
55
  import {
56
56
  confirmMemory,
57
57
  demoteGlobalMemory,
@@ -281,6 +281,16 @@ function createRecallMcpServer(db = initDb()) {
281
281
  recent_tool_calls
282
282
  }, mcpSource());
283
283
  if (result.ids.length === 0) {
284
+ if (result.pendingTaskId) {
285
+ return {
286
+ content: [
287
+ {
288
+ type: "text",
289
+ text: `Enqueued for LLM extraction (task ${result.pendingTaskId.slice(0, 16)}). The candidate memory will appear once the dispatcher processes the prompt.`
290
+ }
291
+ ]
292
+ };
293
+ }
284
294
  return {
285
295
  content: [
286
296
  {
@@ -330,6 +340,16 @@ function createRecallMcpServer(db = initDb()) {
330
340
  recent_tool_calls
331
341
  }, mcpSource());
332
342
  if (result.ids.length === 0) {
343
+ if (result.pendingTaskId) {
344
+ return {
345
+ content: [
346
+ {
347
+ type: "text",
348
+ text: `Enqueued for LLM extraction (task ${result.pendingTaskId.slice(0, 16)}). The candidate memory will appear once the dispatcher processes the prompt.`
349
+ }
350
+ ]
351
+ };
352
+ }
333
353
  return {
334
354
  content: [
335
355
  {
@@ -1111,4 +1131,4 @@ function createRecallMcpServer(db = initDb()) {
1111
1131
  export {
1112
1132
  createRecallMcpServer
1113
1133
  };
1114
- //# sourceMappingURL=chunk-GNXTOM5K.js.map
1134
+ //# sourceMappingURL=chunk-I5TTXHOM.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/mcp/factory.ts"],"sourcesContent":["import { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\";\nimport { AsyncLocalStorage } from \"node:async_hooks\";\nimport { z } from \"zod\";\nimport { initDb, type RecallDb } from \"../db/client.js\";\nimport { tagActivitySource } from \"../types.js\";\nimport {\n queryMemories,\n getMemory,\n confirmMemory,\n rejectMemory,\n recordFeedback,\n listMemories,\n demoteGlobalMemory,\n} from \"../models/memory.js\";\nimport { recordAudit } from \"../audit/trail.js\";\nimport { compileContext, compileContextHybrid } from \"../compiler/context.js\";\nimport { processCorrection, processReviewFeedback } from \"../capture/correction.js\";\nimport { scanAndStore } from \"../scanner/repo.js\";\nimport { computeMetrics, formatMetricsReport } from \"../eval/harness.js\";\nimport { formatRetrievalEvalReport, runRetrievalEval } from \"../eval/retrieval.js\";\nimport { recordSignal, getSignalStats } from \"../feedback/implicit.js\";\nimport { inferScope } from \"../capture/scope.js\";\nimport { evaluatePolicy, listPendingApprovals, resolveApproval } from \"../policy/engine.js\";\nimport { computeHealthScore, computeAllHealthScores, formatHealthReport } from \"../health/scoring.js\";\nimport { detectContradictions, resolveContradiction, autoResolveContradictions } from \"../contradictions/detector.js\";\nimport { pruneMemories, formatPruneReport } from \"../pruning/pruner.js\";\nimport { getAuditTrail, getRecentAudit, formatAuditTrail, rollbackMemory } from \"../audit/trail.js\";\nimport { getRepoQualityProfile } from \"../repo/quality.js\";\nimport { createActivityEvent, listActivityEvents, listActivitySessions } from \"../models/activity.js\";\nimport { ensureRepoBootstrapped } from \"../repo/discovery.js\";\nimport {\n captureCorrectionFallback,\n sessionEndFallback,\n signalOutcomeFallback,\n} from \"./fallback.js\";\nimport {\n DEFAULT_LEASE_SECONDS,\n TaskClaimConflictError,\n claimTask,\n peekTasks,\n releaseTask,\n submitTask,\n} from \"../maintenance/tasks.js\";\nimport { graphQuery } from \"../graph/retrieval.js\";\nimport {\n getEntity,\n listEntities,\n listMemoryIdsForEntity,\n neighborsOf,\n type RelationType,\n} from \"../graph/store.js\";\nimport { loadEmbeddingConfigFromEnv } from \"../embeddings/embeddings.js\";\n\nexport function createRecallMcpServer(db: RecallDb = initDb()) {\nconst activityEventTypes = [\n \"compile\",\n \"query\",\n \"scan\",\n \"correction\",\n \"review\",\n \"feedback\",\n \"signal\",\n \"session_start\",\n \"session_event\",\n \"session_end\",\n \"tool_call\",\n] as const;\n\nconst server = new McpServer({\n name: \"recall\",\n version: \"0.5.0\",\n});\n\nconst mcpClientContext = new AsyncLocalStorage<{ name?: string }>();\n\nfunction mcpSource() {\n return tagActivitySource(\"mcp\", mcpClientContext.getStore()?.name);\n}\n\nfunction resolveCurrentClientName(): string | undefined {\n return server.server.getClientVersion()?.name;\n}\n\nfunction summarizeArgs(args: Record<string, unknown>): Record<string, unknown> {\n const out: Record<string, unknown> = {};\n for (const [k, v] of Object.entries(args)) {\n if (v === null || v === undefined) continue;\n if (typeof v === \"string\") {\n out[k] = v.length > 200 ? `${v.slice(0, 200)}…(len=${v.length})` : v;\n } else if (typeof v === \"number\" || typeof v === \"boolean\") {\n out[k] = v;\n } else if (Array.isArray(v)) {\n out[k] = { array_length: v.length };\n } else if (typeof v === \"object\") {\n out[k] = { object_keys: Object.keys(v as object).length };\n }\n }\n return out;\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction tool(name: string, description: string, schema: any, handler: (args: any, extra: any) => any) {\n server.tool(name, description, schema, async (args: Record<string, unknown>, extra: unknown) => {\n const start = Date.now();\n let ok = true;\n let errorMessage: string | undefined;\n return mcpClientContext.run({ name: resolveCurrentClientName() }, async () => {\n try {\n return await handler(args, extra);\n } catch (err) {\n ok = false;\n errorMessage = err instanceof Error ? err.message : String(err);\n throw err;\n } finally {\n try {\n createActivityEvent(db, {\n session_id: typeof args.session_id === \"string\" ? args.session_id : null,\n repo: typeof args.repo === \"string\" ? args.repo : null,\n path: typeof args.path === \"string\" ? args.path : null,\n source: mcpSource(),\n event_type: \"tool_call\",\n request: { tool: name, args: summarizeArgs(args) },\n result: {\n ok,\n duration_ms: Date.now() - start,\n ...(errorMessage ? { error: errorMessage } : {}),\n },\n });\n } catch {\n // telemetry must never break a tool call\n }\n }\n });\n });\n}\n\n// --- Tools ---\n\ntool(\n \"query\",\n \"Fallback retrieval for repo memory. Recall's lifecycle hooks already inject memory at SessionStart and on every UserPromptSubmit, so only call this tool when (a) injected context clearly missed something specific you need, (b) the user asks you to look up memory explicitly, or (c) you want memory for a different repo than the current one. Prefer query_text so results are ranked against your actual task.\",\n {\n repo: z.string().describe(\"Repository name (e.g., owner/repo)\"),\n repo_path: z.string().optional().describe(\"Optional local repo path hint for first-time bootstrap\"),\n path: z.string().optional().describe(\"Current file path for path-scoped filtering\"),\n query_text: z.string().optional().describe(\"Optional task/query text for hybrid reranking\"),\n include_candidates: z.boolean().optional().describe(\"Allow strong candidate memories into hybrid ranking\"),\n min_confidence: z.number().optional().describe(\"Minimum confidence threshold (default: 0.6)\"),\n session_id: z.string().optional().describe(\"Optional session identifier\"),\n },\n async ({ repo, repo_path, path, query_text, include_candidates, min_confidence, session_id }) => {\n const bootstrap = ensureRepoBootstrapped(db, {\n repo,\n repoPathHint: repo_path,\n });\n if (bootstrap.status === \"bootstrapped\" || bootstrap.status === \"scanned_empty\") {\n createActivityEvent(db, {\n session_id: session_id ?? null,\n repo,\n source: mcpSource(),\n event_type: \"scan\",\n memory_ids: bootstrap.created_ids,\n request: {\n repo_path: bootstrap.repo_path,\n trigger: \"query_auto_bootstrap\",\n },\n result: {\n created: bootstrap.created_ids.length,\n status: bootstrap.status,\n },\n });\n }\n\n const result = query_text || include_candidates\n ? await compileContextHybrid(db, {\n repo,\n path,\n session_id,\n query_text,\n config: {\n ...(min_confidence ? { confidence_threshold: min_confidence } : {}),\n include_candidates: include_candidates ?? false,\n },\n })\n : compileContext(db, {\n repo,\n path,\n session_id,\n config: min_confidence ? { confidence_threshold: min_confidence } : {},\n });\n createActivityEvent(db, {\n session_id: session_id ?? null,\n repo,\n path: path ?? null,\n source: mcpSource(),\n event_type: \"query\",\n memory_ids: result.memories_included,\n request: {\n min_confidence: min_confidence ?? null,\n query_text: query_text ?? null,\n include_candidates: include_candidates ?? false,\n bootstrap_status: bootstrap.status,\n },\n result: {\n included: result.memories_included,\n dropped: result.memories_dropped,\n history_included: result.history_included,\n token_estimate: result.token_estimate,\n repo_path: bootstrap.repo_path,\n },\n });\n\n if (!result.text) {\n return {\n content: [\n {\n type: \"text\" as const,\n text: \"No memories above confidence threshold for this context.\",\n },\n ],\n };\n }\n\n return {\n content: [{ type: \"text\" as const, text: result.text }],\n };\n },\n);\n\ntool(\n \"list\",\n \"List all memories for a repository, optionally filtered by status.\",\n {\n repo: z.string().describe(\"Repository name\"),\n status: z\n .enum([\"transient\", \"candidate\", \"active\", \"rejected\"])\n .optional()\n .describe(\"Filter by memory status\"),\n limit: z.number().optional().describe(\"Max memories to return\"),\n offset: z.number().optional().describe(\"Skip first N memories\"),\n },\n async ({ repo, status, limit, offset }) => {\n const items = queryMemories(db, { repo, status, limit, offset });\n if (items.length === 0) {\n return {\n content: [{ type: \"text\" as const, text: \"No memories found.\" }],\n };\n }\n\n const lines = items.map(\n (m) =>\n `[${m.status}] (${m.confidence.toFixed(2)}) ${m.type}: ${m.text} [${m.id.slice(0, 8)}]`,\n );\n\n return {\n content: [{ type: \"text\" as const, text: lines.join(\"\\n\") }],\n };\n },\n);\n\ntool(\n \"report_correction\",\n \"Report a correction or rule to be learned. Accepts optional assistant/tool context and creates candidate memories from the correction text.\",\n {\n text: z.string().describe(\"The correction or rule (e.g., 'don't use pip, use uv')\"),\n repo: z.string().optional().describe(\"Repository name\"),\n path: z.string().optional().describe(\"File path context\"),\n session_id: z.string().optional().describe(\"Session identifier\"),\n agent: z.string().optional().describe(\"Source agent name, such as codex or claude-code.\"),\n prev_assistant_turn: z.string().optional().describe(\"The assistant message that triggered the correction.\"),\n recent_tool_calls: z.array(\n z.object({\n name: z.string(),\n path: z.string().optional(),\n input_summary: z.string().optional(),\n exit_code: z.number().optional(),\n }),\n ).optional().describe(\"Last 1-3 tool calls leading up to the correction.\"),\n },\n async ({ text, repo, path, session_id, agent, prev_assistant_turn, recent_tool_calls }) => {\n const result = await captureCorrectionFallback(db, {\n text,\n repo,\n path,\n session_id,\n agent: agent ?? \"mcp\",\n prev_assistant_turn,\n recent_tool_calls,\n }, mcpSource());\n\n if (result.ids.length === 0) {\n if (result.pendingTaskId) {\n return {\n content: [\n {\n type: \"text\" as const,\n text: `Enqueued for LLM extraction (task ${result.pendingTaskId.slice(0, 16)}). The candidate memory will appear once the dispatcher processes the prompt.`,\n },\n ],\n };\n }\n return {\n content: [\n {\n type: \"text\" as const,\n text: \"No correction pattern detected. Try phrasing as a rule (e.g., 'always use X' or 'don't use Y, use Z').\",\n },\n ],\n };\n }\n\n return {\n content: [\n {\n type: \"text\" as const,\n text: `Created ${result.ids.length} candidate memory/memories: ${result.ids.map((id) => id.slice(0, 8)).join(\", \")}`,\n },\n ],\n };\n },\n);\n\ntool(\n \"capture_correction\",\n \"Call this right after the user corrects the assistant or states a repo rule. Captures the correction with richer context so scope inference stays accurate.\",\n {\n text: z.string().describe(\"The user correction or rule text to capture.\"),\n repo: z.string().optional().describe(\"Repository name when known.\"),\n path: z.string().optional().describe(\"Current file path context, if the correction is file-specific.\"),\n session_id: z.string().optional().describe(\"Current session identifier.\"),\n agent: z.string().optional().describe(\"Source agent name, such as codex or claude-code.\"),\n prev_assistant_turn: z.string().optional().describe(\"The assistant message that triggered the correction.\"),\n recent_tool_calls: z.array(\n z.object({\n name: z.string(),\n path: z.string().optional(),\n input_summary: z.string().optional(),\n exit_code: z.number().optional(),\n }),\n ).optional().describe(\"Last 1-3 tool calls leading up to the correction.\"),\n },\n async ({ text, repo, path, session_id, agent, prev_assistant_turn, recent_tool_calls }) => {\n const result = await captureCorrectionFallback(db, {\n text,\n repo,\n path,\n session_id,\n agent,\n prev_assistant_turn,\n recent_tool_calls,\n }, mcpSource());\n\n if (result.ids.length === 0) {\n if (result.pendingTaskId) {\n return {\n content: [\n {\n type: \"text\" as const,\n text: `Enqueued for LLM extraction (task ${result.pendingTaskId.slice(0, 16)}). The candidate memory will appear once the dispatcher processes the prompt.`,\n },\n ],\n };\n }\n return {\n content: [\n {\n type: \"text\" as const,\n text: \"No correction pattern detected. Use this when the user is explicitly correcting prior behavior or stating a durable repo rule.\",\n },\n ],\n };\n }\n\n return {\n content: [\n {\n type: \"text\" as const,\n text: `Captured correction context for ${result.ids.length} memory/memories: ${result.ids.map((id) => id.slice(0, 8)).join(\", \")}`,\n },\n ],\n };\n },\n);\n\ntool(\n \"report_review\",\n \"Report review feedback from a code review. Creates candidate memories from review comments.\",\n {\n feedback: z.string().describe(\"The review feedback\"),\n repo: z.string().optional().describe(\"Repository name\"),\n path: z.string().optional().describe(\"File path context\"),\n reviewer: z.string().optional().describe(\"Reviewer name\"),\n session_id: z.string().optional().describe(\"Optional session identifier\"),\n },\n async ({ feedback, repo, path, reviewer, session_id }) => {\n const ids = await processReviewFeedback(db, feedback, {\n sessionId: session_id ?? \"mcp-review\",\n repo,\n path,\n reviewer,\n });\n createActivityEvent(db, {\n session_id: session_id ?? \"mcp-review\",\n repo: repo ?? null,\n path: path ?? null,\n source: mcpSource(),\n event_type: \"review\",\n memory_ids: ids,\n request: { feedback, reviewer: reviewer ?? null },\n result: { created: ids },\n });\n\n return {\n content: [\n {\n type: \"text\" as const,\n text: `Created ${ids.length} candidate memory/memories from review feedback: ${ids.map((id) => id.slice(0, 8)).join(\", \")}`,\n },\n ],\n };\n },\n);\n\ntool(\n \"confirm\",\n \"Confirm a candidate memory, promoting it to active status.\",\n {\n memory_id: z.string().describe(\"Memory ID to confirm\"),\n },\n async ({ memory_id }) => {\n const success = confirmMemory(db, memory_id);\n if (!success) {\n return {\n content: [\n { type: \"text\" as const, text: `Memory ${memory_id} not found or already rejected.` },\n ],\n };\n }\n return {\n content: [\n { type: \"text\" as const, text: `Memory ${memory_id.slice(0, 8)} confirmed and promoted to active.` },\n ],\n };\n },\n);\n\ntool(\n \"reject\",\n \"Reject a memory. It will never be injected again.\",\n {\n memory_id: z.string().describe(\"Memory ID to reject\"),\n },\n async ({ memory_id }) => {\n const before = getMemory(db, memory_id);\n const success = rejectMemory(db, memory_id);\n if (!success) {\n return {\n content: [\n { type: \"text\" as const, text: `Memory ${memory_id} not found.` },\n ],\n };\n }\n const after = getMemory(db, memory_id);\n recordAudit(\n db,\n memory_id,\n \"rejected\",\n \"mcp\",\n \"manual reject\",\n before ? JSON.stringify(before) : null,\n after ? JSON.stringify(after) : null,\n );\n return {\n content: [\n { type: \"text\" as const, text: `Memory ${memory_id.slice(0, 8)} rejected.` },\n ],\n };\n },\n);\n\ntool(\n \"demote_global\",\n \"Demote a global-scoped memory. Pass `repo` to re-scope it to a single repo (the rule was real but over-scoped). Omit `repo` to reject it (the rule was junk for everywhere).\",\n {\n memory_id: z.string().describe(\"Memory ID to demote\"),\n repo: z.string().optional().describe(\"Re-scope to this repo. If omitted, the memory is rejected instead.\"),\n reason: z.string().optional().describe(\"Why this is being demoted (recorded in the audit trail).\"),\n },\n async ({ memory_id, repo, reason }) => {\n const result = demoteGlobalMemory(db, memory_id, { repo: repo ?? null });\n if (!result.ok) {\n const msg = result.reason === \"not_found\"\n ? `Memory ${memory_id} not found.`\n : `Memory ${memory_id.slice(0, 8)} is not global-scoped; nothing to demote.`;\n return { content: [{ type: \"text\" as const, text: msg }] };\n }\n const auditReason = reason\n ?? (result.outcome === \"rescoped\" ? `demoted from global to repo ${repo}` : \"demoted from global; rejected\");\n recordAudit(db, memory_id, result.outcome === \"rejected\" ? \"rejected\" : \"demoted\", \"mcp\", auditReason);\n const text = result.outcome === \"rescoped\"\n ? `Memory ${memory_id.slice(0, 8)} re-scoped to repo ${repo}.`\n : `Memory ${memory_id.slice(0, 8)} rejected (was global, no repo target).`;\n return { content: [{ type: \"text\" as const, text }] };\n },\n);\n\ntool(\n \"feedback\",\n \"Record feedback about an injected memory — whether it was followed, overridden, ignored, or contradicted.\",\n {\n memory_id: z.string().describe(\"Memory ID\"),\n session_id: z.string().describe(\"Session ID\"),\n injected: z.boolean().describe(\"Was the memory injected into this session?\"),\n outcome: z\n .enum([\"followed\", \"overridden\", \"ignored\", \"contradicted\"])\n .describe(\"What happened with the memory\"),\n },\n async ({ memory_id, session_id, injected, outcome }) => {\n const result = signalOutcomeFallback(db, {\n memory_id,\n session_id,\n injected,\n outcome,\n }, mcpSource());\n return {\n content: [\n { type: \"text\" as const, text: `Feedback recorded: ${result.feedback_id.slice(0, 8)}` },\n ],\n };\n },\n);\n\ntool(\n \"signal_outcome\",\n \"Call this after acting on an injected memory to report whether it was followed, overridden, ignored, or contradicted in the current session.\",\n {\n memory_id: z.string().describe(\"The injected memory being evaluated.\"),\n session_id: z.string().describe(\"Current session ID.\"),\n injected: z.boolean().optional().describe(\"Whether the memory was actually injected; defaults to true.\"),\n outcome: z\n .enum([\"followed\", \"overridden\", \"ignored\", \"contradicted\"])\n .describe(\"What happened after the memory was shown to the model.\"),\n context: z.string().optional().describe(\"Short note explaining the outcome.\"),\n },\n async ({ memory_id, session_id, injected, outcome, context }) => {\n const result = signalOutcomeFallback(db, {\n memory_id,\n session_id,\n injected,\n outcome,\n context,\n }, mcpSource());\n return {\n content: [\n { type: \"text\" as const, text: `Outcome recorded: ${result.feedback_id.slice(0, 8)}` },\n ],\n };\n },\n);\n\ntool(\n \"scan\",\n \"Scan a repository and bootstrap memories from config files, scripts, and instruction files.\",\n {\n repo_path: z.string().describe(\"Absolute path to the repository root\"),\n session_id: z.string().optional().describe(\"Optional session identifier\"),\n },\n async ({ repo_path, session_id }) => {\n const ids = scanAndStore(db, repo_path);\n const mem = ids[0] ? getMemory(db, ids[0]) : undefined;\n createActivityEvent(db, {\n session_id: session_id ?? null,\n repo: mem?.repo ?? null,\n source: mcpSource(),\n event_type: \"scan\",\n memory_ids: ids,\n request: { repo_path },\n result: { created: ids },\n });\n return {\n content: [\n {\n type: \"text\" as const,\n text: `Scanned repo. Created ${ids.length} candidate memories.`,\n },\n ],\n };\n },\n);\n\n// --- Phase 2 tools ---\n\ntool(\n \"eval\",\n \"Get evaluation metrics for memory effectiveness.\",\n {\n repo: z.string().optional().describe(\"Filter by repo\"),\n since: z.string().optional().describe(\"Since date (ISO)\"),\n },\n async ({ repo, since }) => {\n const metrics = computeMetrics(db, { repo, since });\n return {\n content: [{ type: \"text\" as const, text: formatMetricsReport(metrics) }],\n };\n },\n);\n\ntool(\n \"eval_retrieval\",\n \"Run retrieval eval fixtures against baseline vs hybrid retrieval.\",\n {\n cases_json: z.string().describe(\"JSON string matching { cases: [...] } retrieval fixture format\"),\n },\n async ({ cases_json }) => {\n const parsed = JSON.parse(cases_json);\n const report = await runRetrievalEval(db, parsed);\n return {\n content: [{ type: \"text\" as const, text: formatRetrievalEvalReport(report) }],\n };\n },\n);\n\ntool(\n \"signal\",\n \"Record an implicit feedback signal (test pass/fail, file unchanged/rewritten, task accepted/rejected).\",\n {\n memory_id: z.string().describe(\"Memory ID\"),\n session_id: z.string().describe(\"Session ID\"),\n signal_type: z\n .enum([\"test_pass\", \"test_fail\", \"file_unchanged\", \"file_rewritten\", \"task_accepted\", \"task_rejected\"])\n .describe(\"Type of implicit signal\"),\n context: z.string().optional().describe(\"Additional context\"),\n },\n async ({ memory_id, session_id, signal_type, context }) => {\n const id = recordSignal(db, memory_id, session_id, signal_type, context);\n const stats = getSignalStats(db, memory_id);\n const mem = getMemory(db, memory_id);\n createActivityEvent(db, {\n session_id,\n repo: mem?.repo ?? null,\n path: mem?.path_scope ?? null,\n source: mcpSource(),\n event_type: \"signal\",\n memory_ids: [memory_id],\n request: { signal_type, context: context ?? null },\n result: { signal_id: id },\n });\n return {\n content: [\n {\n type: \"text\" as const,\n text: `Signal recorded: ${id.slice(0, 8)}. Stats: ${JSON.stringify(stats)}`,\n },\n ],\n };\n },\n);\n\ntool(\n \"session_end\",\n \"Call this when the session is ending or being cleared so Recall can record the end-of-session boundary and run follow-up session logic.\",\n {\n session_id: z.string().describe(\"Current session ID.\"),\n repo: z.string().optional().describe(\"Repository slug if already known.\"),\n repo_path: z.string().optional().describe(\"Repository path when available.\"),\n path: z.string().optional().describe(\"Current file path context.\"),\n agent: z.string().optional().describe(\"Source agent name.\"),\n turn_count: z.number().optional().describe(\"Completed turn count, if known.\"),\n },\n async ({ session_id, repo, repo_path, path, agent, turn_count }) => {\n const result = sessionEndFallback(db, {\n session_id,\n repo,\n repo_path,\n path,\n agent,\n turn_count,\n });\n return {\n content: [\n {\n type: \"text\" as const,\n text: `Session end recorded for ${result.session_id}${result.repo ? ` (${result.repo})` : \"\"}.`,\n },\n ],\n };\n },\n);\n\ntool(\n \"scope\",\n \"Analyze the scope of a correction text. Returns inferred scope, path, and reasoning.\",\n {\n text: z.string().describe(\"Correction text to analyze\"),\n path: z.string().optional().describe(\"Context file path\"),\n },\n async ({ text, path }) => {\n const result = inferScope(text, path);\n return {\n content: [\n {\n type: \"text\" as const,\n text: `Scope: ${result.scope}, Path: ${result.path_scope ?? \"none\"}, Reason: ${result.reason}`,\n },\n ],\n };\n },\n);\n\n// --- Phase 3 tools ---\n\ntool(\n \"health\",\n \"Get memory health scores. Returns composite health report for all memories or a single memory.\",\n {\n repo: z.string().optional().describe(\"Filter by repo\"),\n memory_id: z.string().optional().describe(\"Score a single memory\"),\n },\n async ({ repo, memory_id }) => {\n if (memory_id) {\n const score = computeHealthScore(db, memory_id);\n if (!score) {\n return { content: [{ type: \"text\" as const, text: \"Memory not found.\" }] };\n }\n return {\n content: [{\n type: \"text\" as const,\n text: `Health: ${(score.score * 100).toFixed(0)}% | Conf: ${(score.confidence_component * 100).toFixed(0)}% | Fresh: ${(score.freshness_component * 100).toFixed(0)}% | Follow: ${(score.follow_rate_component * 100).toFixed(0)}% | Signal: ${(score.signal_ratio_component * 100).toFixed(0)}%`,\n }],\n };\n }\n const scores = computeAllHealthScores(db, repo);\n return { content: [{ type: \"text\" as const, text: formatHealthReport(scores) }] };\n },\n);\n\ntool(\n \"contradictions\",\n \"Detect contradictions between memories. Finds conflicting rules, negations, and scope overlaps.\",\n {\n repo: z.string().optional().describe(\"Filter by repo\"),\n auto_resolve: z.boolean().optional().describe(\"Auto-resolve by confidence (default: false)\"),\n },\n async ({ repo, auto_resolve }) => {\n const found = detectContradictions(db, repo);\n if (auto_resolve) {\n const resolved = autoResolveContradictions(db, repo);\n return {\n content: [{\n type: \"text\" as const,\n text: `Detected ${found.length} contradiction(s). Auto-resolved ${resolved}.`,\n }],\n };\n }\n if (found.length === 0) {\n return { content: [{ type: \"text\" as const, text: \"No contradictions detected.\" }] };\n }\n const lines = found.map(\n (c) => `[${c.severity}] ${c.contradiction_type}: ${c.description} (${c.id.slice(0, 8)})`,\n );\n return { content: [{ type: \"text\" as const, text: lines.join(\"\\n\") }] };\n },\n);\n\ntool(\n \"prune\",\n \"Auto-prune stale, rejected, transient, and unhealthy memories.\",\n {\n repo: z.string().optional().describe(\"Limit pruning to one repo\"),\n dry_run: z.boolean().optional().describe(\"Preview without making changes (default: false)\"),\n stale_days: z.number().optional().describe(\"Days before rejecting stale memories (default: 90)\"),\n min_health_score: z.number().optional().describe(\"Min health score for active (default: 0.2)\"),\n },\n async ({ repo, dry_run, stale_days, min_health_score }) => {\n const result = pruneMemories(db, { repo, dry_run: dry_run ?? false, stale_days, min_health_score });\n return {\n content: [{ type: \"text\" as const, text: formatPruneReport(result, dry_run ?? false) }],\n };\n },\n);\n\ntool(\n \"audit\",\n \"View audit trail for a memory or recent activity.\",\n {\n memory_id: z.string().optional().describe(\"Memory ID (omit for recent global audit)\"),\n limit: z.number().optional().describe(\"Max entries for recent audit (default: 50)\"),\n },\n async ({ memory_id, limit }) => {\n const entries = memory_id\n ? getAuditTrail(db, memory_id)\n : getRecentAudit(db, limit ?? 50);\n return {\n content: [{ type: \"text\" as const, text: formatAuditTrail(entries) }],\n };\n },\n);\n\ntool(\n \"rollback\",\n \"Rollback a memory to a previous state using an audit entry.\",\n {\n memory_id: z.string().describe(\"Memory ID\"),\n audit_entry_id: z.string().describe(\"Audit entry ID to rollback to\"),\n actor: z.string().optional().describe(\"Who is performing the rollback\"),\n },\n async ({ memory_id, audit_entry_id, actor }) => {\n const ok = rollbackMemory(db, memory_id, audit_entry_id, actor ?? \"mcp\");\n return {\n content: [{\n type: \"text\" as const,\n text: ok\n ? `Memory ${memory_id.slice(0, 8)} rolled back successfully.`\n : \"Rollback failed. Audit entry not found or no snapshot available.\",\n }],\n };\n },\n);\n\ntool(\n \"policy_check\",\n \"Check a memory against org policies. Returns policy violations.\",\n {\n org_id: z.string().describe(\"Organization ID\"),\n memory_id: z.string().describe(\"Memory ID to check\"),\n },\n async ({ org_id, memory_id }) => {\n const mem = getMemory(db, memory_id);\n if (!mem) {\n return { content: [{ type: \"text\" as const, text: \"Memory not found.\" }] };\n }\n const violations = evaluatePolicy(db, org_id, mem);\n if (violations.length === 0) {\n return { content: [{ type: \"text\" as const, text: \"No policy violations.\" }] };\n }\n const lines = violations.map(\n (v) => `[${v.blocking ? \"BLOCK\" : \"WARN\"}] ${v.rule_type}: ${v.message}`,\n );\n return { content: [{ type: \"text\" as const, text: lines.join(\"\\n\") }] };\n },\n);\n\ntool(\n \"approval_list\",\n \"List pending approval requests for an organization.\",\n {\n org_id: z.string().describe(\"Organization ID\"),\n },\n async ({ org_id }) => {\n const pending = listPendingApprovals(db, org_id);\n if (pending.length === 0) {\n return { content: [{ type: \"text\" as const, text: \"No pending approvals.\" }] };\n }\n const lines = pending.map(\n (a) => `${a.id.slice(0, 8)} memory:${a.memory_id.slice(0, 8)} by:${a.requested_by} ${a.created_at}`,\n );\n return { content: [{ type: \"text\" as const, text: lines.join(\"\\n\") }] };\n },\n);\n\ntool(\n \"approval_resolve\",\n \"Approve or deny a pending approval request.\",\n {\n approval_id: z.string().describe(\"Approval request ID\"),\n status: z.enum([\"approved\", \"denied\"]).describe(\"Decision\"),\n reviewed_by: z.string().optional().describe(\"Reviewer name\"),\n reason: z.string().optional().describe(\"Reason for decision\"),\n },\n async ({ approval_id, status, reviewed_by, reason }) => {\n const ok = resolveApproval(db, approval_id, status, reviewed_by ?? \"mcp\", reason);\n return {\n content: [{\n type: \"text\" as const,\n text: ok\n ? `Approval ${approval_id.slice(0, 8)} → ${status}`\n : \"Approval not found.\",\n }],\n };\n },\n);\n\ntool(\n \"activity\",\n \"List recent activity events such as queries, compiles, scans, corrections, feedback, and signals.\",\n {\n repo: z.string().optional().describe(\"Filter by repo\"),\n session_id: z.string().optional().describe(\"Filter by session id\"),\n source: z.string().optional().describe(\"Filter by source (e.g., 'mcp', 'hook:claude-code', 'cli')\"),\n event_type: z.enum(activityEventTypes).optional().describe(\"Filter by event type\"),\n since: z.string().optional().describe(\"Created at >= ISO timestamp\"),\n limit: z.number().optional().describe(\"Max events to return\"),\n },\n async ({ repo, session_id, source, event_type, since, limit }) => {\n const events = listActivityEvents(db, { repo, session_id, source, event_type, since, limit });\n if (events.length === 0) {\n return { content: [{ type: \"text\" as const, text: \"No activity found.\" }] };\n }\n const lines = events.map(\n (event) =>\n `${event.created_at} ${event.source}/${event.event_type} session:${event.session_id ?? \"-\"} repo:${event.repo ?? \"-\"} memories:${event.memory_ids.length}`,\n );\n return { content: [{ type: \"text\" as const, text: lines.join(\"\\n\") }] };\n },\n);\n\ntool(\n \"sessions\",\n \"List grouped activity sessions so you can review what happened in prior runs.\",\n {\n repo: z.string().optional().describe(\"Filter by repo\"),\n source: z.string().optional().describe(\"Filter by source (e.g., 'mcp', 'hook:claude-code', 'cli')\"),\n event_type: z.enum(activityEventTypes).optional().describe(\"Filter by event type\"),\n since: z.string().optional().describe(\"Created at >= ISO timestamp\"),\n limit: z.number().optional().describe(\"Max sessions to return\"),\n },\n async ({ repo, source, event_type, since, limit }) => {\n const sessions = listActivitySessions(db, { repo, source, event_type, since, limit });\n if (sessions.length === 0) {\n return { content: [{ type: \"text\" as const, text: \"No sessions found.\" }] };\n }\n const lines = sessions.map(\n (session) =>\n `${session.last_at} ${session.session_id} repo:${session.repo ?? \"-\"} events:${session.event_count} types:${session.event_types.join(\",\")}`,\n );\n return { content: [{ type: \"text\" as const, text: lines.join(\"\\n\") }] };\n },\n);\n\ntool(\n \"quality\",\n \"Get the repo quality profile — maturity stage, dynamic thresholds, and quality score. Use this to understand how strict memory gating is for a repo.\",\n {\n repo: z.string().optional().describe(\"Repository name\"),\n },\n async ({ repo }) => {\n const profile = getRepoQualityProfile(db, repo);\n const lines = [\n `Stage: ${profile.stage} | Score: ${(profile.score * 100).toFixed(0)}%`,\n `Active: ${profile.active_count} | Total: ${profile.total_count}`,\n `Avg health: ${(profile.avg_health * 100).toFixed(0)}% | Override rate: ${(profile.override_rate * 100).toFixed(0)}%`,\n `Repeat sessions needed: ${profile.repeat_sessions_required}`,\n `Compile threshold: ${profile.compile_confidence_threshold.toFixed(2)}`,\n `Dedup similarity: ${profile.dedup_similarity_threshold.toFixed(2)}`,\n ];\n return { content: [{ type: \"text\" as const, text: lines.join(\"\\n\") }] };\n },\n);\n\n// --- Delegated maintenance (Tier-2) ---\n\nconst maintenanceTaskKinds = [\n \"summarize_history\",\n \"merge_duplicates\",\n \"refine_candidate\",\n \"summarize_session\",\n \"synthesize_repo\",\n \"verify_capture\",\n] as const;\n\ntool(\n \"maintenance_peek\",\n \"Call at session start or between turns to see pending memory maintenance work that you could pick up. Returns small tasks the agent can complete in one turn. Do not call during an active user turn.\",\n {\n repo: z.string().optional().describe(\"Optional repo to filter by (owner/repo).\"),\n kinds: z.array(z.enum(maintenanceTaskKinds)).optional().describe(\"Restrict to specific task kinds.\"),\n limit: z.number().int().positive().max(10).optional().describe(\"Max tasks to return; defaults to 3.\"),\n },\n async ({ repo, kinds, limit }) => {\n const tasks = peekTasks(db, { repo, kinds, limit });\n return {\n content: [\n { type: \"text\" as const, text: JSON.stringify({ tasks }, null, 2) },\n ],\n };\n },\n);\n\ntool(\n \"maintenance_claim\",\n \"Claim a pending maintenance task so you can work on it. Only call when the user is idle — never during an active user turn. Returns the full payload and a lease; submit or release before the lease expires.\",\n {\n task_id: z.string().describe(\"ID of a task returned by maintenance_peek.\"),\n agent: z.string().describe(\"Caller agent name (e.g., claude-code, codex).\"),\n lease_seconds: z.number().int().positive().max(3600).optional().describe(`Lease duration; default ${DEFAULT_LEASE_SECONDS}s.`),\n },\n async ({ task_id, agent, lease_seconds }) => {\n try {\n const result = claimTask(db, task_id, agent, lease_seconds);\n return {\n content: [\n {\n type: \"text\" as const,\n text: JSON.stringify({\n task: {\n id: result.task.id,\n kind: result.task.kind,\n repo: result.task.repo,\n payload: result.task.payload,\n priority: result.task.priority,\n },\n lease_expires_at: result.lease_expires_at,\n }, null, 2),\n },\n ],\n };\n } catch (err) {\n if (err instanceof TaskClaimConflictError) {\n return {\n content: [\n { type: \"text\" as const, text: JSON.stringify({ error: err.reason, task_id }) },\n ],\n isError: true,\n };\n }\n throw err;\n }\n },\n);\n\ntool(\n \"maintenance_submit\",\n \"Submit the result of a claimed maintenance task. Recall validates the shape per task kind and applies the effect. Rejection bumps the task's attempt counter; after max_attempts the task is abandoned.\",\n {\n task_id: z.string().describe(\"Claimed task ID.\"),\n agent: z.string().describe(\"Caller agent name; must match the claim holder.\"),\n result: z.record(z.string(), z.unknown()).describe(\"Result payload. Shape depends on task kind; see payload for expectations.\"),\n },\n async ({ task_id, agent, result }) => {\n const outcome = submitTask(db, task_id, agent, result);\n return {\n content: [\n { type: \"text\" as const, text: JSON.stringify(outcome, null, 2) },\n ],\n isError: outcome.status === \"rejected\",\n };\n },\n);\n\ntool(\n \"maintenance_release\",\n \"Release a previously-claimed maintenance task without submitting a result (e.g., user interrupted you, context compacted, agent can't handle this kind). Returns the task to pending so another run can pick it up.\",\n {\n task_id: z.string().describe(\"Claimed task ID.\"),\n agent: z.string().describe(\"Caller agent name; must match the claim holder.\"),\n reason: z.string().max(500).optional().describe(\"Short note about why you released.\"),\n },\n async ({ task_id, agent, reason }) => {\n const outcome = releaseTask(db, task_id, agent, reason);\n return {\n content: [\n { type: \"text\" as const, text: JSON.stringify(outcome) },\n ],\n isError: outcome.status !== \"released\",\n };\n },\n);\n\nconst RELATION_TYPES = [\n \"uses\",\n \"replaces\",\n \"conflicts_with\",\n \"tested_by\",\n \"depends_on\",\n \"references\",\n \"part_of\",\n] as const;\n\nconst ENTITY_KINDS = [\n \"file\",\n \"function\",\n \"library\",\n \"tool\",\n \"concept\",\n \"repo_path\",\n \"command\",\n \"url\",\n] as const;\n\ntool(\n \"graph_query\",\n \"Knowledge-graph aware retrieval. Same shape as `query` but walks the entity graph N hops from the seed memories so related memories that don't textually match the query still surface (e.g. asking about 'auth' returns a memory about `jose` key rotation if both reference the same auth entities). Use for complex questions where you suspect related context exists under a different vocabulary.\",\n {\n query: z.string().describe(\"Natural-language question or task description.\"),\n repo: z.string().optional().describe(\"Restrict to a repository.\"),\n hops: z.number().int().min(0).max(4).optional().describe(\"Graph walk depth (default 2).\"),\n limit: z.number().int().min(1).max(50).optional().describe(\"Max hits to return (default 15).\"),\n relation_types: z.array(z.enum(RELATION_TYPES)).optional().describe(\"Restrict graph walk to these relation types.\"),\n },\n async ({ query, repo, hops, limit, relation_types }) => {\n const embeddingConfig = loadEmbeddingConfigFromEnv();\n const result = await graphQuery(db, query, embeddingConfig, {\n repo,\n hops,\n limit,\n relationTypes: relation_types as RelationType[] | undefined,\n });\n const payload = {\n seed_count: result.seed_count,\n expanded_entities: result.expanded_entities,\n hits: result.hits.map((h) => ({\n memory_id: h.memory.id,\n text: h.memory.text,\n repo: h.memory.repo,\n scope: h.memory.scope,\n status: h.memory.status,\n via: h.via,\n score: Number(h.score.toFixed(4)),\n hops: h.hops,\n shared_entities: h.shared_entities.map((e) => ({\n id: e.id,\n kind: e.kind,\n name: e.name,\n })),\n })),\n };\n return {\n content: [{ type: \"text\" as const, text: JSON.stringify(payload, null, 2) }],\n };\n },\n);\n\ntool(\n \"graph_neighbors\",\n \"Walk the entity graph from a starting entity. Returns the neighbour entities + relations + every memory mentioning any of them. Use this to explore 'what else does the codebase know about X'.\",\n {\n entity_id: z.string().describe(\"Starting entity ID (from entity_list or graph_query.shared_entities[].id).\"),\n hops: z.number().int().min(1).max(5).optional().describe(\"Walk depth (default 1).\"),\n relation_types: z.array(z.enum(RELATION_TYPES)).optional().describe(\"Restrict to these relation types.\"),\n include_memories: z.boolean().optional().describe(\"Include the memory IDs that mention each entity (default true).\"),\n },\n async ({ entity_id, hops, relation_types, include_memories }) => {\n const root = getEntity(db, entity_id);\n if (!root) {\n return {\n content: [{ type: \"text\" as const, text: JSON.stringify({ error: \"entity not found\", entity_id }) }],\n isError: true,\n };\n }\n const walk = neighborsOf(db, entity_id, {\n hops,\n relationTypes: relation_types as RelationType[] | undefined,\n });\n const memIds = include_memories === false\n ? {}\n : Object.fromEntries(walk.entities.map((e) => [e.id, listMemoryIdsForEntity(db, e.id)]));\n const payload = {\n root: { id: root.id, kind: root.kind, name: root.name, repo: root.repo },\n entities: walk.entities.map((e) => ({\n id: e.id,\n kind: e.kind,\n name: e.name,\n repo: e.repo,\n mention_count: e.mention_count,\n })),\n relations: walk.relations.map((r) => ({\n source: r.source_entity_id,\n target: r.target_entity_id,\n type: r.relation_type,\n confidence: r.confidence,\n })),\n memories_by_entity: memIds,\n };\n return {\n content: [{ type: \"text\" as const, text: JSON.stringify(payload, null, 2) }],\n };\n },\n);\n\ntool(\n \"entity_list\",\n \"List entities (files, functions, libraries, tools, concepts) the knowledge graph knows about. Filter by repo/kind/search to find a starting node for graph_neighbors.\",\n {\n repo: z.string().optional().describe(\"Restrict to a repository.\"),\n kind: z.enum(ENTITY_KINDS).optional().describe(\"Restrict to one entity kind.\"),\n search: z.string().optional().describe(\"Case-insensitive substring filter on name.\"),\n limit: z.number().int().min(1).max(500).optional().describe(\"Max rows (default 100).\"),\n },\n async ({ repo, kind, search, limit }) => {\n const rows = listEntities(db, {\n repo,\n kind,\n search,\n limit,\n });\n const payload = {\n count: rows.length,\n entities: rows.map((r) => ({\n id: r.id,\n kind: r.kind,\n name: r.name,\n repo: r.repo,\n mention_count: r.mention_count,\n })),\n };\n return {\n content: [{ type: \"text\" as const, text: JSON.stringify(payload, null, 2) }],\n };\n },\n);\n\nreturn server;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,iBAAiB;AAC1B,SAAS,yBAAyB;AAClC,SAAS,SAAS;AAmDX,SAAS,sBAAsB,KAAe,OAAO,GAAG;AAC/D,QAAM,qBAAqB;AAAA,IACzB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAEA,QAAM,SAAS,IAAI,UAAU;AAAA,IAC3B,MAAM;AAAA,IACN,SAAS;AAAA,EACX,CAAC;AAED,QAAM,mBAAmB,IAAI,kBAAqC;AAElE,WAAS,YAAY;AACnB,WAAO,kBAAkB,OAAO,iBAAiB,SAAS,GAAG,IAAI;AAAA,EACnE;AAEA,WAAS,2BAA+C;AACtD,WAAO,OAAO,OAAO,iBAAiB,GAAG;AAAA,EAC3C;AAEA,WAAS,cAAc,MAAwD;AAC7E,UAAM,MAA+B,CAAC;AACtC,eAAW,CAAC,GAAG,CAAC,KAAK,OAAO,QAAQ,IAAI,GAAG;AACzC,UAAI,MAAM,QAAQ,MAAM,OAAW;AACnC,UAAI,OAAO,MAAM,UAAU;AACzB,YAAI,CAAC,IAAI,EAAE,SAAS,MAAM,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC,cAAS,EAAE,MAAM,MAAM;AAAA,MACrE,WAAW,OAAO,MAAM,YAAY,OAAO,MAAM,WAAW;AAC1D,YAAI,CAAC,IAAI;AAAA,MACX,WAAW,MAAM,QAAQ,CAAC,GAAG;AAC3B,YAAI,CAAC,IAAI,EAAE,cAAc,EAAE,OAAO;AAAA,MACpC,WAAW,OAAO,MAAM,UAAU;AAChC,YAAI,CAAC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AAAA,UACR,YAAY,EAAE;AAAA,QAChB,EAAE;AAAA,QACF,oBAAoB;AAAA,MACtB;AACA,aAAO;AAAA,QACL,SAAS,CAAC,EAAE,MAAM,QAAiB,MAAM,KAAK,UAAU,SAAS,MAAM,CAAC,EAAE,CAAC;AAAA,MAC7E;AAAA,IACF;AAAA,EACF;AAEA;AAAA,IACE;AAAA,IACA;AAAA,IACA;AAAA,MACE,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,2BAA2B;AAAA,MAChE,MAAM,EAAE,KAAK,YAAY,EAAE,SAAS,EAAE,SAAS,8BAA8B;AAAA,MAC7E,QAAQ,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,4CAA4C;AAAA,MACnF,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,EAAE,IAAI,GAAG,EAAE,SAAS,EAAE,SAAS,yBAAyB;AAAA,IACvF;AAAA,IACA,OAAO,EAAE,MAAM,MAAM,QAAQ,MAAM,MAAM;AACvC,YAAM,OAAO,aAAa,IAAI;AAAA,QAC5B;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MACF,CAAC;AACD,YAAM,UAAU;AAAA,QACd,OAAO,KAAK;AAAA,QACZ,UAAU,KAAK,IAAI,CAAC,OAAO;AAAA,UACzB,IAAI,EAAE;AAAA,UACN,MAAM,EAAE;AAAA,UACR,MAAM,EAAE;AAAA,UACR,MAAM,EAAE;AAAA,UACR,eAAe,EAAE;AAAA,QACnB,EAAE;AAAA,MACJ;AACA,aAAO;AAAA,QACL,SAAS,CAAC,EAAE,MAAM,QAAiB,MAAM,KAAK,UAAU,SAAS,MAAM,CAAC,EAAE,CAAC;AAAA,MAC7E;AAAA,IACF;AAAA,EACF;AAEA,SAAO;AACP;","names":[]}
@@ -15,14 +15,14 @@ import {
15
15
  signalOutcomeFallback,
16
16
  startSessionLifecycle,
17
17
  toolCallTouchesMemory
18
- } from "./chunk-PG2ZVVAT.js";
18
+ } from "./chunk-2G5DMOVA.js";
19
19
  import {
20
20
  detectCorrections,
21
21
  isHighRiskRule,
22
22
  isTriggerTemplateRule,
23
23
  peekTasks,
24
24
  redactSensitiveText
25
- } from "./chunk-PH6YNVHR.js";
25
+ } from "./chunk-BMWLHPLS.js";
26
26
  import {
27
27
  hookCallDedupeKey,
28
28
  queryMemories
@@ -987,4 +987,4 @@ export {
987
987
  readCodexSessionEndInputFromStdin,
988
988
  dispatchCodexNotify
989
989
  };
990
- //# sourceMappingURL=chunk-CPOANMKD.js.map
990
+ //# sourceMappingURL=chunk-OLZS3M24.js.map
@@ -9,7 +9,7 @@ import {
9
9
  qualityReasons,
10
10
  revertCleanupRun,
11
11
  runDeterministicCleanup
12
- } from "./chunk-PH6YNVHR.js";
12
+ } from "./chunk-BMWLHPLS.js";
13
13
  import "./chunk-UBPGOOAN.js";
14
14
  import "./chunk-37K4DPRI.js";
15
15
  import "./chunk-JRIM7VBY.js";
@@ -28,4 +28,4 @@ export {
28
28
  revertCleanupRun,
29
29
  runDeterministicCleanup
30
30
  };
31
- //# sourceMappingURL=cleanup-YGHZIYLJ.js.map
31
+ //# sourceMappingURL=cleanup-2HK2TX7Q.js.map
package/dist/cli.js CHANGED
@@ -22,7 +22,7 @@ import {
22
22
  readCodexSessionStartInputFromStdin,
23
23
  readCodexToolInputFromStdin,
24
24
  restoreBackup
25
- } from "./chunk-CPOANMKD.js";
25
+ } from "./chunk-OLZS3M24.js";
26
26
  import {
27
27
  RECALL_DB_USER_VERSION,
28
28
  compileContext,
@@ -61,7 +61,7 @@ import {
61
61
  startEvalSession,
62
62
  togglePolicy,
63
63
  writeRepoContextArtifact
64
- } from "./chunk-PG2ZVVAT.js";
64
+ } from "./chunk-2G5DMOVA.js";
65
65
  import {
66
66
  autoResolveContradictions,
67
67
  computeAllHealthScores,
@@ -79,9 +79,10 @@ import {
79
79
  recordAudit,
80
80
  resolveContradiction,
81
81
  rollbackMemory
82
- } from "./chunk-PH6YNVHR.js";
82
+ } from "./chunk-BMWLHPLS.js";
83
83
  import {
84
84
  confirmMemory,
85
+ createMemory,
85
86
  getMemory,
86
87
  listMemories,
87
88
  listRepos,
@@ -92,11 +93,14 @@ import "./chunk-37K4DPRI.js";
92
93
  import {
93
94
  bootstrapEmbeddings,
94
95
  ensureEmbeddingProviderReady,
96
+ flushEmbeddingJobs,
95
97
  getEmbeddingModelInfo,
96
98
  hybridSearch,
97
99
  loadEmbeddingConfigFromEnv,
98
100
  queueMemoryEmbeddingSync,
99
101
  rebuildEmbeddingIndex,
102
+ searchMemoryFtsIndex,
103
+ semanticSearch,
100
104
  verifyEmbeddings
101
105
  } from "./chunk-JRIM7VBY.js";
102
106
  import {
@@ -119,6 +123,159 @@ import { resolve as resolve6 } from "path";
119
123
  import { writeFileSync as writeFileSync5, readFileSync as readFileSync5 } from "fs";
120
124
  import { join as join7 } from "path";
121
125
 
126
+ // src/ump/serve.ts
127
+ import {
128
+ UmpServer,
129
+ generateKeyPair,
130
+ createHttpServer,
131
+ createMcpServer
132
+ } from "@universalmemoryprotocol/core";
133
+ import { RecallStore } from "@universalmemoryprotocol/core/adapters/recall";
134
+ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
135
+
136
+ // src/ump/backend.ts
137
+ var SEARCH_MIN_SIM = parseFloat(process.env.UMP_RECALL_MIN_SIM ?? "0.3");
138
+ var RRF_K = 60;
139
+ function toRecallMemory(m) {
140
+ return {
141
+ id: m.id,
142
+ text: m.text,
143
+ type: m.type,
144
+ scope: m.scope,
145
+ status: m.status,
146
+ confidence: m.confidence,
147
+ repo: m.repo,
148
+ path: m.path_scope,
149
+ source: m.source,
150
+ supersedes: m.supersedes,
151
+ created_at: m.created_at,
152
+ updated_at: m.updated_at,
153
+ last_validated_at: m.last_validated_at,
154
+ evidence: m.evidence?.map((e) => ({
155
+ ref: e.ref,
156
+ context: e.context
157
+ })),
158
+ capture_context: m.capture_context ?? null
159
+ };
160
+ }
161
+ function tokenOverlap(query, text) {
162
+ const q = new Set(query.toLowerCase().split(/[^a-z0-9]+/).filter((t2) => t2.length > 1));
163
+ if (q.size === 0) return 0;
164
+ const t = text.toLowerCase();
165
+ let hits = 0;
166
+ for (const w of q) if (t.includes(w)) hits++;
167
+ return hits / q.size;
168
+ }
169
+ function makeRecallBackend(db) {
170
+ return {
171
+ queryMemories: (f) => queryMemories(db, { repo: f.repo }).map(toRecallMemory),
172
+ getMemory: (id) => {
173
+ const m = getMemory(db, id);
174
+ return m ? toRecallMemory(m) : void 0;
175
+ },
176
+ compileHybrid: async ({ query, repo, limit }) => {
177
+ const cap = limit ?? 8;
178
+ const window = Math.max(cap * 5, 30);
179
+ const rrf = /* @__PURE__ */ new Map();
180
+ const add = (id, rank) => rrf.set(id, (rrf.get(id) ?? 0) + 1 / (RRF_K + rank));
181
+ const cfg = loadEmbeddingConfigFromEnv();
182
+ if (cfg) {
183
+ try {
184
+ const sem = await semanticSearch(
185
+ db,
186
+ query,
187
+ { ...cfg, similarity_threshold: SEARCH_MIN_SIM },
188
+ { repo, limit: window }
189
+ );
190
+ sem.forEach((s, i) => add(s.memory.id, i));
191
+ } catch {
192
+ }
193
+ }
194
+ try {
195
+ searchMemoryFtsIndex(db, query, { repo, limit: window }).forEach((l, i) => add(l.memory_id, i));
196
+ } catch {
197
+ }
198
+ if (rrf.size > 0) {
199
+ const out = [];
200
+ for (const [id, score] of [...rrf.entries()].sort((a, b) => b[1] - a[1])) {
201
+ const m = getMemory(db, id);
202
+ if (m && (m.status === "active" || m.status === "candidate")) {
203
+ out.push({ memory: toRecallMemory(m), score });
204
+ if (out.length >= cap) break;
205
+ }
206
+ }
207
+ if (out.length > 0) return out;
208
+ }
209
+ return queryMemories(db, {}).filter((m) => m.status === "active" || m.status === "candidate").map((m) => ({ memory: toRecallMemory(m), score: tokenOverlap(query, m.text) })).filter((r) => r.score > 0).sort((a, b) => b.score - a.score).slice(0, cap);
210
+ },
211
+ storeDirect: async ({ text, type, scope, repo, confidence, kind }) => {
212
+ const id = createMemory(db, {
213
+ type,
214
+ text,
215
+ scope,
216
+ repo: repo ?? null,
217
+ source: "user_correction",
218
+ confidence,
219
+ capture_context: { ump_kind: kind }
220
+ });
221
+ await flushEmbeddingJobs();
222
+ return id;
223
+ },
224
+ tombstone: (id) => rejectMemory(db, id),
225
+ capture: async ({ text, repo, path }) => {
226
+ const res = await processCorrection(db, text, {
227
+ sessionId: "ump",
228
+ repo,
229
+ path
230
+ });
231
+ return { ids: res.ids ?? [] };
232
+ }
233
+ };
234
+ }
235
+
236
+ // src/ump/serve.ts
237
+ async function runUmpServer(opts = {}) {
238
+ const db = initDb();
239
+ const key = generateKeyPair();
240
+ const owner = key.did;
241
+ const embedCfg = loadEmbeddingConfigFromEnv();
242
+ if (embedCfg) {
243
+ try {
244
+ process.stderr.write(`[recall ump] loading embedding model ${embedCfg.model}...
245
+ `);
246
+ await ensureEmbeddingProviderReady(embedCfg);
247
+ const n = await bootstrapEmbeddings(db, embedCfg);
248
+ process.stderr.write(`[recall ump] semantic search ready (${n} memories indexed)
249
+ `);
250
+ } catch (e) {
251
+ process.stderr.write(
252
+ `[recall ump] embeddings unavailable (${e instanceof Error ? e.message : String(e)}); using lexical search
253
+ `
254
+ );
255
+ }
256
+ }
257
+ const server = new UmpServer({
258
+ name: "recall",
259
+ version: "ump-0.1",
260
+ conformance: "L1",
261
+ store: new RecallStore(makeRecallBackend(db), { owner, smart: opts.smart }),
262
+ key
263
+ });
264
+ if (opts.http) {
265
+ createHttpServer(server, { wellKnown: { owner } }).listen(opts.http, () => {
266
+ process.stderr.write(
267
+ `[recall ump] HTTP binding on :${opts.http} (owner ${owner})
268
+ `
269
+ );
270
+ });
271
+ }
272
+ if (opts.stdio ?? !opts.http) {
273
+ await createMcpServer(server).connect(new StdioServerTransport());
274
+ process.stderr.write(`[recall ump] MCP binding on stdio (owner ${owner})
275
+ `);
276
+ }
277
+ }
278
+
122
279
  // src/sync/client.ts
123
280
  import { randomUUID } from "crypto";
124
281
  function getSyncState(db) {
@@ -320,10 +477,11 @@ function hasCommand(name) {
320
477
  var CLAUDE_CONFIG_RELATIVE_PATH = [".claude", "settings.json"];
321
478
  var CLAUDE_MD_RELATIVE_PATH = [".claude", "CLAUDE.md"];
322
479
  var MANAGED_TAG = "recall:managed:claude-code";
323
- var CLAUDE_MD_BLOCK_VERSION = 1;
324
- var CLAUDE_MD_BEGIN = `<!-- recall:managed:claude-md:begin v${CLAUDE_MD_BLOCK_VERSION} -->`;
325
- var CLAUDE_MD_END = "<!-- recall:managed:claude-md:end -->";
326
- var CLAUDE_MD_BLOCK_RE = /<!--\s*recall:managed:claude-md:begin(?:\s+v\d+)?\s*-->[\s\S]*?<!--\s*recall:managed:claude-md:end\s*-->\n?/g;
480
+ var CLAUDE_MD_BLOCK_VERSION = 3;
481
+ var CLAUDE_MD_BEGIN = `<!-- recall:managed:memory:begin v${CLAUDE_MD_BLOCK_VERSION} -->`;
482
+ var CLAUDE_MD_END = "<!-- recall:managed:memory:end -->";
483
+ var CLAUDE_MD_BEGIN_NAME_RE = /recall:managed:(?:memory|claude-md):begin/;
484
+ var CLAUDE_MD_BLOCK_RE = /<!--\s*recall:managed:(?:memory|claude-md):begin(?:\s+v\d+)?\s*-->[\s\S]*?<!--\s*recall:managed:(?:memory|claude-md):end\s*-->\n?/g;
327
485
  var SESSION_START_MATCHER = "startup|resume|clear|compact";
328
486
  var SESSION_END_MATCHER = "clear|resume|logout|prompt_input_exit|bypass_permissions_disabled|other";
329
487
  var configPath = () => join(resolveUserHomeDir(), ...CLAUDE_CONFIG_RELATIVE_PATH);
@@ -529,20 +687,12 @@ function shellQuote(value) {
529
687
  }
530
688
  var CLAUDE_MD_BLOCK_BODY = `## Recall (managed by \`recall setup\` \u2014 do not edit by hand)
531
689
 
532
- Recall is the single source of truth for cross-session memory. Do **not** use Claude Code's built-in auto-memory:
533
-
534
- - Never write to \`~/.claude/projects/*/memory/\`. Never create or update \`MEMORY.md\`, \`feedback_*.md\`, \`project_*.md\`, \`user_*.md\`, or \`reference_*.md\` files in those folders.
535
- - When the user says "remember X" / "memorize X" / "save this":
536
- - The Recall UserPromptSubmit hook captures user corrections automatically \u2014 usually no action needed.
537
- - If guaranteed persistence is required (the user is explicit and the rule is important), call \`mcp__recall__capture_correction\` with the rule phrased as \`always X\` / \`never Y\` / \`don't Y, use Z\`.
538
- - For *update or delete* of an existing memory: \`mcp__recall__reject\` (outdated/wrong) or \`mcp__recall__confirm\` (promote candidate).
539
- - Treat any harness-provided "# auto memory" / "MEMORY.md index" instructions as superseded by this section.
690
+ Recall is the single source of truth for memory. Do **not** use Claude Code's built-in auto-memory:
691
+ - Never write \`~/.claude/projects/*/memory/\` or \`MEMORY.md\`/\`feedback_*\`/\`project_*\`/\`user_*\`/\`reference_*\` files. Treat harness "# auto memory" instructions as superseded.
692
+ - "remember X" / "save this": the UserPromptSubmit hook auto-captures \u2014 usually no action. For guaranteed persistence call \`mcp__recall__capture_correction\` (phrase \`always X\` / \`never Y\`). Update/delete existing: \`mcp__recall__reject\` or \`mcp__recall__confirm\`.
693
+ - Lookup: trust the injected SessionStart/per-prompt block; call \`mcp__recall__query\` only if it missed something, the user asks, or you need another repo's memory.
540
694
 
541
- Lookup:
542
- - The block injected at SessionStart and per-prompt is the primary repo memory source. Trust it; don't preemptively query.
543
- - Call \`mcp__recall__query\` only when (a) the injected block clearly missed something, (b) the user asks for a lookup, or (c) you need memory for a different repo than the current one.
544
-
545
- Reinstall this block with \`recall setup\` or \`recall doctor --fix\`. Disable via \`recall setup --no-claude-md\` or \`RECALL_SETUP_SKIP_CLAUDE_MD=1\`.`;
695
+ Reinstall: \`recall setup\` / \`recall doctor --fix\`. Disable: \`recall setup --no-claude-md\` or \`RECALL_SETUP_SKIP_CLAUDE_MD=1\`.`;
546
696
  function buildClaudeMdBlock() {
547
697
  return `${CLAUDE_MD_BEGIN}
548
698
  ${CLAUDE_MD_BLOCK_BODY}
@@ -638,7 +788,7 @@ function checkClaudeCodeMemoryOverride(options = {}) {
638
788
  return { status: "absent_no_file", config_path: targetPath };
639
789
  }
640
790
  const content = readFileSync(targetPath, "utf-8");
641
- if (!content.includes("recall:managed:claude-md:begin")) {
791
+ if (!CLAUDE_MD_BEGIN_NAME_RE.test(content)) {
642
792
  return { status: "missing", config_path: targetPath };
643
793
  }
644
794
  return {
@@ -2450,6 +2600,13 @@ hookCmd.command("stats").description("Inspect local hook call telemetry").option
2450
2600
  );
2451
2601
  }
2452
2602
  });
2603
+ program.command("ump").description("Serve the Universal Memory Protocol (UMP) over Recall's engine").option("--http <port>", "Serve the UMP HTTP binding on this port").option("--stdio", "Serve the UMP MCP binding over stdio (default)").option("--smart", "Route writes through Recall's capture/judgement pipeline").action(async (opts) => {
2604
+ await runUmpServer({
2605
+ http: opts.http ? parseInt(opts.http, 10) : void 0,
2606
+ stdio: opts.stdio,
2607
+ smart: opts.smart
2608
+ });
2609
+ });
2453
2610
  program.command("scan").description("Scan a repository and bootstrap memories").argument("[path]", "Repository path", ".").option("-s, --session <id>", "Session ID").action((path, opts) => {
2454
2611
  const db = initDb();
2455
2612
  const repoPath = resolve6(path);
@@ -2618,7 +2775,7 @@ program.command("compile").description("Compile active memories into injection p
2618
2775
  });
2619
2776
  program.command("correct").description("Report a correction to learn from").argument("<text>", "Correction text").option("-r, --repo <repo>", "Repository name").option("-p, --path <path>", "File path context").option("-s, --session <id>", "Session ID", "cli").action(async (text, opts) => {
2620
2777
  const db = initDb();
2621
- const ids = await processCorrection(db, text, {
2778
+ const { ids, pendingTaskId } = await processCorrection(db, text, {
2622
2779
  sessionId: opts.session,
2623
2780
  repo: opts.repo,
2624
2781
  path: opts.path
@@ -2631,9 +2788,14 @@ program.command("correct").description("Report a correction to learn from").argu
2631
2788
  event_type: "correction",
2632
2789
  memory_ids: ids,
2633
2790
  request: { text },
2634
- result: { created: ids }
2791
+ result: { created: ids, pending_task_id: pendingTaskId ?? null }
2635
2792
  });
2636
2793
  if (ids.length === 0) {
2794
+ if (pendingTaskId) {
2795
+ console.log(`Enqueued for LLM extraction (task ${pendingTaskId.slice(0, 16)}).`);
2796
+ console.log("The candidate memory will appear once the dispatcher processes the prompt.");
2797
+ return;
2798
+ }
2637
2799
  console.log("No correction pattern detected.");
2638
2800
  console.log(
2639
2801
  `Try: "don't use X, use Y", "always do Z", "let's use editorconfig defaults", or "review said to use W"`
@@ -3356,7 +3518,7 @@ graphCmd.command("query <query...>").description("Run graph-aware retrieval for
3356
3518
  });
3357
3519
  var maintenanceCmd = program.command("maintenance").description("Inspect and manage the delegated maintenance task queue");
3358
3520
  maintenanceCmd.command("stats").description("Show backlog counts, completion stats, and mean latency").action(async () => {
3359
- const { getTaskStats } = await import("./tasks-6J3LULYO.js");
3521
+ const { getTaskStats } = await import("./tasks-GJBURDAB.js");
3360
3522
  const db = initDb();
3361
3523
  const stats = getTaskStats(db);
3362
3524
  console.log(`Total tasks: ${stats.total}`);
@@ -3382,7 +3544,7 @@ maintenanceCmd.command("stats").description("Show backlog counts, completion sta
3382
3544
  }
3383
3545
  });
3384
3546
  maintenanceCmd.command("list").description("List tasks (default: pending)").option("-s, --status <status>", "pending|claimed|completed|abandoned", "pending").option("-k, --kind <kind>", "Filter by kind").option("-r, --repo <repo>", "Filter by repo").option("-n, --limit <n>", "Max entries", "20").action(async (opts) => {
3385
- const { listTasks } = await import("./tasks-6J3LULYO.js");
3547
+ const { listTasks } = await import("./tasks-GJBURDAB.js");
3386
3548
  const db = initDb();
3387
3549
  const tasks = listTasks(db, {
3388
3550
  status: opts.status,
@@ -3404,7 +3566,7 @@ maintenanceCmd.command("list").description("List tasks (default: pending)").opti
3404
3566
  }
3405
3567
  });
3406
3568
  maintenanceCmd.command("drop").description("Delete a task by id (or id prefix)").argument("<task-id>", "Task id or prefix").action(async (taskIdArg) => {
3407
- const { deleteTask, listTasks } = await import("./tasks-6J3LULYO.js");
3569
+ const { deleteTask, listTasks } = await import("./tasks-GJBURDAB.js");
3408
3570
  const db = initDb();
3409
3571
  const all = listTasks(db, { limit: 1e4 });
3410
3572
  const matches = all.filter((t) => t.id === taskIdArg || t.id.startsWith(taskIdArg));
@@ -3510,8 +3672,8 @@ credentialsCmd.command("clear").description("Remove provider credentials from th
3510
3672
  else console.log(`No ${provider} credentials found in Keychain.`);
3511
3673
  });
3512
3674
  maintenanceCmd.command("dispatch").description("Run the daemon-owned dispatcher once against pending maintenance tasks (requires a configured LLM provider)").option("--provider <provider>", "openai|anthropic|azure-openai (defaults to whichever is configured)").option("--model <model>", "Model override").option("--kind <kind>", "Restrict to a single task kind (repeatable)", (value, acc = []) => [...acc, value], []).option("--repo <repo>", "Restrict to a single repo").option("--max <n>", "Max tasks to run this round", "5").option("--dry-run", "Show which tasks would be dispatched; do not call the LLM").option("--preview", "Show the actual prompts that would be sent (no provider needed; no LLM call)").option("--json", "Emit the raw JSON report").action(async (opts) => {
3513
- const { dispatchPendingTasks, formatDispatchReport, buildPrompt } = await import("./dispatcher-5MDL3QQT.js");
3514
- const { listTasks } = await import("./tasks-6J3LULYO.js");
3675
+ const { dispatchPendingTasks, formatDispatchReport, buildPrompt } = await import("./dispatcher-Z4GEFOQG.js");
3676
+ const { listTasks } = await import("./tasks-GJBURDAB.js");
3515
3677
  const db = initDb();
3516
3678
  if (opts.preview) {
3517
3679
  const pending = listTasks(db, {
@@ -3568,7 +3730,7 @@ ${p.prompt.max_output_tokens}
3568
3730
  console.log(formatDispatchReport(report));
3569
3731
  });
3570
3732
  maintenanceCmd.command("cleanup").description("Run deterministic, LLM-free cleanup: exact-text dedupe, fragment rejection, repeat-correction promotion").option("--apply", "Persist changes (default is dry-run)").option("--only <action>", "Restrict to one action: dedupe_exact_merge|reject_fragment_candidate|promote_repeat_correction").option("--revert <run-id>", "Revert a previous cleanup run (id or 8-char prefix)").option("--list", "List recent cleanup runs").option("--json", "Emit the raw JSON report").action(async (opts) => {
3571
- const { runDeterministicCleanup, formatCleanupReport, revertCleanupRun, listCleanupRuns } = await import("./cleanup-YGHZIYLJ.js");
3733
+ const { runDeterministicCleanup, formatCleanupReport, revertCleanupRun, listCleanupRuns } = await import("./cleanup-2HK2TX7Q.js");
3572
3734
  const db = initDb();
3573
3735
  if (opts.list) {
3574
3736
  const runs = listCleanupRuns(db);