@kage-core/kage-graph-mcp 1.1.35 → 1.1.37

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 CHANGED
@@ -89,6 +89,7 @@ function listTools() {
89
89
  project_dir: { type: "string", description: "Absolute path to the project root" },
90
90
  query: { type: "string", description: "The task or question — used for both memory recall and code graph search" },
91
91
  limit: { type: "number", description: "Max memory packets to return (default 5)" },
92
+ session_id: { type: "string", description: "Optional active agent session id for memory reconciliation" },
92
93
  targets: { type: "array", items: { type: "string" }, description: "Optional files the agent may edit or explain; used for risk context" },
93
94
  changed_files: { type: "array", items: { type: "string" }, description: "Optional changed files for pre-edit or PR risk context" },
94
95
  },
@@ -149,6 +150,7 @@ function listTools() {
149
150
  project_dir: { type: "string" },
150
151
  limit: { type: "number" },
151
152
  explain: { type: "boolean" },
153
+ embeddings: { type: "boolean" },
152
154
  json: { type: "boolean" },
153
155
  },
154
156
  required: ["query", "project_dir"],
@@ -254,6 +256,69 @@ function listTools() {
254
256
  required: ["project_dir"],
255
257
  },
256
258
  },
259
+ {
260
+ name: "kage_profile",
261
+ description: "Return a compact project profile for agent orientation: repo totals, languages, top code+memory concepts, key files, memory focus, run commands, and next actions.",
262
+ inputSchema: {
263
+ type: "object",
264
+ properties: {
265
+ project_dir: { type: "string" },
266
+ },
267
+ required: ["project_dir"],
268
+ },
269
+ },
270
+ {
271
+ name: "kage_capabilities",
272
+ description: "Return an evidence-backed Kage memory-system capability audit across repo memory, collaboration/session proof, benchmarks, and dashboard/viewer readiness.",
273
+ inputSchema: {
274
+ type: "object",
275
+ properties: {
276
+ project_dir: { type: "string" },
277
+ },
278
+ required: ["project_dir"],
279
+ },
280
+ },
281
+ {
282
+ name: "kage_context_slots",
283
+ description: "List repo-local pinned context slots. Pinned slots are small, reviewable facts that Kage includes in recall/context before task-specific memory.",
284
+ inputSchema: {
285
+ type: "object",
286
+ properties: {
287
+ project_dir: { type: "string" },
288
+ },
289
+ required: ["project_dir"],
290
+ },
291
+ },
292
+ {
293
+ name: "kage_context_slot_set",
294
+ description: "Create or update a repo-local pinned context slot. Use for durable, high-signal repo guidance that should always be included without loading all memory.",
295
+ inputSchema: {
296
+ type: "object",
297
+ properties: {
298
+ project_dir: { type: "string" },
299
+ label: { type: "string" },
300
+ content: { type: "string" },
301
+ description: { type: "string" },
302
+ pinned: { type: "boolean" },
303
+ size_limit: { type: "number" },
304
+ paths: { type: "array", items: { type: "string" } },
305
+ tags: { type: "array", items: { type: "string" } },
306
+ },
307
+ required: ["project_dir", "label", "content"],
308
+ },
309
+ },
310
+ {
311
+ name: "kage_context_slot_delete",
312
+ description: "Delete a repo-local context slot by label.",
313
+ inputSchema: {
314
+ type: "object",
315
+ properties: {
316
+ project_dir: { type: "string" },
317
+ label: { type: "string" },
318
+ },
319
+ required: ["project_dir", "label"],
320
+ },
321
+ },
257
322
  {
258
323
  name: "kage_decisions",
259
324
  description: "Summarize Kage why-memory for a repo: decisions, gotchas, runbooks, conventions, code explanations, path coverage, weak/stale memory, and important code paths that still lack decision memory.",
@@ -298,6 +363,17 @@ function listTools() {
298
363
  required: ["project_dir"],
299
364
  },
300
365
  },
