@mneme-ai/mcp 1.17.6 → 1.19.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.
Files changed (96) hide show
  1. package/README.md +64 -9
  2. package/dist/index.d.ts.map +1 -1
  3. package/dist/index.js +135 -8
  4. package/dist/index.js.map +1 -1
  5. package/dist/mcp_primitives/completion.d.ts +19 -0
  6. package/dist/mcp_primitives/completion.d.ts.map +1 -0
  7. package/dist/mcp_primitives/completion.js +55 -0
  8. package/dist/mcp_primitives/completion.js.map +1 -0
  9. package/dist/mcp_primitives/prompts.d.ts +36 -0
  10. package/dist/mcp_primitives/prompts.d.ts.map +1 -0
  11. package/dist/mcp_primitives/prompts.js +140 -0
  12. package/dist/mcp_primitives/prompts.js.map +1 -0
  13. package/dist/mcp_primitives/resources.d.ts +30 -0
  14. package/dist/mcp_primitives/resources.d.ts.map +1 -0
  15. package/dist/mcp_primitives/resources.js +127 -0
  16. package/dist/mcp_primitives/resources.js.map +1 -0
  17. package/dist/tools/_aletheia.d.ts +82 -0
  18. package/dist/tools/_aletheia.d.ts.map +1 -0
  19. package/dist/tools/_aletheia.js +800 -0
  20. package/dist/tools/_aletheia.js.map +1 -0
  21. package/dist/tools/_confess.d.ts +67 -0
  22. package/dist/tools/_confess.d.ts.map +1 -0
  23. package/dist/tools/_confess.js +260 -0
  24. package/dist/tools/_confess.js.map +1 -0
  25. package/dist/tools/_confess.test.d.ts +6 -0
  26. package/dist/tools/_confess.test.d.ts.map +1 -0
  27. package/dist/tools/_confess.test.js +96 -0
  28. package/dist/tools/_confess.test.js.map +1 -0
  29. package/dist/tools/_contract.test.d.ts +19 -0
  30. package/dist/tools/_contract.test.d.ts.map +1 -0
  31. package/dist/tools/_contract.test.js +117 -0
  32. package/dist/tools/_contract.test.js.map +1 -0
  33. package/dist/tools/_court.d.ts +57 -0
  34. package/dist/tools/_court.d.ts.map +1 -0
  35. package/dist/tools/_court.js +261 -0
  36. package/dist/tools/_court.js.map +1 -0
  37. package/dist/tools/_court.test.d.ts +8 -0
  38. package/dist/tools/_court.test.d.ts.map +1 -0
  39. package/dist/tools/_court.test.js +111 -0
  40. package/dist/tools/_court.test.js.map +1 -0
  41. package/dist/tools/_genome_marketplace.d.ts +83 -0
  42. package/dist/tools/_genome_marketplace.d.ts.map +1 -0
  43. package/dist/tools/_genome_marketplace.js +410 -0
  44. package/dist/tools/_genome_marketplace.js.map +1 -0
  45. package/dist/tools/_genome_marketplace.test.d.ts +5 -0
  46. package/dist/tools/_genome_marketplace.test.d.ts.map +1 -0
  47. package/dist/tools/_genome_marketplace.test.js +157 -0
  48. package/dist/tools/_genome_marketplace.test.js.map +1 -0
  49. package/dist/tools/_lineage.d.ts +35 -0
  50. package/dist/tools/_lineage.d.ts.map +1 -0
  51. package/dist/tools/_lineage.js +782 -0
  52. package/dist/tools/_lineage.js.map +1 -0
  53. package/dist/tools/_mesh.d.ts +51 -0
  54. package/dist/tools/_mesh.d.ts.map +1 -0
  55. package/dist/tools/_mesh.js +182 -0
  56. package/dist/tools/_mesh.js.map +1 -0
  57. package/dist/tools/_registry.d.ts.map +1 -1
  58. package/dist/tools/_registry.js +19 -0
  59. package/dist/tools/_registry.js.map +1 -1
  60. package/dist/tools/_replay.d.ts +52 -0
  61. package/dist/tools/_replay.d.ts.map +1 -0
  62. package/dist/tools/_replay.js +253 -0
  63. package/dist/tools/_replay.js.map +1 -0
  64. package/dist/tools/_replay.test.d.ts +5 -0
  65. package/dist/tools/_replay.test.d.ts.map +1 -0
  66. package/dist/tools/_replay.test.js +90 -0
  67. package/dist/tools/_replay.test.js.map +1 -0
  68. package/dist/tools/_timetravel.d.ts +46 -0
  69. package/dist/tools/_timetravel.d.ts.map +1 -0
  70. package/dist/tools/_timetravel.js +243 -0
  71. package/dist/tools/_timetravel.js.map +1 -0
  72. package/dist/tools/_timetravel.test.d.ts +7 -0
  73. package/dist/tools/_timetravel.test.d.ts.map +1 -0
  74. package/dist/tools/_timetravel.test.js +31 -0
  75. package/dist/tools/_timetravel.test.js.map +1 -0
  76. package/dist/tools/_tool_meta.d.ts +30 -0
  77. package/dist/tools/_tool_meta.d.ts.map +1 -0
  78. package/dist/tools/_tool_meta.js +530 -0
  79. package/dist/tools/_tool_meta.js.map +1 -0
  80. package/dist/tools/_types.d.ts +46 -5
  81. package/dist/tools/_types.d.ts.map +1 -1
  82. package/dist/tools/_types.js.map +1 -1
  83. package/dist/tools/_verify_claims_tool.d.ts.map +1 -1
  84. package/dist/tools/_verify_claims_tool.js +23 -0
  85. package/dist/tools/_verify_claims_tool.js.map +1 -1
  86. package/dist/tools/audit.d.ts.map +1 -1
  87. package/dist/tools/audit.js +37 -0
  88. package/dist/tools/audit.js.map +1 -1
  89. package/dist/tools/memory.d.ts.map +1 -1
  90. package/dist/tools/memory.js +23 -0
  91. package/dist/tools/memory.js.map +1 -1
  92. package/dist/tools/quant.d.ts +10 -2
  93. package/dist/tools/quant.d.ts.map +1 -1
  94. package/dist/tools/quant.js +311 -18
  95. package/dist/tools/quant.js.map +1 -1
  96. package/package.json +3 -3
