@kage-core/kage-graph-mcp 1.1.36 → 1.1.38

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,80 @@ 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_xray",
272
+ description: "Return a first-use Repo X-Ray: code structure layers for entry points, core files, risk, tests, memory overlay, and knowledge gaps.",
273
+ inputSchema: {
274
+ type: "object",
275
+ properties: {
276
+ project_dir: { type: "string" },
277
+ },
278
+ required: ["project_dir"],
279
+ },
280
+ },
281
+ {
282
+ name: "kage_capabilities",
283
+ description: "Return an evidence-backed Kage memory-system capability audit across repo memory, collaboration/session proof, benchmarks, and dashboard/viewer readiness.",
284
+ inputSchema: {
285
+ type: "object",
286
+ properties: {
287
+ project_dir: { type: "string" },
288
+ },
289
+ required: ["project_dir"],
290
+ },
291
+ },
292
+ {
293
+ name: "kage_context_slots",
294
+ description: "List repo-local pinned context slots. Pinned slots are small, reviewable facts that Kage includes in recall/context before task-specific memory.",
295
+ inputSchema: {
296
+ type: "object",
297
+ properties: {
298
+ project_dir: { type: "string" },
299
+ },
300
+ required: ["project_dir"],
301
+ },
302
+ },
303
+ {
304
+ name: "kage_context_slot_set",
305
+ 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.",
306
+ inputSchema: {
307
+ type: "object",
308
+ properties: {
309
+ project_dir: { type: "string" },
310
+ label: { type: "string" },
311
+ content: { type: "string" },
312
+ description: { type: "string" },
313
+ pinned: { type: "boolean" },
314
+ size_limit: { type: "number" },
315
+ paths: { type: "array", items: { type: "string" } },
316
+ tags: { type: "array", items: { type: "string" } },
317
+ },
318
+ required: ["project_dir", "label", "content"],
319
+ },
320
+ },
321
+ {
322
+ name: "kage_context_slot_delete",
323
+ description: "Delete a repo-local context slot by label.",
324
+ inputSchema: {
325
+ type: "object",
326
+ properties: {
327
+ project_dir: { type: "string" },
328
+ label: { type: "string" },
329
+ },
330
+ required: ["project_dir", "label"],
331
+ },
332
+ },
257
333
  {
258
334
  name: "kage_decisions",
259
335
  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 +374,17 @@ function listTools() {
298
374
  required: ["project_dir"],
299
375
  },
300
376
  },
377
+ {
378
+ name: "kage_memory_access",
379
+ 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.",
380
+ inputSchema: {
381
+ type: "object",
382
+ properties: {
383
+ project_dir: { type: "string" },
384
+ },
385
+ required: ["project_dir"],
386
+ },
387
+ },
301
388
  {
302
389
  name: "kage_module_health",
303
390
  description: "Return local module health scorecards from Kage's code graph, test signals, cleanup candidates, git churn, and ownership concentration.",
@@ -399,6 +486,19 @@ function listTools() {
399
486
  required: ["project_dir"],
400
487
  },
401
488
  },
489
+ {
490
+ name: "kage_memory_reconcile",
491
+ 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.",
492
+ inputSchema: {
493
+ type: "object",
494
+ properties: {
495
+ project_dir: { type: "string" },
496
+ session_id: { type: "string" },
497
+ limit: { type: "number" },
498
+ },
499
+ required: ["project_dir"],
500
+ },
501
+ },
402
502
  {
403
503
  name: "kage_quality",
404
504
  description: "Return memory quality metrics: useful memory ratio, duplicate burden, stale/wrong feedback, evidence coverage, path grounding, and review queue size.",
@@ -410,13 +510,87 @@ function listTools() {
410
510
  required: ["project_dir"],
411
511
  },
412
512
  },
