mneme-ai 2.103.0 → 2.105.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,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `mneme cortex` (v2.104.0) — the Sovereign Memory Bus on the CLI:
|
|
3
|
+
* contribute / recall / handoff into the local shared, signed,
|
|
4
|
+
* drift-guarded memory every agent reads. Persists to
|
|
5
|
+
* .mneme/cortex/store.json. Total: never throws.
|
|
6
|
+
*/
|
|
7
|
+
import type { Command } from "commander";
|
|
8
|
+
export declare function registerCortexCommands(program: Command): void;
|
|
9
|
+
//# sourceMappingURL=cortex.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cortex.d.ts","sourceRoot":"","sources":["../../src/commands/cortex.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAwBzC,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CA4C7D"}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `mneme cortex` (v2.104.0) — the Sovereign Memory Bus on the CLI:
|
|
3
|
+
* contribute / recall / handoff into the local shared, signed,
|
|
4
|
+
* drift-guarded memory every agent reads. Persists to
|
|
5
|
+
* .mneme/cortex/store.json. Total: never throws.
|
|
6
|
+
*/
|
|
7
|
+
import { existsSync, readFileSync, writeFileSync, mkdirSync } from "node:fs";
|
|
8
|
+
import { join } from "node:path";
|
|
9
|
+
function writeJson(p) { process.stdout.write(JSON.stringify(p, null, 2) + "\n"); }
|
|
10
|
+
function writeText(l) { process.stdout.write(l + "\n"); }
|
|
11
|
+
async function core() {
|
|
12
|
+
try {
|
|
13
|
+
const c = (await import("@mneme-ai/core"));
|
|
14
|
+
if (c.cortex)
|
|
15
|
+
return c;
|
|
16
|
+
}
|
|
17
|
+
catch { /* */ }
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
function storePath(cwd) { return join(cwd, ".mneme", "cortex", "store.json"); }
|
|
21
|
+
function readStore(cwd) {
|
|
22
|
+
try {
|
|
23
|
+
const p = storePath(cwd);
|
|
24
|
+
if (!existsSync(p))
|
|
25
|
+
return { v: 1, entries: [] };
|
|
26
|
+
const j = JSON.parse(readFileSync(p, "utf8"));
|
|
27
|
+
return j && Array.isArray(j.entries) ? j : { v: 1, entries: [] };
|
|
28
|
+
}
|
|
29
|
+
catch {
|
|
30
|
+
return { v: 1, entries: [] };
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
function saveStore(cwd, s) { try {
|
|
34
|
+
const d = join(cwd, ".mneme", "cortex");
|
|
35
|
+
if (!existsSync(d))
|
|
36
|
+
mkdirSync(d, { recursive: true });
|
|
37
|
+
writeFileSync(storePath(cwd), JSON.stringify(s, null, 2));
|
|
38
|
+
}
|
|
39
|
+
catch { /* */ } }
|
|
40
|
+
export function registerCortexCommands(program) {
|
|
41
|
+
const c = program
|
|
42
|
+
.command("cortex")
|
|
43
|
+
.description("🧠 COGNITIVE CORTEX — the local, signed, drift-guarded Sovereign Memory Bus every AI agent shares. contribute / recall / handoff. The gatekeeper quarantines conflicts so the shared memory can't be poisoned.");
|
|
44
|
+
c.command("contribute <key> <value>")
|
|
45
|
+
.description("Write a fact to the shared memory (signed). Quarantined if it conflicts with established memory unless --update.")
|
|
46
|
+
.option("--agent <id>", "your agent id", "cli")
|
|
47
|
+
.option("--kind <k>", "fact | decision | context | warning", "fact")
|
|
48
|
+
.option("--update", "declare a supersede of an existing conflicting value")
|
|
49
|
+
.option("--json", "JSON output.")
|
|
50
|
+
.action(async (key, value, opts) => {
|
|
51
|
+
const m = await core();
|
|
52
|
+
if (!m) {
|
|
53
|
+
writeText("✗ @mneme-ai/core unavailable.");
|
|
54
|
+
process.exitCode = 1;
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
const cwd = process.cwd();
|
|
58
|
+
const out = m.cortex.contribute(cwd, readStore(cwd), { agent: opts.agent ?? "cli", key, value, kind: opts.kind }, Date.now(), { update: !!opts.update });
|
|
59
|
+
if (out.result.verdict !== "QUARANTINED" && out.result.entry)
|
|
60
|
+
saveStore(cwd, out.store);
|
|
61
|
+
if (opts.json) {
|
|
62
|
+
writeJson(out.result);
|
|
63
|
+
process.exitCode = out.result.verdict === "QUARANTINED" ? 1 : 0;
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
const icon = out.result.verdict === "QUARANTINED" ? "⚠" : "✓";
|
|
67
|
+
writeText(`${icon} ${out.result.verdict} — ${out.result.reason}`);
|
|
68
|
+
process.exitCode = out.result.verdict === "QUARANTINED" ? 1 : 0;
|
|
69
|
+
});
|
|
70
|
+
c.command("recall <query>")
|
|
71
|
+
.description("Recall shared memory relevant to a query (signed facts every agent contributed).")
|
|
72
|
+
.option("--limit <n>", "max hits", (v) => parseInt(v, 10), 10)
|
|
73
|
+
.option("--json", "JSON output.")
|
|
74
|
+
.action(async (query, opts) => {
|
|
75
|
+
const m = await core();
|
|
76
|
+
if (!m) {
|
|
77
|
+
writeText("✗ @mneme-ai/core unavailable.");
|
|
78
|
+
process.exitCode = 1;
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
const hits = m.cortex.recall(readStore(process.cwd()), query, opts.limit ?? 10);
|
|
82
|
+
if (opts.json) {
|
|
83
|
+
writeJson(hits.map((h) => ({ key: h.entry.key, value: h.entry.value, agent: h.entry.agent, score: h.score })));
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
if (hits.length === 0) {
|
|
87
|
+
writeText("· no shared memory matches that query yet");
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
writeText(`CORTEX recall — ${hits.length} fact(s):`);
|
|
91
|
+
for (const h of hits)
|
|
92
|
+
writeText(` • ${h.entry.key} = ${h.entry.value} (by ${h.entry.agent})`);
|
|
93
|
+
});
|
|
94
|
+
c.command("handoff <toAgent>")
|
|
95
|
+
.description("Build a signed context capsule of the live shared memory for a receiving agent.")
|
|
96
|
+
.option("--json", "JSON output.")
|
|
97
|
+
.action(async (toAgent, opts) => {
|
|
98
|
+
const m = await core();
|
|
99
|
+
if (!m) {
|
|
100
|
+
writeText("✗ @mneme-ai/core unavailable.");
|
|
101
|
+
process.exitCode = 1;
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
const cap = m.cortex.handoff(process.cwd(), readStore(process.cwd()), toAgent, Date.now());
|
|
105
|
+
if (opts.json) {
|
|
106
|
+
writeJson(cap);
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
writeText(`✓ signed handoff capsule for ${cap.toAgent} — ${cap.facts.length} fact(s)`);
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
//# sourceMappingURL=cortex.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cortex.js","sourceRoot":"","sources":["../../src/commands/cortex.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAC7E,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,SAAS,SAAS,CAAC,CAAU,IAAU,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;AACjG,SAAS,SAAS,CAAC,CAAS,IAAU,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;AASvE,KAAK,UAAU,IAAI;IACjB,IAAI,CAAC;QAAC,MAAM,CAAC,GAAG,CAAC,MAAM,MAAM,CAAC,gBAAgB,CAAC,CAA0B,CAAC;QAAC,IAAI,CAAC,CAAC,MAAM;YAAE,OAAO,CAAC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AAC,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,SAAS,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,EAAE,OAAO,EAAE,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC;QAC3F,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;YAAC,SAAS,CAAC,GAAG,CAAC,CAAC;YAAC,OAAO;QAAC,CAAC;QAC1C,SAAS,CAAC,gCAAgC,GAAG,CAAC,OAAO,MAAM,GAAG,CAAC,KAAK,CAAC,MAAM,UAAU,CAAC,CAAC;IACzF,CAAC,CAAC,CAAC;AACP,CAAC"}
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AA0IA,wBAAsB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAo+MvD"}
|
package/dist/index.js
CHANGED
|
@@ -70,6 +70,7 @@ import { registerSupernovaCommands } from "./commands/supernova-cli.js";
|
|
|
70
70
|
import { registerManifestCommands } from "./commands/manifest.js";
|
|
71
71
|
import { registerHydraCommands } from "./commands/hydra.js";
|
|
72
72
|
import { registerWisdomGateCommands } from "./commands/wisdom_gates.js";
|
|
73
|
+
import { registerCortexCommands } from "./commands/cortex.js";
|
|
73
74
|
import { registerTrustCommands } from "./commands/trust.js";
|
|
74
75
|
import { registerNuclearCommands } from "./commands/nuclear-cli.js";
|
|
75
76
|
import { registerOvernightCommand } from "./commands/overnight.js";
|
|
@@ -4685,6 +4686,7 @@ export async function run(argv) {
|
|
|
4685
4686
|
registerManifestCommands(program);
|
|
4686
4687
|
registerHydraCommands(program);
|
|
4687
4688
|
registerWisdomGateCommands(program);
|
|
4689
|
+
registerCortexCommands(program);
|
|
4688
4690
|
// ─── Trust calibrator (v1.31.0) -- per-subsystem precision/recall/band
|
|
4689
4691
|
registerTrustCommands(program);
|
|
4690
4692
|
// ─── Wisdom reactor (v1.33.0) -- five nuclear-physics formulas as Mneme metrics
|