@kage-core/kage-graph-mcp 2.5.0 → 2.5.1

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/cli.js CHANGED
@@ -1419,11 +1419,12 @@ async function main() {
1419
1419
  if (!result.results.length)
1420
1420
  return;
1421
1421
  let out = result.context_block;
1422
- if (result.value_receipt) {
1423
- const r = result.value_receipt;
1424
- const plural = result.results.length === 1 ? "y" : "ies";
1425
- out += `\n\n_↳ Kage recalled ${result.results.length} verified memor${plural} · ~${(0, kernel_js_1.formatTokenCount)(r.tokens_saved)} tokens saved this recall · ${r.stale_withheld} stale withheld._`;
1426
- }
1422
+ // Lead with felt behavior, not a vanity/gameable token number: tell the agent these are
1423
+ // verified team memories to follow. (The tokens/$ ledger lives in `kage gains` for anyone
1424
+ // who wants it.) Keep only the trust-relevant stale-withheld signal here.
1425
+ const plural = result.results.length === 1 ? "y" : "ies";
1426
+ const withheld = result.value_receipt?.stale_withheld ?? 0;
1427
+ out += `\n\n_${result.results.length} verified team memor${plural} above — follow them.${withheld ? ` ${withheld} stale memor${withheld === 1 ? "y" : "ies"} withheld (code changed under them).` : ""}_`;
1427
1428
  console.log(out);
1428
1429
  return;
1429
1430
  }