513
+ {
514
+ name: "kage_memory_lifecycle",
515
+ description: "Return a repo-local memory lifecycle report: healthy, hot, cold, stale, disputed, ungrounded, pending, generated, and concrete review actions.",
516
+ inputSchema: {
517
+ type: "object",
518
+ properties: {
519
+ project_dir: { type: "string" },
520
+ },
521
+ required: ["project_dir"],
522
+ },
523
+ },
524
+ {
525
+ name: "kage_memory_timeline",
526
+ description: "Return recent repo-memory activity for teammate handoff: added, updated, pending, and deprecated packets with review actions.",
527
+ inputSchema: {
528
+ type: "object",
529
+ properties: {
530
+ project_dir: { type: "string" },
531
+ days: { type: "number" },
532
+ },
533
+ required: ["project_dir"],
534
+ },
535
+ },
536
+ {
537
+ name: "kage_memory_lineage",
538
+ description: "Return memory supersession chains so agents can use current replacement packets and keep retired memory as audit history.",
539
+ inputSchema: {
540
+ type: "object",
541
+ properties: {
542
+ project_dir: { type: "string" },
543
+ },
544
+ required: ["project_dir"],
545
+ },
546
+ },
547
+ {
548
+ name: "kage_memory_audit",
549
+ description: "Return the repo-local audit trail for explicit memory mutations: capture, feedback, review, supersede, deprecate, and delete.",
550
+ inputSchema: {
551
+ type: "object",
552
+ properties: {
553
+ project_dir: { type: "string" },
554
+ limit: { type: "number" },
555
+ },
556
+ required: ["project_dir"],
557
+ },
558
+ },
559
+ {
560
+ name: "kage_memory_handoff",
561
+ description: "Return a teammate/agent handoff queue by combining memory inbox, lifecycle, audit, timeline, and lineage into concrete next actions.",
562
+ inputSchema: {
563
+ type: "object",
564
+ properties: {
565
+ project_dir: { type: "string" },
566
+ },
567
+ required: ["project_dir"],
568
+ },
569
+ },
570
+ {
571
+ name: "kage_supersede",
572
+ description: "Mark one repo-local memory packet as superseded by a replacement packet and write bidirectional lineage edges.",
573
+ inputSchema: {
574
+ type: "object",
575
+ properties: {
576
+ project_dir: { type: "string" },
577
+ packet_id: { type: "string" },
578
+ replacement_packet_id: { type: "string" },
579
+ reason: { type: "string" },
580
+ },
581
+ required: ["project_dir", "packet_id", "replacement_packet_id"],
582
+ },
583
+ },
413
584
  {
414
585
  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.",
586
+ description: "Return Kage proof metrics, or set mode=memory_quality / memory_scale for synthetic memory retrieval benchmarks.",
416
587
  inputSchema: {
417
588
  type: "object",
418
589
  properties: {
419
590
  project_dir: { type: "string" },
591
+ mode: { type: "string", enum: ["project", "memory_quality", "memory_scale"] },
592
+ sizes: { type: "array", items: { type: "number" } },
593
+ top_k: { type: "number" },
420
594
  },
421
595
  required: ["project_dir"],
422
596
  },
@@ -446,6 +620,17 @@ function listTools() {
446
620
  required: ["agent", "project_dir"],
447
621
  },
448
622
  },
623
+ {
624
+ name: "kage_setup_doctor",
625
+ description: "Audit Kage setup across supported agents, including Claude Code ambient hook readiness when applicable.",
626
+ inputSchema: {
627
+ type: "object",
628
+ properties: {
629
+ project_dir: { type: "string" },
630
+ },
631
+ required: ["project_dir"],
632
+ },
633
+ },
449
634
  {
450
635
  name: "kage_verify_agent",
451
636
  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 +737,43 @@ function listTools() {
552
737
  required: ["project_dir", "session_id"],
553
738
  },
554
739
  },
