mneme-ai 3.115.0 → 3.116.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,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `mneme statguard` (v3.116.0) — catch statistical misinterpretations (p-value /
|
|
3
|
+
* CI / power) in a claim, grounded in Greenland et al. 2016. The anti-trap guard
|
|
4
|
+
* so an AI agent (or a researcher) never relays a documented statistics fallacy.
|
|
5
|
+
*
|
|
6
|
+
* mneme statguard "p > 0.05 so there is no effect"
|
|
7
|
+
* mneme statguard bench
|
|
8
|
+
*/
|
|
9
|
+
import type { Command } from "commander";
|
|
10
|
+
export declare function registerStatguardCommands(program: Command): void;
|
|
11
|
+
//# sourceMappingURL=statguard.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"statguard.d.ts","sourceRoot":"","sources":["../../src/commands/statguard.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAKzC,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAiChE"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `mneme statguard` (v3.116.0) — catch statistical misinterpretations (p-value /
|
|
3
|
+
* CI / power) in a claim, grounded in Greenland et al. 2016. The anti-trap guard
|
|
4
|
+
* so an AI agent (or a researcher) never relays a documented statistics fallacy.
|
|
5
|
+
*
|
|
6
|
+
* mneme statguard "p > 0.05 so there is no effect"
|
|
7
|
+
* mneme statguard bench
|
|
8
|
+
*/
|
|
9
|
+
import { statguard, notary } from "@mneme-ai/core";
|
|
10
|
+
function out(s) { process.stdout.write(s + "\n"); }
|
|
11
|
+
export function registerStatguardCommands(program) {
|
|
12
|
+
const g = program
|
|
13
|
+
.command("statguard")
|
|
14
|
+
.alias("stat-check")
|
|
15
|
+
.argument("[claim...]", "a statistical claim to check")
|
|
16
|
+
.description("📐 STATGUARD — flag documented statistical misinterpretations (p-value / confidence interval / power) in a claim, with the correct interpretation + the Greenland et al. 2016 citation. The anti-trap guard so an AI never relays a stats fallacy to a researcher/doctor/analyst. Deterministic; CLEAN = no KNOWN fallacy (not 'the stats are correct').")
|
|
17
|
+
.option("--json", "JSON output (signed)")
|
|
18
|
+
.action((claim, opts) => {
|
|
19
|
+
const q = Array.isArray(claim) ? claim.join(" ") : String(claim ?? "");
|
|
20
|
+
if (!q.trim()) {
|
|
21
|
+
out("usage: mneme statguard \"<a statistical claim>\"");
|
|
22
|
+
process.exitCode = 2;
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
const r = statguard.checkStat(q);
|
|
26
|
+
let receipt = null;
|
|
27
|
+
try {
|
|
28
|
+
receipt = notary.issueReceipt(process.cwd(), { kind: "claim-verdict", subject: `statguard:${r.verdict}`, payload: { verdict: r.verdict, hits: r.hits.map((h) => h.id) }, includePayload: true });
|
|
29
|
+
}
|
|
30
|
+
catch { /* */ }
|
|
31
|
+
if (opts.json) {
|
|
32
|
+
out(JSON.stringify({ ...r, signed: receipt }, null, 2));
|
|
33
|
+
process.exitCode = r.verdict === "CLEAN" ? 0 : 2;
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
if (r.verdict === "CLEAN") {
|
|
37
|
+
out(`✓ CLEAN — no known statistical misinterpretation detected.`);
|
|
38
|
+
process.exitCode = 0;
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
out(`🛑 MISINTERPRETATION — ${r.hits.length} fallacy(ies):`);
|
|
42
|
+
for (const h of r.hits) {
|
|
43
|
+
out(` • ${h.name} [${h.ref}]`);
|
|
44
|
+
out(` why: ${h.why}`);
|
|
45
|
+
out(` fix: ${h.correct}`);
|
|
46
|
+
}
|
|
47
|
+
process.exitCode = 2;
|
|
48
|
+
});
|
|
49
|
+
g.command("bench")
|
|
50
|
+
.description("the signed A/B: detection recall on documented fallacies + precision (no false flag on correct statements).")
|
|
51
|
+
.option("--json", "JSON output")
|
|
52
|
+
.action((opts) => {
|
|
53
|
+
const b = statguard.statGuardBench();
|
|
54
|
+
let receipt = null;
|
|
55
|
+
try {
|
|
56
|
+
receipt = notary.issueReceipt(process.cwd(), { kind: "reasoning-trace", subject: `statguard.bench:r${b.recall}p${b.precision}`, payload: { recall: b.recall, precision: b.precision }, includePayload: true });
|
|
57
|
+
}
|
|
58
|
+
catch { /* */ }
|
|
59
|
+
if (opts.json) {
|
|
60
|
+
out(JSON.stringify({ ...b, signed: receipt }, null, 2));
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
out(`📐 STATGUARD — ${b.total} labeled claims (${b.flaggable} fallacious + ${b.total - b.flaggable} correct):`);
|
|
64
|
+
out(` fallacies caught: ${b.caught}/${b.flaggable} · recall ${(b.recall * 100).toFixed(0)}%`);
|
|
65
|
+
out(` correct kept clean: ${b.cleanCorrect}/${b.total - b.flaggable} · precision ${(b.precision * 100).toFixed(0)}% (${b.falseFlags} false flag)`);
|
|
66
|
+
out(` ${receipt ? "✓ signed · " : ""}grounded in Greenland et al. 2016; deterministic pattern detector — CLEAN = no KNOWN fallacy, not a full stats proof.`);
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=statguard.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"statguard.js","sourceRoot":"","sources":["../../src/commands/statguard.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAEnD,SAAS,GAAG,CAAC,CAAS,IAAU,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;AAEjE,MAAM,UAAU,yBAAyB,CAAC,OAAgB;IACxD,MAAM,CAAC,GAAG,OAAO;SACd,OAAO,CAAC,WAAW,CAAC;SACpB,KAA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EAAE,SAAS,EAAE,CAAC,CAAC,SAAS,EAAE,EAAE,cAAc,EAAE,IAAI,EAAE,CAAC,CAAC;QAAC,CAAC;QAAC,MAAM,CAAC,CAAC,KAAK,CAAC,CAAC;QACvO,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;YAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,GAAG,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;YAAC,OAAO;QAAC,CAAC;QACnF,GAAG,CAAC,kBAAkB,CAAC,CAAC,KAAK,oBAAoB,CAAC,CAAC,SAAS,iBAAiB,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,SAAS,YAAY,CAAC,CAAC;QAChH,GAAG,CAAC,wBAAwB,CAAC,CAAC,MAAM,IAAI,CAAC,CAAC,SAAS,cAAc,CAAC,CAAC,CAAC,MAAM,GAAG,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;QACjG,GAAG,CAAC,0BAA0B,CAAC,CAAC,YAAY,IAAI,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,SAAS,iBAAiB,CAAC,CAAC,CAAC,SAAS,GAAG,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,UAAU,cAAc,CAAC,CAAC;QACtJ,GAAG,CAAC,MAAM,OAAO,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,uHAAuH,CAAC,CAAC;IACjK,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":"AAuMA,wBAAsB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CA0mNvD"}
|
package/dist/index.js
CHANGED
|
@@ -129,6 +129,7 @@ import { registerMyceliumCommands } from "./commands/mycelium.js";
|
|
|
129
129
|
import { registerSiegeCommands } from "./commands/siege.js";
|
|
130
130
|
import { registerCanonCommands } from "./commands/canon.js";
|
|
131
131
|
import { registerSdcCommands } from "./commands/sdc.js";
|
|
132
|
+
import { registerStatguardCommands } from "./commands/statguard.js";
|
|
132
133
|
import { registerMoatCommands } from "./commands/moat.js";
|
|
133
134
|
import { attachRegretOracle } from "./commands/regret.js";
|
|
134
135
|
import { registerTrustCommands } from "./commands/trust.js";
|
|
@@ -4815,6 +4816,7 @@ export async function run(argv) {
|
|
|
4815
4816
|
registerSiegeCommands(program);
|
|
4816
4817
|
registerCanonCommands(program);
|
|
4817
4818
|
registerSdcCommands(program);
|
|
4819
|
+
registerStatguardCommands(program);
|
|
4818
4820
|
registerMoatCommands(program);
|
|
4819
4821
|
// ─── Trust calibrator (v1.31.0) -- per-subsystem precision/recall/band
|
|
4820
4822
|
registerTrustCommands(program);
|