package/dist/kernel.js CHANGED
@@ -8102,14 +8102,23 @@ function recallWithVectorScores(projectDir, query, limit = 5, explain = false, i
8102
8102
  ...scored.flatMap((entry, index) => {
8103
8103
  const contradicts = (entry.packet.quality ?? {}).contradicts;
8104
8104
  const contested = Array.isArray(contradicts) && contradicts.length > 0;
8105
+ // Felt format: lead with an imperative "Team memory:" claim the agent should follow,
8106
+ // dated and cited to file — not machinery (confidence/why-matched/source read as vanity
8107
+ // and noise). The behavior change is the value, not the metadata.
8108
+ const when = (entry.packet.created_at || entry.packet.updated_at || "").slice(0, 10);
8109
+ const verb = entry.packet.type === "decision" ? "decided"
8110
+ : entry.packet.type === "bug_fix" ? "fixed"
8111
+ : entry.packet.type === "convention" ? "convention since"
8112
+ : "noted";
8113
+ const cited = entry.packet.paths.slice(0, 3).join(", ");
8114
+ const meta = `${verb}${when ? ` ${when}` : ""}${cited ? ` · ${cited}` : ""}`;
8105
8115
  return [
8106
8116
  "",
8107
- `${index + 1}. [${entry.packet.type} | ${entry.packet.scope} | confidence ${entry.packet.confidence.toFixed(2)}] ${entry.packet.title}`,
8108
- ` Summary: ${entry.packet.summary}`,
8109
- ` Why matched: ${entry.why_matched.join(", ") || "text relevance"}`,
8110
- ` Source: ${sourceLabel(entry.packet)}`,
8117
+ `${index + 1}. Team memory: ${entry.packet.title}`,
8118
+ ` ${entry.packet.summary}`,
8119
+ ...(meta.trim() ? [` (${meta})`] : []),
8111
8120
  ...(contested
8112
- ? [` ⚠ Contested: this memory contradicts ${contradicts.length} other packet(s) (${contradicts.join(", ")}). Resolve with kage conflicts / kage supersede before relying on it.`]
8121
+ ? [` ⚠ Contested: contradicts ${contradicts.length} other packet(s) (${contradicts.join(", ")}) resolve with kage conflicts / kage supersede before relying on it.`]
8113
8122
  : []),
8114
8123
  ];
8115
8124
  }),
@@ -14622,6 +14631,13 @@ function loadObservations(projectDir, sessionId) {
14622
14631
  // and echoes of Kage's own demo/receipt output. Manual `kage learn`/`kage capture`
14623
14632
  // and manual `kage distill` are never gated — explicit intent outranks the heuristic.
14624
14633
  exports.AUTO_DISTILL_SIGNAL_THRESHOLD = 0.4;
14634
+ // Auto-promote gate: a distilled draft jumps straight to trusted (approved, recallable)
14635
+ // memory — instead of waiting in the pending inbox — only when it is clearly-good AND
14636
+ // code-grounded AND not a duplicate. Everything else still goes to review. This is what
14637
+ // makes the capture flywheel actually spin; KAGE_AUTO_PROMOTE=0 disables it. Grounding keeps
14638
+ // the verification wedge intact: a promoted memory is still checked against the code, just
14639
+ // not gated on a human.
14640
+ const AUTO_PROMOTE_ENABLED = process.env.KAGE_AUTO_PROMOTE !== "0";
14625
14641
  // Markers of hook/system plumbing payloads that sometimes leak into observation text
14626
14642
  // (e.g. a raw <task-notification> block stored as a "user prompt").
14627
14643
  const HOOK_PAYLOAD_MARKERS = [
@@ -15274,16 +15290,44 @@ function distillSession(projectDir, sessionId, options = {}) {
15274
15290
  observation_count: observations.length,
15275
15291
  },
15276
15292
  ];
15293
+ const admission = evaluateMemoryAdmission(projectDir, result.packet);
15277
15294
  result.packet.quality = {
15278
15295
  ...result.packet.quality,
15279
15296
  ...(sessionDiscoveryTokens > 0
15280
15297
  ? { discovery_tokens: sessionDiscoveryTokens, discovery_tokens_estimated: true }
15281
15298
  : {}),
15282
15299
  distillation: auto ? "auto_distill" : "automatic_observation_candidate",
15283
- admission: evaluateMemoryAdmission(projectDir, result.packet),
15300
+ admission,
15284
15301
  suggested_review_action: suggestedAction(classifyPacket(projectDir, result.packet), result.packet.status),
15285
15302
  };
15286
- writeJson(result.path, result.packet);
15303
+ // Auto-promote the clearly-good, code-grounded, non-duplicate drafts straight to trusted
15304
+ // recall so the flywheel spins without manual review; borderline / ungrounded / path-less
15305
+ // drafts stay in the pending inbox for a quick review.
15306
+ const groundedHighSignal = AUTO_PROMOTE_ENABLED
15307
+ && auto
15308
+ && result.packet.status === "pending"
15309
+ && admission.admit
15310
+ && admission.class === "high_signal"
15311
+ && result.packet.paths.length > 0
15312
+ && result.packet.paths.every((path) => pathExistsInRepo(projectDir, path))
15313
+ && duplicateCandidates(projectDir, result.packet).length === 0
15314
+ && detectContradictions(projectDir, result.packet).length === 0;
15315
+ if (groundedHighSignal) {
15316
+ result.packet.status = "approved";
15317
+ result.packet.tags = unique([...result.packet.tags, "auto-promoted"]);
15318
+ result.packet.quality.suggested_review_action = suggestedAction(classifyPacket(projectDir, result.packet), "approved");
15319
+ const promotedPath = writePacket(projectDir, result.packet, "packets");
15320
+ if (result.path && result.path !== promotedPath) {
15321
+ try {
15322
+ (0, node_fs_1.unlinkSync)(result.path);
15323
+ }
15324
+ catch { }
15325
+ }
15326
+ result.path = promotedPath;
15327
+ }
15328
+ else {
15329
+ writeJson(result.path, result.packet);
15330
+ }
15287
15331
  return result;
15288
15332
  };
15289
15333
  const autoTags = auto ? [exports.AUTO_DISTILL_TAG] : [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kage-core/kage-graph-mcp",
3
- "version": "2.5.0",
3
+ "version": "2.5.1",
4
4
  "description": "Team memory for coding agents: captures the decisions, runbooks, and bug fixes that get lost, verified against your code and shared via git. MCP server, zero deps, no account.",
5
5
  "main": "dist/index.js",
6
6
  "files": [