740
+ {
741
+ name: "kage_sessions",
742
+ description: "Summarize local agent observation sessions, durable capture candidates, and next distillation actions without exposing raw transcript replay.",
743
+ inputSchema: {
744
+ type: "object",
745
+ properties: {
746
+ project_dir: { type: "string" },
747
+ },
748
+ required: ["project_dir"],
749
+ },
750
+ },
751
+ {
752
+ name: "kage_learning_ledger",
753
+ description: "Return an agent-facing ledger that classifies observed session events into save, ignore, needs-evidence, or already-distilled memory decisions.",
754
+ inputSchema: {
755
+ type: "object",
756
+ properties: {
757
+ project_dir: { type: "string" },
758
+ session_id: { type: "string" },
759
+ limit: { type: "number" },
760
+ },
761
+ required: ["project_dir"],
762
+ },
763
+ },
764
+ {
765
+ name: "kage_session_replay",
766
+ description: "Return a privacy-preserving replay digest for observed agent sessions: timeline, touched paths, commands, durable candidates, and distill actions without raw transcript text.",
767
+ inputSchema: {
768
+ type: "object",
769
+ properties: {
770
+ project_dir: { type: "string" },
771
+ session_id: { type: "string" },
772
+ limit: { type: "number" },
773
+ },
774
+ required: ["project_dir"],
775
+ },
776
+ },
555
777
  {
556
778
  name: "kage_feedback",
557
779
  description: "Record usefulness feedback on an approved repo-local memory packet: helpful, wrong, or stale.",
@@ -840,11 +1062,29 @@ async function callTool(name, args) {
840
1062
  const dependencyResult = wantsDependencyPath(query) && pathHints.length >= 2
841
1063
  ? (0, kernel_js_1.kageDependencyPath)(projectDir, pathHints[0], pathHints[1])
842
1064
  : null;
1065
+ const reconciliation = (0, kernel_js_1.kageMemoryReconciliation)(projectDir, {
1066
+ sessionId: typeof args?.session_id === "string" ? args.session_id : undefined,
1067
+ limit: 5,
1068
+ });
1069
+ const teammateBrief = (0, kernel_js_1.kageTeammateBrief)(projectDir, {
1070
+ query,
1071
+ targets: explicitTargets,
1072
+ changedFiles,
1073
+ recallResult,
1074
+ riskResult,
1075
+ reconciliation,
1076
+ });
1077
+ const learningLedger = typeof args?.session_id === "string" && args.session_id.trim()
1078
+ ? (0, kernel_js_1.kageSessionLearningLedger)(projectDir, { sessionId: args.session_id, limit: 20 })
1079
+ : null;
843
1080
  const sections = [
844
1081
  recallResult.context_block,
1082
+ teammateBrief.context_block,
1083
+ learningLedger ? learningLedger.context_block : "",
845
1084
  graphResult.context_block ? `\n## Graph Facts\n${graphResult.context_block}` : "",
846
1085
  riskResult ? riskContextBlock(riskResult) : "",
847
1086
  dependencyResult ? `\n## Dependency Path\n${dependencyResult.summary}${dependencyResult.path.length ? `\nPath: ${dependencyResult.path.join(" -> ")}` : ""}` : "",
1087
+ reconciliation.unresolved_count ? `\n## Memory Reconciliation\n${reconciliation.agent_instruction}` : "",
848
1088
  `\n_${validationText}_`,
849
1089
  ].filter(Boolean).join("");
850
1090
  return {
@@ -852,7 +1092,9 @@ async function callTool(name, args) {
852
1092
  };
853
1093
  }
854
1094
  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));
1095
+ const result = args?.embeddings
1096
+ ? await (0, kernel_js_1.recallWithEmbeddings)(String(args?.project_dir ?? ""), String(args?.query ?? ""), Number(args?.limit ?? 5), Boolean(args?.explain))
1097
+ : (0, kernel_js_1.recall)(String(args?.project_dir ?? ""), String(args?.query ?? ""), Number(args?.limit ?? 5), Boolean(args?.explain));
856
1098
  return {
857
1099
  content: [{ type: "text", text: args?.json || args?.explain ? JSON.stringify(result, null, 2) : result.context_block }],
858
1100
  };
@@ -914,6 +1156,50 @@ async function callTool(name, args) {
914
1156
  content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
915
1157
  };
916
1158
  }
