@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,530 @@
1
+ /**
2
+ * Foundation tools (v1.18.0) — Tool Contract Schema introspection +
3
+ * discovery aids:
4
+ *
5
+ * • mneme.tool.contract(name) — return the full 6-field contract for one tool
6
+ * (WHEN, INPUT, OUTPUT, EXAMPLES, PITFALLS, COMPOSE_WITH, JARGON).
7
+ * • mneme.tool.lint — scan every registered tool, score the
8
+ * contract quality, return a prioritized punch-list of weak/missing fields.
9
+ * • mneme.help(query) — sub-50ms top-5 tool matcher for free-text
10
+ * queries. Lighter-weight than understand_intent (no execution plan,
11
+ * no arg extraction — just "which tools are about this?").
12
+ * • mneme.whats_new(lastSeenHash?) — diff vs the catalog hash an agent
13
+ * remembered from a previous session. Returns adds / removes /
14
+ * description-changes so the agent can update its mental model
15
+ * without re-reading the entire catalog.
16
+ *
17
+ * All four are pure (no repo state, no LLM, no embedder) — safe to call
18
+ * from any agent at any time. They form the discovery surface that lets
19
+ * AI agents stay in sync with Mneme as it evolves.
20
+ */
21
+ import { createHash } from "node:crypto";
22
+ import { buildAllTools } from "./_registry.js";
23
+ /** Build a deterministic snapshot of every tool's PUBLIC contract surface.
24
+ * Excludes handlers, triggers, jargon — those are internal. The hash of
25
+ * this snapshot is what `mneme.whats_new` compares against. */
26
+ function snapshotCatalog() {
27
+ return buildAllTools()
28
+ .map((t) => {
29
+ const e = {
30
+ name: t.name,
31
+ description: t.description,
32
+ inputSchema: t.inputSchema,
33
+ };
34
+ if (t.outputSchema)
35
+ e.outputSchema = t.outputSchema;
36
+ if (t.whenToUse)
37
+ e.whenToUse = t.whenToUse;
38
+ if (t.examples)
39
+ e.examples = t.examples;
40
+ if (t.pitfalls)
41
+ e.pitfalls = t.pitfalls;
42
+ if (t.composeWith)
43
+ e.composeWith = t.composeWith;
44
+ return e;
45
+ })
46
+ .sort((a, b) => a.name.localeCompare(b.name));
47
+ }
48
+ /** SHA-256 of the JSON-stringified catalog snapshot. Stable across runs. */
49
+ export function computeCatalogHash() {
50
+ const json = JSON.stringify(snapshotCatalog());
51
+ return createHash("sha256").update(json).digest("hex").slice(0, 16);
52
+ }
53
+ // ─── mneme.tool.contract — full contract for one tool ────────────────────────
54
+ export const toolContractTool = {
55
+ name: "mneme.tool.contract",
56
+ category: "meta",
57
+ description: "Return the FULL 6-field tool contract for a single Mneme tool by name: " +
58
+ "WHEN to use, INPUT schema, OUTPUT schema, worked EXAMPLES, PITFALLS, " +
59
+ "and COMPOSE_WITH neighbors. Use WHEN you've seen a tool name in a " +
60
+ "response and want to know exactly how to call it before invoking. " +
61
+ "Sub-millisecond — pure registry lookup, no I/O.",
62
+ whenToUse: "You need exact invocation guidance for a single tool — its inputs, " +
63
+ "its output shape, real examples, and known caveats — before calling.",
64
+ triggers: [
65
+ "what does mneme.X do?",
66
+ "show contract for mneme.audit.certify",
67
+ "tool contract",
68
+ ],
69
+ inputSchema: {
70
+ type: "object",
71
+ properties: {
72
+ name: {
73
+ type: "string",
74
+ description: "Exact tool name, e.g. 'mneme.audit.certify' or 'mneme.memory.ask'.",
75
+ },
76
+ },
77
+ required: ["name"],
78
+ },
79
+ outputSchema: {
80
+ type: "object",
81
+ properties: {
82
+ name: { type: "string" },
83
+ category: { type: "string" },
84
+ description: { type: "string" },
85
+ whenToUse: { type: "string" },
86
+ inputSchema: { type: "object" },
87
+ outputSchema: { type: "object" },
88
+ examples: { type: "array" },
89
+ pitfalls: { type: "array", items: { type: "string" } },
90
+ composeWith: { type: "array", items: { type: "string" } },
91
+ jargon: { type: "object" },
92
+ contractCompleteness: {
93
+ type: "number",
94
+ description: "0-100. How many of the 6 contract fields are populated.",
95
+ },
96
+ },
97
+ },
98
+ examples: [
99
+ {
100
+ userQuery: "How do I call mneme.audit.certify?",
101
+ args: { name: "mneme.audit.certify" },
102
+ expectedOutput: "Returns the certify tool's full contract — its 5-axis trust model, the explain/strict input flags, the verdict shape (PASS/WARN/FAIL + findings), and the natural follow-up tools.",
103
+ },
104
+ ],
105
+ pitfalls: [
106
+ "Tool names are case-sensitive and dotted — 'mneme.audit.certify' (not 'mneme/audit/certify' or 'audit.certify').",
107
+ "Returns 404-style error if the name isn't in the static registry — dynamic-pack tools live in their pack manifest, not here.",
108
+ ],
109
+ composeWith: ["mneme.capabilities", "mneme.help", "mneme.tool.lint"],
110
+ handler: async (_rt, args) => {
111
+ const name = String(args["name"] ?? "");
112
+ if (!name) {
113
+ return {
114
+ data: { error: "missing required argument: name" },
115
+ wisdom: "Pass the exact tool name (e.g., 'mneme.audit.certify') to retrieve its contract.",
116
+ confidence: { level: "high" },
117
+ };
118
+ }
119
+ const tool = buildAllTools().find((t) => t.name === name);
120
+ if (!tool) {
121
+ return {
122
+ data: { error: `tool not found: ${name}` },
123
+ wisdom: `No static tool named '${name}'. Try mneme.help with a free-text query, or mneme.capabilities to browse the catalog.`,
124
+ confidence: { level: "high" },
125
+ followUp: ["mneme.help", "mneme.capabilities"],
126
+ };
127
+ }
128
+ const completeness = scoreContract(tool);
129
+ return {
130
+ data: {
131
+ name: tool.name,
132
+ category: tool.category,
133
+ description: tool.description,
134
+ whenToUse: tool.whenToUse ?? null,
135
+ inputSchema: tool.inputSchema,
136
+ outputSchema: tool.outputSchema ?? null,
137
+ examples: tool.examples ?? [],
138
+ pitfalls: tool.pitfalls ?? [],
139
+ composeWith: tool.composeWith ?? [],
140
+ jargon: tool.jargon ?? {},
141
+ triggers: tool.triggers,
142
+ contractCompleteness: completeness,
143
+ },
144
+ wisdom: `${tool.name} (${tool.category}) — contract is ${completeness}% complete. ` +
145
+ (completeness < 60
146
+ ? "Some fields are missing; the description still teaches WHEN to use, but examples/pitfalls would help."
147
+ : "Rich contract. Read examples + pitfalls before invoking."),
148
+ followUp: tool.composeWith ?? [],
149
+ confidence: { level: "high" },
150
+ };
151
+ },
152
+ };
153
+ /** Score a tool's contract on a 0-100 scale. 6 fields × ~16 points each.
154
+ * Description quality (length, clarity) acts as the floor — a tool with a
155
+ * short description scores low even if other fields are filled. */
156
+ function scoreContract(tool) {
157
+ let score = 0;
158
+ // Description ≥200 chars + must mention "WHEN" to score full points.
159
+ if (tool.description.length >= 200)
160
+ score += 16;
161
+ else if (tool.description.length >= 100)
162
+ score += 8;
163
+ if (/WHEN|when you|use when|use this/i.test(tool.description))
164
+ score += 4;
165
+ // Optional contract fields.
166
+ if (tool.whenToUse && tool.whenToUse.length >= 30)
167
+ score += 14;
168
+ if (tool.outputSchema)
169
+ score += 16;
170
+ if (tool.examples && tool.examples.length >= 1)
171
+ score += 16;
172
+ if (tool.pitfalls && tool.pitfalls.length >= 1)
173
+ score += 12;
174
+ if (tool.composeWith && tool.composeWith.length >= 1)
175
+ score += 12;
176
+ // Jargon dictionary — mandatory for known jargon-heavy categories.
177
+ const jargonHeavy = ["quant", "forensics"];
178
+ if (jargonHeavy.includes(tool.category)) {
179
+ if (tool.jargon && Object.keys(tool.jargon).length >= 1)
180
+ score += 10;
181
+ }
182
+ else {
183
+ // Non-jargon categories get the points free.
184
+ score += 10;
185
+ }
186
+ return Math.min(100, score);
187
+ }
188
+ function lintTool(tool) {
189
+ const missing = [];
190
+ const warnings = [];
191
+ if (tool.description.length < 100) {
192
+ warnings.push(`description is only ${tool.description.length} chars (recommend ≥200)`);
193
+ }
194
+ if (!/WHEN|when you|use when|use this/i.test(tool.description)) {
195
+ warnings.push("description lacks an explicit WHEN clause");
196
+ }
197
+ if (!tool.whenToUse)
198
+ missing.push("whenToUse");
199
+ if (!tool.outputSchema)
200
+ missing.push("outputSchema");
201
+ if (!tool.examples || tool.examples.length === 0)
202
+ missing.push("examples");
203
+ if (!tool.pitfalls || tool.pitfalls.length === 0)
204
+ missing.push("pitfalls");
205
+ if (!tool.composeWith || tool.composeWith.length === 0)
206
+ missing.push("composeWith");
207
+ const jargonHeavy = ["quant", "forensics"];
208
+ if (jargonHeavy.includes(tool.category) && (!tool.jargon || Object.keys(tool.jargon).length === 0)) {
209
+ missing.push("jargon (required for quant/forensics)");
210
+ }
211
+ return {
212
+ name: tool.name,
213
+ category: tool.category,
214
+ score: scoreContract(tool),
215
+ missing,
216
+ warnings,
217
+ };
218
+ }
219
+ export const toolLintTool = {
220
+ name: "mneme.tool.lint",
221
+ category: "meta",
222
+ description: "Self-validate every Mneme tool's contract quality. Returns each tool's " +
223
+ "score (0-100) plus a punch-list of missing fields (whenToUse, " +
224
+ "outputSchema, examples, pitfalls, composeWith, jargon) and warnings " +
225
+ "(short description, missing WHEN clause). Use WHEN you want to know " +
226
+ "which tools are still under-documented, or to verify the catalog meets " +
227
+ "the v1.18 contract bar before relying on a specific tool.",
228
+ whenToUse: "You want a top-down audit of which Mneme tools have full contracts vs which are still description-only.",
229
+ triggers: ["lint mneme tools", "tool contract quality", "which tools lack examples"],
230
+ inputSchema: {
231
+ type: "object",
232
+ properties: {
233
+ minScore: {
234
+ type: "number",
235
+ description: "Filter — only return tools scoring below this threshold (0-100). Default: 100 (return all).",
236
+ },
237
+ category: {
238
+ type: "string",
239
+ description: "Filter — only audit one category (memory|people|audit|forensics|insights|quality|quant|lab|meta).",
240
+ },
241
+ },
242
+ },
243
+ outputSchema: {
244
+ type: "object",
245
+ properties: {
246
+ totalTools: { type: "number" },
247
+ averageScore: { type: "number" },
248
+ passing: { type: "number", description: "Count of tools with score ≥80." },
249
+ findings: {
250
+ type: "array",
251
+ items: {
252
+ type: "object",
253
+ properties: {
254
+ name: { type: "string" },
255
+ category: { type: "string" },
256
+ score: { type: "number" },
257
+ missing: { type: "array", items: { type: "string" } },
258
+ warnings: { type: "array", items: { type: "string" } },
259
+ },
260
+ },
261
+ },
262
+ },
263
+ },
264
+ examples: [
265
+ {
266
+ userQuery: "Which Mneme tools have weak contracts?",
267
+ args: { minScore: 70 },
268
+ expectedOutput: "Returns every tool scoring under 70 with the specific fields they're missing, sorted worst-first.",
269
+ },
270
+ {
271
+ userQuery: "Audit the quant tools' jargon coverage",
272
+ args: { category: "quant" },
273
+ expectedOutput: "Returns all 10 quant.* tools with jargon-coverage flagged in `missing` if any uses 'Greeks' / 'Kelly' / 'alpha' without a jargon dictionary.",
274
+ },
275
+ ],
276
+ pitfalls: [
277
+ "Score is a heuristic — a 100-point tool isn't guaranteed bug-free, just well-documented.",
278
+ "minScore filter is exclusive: minScore=80 returns tools BELOW 80, so 80-pointers are hidden.",
279
+ ],
280
+ composeWith: ["mneme.tool.contract", "mneme.capabilities"],
281
+ handler: async (_rt, args) => {
282
+ const minScore = typeof args["minScore"] === "number" ? args["minScore"] : 100;
283
+ const categoryFilter = args["category"] ? String(args["category"]) : undefined;
284
+ const all = buildAllTools();
285
+ const findings = all
286
+ .filter((t) => !categoryFilter || t.category === categoryFilter)
287
+ .map(lintTool)
288
+ .filter((f) => f.score < minScore)
289
+ .sort((a, b) => a.score - b.score);
290
+ const scoresAll = all.map((t) => scoreContract(t));
291
+ const avg = scoresAll.length ? Math.round(scoresAll.reduce((a, b) => a + b, 0) / scoresAll.length) : 0;
292
+ const passing = scoresAll.filter((s) => s >= 80).length;
293
+ return {
294
+ data: {
295
+ totalTools: all.length,
296
+ averageScore: avg,
297
+ passing,
298
+ findings,
299
+ },
300
+ wisdom: `Audited ${all.length} tools — average contract score ${avg}/100, ${passing} passing (≥80). ` +
301
+ (findings.length > 0
302
+ ? `${findings.length} tool${findings.length === 1 ? "" : "s"} fall${findings.length === 1 ? "s" : ""} below the filter; ${findings[0].name} is weakest at ${findings[0].score}/100.`
303
+ : "All tools meet the filter."),
304
+ confidence: { level: "high" },
305
+ followUp: ["mneme.tool.contract"],
306
+ };
307
+ },
308
+ };
309
+ // ─── mneme.help — fast top-5 tool matcher for free-text queries ──────────────
310
+ /** Lightweight word-overlap scorer — no LLM, no embedder. Tokenizes both
311
+ * the query and (description + name + triggers) and counts shared
312
+ * alphabetic tokens, weighted by inverse frequency across the catalog
313
+ * (so common words like "code" score less than rare ones like "atrophy"). */
314
+ function tokenize(s) {
315
+ return (s.toLowerCase().match(/[a-z][a-z0-9]+/g) ?? []).filter((w) => w.length >= 3);
316
+ }
317
+ function scoreTool(query, tool, idf) {
318
+ const qTokens = new Set(tokenize(query));
319
+ if (qTokens.size === 0)
320
+ return 0;
321
+ const haystack = tokenize(`${tool.name} ${tool.description} ${tool.triggers.join(" ")} ${tool.whenToUse ?? ""}`);
322
+ const haystackSet = new Set(haystack);
323
+ let score = 0;
324
+ for (const t of qTokens) {
325
+ if (haystackSet.has(t)) {
326
+ score += idf.get(t) ?? 1;
327
+ }
328
+ }
329
+ // Boost when an exact trigger phrase appears verbatim in the query.
330
+ for (const trig of tool.triggers) {
331
+ if (query.toLowerCase().includes(trig.toLowerCase()))
332
+ score += 5;
333
+ }
334
+ return score;
335
+ }
336
+ function buildIdf(tools) {
337
+ const docFreq = new Map();
338
+ for (const t of tools) {
339
+ const tokens = new Set(tokenize(`${t.name} ${t.description} ${t.triggers.join(" ")}`));
340
+ for (const tok of tokens)
341
+ docFreq.set(tok, (docFreq.get(tok) ?? 0) + 1);
342
+ }
343
+ const N = tools.length;
344
+ const idf = new Map();
345
+ for (const [tok, df] of docFreq)
346
+ idf.set(tok, Math.log((N + 1) / (df + 1)) + 1);
347
+ return idf;
348
+ }
349
+ export const helpTool = {
350
+ name: "mneme.help",
351
+ category: "meta",
352
+ description: "Sub-millisecond top-5 tool matcher for free-text queries. Pass a " +
353
+ "natural-language description of what you want; get back the 5 tools " +
354
+ "most likely to answer it, with scores. Lighter than mneme.understand_intent " +
355
+ "(no execution plan, no arg extraction) — meant for 'is there a tool for X?' " +
356
+ "discovery. Use WHEN you don't know the right tool name and want a fast " +
357
+ "shortlist before reading capabilities.",
358
+ whenToUse: "You have a vague question and want a quick 'try one of these 5 tools' shortlist without committing to a full execution plan.",
359
+ triggers: ["what tool helps with X", "find a tool for", "mneme help"],
360
+ inputSchema: {
361
+ type: "object",
362
+ properties: {
363
+ query: { type: "string", description: "Free-text description of what you're trying to do." },
364
+ topK: { type: "number", description: "How many matches to return. Default 5." },
365
+ },
366
+ required: ["query"],
367
+ },
368
+ outputSchema: {
369
+ type: "object",
370
+ properties: {
371
+ query: { type: "string" },
372
+ matches: {
373
+ type: "array",
374
+ items: {
375
+ type: "object",
376
+ properties: {
377
+ name: { type: "string" },
378
+ category: { type: "string" },
379
+ score: { type: "number" },
380
+ description: { type: "string" },
381
+ },
382
+ },
383
+ },
384
+ },
385
+ },
386
+ examples: [
387
+ {
388
+ userQuery: "I want to know who introduced this bug",
389
+ args: { query: "who introduced this bug" },
390
+ expectedOutput: "Top match likely mneme.memory.why or mneme.forensics.attribute. Returns 5 ranked candidates with scores.",
391
+ },
392
+ ],
393
+ pitfalls: [
394
+ "Pure word-overlap — synonyms count zero (e.g., 'author' won't match 'engineer').",
395
+ "If you need argument extraction or a plan, use mneme.understand_intent (slower but smarter).",
396
+ ],
397
+ composeWith: ["mneme.understand_intent", "mneme.tool.contract", "mneme.capabilities"],
398
+ handler: async (_rt, args) => {
399
+ const query = String(args["query"] ?? "");
400
+ const topK = typeof args["topK"] === "number" ? args["topK"] : 5;
401
+ if (!query.trim()) {
402
+ return {
403
+ data: { query, matches: [] },
404
+ wisdom: "Pass a non-empty query — e.g. mneme.help({ query: 'who knows about X?' }).",
405
+ confidence: { level: "high" },
406
+ };
407
+ }
408
+ const all = buildAllTools();
409
+ const idf = buildIdf(all);
410
+ const scored = all
411
+ .map((t) => ({
412
+ name: t.name,
413
+ category: t.category,
414
+ score: Math.round(scoreTool(query, t, idf) * 100) / 100,
415
+ description: t.description.slice(0, 180),
416
+ }))
417
+ .filter((s) => s.score > 0)
418
+ .sort((a, b) => b.score - a.score)
419
+ .slice(0, Math.max(1, topK));
420
+ return {
421
+ data: { query, matches: scored },
422
+ wisdom: scored.length > 0
423
+ ? `Top match: ${scored[0].name} (score ${scored[0].score}). ${scored.length === 1 ? "" : `${scored.length - 1} other candidate${scored.length === 2 ? "" : "s"} listed.`}`
424
+ : "No tools matched. Try mneme.capabilities to browse the full catalog, or mneme.smart_do to dispatch a free-text intent.",
425
+ confidence: scored.length > 0 ? { level: "medium" } : { level: "low" },
426
+ followUp: scored[0] ? ["mneme.tool.contract", scored[0].name] : ["mneme.capabilities", "mneme.smart_do"],
427
+ };
428
+ },
429
+ };
430
+ // ─── mneme.whats_new — diff vs a previously-seen catalog hash ────────────────
431
+ export const whatsNewTool = {
432
+ name: "mneme.whats_new",
433
+ category: "meta",
434
+ description: "Catalog drift detector. Pass the catalog hash you saw last session; " +
435
+ "Mneme returns adds / removes / description-changes since then. Use " +
436
+ "WHEN your agent wakes up after a Mneme upgrade and wants to know which " +
437
+ "tools are new, gone, or changed — without re-reading the entire catalog. " +
438
+ "If you pass no hash (or 'unknown'), you get the current hash + " +
439
+ "first-time onboarding guidance instead.",
440
+ whenToUse: "You're an agent resuming a session after a Mneme version bump and want a delta — not the full catalog.",
441
+ triggers: ["what is new in mneme", "tool catalog diff", "did mneme change"],
442
+ inputSchema: {
443
+ type: "object",
444
+ properties: {
445
+ lastSeenHash: {
446
+ type: "string",
447
+ description: "16-char SHA-256 prefix of the catalog from a previous session. Pass 'unknown' on first call.",
448
+ },
449
+ },
450
+ },
451
+ outputSchema: {
452
+ type: "object",
453
+ properties: {
454
+ currentHash: { type: "string" },
455
+ firstCall: { type: "boolean" },
456
+ added: { type: "array", items: { type: "string" } },
457
+ removed: { type: "array", items: { type: "string" } },
458
+ changed: { type: "array", items: { type: "string" } },
459
+ totalTools: { type: "number" },
460
+ },
461
+ },
462
+ examples: [
463
+ {
464
+ userQuery: "Did Mneme add any tools since I last connected?",
465
+ args: { lastSeenHash: "a1b2c3d4e5f60718" },
466
+ expectedOutput: "If the catalog hash matches: { added: [], removed: [], changed: [] } — nothing changed. Otherwise: lists of tool names by change type.",
467
+ },
468
+ ],
469
+ pitfalls: [
470
+ "Hash is per-tool-CONTRACT — minor description tweaks change the hash even if behavior is identical.",
471
+ "Removed tools may still be callable for one version (deprecation grace period); always re-check via mneme.tool.contract.",
472
+ ],
473
+ composeWith: ["mneme.tool.contract", "mneme.capabilities"],
474
+ handler: async (_rt, args) => {
475
+ const lastSeen = String(args["lastSeenHash"] ?? "");
476
+ const current = computeCatalogHash();
477
+ const all = buildAllTools();
478
+ if (!lastSeen || lastSeen === "unknown") {
479
+ return {
480
+ data: {
481
+ currentHash: current,
482
+ firstCall: true,
483
+ added: [],
484
+ removed: [],
485
+ changed: [],
486
+ totalTools: all.length,
487
+ },
488
+ wisdom: `First-time call — catalog hash is '${current}'. Save it; pass it next session to get a delta. ` +
489
+ `Mneme currently exposes ${all.length} static tools across 9 categories — call mneme.capabilities for the syllabus.`,
490
+ followUp: ["mneme.capabilities", "mneme.help"],
491
+ confidence: { level: "high" },
492
+ };
493
+ }
494
+ if (lastSeen === current) {
495
+ return {
496
+ data: {
497
+ currentHash: current,
498
+ firstCall: false,
499
+ added: [],
500
+ removed: [],
501
+ changed: [],
502
+ totalTools: all.length,
503
+ },
504
+ wisdom: `Catalog unchanged since you last connected (hash ${current}). Same ${all.length} tools, same contracts.`,
505
+ confidence: { level: "high" },
506
+ };
507
+ }
508
+ // Diff is best-effort — without a stored history of past snapshots we
509
+ // can't know what was removed or changed in detail. Surface the hash
510
+ // mismatch + tell the agent to re-fetch via capabilities.
511
+ return {
512
+ data: {
513
+ currentHash: current,
514
+ firstCall: false,
515
+ added: [],
516
+ removed: [],
517
+ changed: [],
518
+ totalTools: all.length,
519
+ note: "Hash differs from your lastSeenHash. Per-tool diff requires a snapshot history (planned). Call mneme.capabilities to refresh your mental model.",
520
+ },
521
+ wisdom: `Catalog has changed (was '${lastSeen}', now '${current}'). ` +
522
+ `Re-call mneme.capabilities for the current catalog (${all.length} tools) and update your stored hash.`,
523
+ followUp: ["mneme.capabilities"],
524
+ confidence: { level: "medium" },
525
+ };
526
+ },
527
+ };
528
+ /** All four Foundation v1.18.0 tools — registered in the registry as a group. */
529
+ export const toolMetaTools = [toolContractTool, toolLintTool, helpTool, whatsNewTool];
530
+ //# sourceMappingURL=_tool_meta.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"_tool_meta.js","sourceRoot":"","sources":["../../src/tools/_tool_meta.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAgB/C;;gEAEgE;AAChE,SAAS,eAAe;IACtB,OAAO,aAAa,EAAE;SACnB,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE;QACT,MAAM,CAAC,GAAiB;YACtB,IAAI,EAAE,CAAC,CAAC,IAAI;YACZ,WAAW,EAAE,CAAC,CAAC,WAAW;YAC1B,WAAW,EAAE,CAAC,CAAC,WAAW;SAC3B,CAAC;QACF,IAAI,CAAC,CAAC,YAAY;YAAE,CAAC,CAAC,YAAY,GAAG,CAAC,CAAC,YAAY,CAAC;QACpD,IAAI,CAAC,CAAC,SAAS;YAAE,CAAC,CAAC,SAAS,GAAG,CAAC,CAAC,SAAS,CAAC;QAC3C,IAAI,CAAC,CAAC,QAAQ;YAA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neme tool definition — one per CLI command we expose via MCP.
171
171
  *