366
+ {
367
+ name: "kage_memory_access",
368
+ description: "Report which repo-local memory packets have actually been recalled recently. This uses local ignored access telemetry and does not mutate shareable packet files.",
369
+ inputSchema: {
370
+ type: "object",
371
+ properties: {
372
+ project_dir: { type: "string" },
373
+ },
374
+ required: ["project_dir"],
375
+ },
376
+ },
301
377
  {
302
378
  name: "kage_module_health",
303
379
  description: "Return local module health scorecards from Kage's code graph, test signals, cleanup candidates, git churn, and ownership concentration.",
@@ -399,6 +475,19 @@ function listTools() {
399
475
  required: ["project_dir"],
400
476
  },
401
477
  },
478
+ {
479
+ name: "kage_memory_reconcile",
480
+ description: "Return agent-owned memory reconciliation work when source files linked to existing memory changed. Agents must update, supersede, or mark stale memory before final handoff.",
481
+ inputSchema: {
482
+ type: "object",
483
+ properties: {
484
+ project_dir: { type: "string" },
485
+ session_id: { type: "string" },
486
+ limit: { type: "number" },
487
+ },
488
+ required: ["project_dir"],
489
+ },
490
+ },
402
491
  {
403
492
  name: "kage_quality",
404
493
  description: "Return memory quality metrics: useful memory ratio, duplicate burden, stale/wrong feedback, evidence coverage, path grounding, and review queue size.",
@@ -410,13 +499,87 @@ function listTools() {
410
499
  required: ["project_dir"],
411
500
  },
412
501
  },
502
+ {
503
+ name: "kage_memory_lifecycle",
504
+ description: "Return a repo-local memory lifecycle report: healthy, hot, cold, stale, disputed, ungrounded, pending, generated, and concrete review actions.",
505
+ inputSchema: {
506
+ type: "object",
507
+ properties: {
508
+ project_dir: { type: "string" },
509
+ },
510
+ required: ["project_dir"],
511
+ },
512
+ },
513
+ {
514
+ name: "kage_memory_timeline",
515
+ description: "Return recent repo-memory activity for teammate handoff: added, updated, pending, and deprecated packets with review actions.",
516
+ inputSchema: {
517
+ type: "object",
518
+ properties: {
519
+ project_dir: { type: "string" },
520
+ days: { type: "number" },
521
+ },
522
+ required: ["project_dir"],
523
+ },
524
+ },
525
+ {
526
+ name: "kage_memory_lineage",
527
+ description: "Return memory supersession chains so agents can use current replacement packets and keep retired memory as audit history.",
528
+ inputSchema: {
529
+ type: "object",
530
+ properties: {
531
+ project_dir: { type: "string" },
532
+ },
533
+ required: ["project_dir"],
534
+ },
535
+ },
536
+ {
537
+ name: "kage_memory_audit",
538
+ description: "Return the repo-local audit trail for explicit memory mutations: capture, feedback, review, supersede, deprecate, and delete.",
539
+ inputSchema: {
540
+ type: "object",
541
+ properties: {
542
+ project_dir: { type: "string" },
543
+ limit: { type: "number" },
544
+ },
545
+ required: ["project_dir"],
546
+ },
547
+ },
548
+ {
549
+ name: "kage_memory_handoff",
550
+ description: "Return a teammate/agent handoff queue by combining memory inbox, lifecycle, audit, timeline, and lineage into concrete next actions.",
551
+ inputSchema: {
552
+ type: "object",
553
+ properties: {
554
+ project_dir: { type: "string" },
555
+ },
556
+ required: ["project_dir"],
557
+ },
558
+ },
559
+ {
560
+ name: "kage_supersede",
561
+ description: "Mark one repo-local memory packet as superseded by a replacement packet and write bidirectional lineage edges.",
562
+ inputSchema: {
563
+ type: "object",
564
+ properties: {
565
+ project_dir: { type: "string" },
566
+ packet_id: { type: "string" },
567
+ replacement_packet_id: { type: "string" },
568
+ reason: { type: "string" },
569
+ },
570
+ required: ["project_dir", "packet_id", "replacement_packet_id"],
571
+ },
572
+ },
413
573
  {
414
574
  name: "kage_benchmark",
415
- description: "Return Kage proof metrics: runbook, bug-fix, decision and code-flow coverage, recall hit rate, estimated rediscovery avoided, tokens saved, and time-to-first-use.",
575
+ description: "Return Kage proof metrics, or set mode=memory_quality / memory_scale for synthetic memory retrieval benchmarks.",
416
576
  inputSchema: {
417
577
  type: "object",
418
578
  properties: {
419
579
  project_dir: { type: "string" },
580
+ mode: { type: "string", enum: ["project", "memory_quality", "memory_scale"] },
581
+ sizes: { type: "array", items: { type: "number" } },
582
+ top_k: { type: "number" },
420
583
  },
421
584
  required: ["project_dir"],
422
585
  },
@@ -446,6 +609,17 @@ function listTools() {
446
609
  required: ["agent", "project_dir"],
447
610
  },
448
611
  },