1159
+ if (name === "kage_profile") {
1160
+ const result = (0, kernel_js_1.kageProjectProfile)(String(args?.project_dir ?? ""));
1161
+ return {
1162
+ content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
1163
+ };
1164
+ }
1165
+ if (name === "kage_xray") {
1166
+ const result = (0, kernel_js_1.kageRepoXray)(String(args?.project_dir ?? ""));
1167
+ return {
1168
+ content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
1169
+ };
1170
+ }
1171
+ if (name === "kage_capabilities") {
1172
+ const result = (0, kernel_js_1.kageCapabilityAudit)(String(args?.project_dir ?? ""));
1173
+ return {
1174
+ content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
1175
+ };
1176
+ }
1177
+ if (name === "kage_context_slots") {
1178
+ const result = (0, kernel_js_1.kageContextSlots)(String(args?.project_dir ?? ""));
1179
+ return {
1180
+ content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
1181
+ };
1182
+ }
1183
+ if (name === "kage_context_slot_set") {
1184
+ const result = (0, kernel_js_1.setContextSlot)(String(args?.project_dir ?? ""), {
1185
+ label: String(args?.label ?? ""),
1186
+ content: String(args?.content ?? ""),
1187
+ description: args?.description == null ? undefined : String(args.description),
1188
+ pinned: args?.pinned == null ? undefined : Boolean(args.pinned),
1189
+ size_limit: args?.size_limit == null ? undefined : Number(args.size_limit),
1190
+ paths: arrayArg(args?.paths),
1191
+ tags: arrayArg(args?.tags),
1192
+ });
1193
+ return {
1194
+ content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
1195
+ };
1196
+ }
1197
+ if (name === "kage_context_slot_delete") {
1198
+ const result = (0, kernel_js_1.deleteContextSlot)(String(args?.project_dir ?? ""), String(args?.label ?? ""));
1199
+ return {
1200
+ content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
1201
+ };
1202
+ }
917
1203
  if (name === "kage_decisions") {
918
1204
  const result = (0, kernel_js_1.kageDecisionIntelligence)(String(args?.project_dir ?? ""));
919
1205
  return {
@@ -939,6 +1225,48 @@ async function callTool(name, args) {
939
1225
  content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
940
1226
  };
941
1227
  }
1228
+ if (name === "kage_memory_access") {
1229
+ const result = (0, kernel_js_1.kageMemoryAccess)(String(args?.project_dir ?? ""));
1230
+ return {
1231
+ content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
1232
+ };
1233
+ }
1234
+ if (name === "kage_memory_lifecycle") {
1235
+ const result = (0, kernel_js_1.kageMemoryLifecycle)(String(args?.project_dir ?? ""));
1236
+ return {
1237
+ content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
1238
+ };
1239
+ }
1240
+ if (name === "kage_memory_timeline") {
1241
+ const result = (0, kernel_js_1.kageMemoryTimeline)(String(args?.project_dir ?? ""), Number(args?.days ?? 14));
1242
+ return {
1243
+ content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
1244
+ };
1245
+ }
1246
+ if (name === "kage_memory_lineage") {
1247
+ const result = (0, kernel_js_1.kageMemoryLineage)(String(args?.project_dir ?? ""));
1248
+ return {
1249
+ content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
1250
+ };
1251
+ }
1252
+ if (name === "kage_memory_audit") {
1253
+ const result = (0, kernel_js_1.kageMemoryAudit)(String(args?.project_dir ?? ""), Number(args?.limit ?? 100));
1254
+ return {
1255
+ content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
1256
+ };
1257
+ }
1258
+ if (name === "kage_memory_handoff") {
1259
+ const result = (0, kernel_js_1.kageMemoryHandoff)(String(args?.project_dir ?? ""));
1260
+ return {
1261
+ content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
1262
+ };
1263
+ }
1264
+ if (name === "kage_supersede") {
1265
+ 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 : "");
1266
+ return {
1267
+ content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
1268
+ };
1269
+ }
942
1270
  if (name === "kage_module_health") {
943
1271
  const result = (0, kernel_js_1.kageModuleHealth)(String(args?.project_dir ?? ""));
944
1272
  return {
@@ -998,6 +1326,16 @@ async function callTool(name, args) {
998
1326
  isError: !result.ok,
999
1327
  };
1000
1328
  }
1329
+ if (name === "kage_memory_reconcile") {
1330
+ const result = (0, kernel_js_1.kageMemoryReconciliation)(String(args?.project_dir ?? ""), {
1331
+ sessionId: typeof args?.session_id === "string" ? args.session_id : undefined,
1332
+ limit: Number(args?.limit ?? 25),
1333
+ });
1334
+ return {
1335
+ content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
1336
+ isError: !result.ok,
1337
+ };
1338
+ }
1001
1339
  if (name === "kage_quality") {
1002
1340
  const result = (0, kernel_js_1.qualityReport)(String(args?.project_dir ?? ""));
1003
1341
  return {
@@ -1005,7 +1343,15 @@ async function callTool(name, args) {
1005
1343
  };
1006
1344
  }
1007
1345
  if (name === "kage_benchmark") {
1008
- const result = (0, kernel_js_1.benchmarkProject)(String(args?.project_dir ?? ""));
1346
+ const mode = String(args?.mode ?? "project");
1347
+ const result = mode === "memory_quality"
1348
+ ? (0, kernel_js_1.benchmarkCodingMemoryQuality)({ topK: Number(args?.top_k ?? 10) })
1349
+ : mode === "memory_scale"
1350
+ ? (0, kernel_js_1.benchmarkMemoryScale)({
1351
+ sizes: Array.isArray(args?.sizes) ? args.sizes.map(Number) : undefined,
1352
+ topK: Number(args?.top_k ?? 10),
1353
+ })
1354
+ : (0, kernel_js_1.benchmarkProject)(String(args?.project_dir ?? ""));
1009
1355
  return {
1010
1356
  content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
1011
1357
  };
@@ -1022,6 +1368,12 @@ async function callTool(name, args) {
1022
1368
  content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
1023
1369
  };
1024
1370
  }
1371
+ if (name === "kage_setup_doctor") {
1372
+ const result = (0, kernel_js_1.setupDoctor)(String(args?.project_dir ?? ""));
1373
+ return {
1374
+ content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
1375
+ };
1376
+ }
1025
1377
  if (name === "kage_verify_agent") {
1026
1378
  const result = (0, kernel_js_1.verifyAgentActivation)(String(args?.agent ?? ""), String(args?.project_dir ?? ""), { mcpToolReachable: true });
1027
1379
  return {
@@ -1104,6 +1456,33 @@ async function callTool(name, args) {
1104
1456
  isError: !result.ok,
1105
1457
  };
1106
1458
  }
1459
+ if (name === "kage_sessions") {
1460
+ const result = (0, kernel_js_1.kageSessionCaptureReport)(String(args?.project_dir ?? ""));
1461
+ return {
1462
+ content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
1463
+ isError: false,
1464
+ };
1465
+ }
1466
+ if (name === "kage_learning_ledger") {
1467
+ const result = (0, kernel_js_1.kageSessionLearningLedger)(String(args?.project_dir ?? ""), {
1468
+ sessionId: args?.session_id ? String(args.session_id) : undefined,
1469
+ limit: typeof args?.limit === "number" ? args.limit : undefined,
1470
+ });
1471
+ return {
1472
+ content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
1473
+ isError: false,
1474
+ };
1475
+ }
1476
+ if (name === "kage_session_replay") {
1477
+ const result = (0, kernel_js_1.kageSessionReplay)(String(args?.project_dir ?? ""), {
1478
+ sessionId: args?.session_id ? String(args.session_id) : undefined,
1479
+ limit: typeof args?.limit === "number" ? args.limit : undefined,
1480
+ });
1481
+ return {
1482
+ content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
1483
+ isError: false,
1484
+ };
1485
+ }
1107
1486
  if (name === "kage_feedback") {
1108
1487
  const result = (0, kernel_js_1.recordFeedback)(String(args?.project_dir ?? ""), String(args?.packet_id ?? ""), String(args?.kind ?? ""));
1109
1488
  return {