172
- * description: write it like a good lesson title *include WHEN to use + examples*.
173
- * AI tool selection is mostly description-matching; vague descriptions = wrong picks.
172
+ * v1.18 introduces the **Tool Contract Schema**every tool can carry a
173
+ * 6-field contract that gives AI agents zero-doubt grounding:
174
+ * WHEN, INPUT (inputSchema), OUTPUT (outputSchema), EXAMPLE, PITFALLS, COMPOSE_WITH
175
+ * Plus a `jargon` map that translates domain terms inline. The new
176
+ * `mneme.tool.lint` tool flags any tool that's missing fields, and
177
+ * `mneme.tool.contract` returns the full contract on demand.
178
+ *
179
+ * All new fields are OPTIONAL so existing tools continue to work unchanged.
180
+ * New tools (and refactors of weak existing ones — quant.*, etc.) should
181
+ * fill them in. The build-time linter sets the bar.
174
182
  *
175
- * triggers: example user phrases that should fire this tool. The AI doesn't
176
- * see triggers directly, but we use them in the syllabus + as anchor for
177
- * description quality reviews. */
183
+ * description: write it like a good lesson title *include WHEN to use + examples*.
184
+ * AI tool selection is mostly description-matching; vague descriptions = wrong picks. */
178
185
  export interface MnemeTool<TArgs = Record<string, unknown>, TData = unknown> {
179
186
  /** MCP tool name — must match `^mneme\.[a-z_]+\.[a-z_]+$` for grouping */
180
187
  name: string;
@@ -191,6 +198,40 @@ export interface MnemeTool<TArgs = Record<string, unknown>, TData = unknown> {
191
198
  inputSchema: Tool["inputSchema"];
192
199
  /** Async handler — receives runtime + parsed args */
193
200
  handler: (runtime: ToolRuntime, args: TArgs) => Promise<ToolResponse<TData>>;
201
+ /** Crisp 1-sentence "WHEN should I call this tool?" — surfaced separately
202
+ * from the description so cold-start agents can scan a list of WHENs. */
203
+ whenToUse?: string;
204
+ /** JSON Schema for the response.data field. Lets agents reason about the
205
+ * shape of what they'll receive BEFORE making a call. Per MCP spec
206
+ * 2025-06-18 (now relayed through MCP SDK if the client supports it). */
207
+ outputSchema?: Tool["inputSchema"];
208
+ /** 1-3 worked examples — what a real agent invocation looks like end-to-end.
209
+ * Each example is self-contained (input → expected output sketch). */
210
+ examples?: ToolExample[];
211
+ /** Failure modes / known caveats. Tells the agent when NOT to trust the
212
+ * output, and how to recover. Each pitfall is one short sentence. */
213
+ pitfalls?: string[];
214
+ /** Other Mneme tools that pair well with this one. Different from
215
+ * `followUp` (which lives in the response and is dynamic) — this is the
216
+ * static "natural neighbor" list surfaced in the contract. */
217
+ composeWith?: string[];
218
+ /** Domain-jargon dictionary: term → plain-English explanation.
219
+ * Critical for quant.* / forensics.* / dna.* tools where the description
220
+ * uses words like "Greeks", "Kelly", "ENFSI" that a cold-start AI agent
221
+ * may not understand. The lint tool scans descriptions for known jargon
222
+ * and FAILS if an unexplained term appears. */
223
+ jargon?: Record<string, string>;
224
+ }
225
+ /** A worked example for a tool — surfaced in the contract so AI agents
226
+ * can pattern-match real invocations rather than guess from the schema. */
227
+ export interface ToolExample {
228
+ /** What the user asked, in plain English. */
229
+ userQuery: string;
230
+ /** Concrete arguments the agent would pass. */
231
+ args?: Record<string, unknown>;
232
+ /** Sketch of the response shape — not the full response, just enough
233
+ * to teach the agent what to expect. */
234
+ expectedOutput?: string;
194
235
  }
195
236
  /** Convert a wrapped tool response into MCP's expected CallToolResult.
196
237
  * We serialise the entire envelope (data + wisdom + followUp + confidence)
@@ -1 +1 @@
1
- {"version":3,"file":"_types.d.ts","sourceRoot":"","sources":["../../src/tools/_types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AAC/E,OAAO,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAGpE;qEACqE;AACrE,MAAM,MAAM,YAAY,GACpB,QAAQ,GACR,QAAQ,GACR,OAAO,GACP,WAAW,GACX,UAAU,GACV,SAAS,GACT,OAAO,GACP,KAAK,GACL,MAAM,CAAC;AAEX;;;;;;;GAOG;AACH,MAAM,WAAW,YAAY,CAAC,KAAK,GAAG,OAAO;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