@@ -0,0 +1,117 @@
1
+ /**
2
+ * Contract tests — loop every registered MCP tool and verify the structural
3
+ * invariants that the Mneme architecture depends on. These tests catch:
4
+ *
5
+ * • name regex violations (the namespace pattern matters for grouping)
6
+ * • description / handler shape regressions
7
+ * • inputSchema validity (must be a JSON Schema object, type=object)
8
+ * • outputSchema validity when present
9
+ * • duplicate names across categories
10
+ * • unique categories (only the 9 documented categories are allowed)
11
+ * • no orphaned composeWith references
12
+ *
13
+ * v1.18 — these tests are STRUCTURAL only. Description-quality scoring
14
+ * (length, jargon coverage, examples) lives in mneme.tool.lint and is
15
+ * intended to be a soft target, not a build-time gate. Build-time gates
16
+ * here would block legitimate refactors of legacy tools.
17
+ */
18
+ import { describe, expect, it } from "vitest";
19
+ import { buildAllTools, buildToolMap } from "./_registry.js";
20
+ import { computeCatalogHash } from "./_tool_meta.js";
21
+ const NAME_PATTERN = /^mneme\.[a-z_]+(?:\.[a-z_]+)*$/;
22
+ const VALID_CATEGORIES = new Set([
23
+ "memory",
24
+ "people",
25
+ "audit",
26
+ "forensics",
27
+ "insights",
28
+ "quality",
29
+ "quant",
30
+ "lab",
31
+ "meta",
32
+ ]);
33
+ describe("MCP tool contract — structural invariants", () => {
34
+ const all = buildAllTools();
35
+ it("registers at least 90 tools (catalog should be growing, not shrinking)", () => {
36
+ expect(all.length).toBeGreaterThanOrEqual(90);
37
+ });
38
+ it.each(all.map((t) => [t.name, t]))("%s — name matches mneme.<group>(.<sub>)* pattern", (_name, t) => {
39
+ expect(t.name).toMatch(NAME_PATTERN);
40
+ });
41
+ it.each(all.map((t) => [t.name, t]))("%s — category is one of the 9 documented categories", (_name, t) => {
42
+ expect(VALID_CATEGORIES.has(t.category)).toBe(true);
43
+ });
44
+ it.each(all.map((t) => [t.name, t]))("%s — has a non-empty description", (_name, t) => {
45
+ expect(t.description).toBeTypeOf("string");
46
+ expect(t.description.length).toBeGreaterThan(20);
47
+ });
48
+ it.each(all.map((t) => [t.name, t]))("%s — has at least one trigger phrase", (_name, t) => {
49
+ expect(Array.isArray(t.triggers)).toBe(true);
50
+ expect(t.triggers.length).toBeGreaterThanOrEqual(1);
51
+ });
52
+ it.each(all.map((t) => [t.name, t]))("%s — handler is an async function", (_name, t) => {
53
+ expect(typeof t.handler).toBe("function");
54
+ // Async functions in TS may lose the AsyncFunction prototype after compile,
55
+ // so we don't assert constructor.name; we trust the type system here.
56
+ });
57
+ it.each(all.map((t) => [t.name, t]))("%s — inputSchema is a JSON Schema object", (_name, t) => {
58
+ const s = t.inputSchema;
59
+ expect(s).toBeTypeOf("object");
60
+ expect(s.type).toBe("object");
61
+ // properties may be empty {} for zero-arg tools — that's fine.
62
+ expect(s.properties).toBeTypeOf("object");
63
+ });
64
+ it("has no duplicate tool names across the registry", () => {
65
+ const names = all.map((t) => t.name);
66
+ const set = new Set(names);
67
+ expect(set.size).toBe(names.length);
68
+ });
69
+ it("buildToolMap rejects collisions and produces a 1:1 map", () => {
70
+ const map = buildToolMap();
71
+ expect(map.size).toBe(all.length);
72
+ for (const t of all)
73
+ expect(map.get(t.name)).toBe(t);
74
+ });
75
+ });
76
+ describe("MCP tool contract — v1.18 optional fields are well-formed when present", () => {
77
+ const all = buildAllTools();
78
+ it.each(all.filter((t) => t.outputSchema).map((t) => [t.name, t]))("%s — outputSchema (when present) is a JSON Schema object", (_name, t) => {
79
+ const s = t.outputSchema;
80
+ expect(s).toBeTypeOf("object");
81
+ expect(s.type).toBe("object");
82
+ });
83
+ it.each(all.filter((t) => t.examples).map((t) => [t.name, t]))("%s — every example has at minimum a userQuery string", (_name, t) => {
84
+ for (const ex of t.examples) {
85
+ expect(typeof ex.userQuery).toBe("string");
86
+ expect(ex.userQuery.length).toBeGreaterThan(0);
87
+ }
88
+ });
89
+ it.each(all.filter((t) => t.composeWith && t.composeWith.length > 0).map((t) => [t.name, t]))("%s — composeWith references resolve (no orphans)", (_name, t) => {
90
+ const map = buildToolMap();
91
+ for (const ref of t.composeWith) {
92
+ // composeWith may legitimately reference tools that don't exist yet
93
+ // (e.g., in same-version planning), so we only enforce when the
94
+ // ref looks like an mneme.* name.
95
+ if (ref.startsWith("mneme.")) {
96
+ expect(map.has(ref), `${t.name} composeWith references unknown tool ${ref}`).toBe(true);
97
+ }
98
+ }
99
+ });
100
+ it.each(all.filter((t) => t.pitfalls).map((t) => [t.name, t]))("%s — every pitfall is a non-empty short string", (_name, t) => {
101
+ for (const p of t.pitfalls) {
102
+ expect(typeof p).toBe("string");
103
+ expect(p.length).toBeGreaterThan(5);
104
+ expect(p.length).toBeLessThan(400);
105
+ }
106
+ });
107
+ });
108
+ describe("Catalog hash — deterministic + stable", () => {
109
+ it("computeCatalogHash returns a 16-char hex string", () => {
110
+ const h = computeCatalogHash();
111
+ expect(h).toMatch(/^[0-9a-f]{16}$/);
112
+ });
113
+ it("computeCatalogHash is deterministic across calls", () => {
114
+ expect(computeCatalogHash()).toBe(computeCatalogHash());
115
+ });
116
+ });
117
+ //# sourceMappingURL=_contract.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"_contract.test.js","sourceRoot":"","sources":["../../src/tools/_contract.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAErD,MAAM,YAAY,GAAG,gCAAgC,CAAC;AACtD,MAAM,gBAAgB,GAAG,IAAI,GAAG,CAAC;IAC/B,QAAQ;IACR,QAAQ;IACR,OAAO;IACP,WAAW;IACX,UAAU;IACV,SAAS;IACT,OAAO;IACP,KAAK;IACL,MAAM;CACP,CAAC,CAAC;AAEH,QAAQ,CAAC,2CAA2C,EAAE,GAAG,EAAE;IACzD,MAAM,GAAG,GAAG,aAAa,EAAE,CAAC;IAE5B,EAAE,CAAC,wEAAwE,EAAE,GAAG,EAAE;QAChF,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,sBAAsB,CAAC,EAAE,CAAC,CAAC;IAChD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,kDAAkD,EAAE,CAAC,KAAK,EAAE,CAAC,EAAE,EAAE;QACpG,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;IACvC,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CA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AAC,GAAG,CAAC,CAAC;QACrC,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,QAAQ,CAAC,uCAAuC,EAAE,GAAG,EAAE;IACrD,EAAE,CAAC,iDAAiD,EAAE,GAAG,EAAE;QACzD,MAAM,CAAC,GAAG,kBAAkB,EAAE,CAAC;QAC/B,MAAM,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC;IACtC,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,kDAAkD,EAAE,GAAG,EAAE;QAC1D,MAAM,CAAC,kBAAkB,EAAE,CAAC,CAAC,IAAI,CAAC,kBAAkB,EAAE,CAAC,CAAC;IAC1D,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,57 @@
1
+ /**
2
+ * Mneme Court (v1.18.0 — black sheep #3)
3
+ *
4
+ * The AI states a CLAIM. Mneme assembles the adversarial response: every
5
+ * commit / file / signal that contradicts the claim, ranked by strength.
6
+ * Returns a verdict — `motion_to_dismiss | hung_jury | verdict_for_plaintiff`
7
+ * — plus key witnesses (commit hashes) the AI can cite.
8
+ *
9
+ * No other MCP server has a built-in red-team for the AI's own outputs.
10
+ * This is the "second opinion" tool: the AI calls it BEFORE delivering a
11
+ * confident claim, lets Mneme assemble counter-evidence, then either
12
+ * stands by the claim (with citations of the cross-examination) or
13
+ * rewrites it.
14
+ *
15
+ * The verdict is a heuristic — not a court ruling. But the *evidence
16
+ * surface* is real: we walk the actual commit history for matches and
17
+ * counter-matches against the claim's keywords, and we score the
18
+ * strength of contradiction by recency × frequency × specificity.
19
+ */
20
+ import type { MnemeTool } from "./_types.js";
21
+ export type CourtVerdict =
22
+ /** Strong evidence supports the claim — Mneme cannot mount a credible challenge. */
23
+ "verdict_for_plaintiff"
24
+ /** Roughly equal evidence on both sides — claim is contested. */
25
+ | "hung_jury"
26
+ /** Strong evidence contradicts the claim — recommend the AI retract or qualify. */
27
+ | "motion_to_dismiss";
28
+ export interface CourtWitness {
29
+ commit: string;
30
+ date: string;
31
+ subject: string;
32
+ /** -1 to +1: -1 = strongly contradicts the claim, +1 = strongly supports. */
33
+ weight: number;
34
+ reason: string;
35
+ }
36
+ export interface CourtRuling {
37
+ claim: string;
38
+ verdict: CourtVerdict;
39
+ /** -1 (full contradiction) to +1 (full support). */
40
+ evidenceBalance: number;
41
+ witnessesFor: CourtWitness[];
42
+ witnessesAgainst: CourtWitness[];
43
+ /** One-line summary the AI can quote. */
44
+ summary: string;
45
+ /** Concrete instructions for the AI. */
46
+ recommendation: string;
47
+ }
48
+ interface CommitDigest {
49
+ hash: string;
50
+ date: string;
51
+ subject: string;
52
+ body: string;
53
+ }
54
+ export declare function crossExamineClaim(claim: string, commits: CommitDigest[]): CourtRuling;
55
+ export declare const adversaryTool: MnemeTool;
56
+ export {};
57
+ //# sourceMappingURL=_court.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"_court.d.ts","sourceRoot":"","sources":["../../src/tools/_court.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAG7C,MAAM,MAAM,YAAY;AACtB,oFAAoF;AAClF,uBAAuB;AACzB,iEAAiE;GAC/D,WAAW;AACb,mFAAmF;GACjF,mBAAmB,CAAC;AAExB,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,6EAA6E;IAC7E,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,YAAY,CAAC;IACtB,oDAAoD;IACpD,eAAe,EAAE,MAAM,CAAC;IACxB,YAAY,EAAE,YAAY,EAAE,CAAC;IAC7B,gBAAgB,EAAE,YAAY,EAAE,CAAC;IACjC,yCAAyC;IACzC,OAAO,EAAE,MAAM,CAAC;IAChB,wCAAwC;IACxC,cAAc,EAAE,MAAM,CAAC;CACxB;AA4BD,UAAU,YAAY;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;CACd;AAqDD,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY,EAAE,GAAG,WAAW,CA2ErF;AAED,eAAO,MAAM,aAAa,EAAE,SA4F3B,CAAC"}
@@ -0,0 +1,261 @@
1
+ /**
2
+ * Mneme Court (v1.18.0 — black sheep #3)
3
+ *
4
+ * The AI states a CLAIM. Mneme assembles the adversarial response: every
5
+ * commit / file / signal that contradicts the claim, ranked by strength.
6
+ * Returns a verdict — `motion_to_dismiss | hung_jury | verdict_for_plaintiff`
7
+ * — plus key witnesses (commit hashes) the AI can cite.
8
+ *
9
+ * No other MCP server has a built-in red-team for the AI's own outputs.
10
+ * This is the "second opinion" tool: the AI calls it BEFORE delivering a
11
+ * confident claim, lets Mneme assemble counter-evidence, then either
12
+ * stands by the claim (with citations of the cross-examination) or
13
+ * rewrites it.
14
+ *
15
+ * The verdict is a heuristic — not a court ruling. But the *evidence
16
+ * surface* is real: we walk the actual commit history for matches and
17
+ * counter-matches against the claim's keywords, and we score the
18
+ * strength of contradiction by recency × frequency × specificity.
19
+ */
20
+ import { spawnSync } from "node:child_process";
21
+ /** Tokenize a claim into salient lowercase tokens (≥4 chars, alpha-only). */
22
+ function tokenizeClaim(claim) {
23
+ return Array.from(new Set((claim.toLowerCase().match(/[a-z][a-z0-9_-]+/g) ?? []).filter((w) => w.length >= 4)));
24
+ }
25
+ /** Negation markers — if a commit message contains both a claim token and
26
+ * a negation marker, weight tips toward CONTRADICTION. Symmetric for
27
+ * the inverse case. */
28
+ const NEGATION_MARKERS = [
29
+ "revert",
30
+ "rollback",
31
+ "undo",
32
+ "remove",
33
+ "delete",
34
+ "deprecate",
35
+ "broken",
36
+ "regress",
37
+ "rollback",
38
+ "fix",
39
+ "hotfix",
40
+ ];
41
+ const SUPPORT_MARKERS = ["add", "introduce", "implement", "ship", "enable", "release"];
42
+ /** Read up to N most-recent commits via `git log --pretty`. Pure read,
43
+ * cwd-scoped, no shell. */
44
+ function readCommits(cwd, limit) {
45
+ const sep = "MNEMECOURT";
46
+ const recordSep = "MNEMECOURT";
47
+ const r = spawnSync("git", [
48
+ "log",
49
+ `--max-count=${limit}`,
50
+ `--pretty=format:%H${sep}%cI${sep}%s${sep}%b${recordSep}`,
51
+ ], { cwd, stdio: ["ignore", "pipe", "pipe"], encoding: "utf8" });
52
+ if (r.status !== 0)
53
+ return [];
54
+ const blob = r.stdout ?? "";
55
+ return blob
56
+ .split(recordSep)
57
+ .map((rec) => rec.trim())
58
+ .filter((rec) => rec.length > 0)
59
+ .map((rec) => {
60
+ const [hash, date, subject, ...rest] = rec.split(sep);
61
+ return {
62
+ hash: (hash ?? "").slice(0, 12),
63
+ date: (date ?? "").slice(0, 10),
64
+ subject: subject ?? "",
65
+ body: rest.join(sep),
66
+ };
67
+ });
68
+ }
69
+ function scoreCommitAgainstClaim(c, tokens) {
70
+ const text = `${c.subject}\n${c.body}`.toLowerCase();
71
+ const tokenHits = tokens.filter((t) => text.includes(t));
72
+ if (tokenHits.length === 0)
73
+ return { weight: 0, reason: "" };
74
+ const negationHit = NEGATION_MARKERS.some((m) => text.includes(m));
75
+ const supportHit = SUPPORT_MARKERS.some((m) => text.includes(m));
76
+ // Specificity: more matched tokens = stronger evidence (capped at 1).
77
+ const specificity = Math.min(1, tokenHits.length / Math.max(2, tokens.length / 2));
78
+ let weight = 0;
79
+ if (negationHit && !supportHit)
80
+ weight = -specificity;
81
+ else if (supportHit && !negationHit)
82
+ weight = +specificity;
83
+ else if (negationHit && supportHit)
84
+ weight = -specificity * 0.5; // mixed signals → mild contra
85
+ else
86
+ weight = +specificity * 0.3; // mention without verb → weak support
87
+ const reason = weight < 0
88
+ ? `cites ${tokenHits.slice(0, 3).join(", ")} alongside ${negationHit ? "revert/fix" : "deprecation"} markers`
89
+ : `mentions ${tokenHits.slice(0, 3).join(", ")} with ${supportHit ? "additive" : "neutral"} framing`;
90
+ return { weight, reason };
91
+ }
92
+ export function crossExamineClaim(claim, commits) {
93
+ const tokens = tokenizeClaim(claim);
94
+ if (tokens.length === 0) {
95
+ return {
96
+ claim,
97
+ verdict: "hung_jury",
98
+ evidenceBalance: 0,
99
+ witnessesFor: [],
100
+ witnessesAgainst: [],
101
+ summary: "Claim has no salient tokens to search against (too short or all stopwords).",
102
+ recommendation: "Restate the claim with more specific terms (file names, function names, or feature words).",
103
+ };
104
+ }
105
+ const witnessesFor = [];
106
+ const witnessesAgainst = [];
107
+ for (const c of commits) {
108
+ const { weight, reason } = scoreCommitAgainstClaim(c, tokens);
109
+ if (weight === 0)
110
+ continue;
111
+ const w = { commit: c.hash, date: c.date, subject: c.subject.slice(0, 100), weight, reason };
112
+ if (weight > 0)
113
+ witnessesFor.push(w);
114
+ else
115
+ witnessesAgainst.push(w);
116
+ }
117
+ // Recency boost — each witness is multiplied by a 0.5–1.0 recency factor
118
+ // (newest = 1.0, oldest among the set = 0.5).
119
+ const allDates = [...witnessesFor, ...witnessesAgainst]
120
+ .map((w) => Date.parse(w.date))
121
+ .filter((d) => Number.isFinite(d));
122
+ if (allDates.length > 1) {
123
+ const newest = Math.max(...allDates);
124
+ const oldest = Math.min(...allDates);
125
+ const span = Math.max(1, newest - oldest);
126
+ const boost = (w) => {
127
+ const d = Date.parse(w.date);
128
+ const r = Number.isFinite(d) ? 0.5 + 0.5 * ((d - oldest) / span) : 0.75;
129
+ return { ...w, weight: w.weight * r };
130
+ };
131
+ for (let i = 0; i < witnessesFor.length; i++)
132
+ witnessesFor[i] = boost(witnessesFor[i]);
133
+ for (let i = 0; i < witnessesAgainst.length; i++)
134
+ witnessesAgainst[i] = boost(witnessesAgainst[i]);
135
+ }
136
+ // Sort each side by absolute weight desc, take top 5.
137
+ witnessesFor.sort((a, b) => Math.abs(b.weight) - Math.abs(a.weight));
138
+ witnessesAgainst.sort((a, b) => Math.abs(b.weight) - Math.abs(a.weight));
139
+ const top5For = witnessesFor.slice(0, 5);
140
+ const top5Against = witnessesAgainst.slice(0, 5);
141
+ const sumFor = top5For.reduce((s, w) => s + w.weight, 0);
142
+ const sumAgainst = top5Against.reduce((s, w) => s + w.weight, 0); // negative
143
+ const balance = sumFor + sumAgainst;
144
+ const margin = Math.abs(balance);
145
+ let verdict;
146
+ let summary;
147
+ let recommendation;
148
+ if (margin < 0.3) {
149
+ verdict = "hung_jury";
150
+ summary = `Claim contested — ${top5For.length} witnesses for, ${top5Against.length} against, evidence roughly balanced.`;
151
+ recommendation =
152
+ "Qualify the claim ('the history is mixed') and present the strongest commit on each side.";
153
+ }
154
+ else if (balance > 0) {
155
+ verdict = "verdict_for_plaintiff";
156
+ summary = `Claim supported — ${top5For.length} witnesses (balance +${balance.toFixed(2)}). Mneme cannot mount a credible challenge.`;
157
+ recommendation = "Stand by the claim; cite the top witness commits as evidence.";
158
+ }
159
+ else {
160
+ verdict = "motion_to_dismiss";
161
+ summary = `Claim contradicted — ${top5Against.length} witnesses against (balance ${balance.toFixed(2)}). Recommend retract or qualify.`;
162
+ recommendation =
163
+ "Rewrite the claim to acknowledge the contradicting commits, or restrict its scope to the time window where it holds.";
164
+ }
165
+ return {
166
+ claim,
167
+ verdict,
168
+ evidenceBalance: Math.round(balance * 100) / 100,
169
+ witnessesFor: top5For,
170
+ witnessesAgainst: top5Against,
171
+ summary,
172
+ recommendation,
173
+ };
174
+ }
175
+ export const adversaryTool = {
176
+ name: "mneme.adversary.cross_examine",
177
+ category: "meta",
178
+ description: "Mneme Court — cross-examine an AI claim against repo history. The AI passes " +
179
+ "a CLAIM (e.g., 'X is dead code', 'Alice introduced the bug', 'feature Y was " +
180
+ "shipped in 2024'). Mneme assembles witnesses FOR and AGAINST by scanning " +
181
+ "commit messages + bodies, weighting each by recency × specificity × support/" +
182
+ "negation markers. Returns a verdict (verdict_for_plaintiff | hung_jury | " +
183
+ "motion_to_dismiss) + the top 5 witnesses on each side. Use WHEN you've drafted " +
184
+ "a confident assertion and want a second opinion before delivery.",
185
+ whenToUse: "You drafted a confident factual claim about the codebase and want Mneme to mount the strongest counter-evidence before delivery.",
186
+ triggers: ["cross-examine this claim", "is this true?", "second opinion on this claim", "adversarial check"],
187
+ inputSchema: {
188
+ type: "object",
189
+ properties: {
190
+ claim: { type: "string", description: "The claim, in plain English. e.g. 'src/legacy/db.ts is dead code'." },
191
+ lookback: {
192
+ type: "number",
193
+ description: "How many recent commits to scan as the evidence pool. Default 500. Max 5000.",
194
+ },
195
+ },
196
+ required: ["claim"],
197
+ },
198
+ outputSchema: {
199
+ type: "object",
200
+ properties: {
201
+ claim: { type: "string" },
202
+ verdict: { type: "string", enum: ["verdict_for_plaintiff", "hung_jury", "motion_to_dismiss"] },
203
+ evidenceBalance: { type: "number", description: "-1 (full contra) to +1 (full support)." },
204
+ witnessesFor: { type: "array", items: { type: "object" } },
205
+ witnessesAgainst: { type: "array", items: { type: "object" } },
206
+ summary: { type: "string" },
207
+ recommendation: { type: "string" },
208
+ },
209
+ },
210
+ examples: [
211
+ {
212
+ userQuery: "Cross-examine: 'src/legacy/auth.ts is dead code and safe to delete'",
213
+ args: { claim: "src/legacy/auth.ts is dead code and safe to delete", lookback: 500 },
214
+ expectedOutput: "Returns the verdict + up to 5 witnesses on each side. If recent commits still touch auth.ts, expect motion_to_dismiss + a recommendation to qualify the claim.",
215
+ },
216
+ {
217
+ userQuery: "Verify: 'we shipped multi-tenancy in Q3 2024'",
218
+ args: { claim: "we shipped multi-tenancy in Q3 2024", lookback: 1000 },
219
+ expectedOutput: "Returns verdict_for_plaintiff if commits in Jul-Sep 2024 mention 'multi-tenancy'+'add/ship', hung_jury if mixed, motion_to_dismiss if Q3 commits are absent or all reverts.",
220
+ },
221
+ ],
222
+ pitfalls: [
223
+ "Heuristic — scores commit message TEXT, not actual code. A correct claim with ambiguous commit messages may get hung_jury.",
224
+ "lookback=500 (default) caps the evidence pool — for old claims, raise it (max 5000).",
225
+ "Doesn't consult code, AST, or runtime — only commit history. Pair with mneme.memory.ask for code-grounded verification.",
226
+ ],
227
+ composeWith: ["mneme.memory.ask", "mneme.verify_claims", "mneme.grade.answer"],
228
+ handler: async (rt, args) => {
229
+ const claim = String(args["claim"] ?? "").trim();
230
+ const lookback = Math.min(5000, Math.max(50, typeof args["lookback"] === "number" ? args["lookback"] : 500));
231
+ if (!claim) {
232
+ return {
233
+ data: { error: "missing required argument: claim" },
234
+ wisdom: "Pass the AI's draft claim, e.g. mneme.adversary.cross_examine({ claim: 'X is Y' }).",
235
+ confidence: { level: "high" },
236
+ };
237
+ }
238
+ const commits = readCommits(rt.meta.rootPath, lookback);
239
+ const ruling = crossExamineClaim(claim, commits);
240
+ return {
241
+ data: ruling,
242
+ wisdom: `${ruling.verdict.toUpperCase()} — ${ruling.summary}`,
243
+ followUp: ruling.verdict === "motion_to_dismiss"
244
+ ? ["mneme.memory.ask", "mneme.verify_claims"]
245
+ : ["mneme.grade.answer"],
246
+ confidence: Math.abs(ruling.evidenceBalance) > 0.5
247
+ ? { level: "high" }
248
+ : Math.abs(ruling.evidenceBalance) > 0.2
249
+ ? { level: "medium" }
250
+ : { level: "low", notes: "Evidence too thin or balanced — verdict is best-effort." },
251
+ secondBrain: {
252
+ presentation: ruling.verdict === "motion_to_dismiss"
253
+ ? "DO NOT deliver the original claim verbatim. Quote the recommendation, then either retract or restate with the qualifications Mneme suggests."
254
+ : ruling.verdict === "hung_jury"
255
+ ? "Surface the disagreement to the user — present both sides with the strongest witness from each."
256
+ : "The claim is well-supported. Cite the top 1-2 witness commits to ground delivery.",
257
+ },
258
+ };
259
+ },
260
+ };
261
+ //# sourceMappingURL=_court.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"_court.js","sourceRoot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test.ts (structural) +
4
+ * smoke run; here we exercise the pure scoring function on synthetic
5
+ * commit pools to verify each verdict path.
6
+ */
7
+ export {};
8
+ //# sourceMappingURL=_court.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"_court.test.d.ts","sourceRoot":"","sources":["../../src/tools/_court.test.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
@@ -0,0 +1,111 @@
1
+ /**
2
+ * Mneme Court — unit tests for the cross-examination logic. The handler
3
+ * itself is integration-tested via _contract.test.ts (structural) +
4
+ * smoke run; here we exercise the pure scoring function on synthetic
5
+ * commit pools to verify each verdict path.
6
+ */
7
+ import { describe, expect, it } from "vitest";
8
+ import { crossExamineClaim } from "./_court.js";
9
+ function commit(over) {
10
+ return {
11
+ hash: "abcdef0",
12
+ date: "2026-05-01",
13
+ subject: "",
14
+ body: "",
15
+ ...over,
16
+ };
17
+ }
18
+ describe("crossExamineClaim — empty / trivial cases", () => {
19
+ it("returns hung_jury with helpful message when claim has no salient tokens", () => {
20
+ const r = crossExamineClaim("a b", []);
21
+ expect(r.verdict).toBe("hung_jury");
22
+ expect(r.witnessesFor).toHaveLength(0);
23
+ expect(r.witnessesAgainst).toHaveLength(0);
24
+ expect(r.summary).toMatch(/no salient tokens/i);
25
+ });
26
+ it("returns hung_jury when no commits match the claim tokens", () => {
27
+ const r = crossExamineClaim("multi-tenancy support", [
28
+ commit({ hash: "aaa1111", subject: "fix typo in README" }),
29
+ commit({ hash: "bbb2222", subject: "bump deps" }),
30
+ ]);
31
+ expect(r.verdict).toBe("hung_jury");
32
+ expect(r.witnessesFor).toHaveLength(0);
33
+ });
34
+ });
35
+ describe("crossExamineClaim — plaintiff verdict", () => {
36
+ it("rules verdict_for_plaintiff when supportive commits dominate", () => {
37
+ const r = crossExamineClaim("multi-tenancy authentication shipped", [
38
+ commit({ hash: "a111", date: "2024-07-15", subject: "feat: add multi-tenancy authentication core" }),
39
+ commit({ hash: "a222", date: "2024-08-02", subject: "ship multi-tenancy authentication routes" }),
40
+ commit({ hash: "a333", date: "2024-09-10", subject: "implement tenant authentication scoping" }),
41
+ ]);
42
+ expect(r.verdict).toBe("verdict_for_plaintiff");
43
+ expect(r.evidenceBalance).toBeGreaterThan(0);
44
+ expect(r.witnessesFor.length).toBeGreaterThan(0);
45
+ expect(r.witnessesAgainst).toHaveLength(0);
46
+ });
47
+ });
48
+ describe("crossExamineClaim — motion_to_dismiss", () => {
49
+ it("rules motion_to_dismiss when contradicting commits dominate", () => {
50
+ const r = crossExamineClaim("legacy authentication module is dead code", [
51
+ commit({ hash: "c111", date: "2026-04-01", subject: "fix authentication regression in legacy module" }),
52
+ commit({ hash: "c222", date: "2026-04-15", subject: "hotfix authentication legacy bug" }),
53
+ commit({ hash: "c333", date: "2026-04-20", subject: "revert authentication legacy refactor" }),
54
+ ]);
55
+ expect(r.verdict).toBe("motion_to_dismiss");
56
+ expect(r.evidenceBalance).toBeLessThan(0);
57
+ expect(r.witnessesAgainst.length).toBeGreaterThan(0);
58
+ expect(r.recommendation).toMatch(/retract|qualify|restrict/i);
59
+ });
60
+ });
61
+ describe("crossExamineClaim — hung jury", () => {
62
+ it("rules hung_jury when evidence is roughly balanced", () => {
63
+ const r = crossExamineClaim("authentication refactor success", [
64
+ commit({ hash: "h111", date: "2026-04-01", subject: "feat: add authentication refactor batch 1" }),
65
+ commit({ hash: "h222", date: "2026-04-08", subject: "ship authentication refactor batch 2" }),
66
+ commit({ hash: "h333", date: "2026-04-15", subject: "revert authentication refactor due to regression" }),
67
+ commit({ hash: "h444", date: "2026-04-22", subject: "rollback authentication refactor v2" }),
68
+ ]);
69
+ // Roughly balanced -> hung_jury OR motion_to_dismiss depending on
70
+ // recency boost; verify it's NOT a clear plaintiff victory.
71
+ expect(r.verdict).not.toBe("verdict_for_plaintiff");
72
+ expect(r.witnessesFor.length).toBeGreaterThan(0);
73
+ expect(r.witnessesAgainst.length).toBeGreaterThan(0);
74
+ });
75
+ });
76
+ describe("crossExamineClaim — recency weighting", () => {
77
+ it("weights recent contradictions more than old support", () => {
78
+ const r = crossExamineClaim("payment gateway is stable", [
79
+ commit({ hash: "old1", date: "2023-01-01", subject: "ship payment gateway stable release" }),
80
+ commit({ hash: "old2", date: "2023-02-01", subject: "implement payment gateway stability fixes" }),
81
+ commit({ hash: "new1", date: "2026-05-01", subject: "hotfix payment gateway stability regression" }),
82
+ commit({ hash: "new2", date: "2026-05-05", subject: "revert payment gateway stable upgrade" }),
83
+ ]);
84
+ // The recent contradictions get a stronger recency boost than the old
85
+ // support — verdict should NOT be verdict_for_plaintiff.
86
+ expect(r.verdict).not.toBe("verdict_for_plaintiff");
87
+ // Witnesses are surfaced with recency-boosted weights.
88
+ const newestAgainst = r.witnessesAgainst[0];
89
+ expect(newestAgainst).toBeDefined();
90
+ expect(newestAgainst.commit).toMatch(/^new/);
91
+ });
92
+ });
93
+ describe("crossExamineClaim — output shape", () => {
94
+ it("returns at most 5 witnesses on each side, sorted by absolute weight", () => {
95
+ const supportive = Array.from({ length: 10 }, (_, i) => commit({ hash: `sup${i}`, date: `2026-04-${String(i + 1).padStart(2, "0")}`, subject: `feat: add database indexing batch ${i}` }));
96
+ const r = crossExamineClaim("database indexing was added", supportive);
97
+ expect(r.witnessesFor.length).toBeLessThanOrEqual(5);
98
+ // Sorted by absolute weight desc.
99
+ for (let i = 1; i < r.witnessesFor.length; i++) {
100
+ expect(Math.abs(r.witnessesFor[i - 1].weight)).toBeGreaterThanOrEqual(Math.abs(r.witnessesFor[i].weight));
101
+ }
102
+ });
103
+ it("evidenceBalance is between -1 and +1", () => {
104
+ const r = crossExamineClaim("authentication added", [
105
+ commit({ hash: "x1", date: "2026-04-01", subject: "feat: add authentication module" }),
106
+ ]);
107
+ expect(r.evidenceBalance).toBeGreaterThanOrEqual(-1);
108
+ expect(r.evidenceBalance).toBeLessThanOrEqual(1);
109
+ });
110
+ });
111
+ //# sourceMappingURL=_court.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"_court.test.js","sourceR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