mneme-ai 2.132.0 → 2.133.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,15 @@
1
+ /**
2
+ * `mneme boot` (v2.133.0) — THE ACTIVATION CORTEX.
3
+ * The first thing an agent (or a SessionStart hook) calls so it instantly knows
4
+ * Mneme is connected + WHEN to reach for which tool (the task→tool decision
5
+ * table) + what the shared memory already knows about this repo.
6
+ *
7
+ * mneme boot # human-readable activation digest
8
+ * mneme boot --json # full signed packet
9
+ * mneme boot --task "..." # rank the table for the task at hand
10
+ * mneme boot --hook # emit the activation CONTEXT (what a SessionStart hook injects)
11
+ * mneme boot --emit-hook-config # print the .claude/settings.json snippet to enable the hook
12
+ */
13
+ import type { Command } from "commander";
14
+ export declare function registerBootCommands(program: Command): void;
15
+ //# sourceMappingURL=boot.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"boot.d.ts","sourceRoot":"","sources":["../../src/commands/boot.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAyBzC,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CA8D3D"}
@@ -0,0 +1,102 @@
1
+ /**
2
+ * `mneme boot` (v2.133.0) — THE ACTIVATION CORTEX.
3
+ * The first thing an agent (or a SessionStart hook) calls so it instantly knows
4
+ * Mneme is connected + WHEN to reach for which tool (the task→tool decision
5
+ * table) + what the shared memory already knows about this repo.
6
+ *
7
+ * mneme boot # human-readable activation digest
8
+ * mneme boot --json # full signed packet
9
+ * mneme boot --task "..." # rank the table for the task at hand
10
+ * mneme boot --hook # emit the activation CONTEXT (what a SessionStart hook injects)
11
+ * mneme boot --emit-hook-config # print the .claude/settings.json snippet to enable the hook
12
+ */
13
+ import { existsSync, readFileSync } from "node:fs";
14
+ import { join } from "node:path";
15
+ import { boot, cortex, notary } from "@mneme-ai/core";
16
+ import { getVersion } from "../version.js";
17
+ function out(s) { process.stdout.write(s + "\n"); }
18
+ function readCortexStore(cwd) {
19
+ try {
20
+ const p = join(cwd, ".mneme", "cortex", "store.json");
21
+ if (!existsSync(p))
22
+ return { v: 1, entries: [] };
23
+ const j = JSON.parse(readFileSync(p, "utf8"));
24
+ return j && Array.isArray(j.entries) ? j : { v: 1, entries: [] };
25
+ }
26
+ catch {
27
+ return { v: 1, entries: [] };
28
+ }
29
+ }
30
+ function recallFacts(cwd, task) {
31
+ try {
32
+ if (!task)
33
+ return [];
34
+ const hits = cortex.recall(readCortexStore(cwd), task, 8);
35
+ return hits.map((h) => ({ key: h.entry.key, value: h.entry.value }));
36
+ }
37
+ catch {
38
+ return [];
39
+ }
40
+ }
41
+ export function registerBootCommands(program) {
42
+ program
43
+ .command("boot")
44
+ .description("⚡ ACTIVATION CORTEX — the session-start handshake: confirms Mneme is connected + returns the task→tool decision table (WHEN to use which Mneme tool) + cortex recall. Fire it FIRST.")
45
+ .option("--task <t>", "the task at hand (ranks the decision table + recalls relevant shared memory).")
46
+ .option("--json", "full signed packet as JSON.")
47
+ .option("--hook", "emit the activation CONTEXT a SessionStart hook injects into the agent.")
48
+ .option("--emit-hook-config", "print the .claude/settings.json SessionStart hook snippet (opt-in).")
49
+ .action((opts) => {
50
+ const cwd = process.cwd();
51
+ const version = getVersion();
52
+ if (opts.emitHookConfig) {
53
+ out(boot.bootHookSnippet(process.env["MNEME_CLI_BIN"] ?? "mneme"));
54
+ process.stderr.write(`\n# Paste the above into .claude/settings.json (merge with existing hooks). It runs \`mneme boot --hook\` at session start so the agent always knows how/when to use Mneme. Opt-in — Mneme never installs a hook for you.\n`);
55
+ return;
56
+ }
57
+ const packet = boot.buildBootPacket({
58
+ version,
59
+ healthy: true,
60
+ ...(opts.task ? { task: opts.task, cortexFacts: recallFacts(cwd, opts.task) } : {}),
61
+ });
62
+ if (opts.hook) {
63
+ // SessionStart hook stdout is injected into the agent's context.
64
+ out(`<mneme-activation v="${version}">`);
65
+ out(packet.instructions);
66
+ if (packet.cortexFacts.length) {
67
+ out(`\nShared memory relevant now:`);
68
+ for (const f of packet.cortexFacts)
69
+ out(`• ${f.key}: ${f.value}`);
70
+ }
71
+ out(`</mneme-activation>`);
72
+ return;
73
+ }
74
+ if (opts.json) {
75
+ const receipt = notary.issueReceipt(cwd, { kind: "claim-verdict", subject: "boot", payload: { version, rows: packet.decisionTable.length }, includePayload: true });
76
+ out(JSON.stringify({ ...packet, receipt }, null, 2));
77
+ return;
78
+ }
79
+ // human-readable digest
80
+ out(`⚡ ${packet.installCheck}`);
81
+ out(``);
82
+ out(`Boundaries:`);
83
+ out(` ${packet.capabilities.inbound}`);
84
+ out(` ${packet.capabilities.outbound}`);
85
+ out(` ${packet.capabilities.memory}`);
86
+ out(` ${packet.capabilities.token}`);
87
+ out(``);
88
+ out(`When to reach for Mneme (signals, not commands):`);
89
+ for (const r of packet.decisionTable)
90
+ out(` • ${r.when}\n → ${r.tool}\n (${r.why})`);
91
+ if (packet.cortexFacts.length) {
92
+ out(``);
93
+ out(`Shared memory relevant to "${opts.task}":`);
94
+ for (const f of packet.cortexFacts)
95
+ out(` • ${f.key}: ${f.value}`);
96
+ }
97
+ out(``);
98
+ out(`# ${packet.note}`);
99
+ out(`# Reliable auto-activation: mneme boot --emit-hook-config (opt-in SessionStart hook)`);
100
+ });
101
+ }
102
+ //# sourceMappingURL=boot.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"boot.js","sourceRoot":"","sources":["../../src/commands/boot.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAGH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;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aAAa,CAAC,CAAC,IAAI,cAAc,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC;QAClG,IAAI,MAAM,CAAC,WAAW,CAAC,MAAM,EAAE,CAAC;YAC9B,GAAG,CAAC,EAAE,CAAC,CAAC;YACR,GAAG,CAAC,8BAA8B,IAAI,CAAC,IAAI,IAAI,CAAC,CAAC;YACjD,KAAK,MAAM,CAAC,IAAI,MAAM,CAAC,WAAW;gBAAE,GAAG,CAAC,OAAO,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC;QACtE,CAAC;QACD,GAAG,CAAC,EAAE,CAAC,CAAC;QACR,GAAG,CAAC,KAAK,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC;QACxB,GAAG,CAAC,uFAAuF,CAAC,CAAC;IAC/F,CAAC,CAAC,CAAC;AACP,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AA4JA,wBAAsB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CA8gNvD"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AA6JA,wBAAsB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CA+gNvD"}
package/dist/index.js CHANGED
@@ -89,6 +89,7 @@ import { registerChannelCommands } from "./commands/channel.js";
89
89
  import { registerSettlementCommands } from "./commands/settlement.js";
90
90
  import { registerFirewallCommands } from "./commands/firewall.js";
91
91
  import { registerRailCommands } from "./commands/rail.js";
92
+ import { registerBootCommands } from "./commands/boot.js";
92
93
  import { registerTrustCommands } from "./commands/trust.js";
93
94
  import { registerNuclearCommands } from "./commands/nuclear-cli.js";
94
95
  import { registerOvernightCommand } from "./commands/overnight.js";
@@ -4723,6 +4724,7 @@ export async function run(argv) {
4723
4724
  registerSettlementCommands(program);
4724
4725
  registerFirewallCommands(program);
4725
4726
  registerRailCommands(program);
4727
+ registerBootCommands(program);
4726
4728
  // ─── Trust calibrator (v1.31.0) -- per-subsystem precision/recall/band
4727
4729
  registerTrustCommands(program);
4728
4730
  // ─── Wisdom reactor (v1.33.0) -- five nuclear-physics formulas as Mneme metrics