mneme-ai 2.199.0 → 2.200.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.
@@ -0,0 +1,10 @@
1
+ /**
2
+ * `mneme succession <agent>` (v2.200.0) — the no-brain-drain halt capsule.
3
+ * When an agent must be stopped (a loop thrash, a policy breach), distil its PROVEN
4
+ * wisdom (geo axioms + its reliability record) into a SIGNED capsule a successor inherits,
5
+ * referencing the signed proofs the toxic raw was purged. Mneme RECOMMENDS the halt + packages
6
+ * the moment; the host orchestrator enforces the actual stop.
7
+ */
8
+ import type { Command } from "commander";
9
+ export declare function registerSuccessionCommands(program: Command): void;
10
+ //# sourceMappingURL=succession.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"succession.d.ts","sourceRoot":"","sources":["../../src/commands/succession.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAQzC,wBAAgB,0BAA0B,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CA4BjE"}
@@ -0,0 +1,48 @@
1
+ import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
2
+ import { join } from "node:path";
3
+ import { succession, geo, awarm, notary } from "@mneme-ai/core";
4
+ function out(s) { process.stdout.write(s + "\n"); }
5
+ const readJson = (p, fb) => { try {
6
+ return existsSync(p) ? JSON.parse(readFileSync(p, "utf8")) : fb;
7
+ }
8
+ catch {
9
+ return fb;
10
+ } };
11
+ export function registerSuccessionCommands(program) {
12
+ program.command("succession <agent>")
13
+ .description("⚱️ SUCCESSION CAPSULE — on halt, distil an agent's proven wisdom (geo axioms + reliability) into a signed capsule a successor inherits, with proof the toxic raw was purged. No brain-drain. Mneme recommends; the host enforces.")
14
+ .option("--reason <text>", "why the halt", "manual halt")
15
+ .option("--trigger <t>", "loopguard|overshoot|govern|reckon|manual", "manual")
16
+ .option("--json", "the full signed capsule")
17
+ .action((agent, opts) => {
18
+ const cwd = process.cwd();
19
+ // proven wisdom: geo axioms + the purge proofs that the raw is gone
20
+ const g = readJson(join(cwd, ".mneme", "geo", "state.json"), geo.emptyGeo());
21
+ const axioms = g.cells.filter((c) => c.tier === "axiom" && c.abstract).map((c) => c.abstract);
22
+ const purgeProofRefs = g.cells.filter((c) => c.purgeProof && c.rawHash).map((c) => `geo-purge:${c.rawHash.slice(0, 12)}`);
23
+ // reliability: the always-warm survival for this agent
24
+ const warm = readJson(join(cwd, ".mneme", "awarm", "state.json"), awarm.emptyState());
25
+ const wa = awarm.queryWarm(warm).agents.find((a) => a.agent === agent);
26
+ const reliability = wa ? { survivalPct: Math.round(wa.survivalRate * 100), band: wa.survivalRate >= 0.9 ? "solid" : wa.survivalRate >= 0.7 ? "watch" : "risky" } : null;
27
+ const capsule = succession.buildSuccessionCapsule({ agent, reason: opts.reason ?? "manual halt", trigger: opts.trigger ?? "manual", axioms, reliability, purgeProofRefs, ts: Date.now() });
28
+ let receipt = null;
29
+ try {
30
+ receipt = notary.issueReceipt(cwd, { kind: "memory-capsule", subject: `succession:${agent}`, payload: capsule, includePayload: true });
31
+ }
32
+ catch { /* */ }
33
+ try {
34
+ mkdirSync(join(cwd, ".mneme", "succession"), { recursive: true });
35
+ writeFileSync(join(cwd, ".mneme", "succession", `${agent.replace(/[^\w.-]/g, "_")}.json`), JSON.stringify({ capsule, receipt }, null, 2), "utf8");
36
+ }
37
+ catch { /* */ }
38
+ if (opts.json) {
39
+ out(JSON.stringify({ capsule, receipt }, null, 2));
40
+ return;
41
+ }
42
+ out(`⚱️ Succession capsule · ${agent} → 🛑 ${capsule.haltVerdict} (enforced by ${capsule.enforcedBy} — Mneme recommends, does not kill)`);
43
+ out(` inherited wisdom: ${capsule.wisdom.length} axiom(s)${reliability ? ` · predecessor reliability ${reliability.survivalPct}% (${reliability.band})` : ""}`);
44
+ out(` raw purged: ${purgeProofRefs.length} signed proof(s) — the toxic state is provably gone, the learning survives`);
45
+ out(` ${receipt ? "capsule signed — a successor inherits it; verify offline (mneme notary verify)" : "(unsigned)"}`);
46
+ });
47
+ }
48
+ //# sourceMappingURL=succession.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"succession.js","sourceRoot":"","sources":["../../src/commands/succession.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC7E,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAEhE,SAAS,GAAG,CAAC,CAAS,IAAU,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;AACjE,MAAM,QAAQ,GAAG,CAAI,CAAS,EAAE,EAAK,EAAK,EAAE,GAAG,IAAI,CAAC;IAAC,OAAO,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,EAAE,MAAM,CAAC,CAAM,CAAC,CAAC,CAAC,EAAE,CAAC;AAAC,CAAC;AAAC,MAAM,CAAC;IAAC,OAAO,EAAE,CAAC;AAAC,CAAC,CAAC,CAAC,CAAC;AAEpJ,MAAM,UAAU,0BAA0B,CAAC,OAAgB;IACzD,OAAO,CAAC,OAAO,CAAC,oBAAoB,CAAC;SAClC,WAAW,CAAC,mOAAmO,CAAC;SAChP,MAAM,CAAC,iBAAiB,EAAE,cAAc,EAAE,aAAa,CAAC;SACxD,MAAM,CAAC,eAAe,EAAE,0CAA0C,EAAE,QAAQ,CAAC;SAC7E,MAAM,CAAC,QAAQ,EAAE,yBAAyB,CAAC;SAC3C,MAAM,CAAC,CAAC,KAAa,EAAE,IAA2D,EAAE,EAAE;QACrF,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;QAC1B,oEAA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AC;QAC9E,GAAG,CAAC,2BAA2B,KAAK,SAAS,OAAO,CAAC,WAAW,iBAAiB,OAAO,CAAC,UAAU,qCAAqC,CAAC,CAAC;QAC1I,GAAG,CAAC,wBAAwB,OAAO,CAAC,MAAM,CAAC,MAAM,YAAY,WAAW,CAAC,CAAC,CAAC,8BAA8B,WAAW,CAAC,WAAW,MAAM,WAAW,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QAClK,GAAG,CAAC,kBAAkB,cAAc,CAAC,MAAM,4EAA4E,CAAC,CAAC;QACzH,GAAG,CAAC,MAAM,OAAO,CAAC,CAAC,CAAC,gFAAgF,CAAC,CAAC,CAAC,YAAY,EAAE,CAAC,CAAC;IACzH,CAAC,CAAC,CAAC;AACP,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAwLA,wBAAsB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAwlNvD"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAyLA,wBAAsB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAylNvD"}
package/dist/index.js CHANGED
@@ -102,6 +102,7 @@ import { registerWarmCommands } from "./commands/warm.js";
102
102
  import { registerGeoCommands } from "./commands/geo.js";
103
103
  import { registerHeartbeatCommands } from "./commands/heartbeat.js";
104
104
  import { registerReckonCommands } from "./commands/reckon.js";
105
+ import { registerSuccessionCommands } from "./commands/succession.js";
105
106
  import { registerAdamasCommands } from "./commands/adamas.js";
106
107
  import { registerPrismCommands } from "./commands/prism.js";
107
108
  import { registerGoldilocksCommands } from "./commands/goldilocks.js";
@@ -4771,6 +4772,7 @@ export async function run(argv) {
4771
4772
  registerGeoCommands(program);
4772
4773
  registerHeartbeatCommands(program);
4773
4774
  registerReckonCommands(program);
4775
+ registerSuccessionCommands(program);
4774
4776
  registerAdamasCommands(program);
4775
4777
  registerPrismCommands(program);
4776
4778
  registerGoldilocksCommands(program);