mneme-ai 2.168.0 → 2.170.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.
- package/dist/commands/prism.d.ts +18 -0
- package/dist/commands/prism.d.ts.map +1 -0
- package/dist/commands/prism.js +53 -0
- package/dist/commands/prism.js.map +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `mneme prism` (v2.169.0) — PRISM: superposition reasoning with interference
|
|
3
|
+
* collapse. Fan a question into N candidate branches (over the Matrix rail —
|
|
4
|
+
* parallel by construction), keep them in superposition weighted by amplitude
|
|
5
|
+
* (√confidence), let them INTERFERE (agreeing branches add coherently; refuting
|
|
6
|
+
* branches subtract — destructive), then COLLAPSE via the Born rule to a measured
|
|
7
|
+
* answer — or return SUPERPOSED (abstain) when there's no clear measurement.
|
|
8
|
+
*
|
|
9
|
+
* mneme prism # live self-test (gauntlet 100/100 + A/B)
|
|
10
|
+
* mneme prism collapse --branches branches.json # collapse provided branches
|
|
11
|
+
*
|
|
12
|
+
* A branch is { "id", "answer", "confidence" (0..1), "stance"?: "support"|"refute" }.
|
|
13
|
+
* Branches are produced by fanning the query out over the Matrix rail (or any
|
|
14
|
+
* multi-agent / multi-attempt source); PRISM is the recombination brain.
|
|
15
|
+
*/
|
|
16
|
+
import type { Command } from "commander";
|
|
17
|
+
export declare function registerPrismCommands(program: Command): void;
|
|
18
|
+
//# sourceMappingURL=prism.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prism.d.ts","sourceRoot":"","sources":["../../src/commands/prism.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAMzC,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CA8B5D"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { readFileSync } from "node:fs";
|
|
2
|
+
import { prism, notary } from "@mneme-ai/core";
|
|
3
|
+
function out(s) { process.stdout.write(s + "\n"); }
|
|
4
|
+
export function registerPrismCommands(program) {
|
|
5
|
+
const p = program
|
|
6
|
+
.command("prism")
|
|
7
|
+
.description("🔺 PRISM — SUPERPOSITION REASONING. Fan a question into N candidate branches, keep them in superposition (amplitude √confidence), let them INTERFERE (agreeing branches add coherently — (Σ√c)² superadditivity; refuting branches subtract — destructive), then COLLAPSE via the Born rule to a measured answer, or return SUPERPOSED (abstain) when there's no clear measurement. Beats confidence-argmax (and plurality) when many weak-but-coherent branches are right and a few strong-but-isolated are wrong. A deterministic operator INSPIRED by quantum amplitudes — NOT a quantum computer.")
|
|
8
|
+
.action(() => {
|
|
9
|
+
const g = prism.prismGauntlet();
|
|
10
|
+
out(`🔺 PRISM — superposition reasoning self-test (gauntlet ${g.score}/100)`);
|
|
11
|
+
out(` measured A/B on the target regime (${g.ab.cases} cases): prism ${(g.ab.prismAcc * 100).toFixed(0)}% · confidence-argmax ${(g.ab.argmaxAcc * 100).toFixed(0)}% · plurality ${(g.ab.pluralityAcc * 100).toFixed(0)}%`);
|
|
12
|
+
for (const c of g.checks)
|
|
13
|
+
out(` ${c.pass ? "✓" : "✗"} ${c.name.padEnd(13)} ${c.detail}`);
|
|
14
|
+
process.exitCode = g.score === 100 ? 0 : 2;
|
|
15
|
+
});
|
|
16
|
+
p.command("collapse")
|
|
17
|
+
.description("collapse provided candidate branches into a measured answer (or SUPERPOSED). exit 2 if no clear collapse.")
|
|
18
|
+
.requiredOption("--branches <file>", "JSON array of { id, answer, confidence, stance? } ('-' for stdin)")
|
|
19
|
+
.option("--threshold <n>", "min top probability to collapse (default 0.5)", (v) => parseFloat(v))
|
|
20
|
+
.option("--margin <n>", "min gap over the runner-up (default 0.15)", (v) => parseFloat(v))
|
|
21
|
+
.option("--json", "JSON output")
|
|
22
|
+
.action((opts) => {
|
|
23
|
+
let branches;
|
|
24
|
+
try {
|
|
25
|
+
branches = JSON.parse(opts.branches === "-" ? readFileSync(0, "utf8") : readFileSync(opts.branches, "utf8"));
|
|
26
|
+
}
|
|
27
|
+
catch {
|
|
28
|
+
out("✗ could not read/parse branches JSON");
|
|
29
|
+
process.exitCode = 2;
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
if (!Array.isArray(branches)) {
|
|
33
|
+
out("✗ branches must be a JSON array");
|
|
34
|
+
process.exitCode = 2;
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
const r = prism.collapse(branches, { ...(opts.threshold !== undefined ? { collapseThreshold: opts.threshold } : {}), ...(opts.margin !== undefined ? { margin: opts.margin } : {}) });
|
|
38
|
+
let signed = r;
|
|
39
|
+
try {
|
|
40
|
+
signed = { ...r, _proof: notary.issueReceipt(process.cwd(), { kind: "reasoning-trace", subject: `prism:${r.collapsed ? "collapsed" : "superposed"}`, payload: { answer: r.answer, confidence: r.confidence }, includePayload: true }) };
|
|
41
|
+
}
|
|
42
|
+
catch { /* unsigned */ }
|
|
43
|
+
if (opts.json) {
|
|
44
|
+
out(JSON.stringify(signed, null, 2));
|
|
45
|
+
process.exitCode = r.collapsed ? 0 : 2;
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
out(r.collapsed ? `🔺 COLLAPSED → "${r.answer}" (P=${r.confidence.toFixed(3)}, coherence=${r.coherence.toFixed(2)})` : `🌫 SUPERPOSED — ${r.reason}`);
|
|
49
|
+
out(` spectrum: ${r.ranked.slice(0, 5).map((o) => `${o.answer}=${o.prob.toFixed(2)}`).join(" · ")}`);
|
|
50
|
+
process.exitCode = r.collapsed ? 0 : 2;
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=prism.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prism.js","sourceRoot":"","sources":["../../src/commands/prism.ts"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AAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,MAAM,IAAI,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QACvG,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACzC,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":"AAgLA,wBAAsB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAglNvD"}
|
package/dist/index.js
CHANGED
|
@@ -96,6 +96,7 @@ import { registerMembraneCommands } from "./commands/membrane.js";
|
|
|
96
96
|
import { registerTrustlessCommands } from "./commands/trustless.js";
|
|
97
97
|
import { registerMatrixCommands } from "./commands/matrix.js";
|
|
98
98
|
import { registerAdamasCommands } from "./commands/adamas.js";
|
|
99
|
+
import { registerPrismCommands } from "./commands/prism.js";
|
|
99
100
|
import { registerAxiaCommands } from "./commands/axia.js";
|
|
100
101
|
import { registerPceCommands } from "./commands/pce.js";
|
|
101
102
|
import { registerHauntCommands } from "./commands/haunt.js";
|
|
@@ -4756,6 +4757,7 @@ export async function run(argv) {
|
|
|
4756
4757
|
registerTrustlessCommands(program);
|
|
4757
4758
|
registerMatrixCommands(program);
|
|
4758
4759
|
registerAdamasCommands(program);
|
|
4760
|
+
registerPrismCommands(program);
|
|
4759
4761
|
registerAxiaCommands(program);
|
|
4760
4762
|
registerPceCommands(program);
|
|
4761
4763
|
registerHauntCommands(program);
|