612
+ {
613
+ name: "kage_setup_doctor",
614
+ description: "Audit Kage setup across supported agents, including Claude Code ambient hook readiness when applicable.",
615
+ inputSchema: {
616
+ type: "object",
617
+ properties: {
618
+ project_dir: { type: "string" },
619
+ },
620
+ required: ["project_dir"],
621
+ },
622
+ },
449
623
  {
450
624
  name: "kage_verify_agent",
451
625
  description: "Verify that Kage is truly active for the current agent: config, repo policy, indexes, recall, code graph, and this live MCP tool reachability.",
@@ -552,6 +726,30 @@ function listTools() {
552
726
  required: ["project_dir", "session_id"],
553
727
  },
554
728
  },
729
+ {
730
+ name: "kage_sessions",
731
+ description: "Summarize local agent observation sessions, durable capture candidates, and next distillation actions without exposing raw transcript replay.",
732
+ inputSchema: {
733
+ type: "object",
734
+ properties: {
735
+ project_dir: { type: "string" },
736
+ },
737
+ required: ["project_dir"],
738
+ },
739
+ },
740
+ {
741
+ name: "kage_session_replay",
742
+ description: "Return a privacy-preserving replay digest for observed agent sessions: timeline, touched paths, commands, durable candidates, and distill actions without raw transcript text.",
743
+ inputSchema: {
744
+ type: "object",
745
+ properties: {
746
+ project_dir: { type: "string" },
747
+ session_id: { type: "string" },
748
+ limit: { type: "number" },
749
+ },
750
+ required: ["project_dir"],
751
+ },
752
+ },
555
753
  {
556
754
  name: "kage_feedback",
557
755
  description: "Record usefulness feedback on an approved repo-local memory packet: helpful, wrong, or stale.",
@@ -840,11 +1038,16 @@ async function callTool(name, args) {
840
1038
  const dependencyResult = wantsDependencyPath(query) && pathHints.length >= 2
841
1039
  ? (0, kernel_js_1.kageDependencyPath)(projectDir, pathHints[0], pathHints[1])
842
1040
  : null;
1041
+ const reconciliation = (0, kernel_js_1.kageMemoryReconciliation)(projectDir, {
1042
+ sessionId: typeof args?.session_id === "string" ? args.session_id : undefined,
1043
+ limit: 5,
1044
+ });
843
1045
  const sections = [
844
1046
  recallResult.context_block,
845
1047
  graphResult.context_block ? `\n## Graph Facts\n${graphResult.context_block}` : "",
846
1048
  riskResult ? riskContextBlock(riskResult) : "",
847
1049
  dependencyResult ? `\n## Dependency Path\n${dependencyResult.summary}${dependencyResult.path.length ? `\nPath: ${dependencyResult.path.join(" -> ")}` : ""}` : "",
1050
+ reconciliation.unresolved_count ? `\n## Memory Reconciliation\n${reconciliation.agent_instruction}` : "",
848
1051
  `\n_${validationText}_`,
849
1052
  ].filter(Boolean).join("");
850
1053
  return {
@@ -852,7 +1055,9 @@ async function callTool(name, args) {
852
1055
  };
853
1056
  }
854
1057
  if (name === "kage_recall") {
855
- const result = (0, kernel_js_1.recall)(String(args?.project_dir ?? ""), String(args?.query ?? ""), Number(args?.limit ?? 5), Boolean(args?.explain));
1058
+ const result = args?.embeddings
1059
+ ? await (0, kernel_js_1.recallWithEmbeddings)(String(args?.project_dir ?? ""), String(args?.query ?? ""), Number(args?.limit ?? 5), Boolean(args?.explain))
1060
+ : (0, kernel_js_1.recall)(String(args?.project_dir ?? ""), String(args?.query ?? ""), Number(args?.limit ?? 5), Boolean(args?.explain));
856
1061
  return {
857
1062
  content: [{ type: "text", text: args?.json || args?.explain ? JSON.stringify(result, null, 2) : result.context_block }],
858
1063
  };
@@ -914,6 +1119,44 @@ async function callTool(name, args) {
914
1119
  content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
915
1120
  };
916
1121
  }
1122
+ if (name === "kage_profile") {
1123
+ const result = (0, kernel_js_1.kageProjectProfile)(String(args?.project_dir ?? ""));
1124
+ return {
1125
+ content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
1126
+ };
1127
+ }
1128
+ if (name === "kage_capabilities") {
1129
+ const result = (0, kernel_js_1.kageCapabilityAudit)(String(args?.project_dir ?? ""));
1130
+ return {
1131
+ content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
1132
+ };
1133
+ }
1134
+ if (name === "kage_context_slots") {
1135
+ const result = (0, kernel_js_1.kageContextSlots)(String(args?.project_dir ?? ""));
1136
+ return {
1137
+ content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
1138
+ };
1139
+ }
1140
+ if (name === "kage_context_slot_set") {
1141
+ const result = (0, kernel_js_1.setContextSlot)(String(args?.project_dir ?? ""), {
1142
+ label: String(args?.label ?? ""),
1143
+ content: String(args?.content ?? ""),
1144
+ description: args?.description == null ? undefined : String(args.description),
1145
+ pinned: args?.pinned == null ? undefined : Boolean(args.pinned),
1146
+ size_limit: args?.size_limit == null ? undefined : Number(args.size_limit),
1147
+ paths: arrayArg(args?.paths),
1148
+ tags: arrayArg(args?.tags),
1149
+ });
1150
+ return {
1151
+ content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
1152
+ };
1153
+ }
1154
+ if (name === "kage_context_slot_delete") {
1155
+ const result = (0, kernel_js_1.deleteContextSlot)(String(args?.project_dir ?? ""), String(args?.label ?? ""));
1156
+ return {
1157
+ content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
1158
+ };
1159
+ }
917
1160
  if (name === "kage_decisions") {
918
1161
  const result = (0, kernel_js_1.kageDecisionIntelligence)(String(args?.project_dir ?? ""));
919
1162
  return {
@@ -939,6 +1182,48 @@ async function callTool(name, args) {
939
1182
  content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
940
1183
  };
941
1184
  }
1185
+ if (name === "kage_memory_access") {
1186
+ const result = (0, kernel_js_1.kageMemoryAccess)(String(args?.project_dir ?? ""));
1187
+ return {
1188
+ content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
1189
+ };
1190
+ }
1191
+ if (name === "kage_memory_lifecycle") {
1192
+ const result = (0, kernel_js_1.kageMemoryLifecycle)(String(args?.project_dir ?? ""));
1193
+ return {
1194
+ content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
1195
+ };
1196
+ }
1197
+ if (name === "kage_memory_timeline") {
1198
+ const result = (0, kernel_js_1.kageMemoryTimeline)(String(args?.project_dir ?? ""), Number(args?.days ?? 14));
1199
+ return {
1200
+ content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
1201
+ };
1202
+ }
1203
+ if (name === "kage_memory_lineage") {
1204
+ const result = (0, kernel_js_1.kageMemoryLineage)(String(args?.project_dir ?? ""));
1205
+ return {
1206
+ content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
1207
+ };
1208
+ }
1209
+ if (name === "kage_memory_audit") {
1210
+ const result = (0, kernel_js_1.kageMemoryAudit)(String(args?.project_dir ?? ""), Number(args?.limit ?? 100));
1211
+ return {
1212
+ content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
1213
+ };
1214
+ }
1215
+ if (name === "kage_memory_handoff") {
1216
+ const result = (0, kernel_js_1.kageMemoryHandoff)(String(args?.project_dir ?? ""));
1217
+ return {
1218
+ content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
1219
+ };
1220
+ }
1221
+ if (name === "kage_supersede") {
1222
+ const result = (0, kernel_js_1.supersedeMemory)(String(args?.project_dir ?? ""), String(args?.packet_id ?? ""), String(args?.replacement_packet_id ?? ""), typeof args?.reason === "string" ? args.reason : "");
1223
+ return {
1224
+ content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
1225
+ };
1226
+ }
942
1227
  if (name === "kage_module_health") {
943
1228
  const result = (0, kernel_js_1.kageModuleHealth)(String(args?.project_dir ?? ""));
944
1229
  return {
@@ -998,6 +1283,16 @@ async function callTool(name, args) {
998
1283
  isError: !result.ok,
999
1284
  };
1000
1285
  }
1286
+ if (name === "kage_memory_reconcile") {
1287
+ const result = (0, kernel_js_1.kageMemoryReconciliation)(String(args?.project_dir ?? ""), {
1288
+ sessionId: typeof args?.session_id === "string" ? args.session_id : undefined,
1289
+ limit: Number(args?.limit ?? 25),
1290
+ });
1291
+ return {
1292
+ content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
1293
+ isError: !result.ok,
1294
+ };
1295
+ }
1001
1296
  if (name === "kage_quality") {
1002
1297
  const result = (0, kernel_js_1.qualityReport)(String(args?.project_dir ?? ""));
1003
1298
  return {
@@ -1005,7 +1300,15 @@ async function callTool(name, args) {
1005
1300
  };
1006
1301
  }
1007
1302
  if (name === "kage_benchmark") {
1008
- const result = (0, kernel_js_1.benchmarkProject)(String(args?.project_dir ?? ""));
1303
+ const mode = String(args?.mode ?? "project");
1304
+ const result = mode === "memory_quality"
1305
+ ? (0, kernel_js_1.benchmarkCodingMemoryQuality)({ topK: Number(args?.top_k ?? 10) })
1306
+ : mode === "memory_scale"
1307
+ ? (0, kernel_js_1.benchmarkMemoryScale)({
1308
+ sizes: Array.isArray(args?.sizes) ? args.sizes.map(Number) : undefined,
1309
+ topK: Number(args?.top_k ?? 10),
1310
+ })
1311
+ : (0, kernel_js_1.benchmarkProject)(String(args?.project_dir ?? ""));
1009
1312
  return {
1010
1313
  content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
1011
1314
  };
@@ -1022,6 +1325,12 @@ async function callTool(name, args) {
1022
1325
  content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
1023
1326
  };
1024
1327
  }
1328
+ if (name === "kage_setup_doctor") {
1329
+ const result = (0, kernel_js_1.setupDoctor)(String(args?.project_dir ?? ""));
1330
+ return {
1331
+ content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
1332
+ };
1333
+ }
1025
1334
  if (name === "kage_verify_agent") {
1026
1335
  const result = (0, kernel_js_1.verifyAgentActivation)(String(args?.agent ?? ""), String(args?.project_dir ?? ""), { mcpToolReachable: true });
1027
1336
  return {
@@ -1104,6 +1413,23 @@ async function callTool(name, args) {
1104
1413
  isError: !result.ok,
1105
1414
  };
1106
1415
  }
1416
+ if (name === "kage_sessions") {
1417
+ const result = (0, kernel_js_1.kageSessionCaptureReport)(String(args?.project_dir ?? ""));
1418
+ return {
1419
+ content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
1420
+ isError: false,
1421
+ };
1422
+ }
1423
+ if (name === "kage_session_replay") {
1424
+ const result = (0, kernel_js_1.kageSessionReplay)(String(args?.project_dir ?? ""), {
1425
+ sessionId: args?.session_id ? String(args.session_id) : undefined,
1426
+ limit: typeof args?.limit === "number" ? args.limit : undefined,
1427
+ });
1428
+ return {
1429
+ content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
1430
+ isError: false,
1431
+ };
1432
+ }
1107
1433
  if (name === "kage_feedback") {
1108
1434
  const result = (0, kernel_js_1.recordFeedback)(String(args?.project_dir ?? ""), String(args?.packet_id ?? ""), String(args?.kind ?? ""));
1109
1435
  return {