@hiveai/mcp 0.2.4 → 0.2.6

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/server.js CHANGED
@@ -124,12 +124,13 @@ import { existsSync as existsSync4 } from "fs";
124
124
  import path3 from "path";
125
125
  import {
126
126
  buildFrontmatter,
127
+ loadMemoriesFromDir as loadMemoriesFromDir2,
127
128
  memoryFilePath,
128
129
  serializeMemory
129
130
  } from "@hiveai/core";
130
131
  import { z as z4 } from "zod";
131
132
  var MemSaveInputSchema = {
132
- type: z4.enum(["convention", "decision", "gotcha", "architecture", "glossary"]).describe("Kind of memory being saved"),
133
+ type: z4.enum(["convention", "decision", "gotcha", "architecture", "glossary", "attempt"]).describe("Kind of memory being saved. Use 'attempt' for failed approaches (auto-validated)."),
133
134
  slug: z4.string().min(1).describe("Short human-readable identifier \u2014 becomes part of the filename"),
134
135
  body: z4.string().describe("Markdown body of the memory"),
135
136
  scope: z4.enum(["personal", "team", "module"]).default("personal").describe("Visibility scope: personal | team | module"),
@@ -169,11 +170,24 @@ async function memSave(input, ctx) {
169
170
  if (existsSync4(file)) {
170
171
  throw new Error(`Memory already exists at ${file}`);
171
172
  }
173
+ let warning;
174
+ if (existsSync4(ctx.paths.memoriesDir)) {
175
+ const existing = await loadMemoriesFromDir2(ctx.paths.memoriesDir);
176
+ const slugTokens = input.slug.toLowerCase().split(/[-_\s]+/).filter(Boolean);
177
+ const similar = existing.filter(({ memory }) => {
178
+ const id = memory.frontmatter.id.toLowerCase();
179
+ return slugTokens.length >= 2 && slugTokens.filter((t) => id.includes(t)).length >= Math.ceil(slugTokens.length * 0.6);
180
+ });
181
+ if (similar.length > 0) {
182
+ warning = `Possible duplicate detected. Similar memories: ${similar.map((m) => m.memory.frontmatter.id).join(", ")}. Consider updating one of these instead.`;
183
+ }
184
+ }
172
185
  await writeFile2(file, serializeMemory({ frontmatter, body: input.body }), "utf8");
173
186
  return {
174
187
  id: frontmatter.id,
175
188
  scope: frontmatter.scope,
176
- file_path: file
189
+ file_path: file,
190
+ ...warning ? { warning } : {}
177
191
  };
178
192
  }
179
193
 
@@ -184,7 +198,8 @@ import {
184
198
  extractSnippet,
185
199
  getUsage,
186
200
  literalMatchesAllTokens,
187
- loadMemoriesFromDir as loadMemoriesFromDir2,
201
+ literalMatchesAnyToken,
202
+ loadMemoriesFromDir as loadMemoriesFromDir3,
188
203
  loadUsageIndex,
189
204
  pickSnippetNeedle,
190
205
  tokenizeQuery,
@@ -194,7 +209,7 @@ import { z as z5 } from "zod";
194
209
  var MemSearchInputSchema = {
195
210
  query: z5.string().describe("Substring matched against id, tags, and body"),
196
211
  scope: z5.enum(["personal", "team", "module"]).optional().describe("Restrict results to a single scope"),
197
- type: z5.enum(["convention", "decision", "gotcha", "architecture", "glossary"]).optional().describe("Restrict results to a memory type"),
212
+ type: z5.enum(["convention", "decision", "gotcha", "architecture", "glossary", "attempt"]).optional().describe("Restrict results to a memory type"),
198
213
  module: z5.string().optional().describe("Restrict results to a module"),
199
214
  status: z5.enum(["draft", "proposed", "validated", "deprecated", "stale", "rejected"]).optional().describe("Filter by a single status. Omit to return all statuses."),
200
215
  exclude_rejected: z5.boolean().default(false).describe("When true, exclude memories with status=rejected from results."),
@@ -209,7 +224,7 @@ async function memSearch(input, ctx) {
209
224
  if (!existsSync5(ctx.paths.memoriesDir)) {
210
225
  return { matches: [], total: 0, mode: input.semantic ? "literal_fallback" : "literal" };
211
226
  }
212
- const all = await loadMemoriesFromDir2(ctx.paths.memoriesDir);
227
+ const all = await loadMemoriesFromDir3(ctx.paths.memoriesDir);
213
228
  const filtered = all.filter(({ memory }) => passesFilters(memory.frontmatter, input));
214
229
  const usage = await loadUsageIndex(ctx.paths);
215
230
  let result;
@@ -245,13 +260,23 @@ function passesFilters(fm, input) {
245
260
  }
246
261
  function buildLiteralResult(input, filtered, usage) {
247
262
  const tokens = tokenizeQuery(input.query);
248
- const matched = filtered.filter(({ memory }) => literalMatchesAllTokens(memory, tokens));
249
263
  const snippetNeedle = pickSnippetNeedle(input.query);
250
- const top = matched.slice(0, input.limit);
264
+ let andMatched = filtered.filter(({ memory }) => literalMatchesAllTokens(memory, tokens));
265
+ if (andMatched.length > 0) {
266
+ const top2 = andMatched.slice(0, input.limit);
267
+ return {
268
+ matches: top2.map((loaded) => toHit(loaded, snippetNeedle, usage)),
269
+ total: andMatched.length,
270
+ mode: "literal"
271
+ };
272
+ }
273
+ const orMatched = filtered.filter(({ memory }) => literalMatchesAnyToken(memory, tokens));
274
+ const top = orMatched.slice(0, input.limit);
251
275
  return {
252
276
  matches: top.map((loaded) => toHit(loaded, snippetNeedle, usage)),
253
- total: matched.length,
254
- mode: "literal"
277
+ total: orMatched.length,
278
+ mode: "literal",
279
+ notice: `No exact match for all tokens. Showing partial matches (OR fallback) \u2014 ${orMatched.length} result${orMatched.length === 1 ? "" : "s"}.`
255
280
  };
256
281
  }
257
282
  async function trySemanticSearch(ctx, input, filtered, usage) {
@@ -315,7 +340,7 @@ function toHit(loaded, needle, usage) {
315
340
  import { writeFile as writeFile3 } from "fs/promises";
316
341
  import { existsSync as existsSync6 } from "fs";
317
342
  import {
318
- loadMemoriesFromDir as loadMemoriesFromDir3,
343
+ loadMemoriesFromDir as loadMemoriesFromDir4,
319
344
  serializeMemory as serializeMemory2,
320
345
  verifyAnchor
321
346
  } from "@hiveai/core";
@@ -331,7 +356,7 @@ async function memVerify(input, ctx) {
331
356
  summary: { checked: 0, fresh: 0, stale: 0, anchorless_skipped: 0, updated: 0 }
332
357
  };
333
358
  }
334
- const all = await loadMemoriesFromDir3(ctx.paths.memoriesDir);
359
+ const all = await loadMemoriesFromDir4(ctx.paths.memoriesDir);
335
360
  const targets = input.id ? all.filter((m) => m.memory.frontmatter.id === input.id) : all;
336
361
  const results = [];
337
362
  let fresh = 0;
@@ -410,7 +435,7 @@ function applyVerification(mem, result) {
410
435
  import { writeFile as writeFile4 } from "fs/promises";
411
436
  import { existsSync as existsSync7 } from "fs";
412
437
  import {
413
- loadMemoriesFromDir as loadMemoriesFromDir4,
438
+ loadMemoriesFromDir as loadMemoriesFromDir5,
414
439
  loadUsageIndex as loadUsageIndex2,
415
440
  recordRejection,
416
441
  saveUsageIndex,
@@ -425,7 +450,7 @@ async function memReject(input, ctx) {
425
450
  if (!existsSync7(ctx.paths.memoriesDir)) {
426
451
  throw new Error(`No .ai/memories at ${ctx.paths.root}.`);
427
452
  }
428
- const memories = await loadMemoriesFromDir4(ctx.paths.memoriesDir);
453
+ const memories = await loadMemoriesFromDir5(ctx.paths.memoriesDir);
429
454
  const loaded = memories.find((m) => m.memory.frontmatter.id === input.id);
430
455
  if (!loaded) throw new Error(`No memory with id "${input.id}".`);
431
456
  await writeFile4(
@@ -461,7 +486,7 @@ import {
461
486
  deriveConfidence as deriveConfidence2,
462
487
  getUsage as getUsage2,
463
488
  inferModulesFromPaths,
464
- loadMemoriesFromDir as loadMemoriesFromDir5,
489
+ loadMemoriesFromDir as loadMemoriesFromDir6,
465
490
  loadUsageIndex as loadUsageIndex3,
466
491
  memoryMatchesAnchorPaths,
467
492
  trackReads as trackReads2
@@ -483,7 +508,7 @@ async function memForFiles(input, ctx) {
483
508
  module_contexts: await loadModuleContexts(ctx, inferred, input.include_module_contexts)
484
509
  };
485
510
  }
486
- const all = await loadMemoriesFromDir5(ctx.paths.memoriesDir);
511
+ const all = await loadMemoriesFromDir6(ctx.paths.memoriesDir);
487
512
  const usage = await loadUsageIndex3(ctx.paths);
488
513
  const seen = /* @__PURE__ */ new Set();
489
514
  const byAnchor = [];
@@ -562,7 +587,7 @@ import { existsSync as existsSync9 } from "fs";
562
587
  import {
563
588
  deriveConfidence as deriveConfidence3,
564
589
  getUsage as getUsage3,
565
- loadMemoriesFromDir as loadMemoriesFromDir6,
590
+ loadMemoriesFromDir as loadMemoriesFromDir7,
566
591
  loadUsageIndex as loadUsageIndex4
567
592
  } from "@hiveai/core";
568
593
  import { z as z9 } from "zod";
@@ -573,7 +598,7 @@ async function memGet(input, ctx) {
573
598
  if (!existsSync9(ctx.paths.memoriesDir)) {
574
599
  throw new Error(`No .ai/memories at ${ctx.paths.root}.`);
575
600
  }
576
- const all = await loadMemoriesFromDir6(ctx.paths.memoriesDir);
601
+ const all = await loadMemoriesFromDir7(ctx.paths.memoriesDir);
577
602
  const found = all.find((m) => m.memory.frontmatter.id === input.id);
578
603
  if (!found) throw new Error(`No memory with id "${input.id}".`);
579
604
  const fm = found.memory.frontmatter;
@@ -605,7 +630,7 @@ async function memGet(input, ctx) {
605
630
  import { existsSync as existsSync10 } from "fs";
606
631
  import { unlink } from "fs/promises";
607
632
  import {
608
- loadMemoriesFromDir as loadMemoriesFromDir7,
633
+ loadMemoriesFromDir as loadMemoriesFromDir8,
609
634
  loadUsageIndex as loadUsageIndex5,
610
635
  saveUsageIndex as saveUsageIndex2
611
636
  } from "@hiveai/core";
@@ -618,7 +643,7 @@ async function memDelete(input, ctx) {
618
643
  if (!existsSync10(ctx.paths.memoriesDir)) {
619
644
  throw new Error(`No .ai/memories at ${ctx.paths.root}.`);
620
645
  }
621
- const all = await loadMemoriesFromDir7(ctx.paths.memoriesDir);
646
+ const all = await loadMemoriesFromDir8(ctx.paths.memoriesDir);
622
647
  const found = all.find((m) => m.memory.frontmatter.id === input.id);
623
648
  if (!found) throw new Error(`No memory with id "${input.id}".`);
624
649
  await unlink(found.filePath);
@@ -637,7 +662,7 @@ async function memDelete(input, ctx) {
637
662
  // src/tools/mem-update.ts
638
663
  import { writeFile as writeFile5 } from "fs/promises";
639
664
  import { existsSync as existsSync11 } from "fs";
640
- import { loadMemoriesFromDir as loadMemoriesFromDir8, serializeMemory as serializeMemory4 } from "@hiveai/core";
665
+ import { loadMemoriesFromDir as loadMemoriesFromDir9, serializeMemory as serializeMemory4 } from "@hiveai/core";
641
666
  import { z as z11 } from "zod";
642
667
  var MemUpdateInputSchema = {
643
668
  id: z11.string().min(1).describe("Id of the memory to update"),
@@ -653,7 +678,7 @@ async function memUpdate(input, ctx) {
653
678
  if (!existsSync11(ctx.paths.memoriesDir)) {
654
679
  throw new Error(`No .ai/memories at ${ctx.paths.root}.`);
655
680
  }
656
- const memories = await loadMemoriesFromDir8(ctx.paths.memoriesDir);
681
+ const memories = await loadMemoriesFromDir9(ctx.paths.memoriesDir);
657
682
  const loaded = memories.find((m) => m.memory.frontmatter.id === input.id);
658
683
  if (!loaded) throw new Error(`No memory with id "${input.id}".`);
659
684
  const { frontmatter, body } = loaded.memory;
@@ -698,7 +723,7 @@ async function memUpdate(input, ctx) {
698
723
  import { existsSync as existsSync12 } from "fs";
699
724
  import {
700
725
  getUsage as getUsage4,
701
- loadMemoriesFromDir as loadMemoriesFromDir9,
726
+ loadMemoriesFromDir as loadMemoriesFromDir10,
702
727
  loadUsageIndex as loadUsageIndex6
703
728
  } from "@hiveai/core";
704
729
  import { z as z12 } from "zod";
@@ -707,7 +732,7 @@ var MemPendingInputSchema = {
707
732
  };
708
733
  async function memPending(input, ctx) {
709
734
  if (!existsSync12(ctx.paths.memoriesDir)) return { pending: [] };
710
- const all = await loadMemoriesFromDir9(ctx.paths.memoriesDir);
735
+ const all = await loadMemoriesFromDir10(ctx.paths.memoriesDir);
711
736
  const usage = await loadUsageIndex6(ctx.paths);
712
737
  const now = Date.now();
713
738
  const proposed = all.filter(({ memory }) => {
@@ -741,7 +766,7 @@ async function memPending(input, ctx) {
741
766
  import { writeFile as writeFile6 } from "fs/promises";
742
767
  import { existsSync as existsSync13 } from "fs";
743
768
  import {
744
- loadMemoriesFromDir as loadMemoriesFromDir10,
769
+ loadMemoriesFromDir as loadMemoriesFromDir11,
745
770
  serializeMemory as serializeMemory5
746
771
  } from "@hiveai/core";
747
772
  import { z as z13 } from "zod";
@@ -752,7 +777,7 @@ async function memApprove(input, ctx) {
752
777
  if (!existsSync13(ctx.paths.memoriesDir)) {
753
778
  throw new Error(`No .ai/memories at ${ctx.paths.root}.`);
754
779
  }
755
- const all = await loadMemoriesFromDir10(ctx.paths.memoriesDir);
780
+ const all = await loadMemoriesFromDir11(ctx.paths.memoriesDir);
756
781
  const found = all.find((m) => m.memory.frontmatter.id === input.id);
757
782
  if (!found) throw new Error(`No memory with id "${input.id}".`);
758
783
  const previous = found.memory.frontmatter.status;
@@ -769,10 +794,60 @@ async function memApprove(input, ctx) {
769
794
  };
770
795
  }
771
796
 
772
- // src/tools/get-briefing.ts
773
- import { readFile as readFile3, readdir as readdir3 } from "fs/promises";
797
+ // src/tools/mem-tried.ts
798
+ import { mkdir as mkdir3, writeFile as writeFile7 } from "fs/promises";
774
799
  import { existsSync as existsSync14 } from "fs";
775
800
  import path5 from "path";
801
+ import {
802
+ buildFrontmatter as buildFrontmatter2,
803
+ memoryFilePath as memoryFilePath2,
804
+ serializeMemory as serializeMemory6
805
+ } from "@hiveai/core";
806
+ import { z as z14 } from "zod";
807
+ var MemTriedInputSchema = {
808
+ what: z14.string().min(1).describe("Brief description of the approach that was tried"),
809
+ why_failed: z14.string().min(1).describe("Why it failed or why it should NOT be used"),
810
+ instead: z14.string().optional().describe("What to use or do instead (recommended alternative)"),
811
+ scope: z14.enum(["personal", "team", "module"]).default("personal").describe("Visibility scope"),
812
+ module: z14.string().optional().describe("Module name (required when scope=module)"),
813
+ tags: z14.array(z14.string()).default([]).describe("Tags for filtering"),
814
+ paths: z14.array(z14.string()).default([]).describe("Anchor file paths this applies to"),
815
+ author: z14.string().optional().describe("Author handle or email")
816
+ };
817
+ async function memTried(input, ctx) {
818
+ if (!existsSync14(ctx.paths.haiveDir)) {
819
+ throw new Error(`No .ai/ directory at ${ctx.paths.root}. Run 'haive init' first.`);
820
+ }
821
+ const slug = input.what.toLowerCase().replace(/[^a-z0-9\s]/g, "").trim().split(/\s+/).slice(0, 5).join("-");
822
+ const baseFm = buildFrontmatter2({
823
+ type: "attempt",
824
+ slug,
825
+ scope: input.scope,
826
+ module: input.module,
827
+ tags: input.tags,
828
+ paths: input.paths,
829
+ author: input.author
830
+ });
831
+ const frontmatter = { ...baseFm, status: "validated" };
832
+ const lines = [`# ${input.what}`, ""];
833
+ lines.push(`**Why it failed / do NOT use:** ${input.why_failed}`);
834
+ if (input.instead) {
835
+ lines.push("", `**Instead, use:** ${input.instead}`);
836
+ }
837
+ const body = lines.join("\n") + "\n";
838
+ const file = memoryFilePath2(ctx.paths, frontmatter.scope, frontmatter.id, frontmatter.module);
839
+ await mkdir3(path5.dirname(file), { recursive: true });
840
+ if (existsSync14(file)) {
841
+ throw new Error(`Memory already exists at ${file}`);
842
+ }
843
+ await writeFile7(file, serializeMemory6({ frontmatter, body }), "utf8");
844
+ return { id: frontmatter.id, scope: frontmatter.scope, file_path: file };
845
+ }
846
+
847
+ // src/tools/get-briefing.ts
848
+ import { readFile as readFile3, readdir as readdir3 } from "fs/promises";
849
+ import { existsSync as existsSync15 } from "fs";
850
+ import path6 from "path";
776
851
  import {
777
852
  allocateBudget,
778
853
  deriveConfidence as deriveConfidence4,
@@ -780,36 +855,43 @@ import {
780
855
  getUsage as getUsage5,
781
856
  inferModulesFromPaths as inferModulesFromPaths2,
782
857
  literalMatchesAllTokens as literalMatchesAllTokens2,
783
- loadMemoriesFromDir as loadMemoriesFromDir11,
858
+ loadMemoriesFromDir as loadMemoriesFromDir12,
784
859
  loadUsageIndex as loadUsageIndex7,
785
860
  memoryMatchesAnchorPaths as memoryMatchesAnchorPaths2,
786
861
  tokenizeQuery as tokenizeQuery2,
787
862
  trackReads as trackReads3,
788
863
  truncateToTokens
789
864
  } from "@hiveai/core";
790
- import { z as z14 } from "zod";
865
+ import { z as z15 } from "zod";
791
866
  var GetBriefingInputSchema = {
792
- task: z14.string().optional().describe(
867
+ task: z15.string().optional().describe(
793
868
  "What you are about to do, in 1\u20132 sentences. Used to rank relevant memories semantically."
794
869
  ),
795
- files: z14.array(z14.string()).default([]).describe("Project-relative file paths the agent is currently looking at or about to edit"),
796
- max_tokens: z14.number().int().positive().default(8e3).describe(
870
+ files: z15.array(z15.string()).default([]).describe("Project-relative file paths the agent is currently looking at or about to edit"),
871
+ max_tokens: z15.number().int().positive().default(8e3).describe(
797
872
  "Approximate token budget for the entire briefing. Each section is allocated a share and truncated to fit."
798
873
  ),
799
- max_memories: z14.number().int().positive().default(8).describe("Cap on memories surfaced regardless of token budget"),
800
- include_project_context: z14.boolean().default(true),
801
- include_module_contexts: z14.boolean().default(true),
802
- semantic: z14.boolean().default(true).describe(
874
+ max_memories: z15.number().int().positive().default(8).describe("Cap on memories surfaced regardless of token budget"),
875
+ include_project_context: z15.boolean().default(true),
876
+ include_module_contexts: z15.boolean().default(true),
877
+ semantic: z15.boolean().default(true).describe(
803
878
  "Use semantic ranking when a task is provided (requires `haive embeddings index`)."
804
879
  ),
805
- track: z14.boolean().default(true).describe("Increment read_count on returned memories")
880
+ include_stale: z15.boolean().default(false).describe("Include stale memories (excluded by default \u2014 they may be outdated)"),
881
+ track: z15.boolean().default(true).describe("Increment read_count on returned memories")
806
882
  };
807
883
  async function getBriefing(input, ctx) {
808
884
  const inferred = inferModulesFromPaths2(input.files);
809
885
  const memories = [];
810
886
  let searchMode = "literal";
811
- if (existsSync14(ctx.paths.memoriesDir)) {
812
- const allMemories = await loadMemoriesFromDir11(ctx.paths.memoriesDir);
887
+ if (existsSync15(ctx.paths.memoriesDir)) {
888
+ const allLoaded = await loadMemoriesFromDir12(ctx.paths.memoriesDir);
889
+ const allMemories = allLoaded.filter(({ memory }) => {
890
+ const s = memory.frontmatter.status;
891
+ if (s === "rejected" || s === "deprecated") return false;
892
+ if (!input.include_stale && s === "stale") return false;
893
+ return true;
894
+ });
813
895
  const usage = await loadUsageIndex7(ctx.paths);
814
896
  const semanticHits = input.task && input.semantic ? await trySemanticHits(ctx, input.task, allMemories.length * 2) : null;
815
897
  if (input.task && input.semantic) {
@@ -880,10 +962,13 @@ async function getBriefing(input, ctx) {
880
962
  await trackReads3(ctx.paths, memories.map((m) => m.id));
881
963
  }
882
964
  }
883
- const projectContext = input.include_project_context && existsSync14(ctx.paths.projectContext) ? await readFile3(ctx.paths.projectContext, "utf8") : "";
965
+ const projectContext = input.include_project_context && existsSync15(ctx.paths.projectContext) ? await readFile3(ctx.paths.projectContext, "utf8") : "";
884
966
  const moduleContents = input.include_module_contexts ? await loadModuleContexts2(ctx, inferred) : [];
885
- const memoriesText = memories.map((m) => `### ${m.id} (${m.scope}/${m.type}, ${m.confidence})
886
- ${m.body.trim()}`).join("\n\n---\n\n");
967
+ const memoriesText = memories.map((m) => {
968
+ const unverified = m.status === "proposed" ? " [UNVERIFIED \u2014 not yet validated]" : "";
969
+ return `### ${m.id} (${m.scope}/${m.type}, ${m.confidence})${unverified}
970
+ ${m.body.trim()}`;
971
+ }).join("\n\n---\n\n");
887
972
  const slices = allocateBudget(
888
973
  [
889
974
  { key: "project", text: projectContext, weight: 3, mode: "head" },
@@ -951,15 +1036,15 @@ async function trySemanticHits(ctx, task, limit) {
951
1036
  }
952
1037
  async function loadModuleContexts2(ctx, modules) {
953
1038
  if (modules.length === 0) return [];
954
- if (!existsSync14(ctx.paths.modulesContextDir)) return [];
1039
+ if (!existsSync15(ctx.paths.modulesContextDir)) return [];
955
1040
  const available = new Set(
956
1041
  (await readdir3(ctx.paths.modulesContextDir, { withFileTypes: true })).filter((d) => d.isDirectory()).map((d) => d.name)
957
1042
  );
958
1043
  const out = [];
959
1044
  for (const m of modules) {
960
1045
  if (!available.has(m)) continue;
961
- const file = path5.join(ctx.paths.modulesContextDir, m, "context.md");
962
- if (existsSync14(file)) {
1046
+ const file = path6.join(ctx.paths.modulesContextDir, m, "context.md");
1047
+ if (existsSync15(file)) {
963
1048
  out.push({ name: m, content: await readFile3(file, "utf8") });
964
1049
  }
965
1050
  }
@@ -968,11 +1053,11 @@ async function loadModuleContexts2(ctx, modules) {
968
1053
 
969
1054
  // src/tools/code-map.ts
970
1055
  import { loadCodeMap, queryCodeMap } from "@hiveai/core";
971
- import { z as z15 } from "zod";
1056
+ import { z as z16 } from "zod";
972
1057
  var CodeMapInputSchema = {
973
- file: z15.string().optional().describe("Filter to files whose path contains this substring"),
974
- symbol: z15.string().optional().describe("Filter to files exporting a symbol whose name contains this substring"),
975
- max_files: z15.number().int().positive().default(40).describe("Cap on returned files")
1058
+ file: z16.string().optional().describe("Filter to files whose path contains this substring"),
1059
+ symbol: z16.string().optional().describe("Filter to files exporting a symbol whose name contains this substring"),
1060
+ max_files: z16.number().int().positive().default(40).describe("Cap on returned files")
976
1061
  };
977
1062
  async function codeMapTool(input, ctx) {
978
1063
  const map = await loadCodeMap(ctx.paths);
@@ -998,12 +1083,12 @@ async function codeMapTool(input, ctx) {
998
1083
  }
999
1084
 
1000
1085
  // src/prompts/bootstrap-project.ts
1001
- import { z as z16 } from "zod";
1086
+ import { z as z17 } from "zod";
1002
1087
  var BootstrapProjectArgsSchema = {
1003
- module: z16.string().optional().describe(
1088
+ module: z17.string().optional().describe(
1004
1089
  "Optional module name to scope the analysis to (writes to .ai/modules/<module>/context.md)"
1005
1090
  ),
1006
- focus: z16.string().optional().describe("Optional area to emphasize (e.g. 'data layer', 'API surface')")
1091
+ focus: z17.string().optional().describe("Optional area to emphasize (e.g. 'data layer', 'API surface')")
1007
1092
  };
1008
1093
  var ROOT_TEMPLATE = `# Project context
1009
1094
 
@@ -1086,7 +1171,7 @@ ${template}\`\`\`
1086
1171
 
1087
1172
  // src/server.ts
1088
1173
  var SERVER_NAME = "haive";
1089
- var SERVER_VERSION = "0.2.4";
1174
+ var SERVER_VERSION = "0.2.6";
1090
1175
  function jsonResult(data) {
1091
1176
  return {
1092
1177
  content: [
@@ -1193,6 +1278,12 @@ function createHaiveServer(options = {}) {
1193
1278
  MemApproveInputSchema,
1194
1279
  async (input) => jsonResult(await memApprove(input, context))
1195
1280
  );
1281
+ server.tool(
1282
+ "mem_tried",
1283
+ "Record a failed approach as negative knowledge (type=attempt, auto-validated). Use this whenever you tried something and it didn't work \u2014 saves future agents from repeating the mistake.",
1284
+ MemTriedInputSchema,
1285
+ async (input) => jsonResult(await memTried(input, context))
1286
+ );
1196
1287
  server.prompt(
1197
1288
  "bootstrap_project",
1198
1289
  "Instructions for the AI client to analyze the project and save the context.",