@inerrata-corporation/errata 2.0.0-dev.41 → 2.0.0-dev.42

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/errata.mjs CHANGED
@@ -20368,12 +20368,17 @@ _${dropped} lower-priority item${dropped === 1 ? "" : "s"} omitted to fit the pa
20368
20368
  }
20369
20369
  return { body: body2, snapshot, dropped };
20370
20370
  }
20371
- var SEARCH_IMPERATIVE_HEADER, SEARCH_IMPERATIVE_BODY, EVICTION_ORDER, DEFAULT_AGENT_CONTEXT_BUDGET;
20371
+ var RECALL_FIRST_HEADER, RECALL_FIRST_BODY, RECALL_FIRST_BLOCK, SEARCH_IMPERATIVE_HEADER, SEARCH_IMPERATIVE_BODY, EVICTION_ORDER, DEFAULT_AGENT_CONTEXT_BUDGET;
20372
20372
  var init_render = __esm({
20373
20373
  "../../packages/context-writer/src/render.ts"() {
20374
20374
  "use strict";
20375
20375
  init_src4();
20376
20376
  init_src2();
20377
+ RECALL_FIRST_HEADER = "## errata \u2014 recall before you work";
20378
+ RECALL_FIRST_BODY = "Before investigating any bug or error, your FIRST tool call must be `mcp__errata__errata_search` with a few words describing the problem. This machine's knowledge graph records previously solved problems \u2014 the answer may already be recorded. Read what it returns before touching any files.";
20379
+ RECALL_FIRST_BLOCK = `${RECALL_FIRST_HEADER}
20380
+
20381
+ ${RECALL_FIRST_BODY}`;
20377
20382
  SEARCH_IMPERATIVE_HEADER = "### \u{1F50E} PRIORS ARE SEEDS \u2014 a sample, not the whole graph";
20378
20383
  SEARCH_IMPERATIVE_BODY = "Everything below is a budgeted, top-of-head slice of a much larger graph. Any prior id below is a live burst seed: `errata.burst` it (or read `.errata/g/burst/<id>`) to pull its wider neighborhood \u2014 causes, fixes, siblings. When a prior is adjacent-but-not-quite, or none fit, that gap is exactly when to search deeper before solving cold: a stuck search is itself a signal that routes help to you.";
20379
20384
  EVICTION_ORDER = [
@@ -37017,7 +37022,7 @@ function resolvePath(rawPath) {
37017
37022
  const rest2 = segs.slice(1);
37018
37023
  if (verb === "index" || verb === "README" || verb === "help") return { kind: "index" };
37019
37024
  if (verb === "search") {
37020
- const query = rest2.join(" ").trim();
37025
+ const query = rest2.join(" ").replace(/[-_]+/g, " ").trim();
37021
37026
  if (!query) return null;
37022
37027
  return { kind: "tool", tool: "errata.search", args: { query } };
37023
37028
  }
@@ -42549,7 +42554,7 @@ function startLoopLagMonitor(thresholdMs = 1e3) {
42549
42554
  }
42550
42555
 
42551
42556
  // src/engine.ts
42552
- var DAEMON_VERSION = true ? "2.0.0-dev.41" : "2.0.0-alpha.0";
42557
+ var DAEMON_VERSION = true ? "2.0.0-dev.42" : "2.0.0-alpha.0";
42553
42558
  var IGNORED_PATH = /[\\/](?:\.git|node_modules|\.errata|\.claude|\.codex|\.cursor|\.turbo|\.next|dist|coverage|test-results|playwright-report|__pycache__)(?:[\\/]|$)/;
42554
42559
  var IGNORED_NOISE = /castalia\.db|eventlog\.sqlite|turn-cursors/;
42555
42560
  var GIT_OP_MUTE_MS = 4e3;
@@ -47088,6 +47093,7 @@ async function installClaudeHooks(port) {
47088
47093
  }
47089
47094
  }
47090
47095
  const matcher = "Read|Edit|Write|Grep|Glob|NotebookEdit|Bash";
47096
+ const postMatcher = `${matcher}|ToolSearch|mcp__errata__.*`;
47091
47097
  const preCmd = `${hookCurlCommand(port)} ${ERRATA_TAG}`;
47092
47098
  const postCmd = `${hookRelayCommand(port, "/api/hook")} ${ERRATA_TAG}`;
47093
47099
  settings.hooks ??= {};
@@ -47096,13 +47102,13 @@ async function installClaudeHooks(port) {
47096
47102
  if (list[i2].hooks.some((h) => h.command.includes(ERRATA_TAG))) list.splice(i2, 1);
47097
47103
  }
47098
47104
  };
47099
- for (const [event, command] of [
47100
- ["PreToolUse", preCmd],
47101
- ["PostToolUse", postCmd]
47105
+ for (const [event, command, eventMatcher] of [
47106
+ ["PreToolUse", preCmd, matcher],
47107
+ ["PostToolUse", postCmd, postMatcher]
47102
47108
  ]) {
47103
47109
  const list = settings.hooks[event] ??= [];
47104
47110
  dropErrata(list);
47105
- list.push({ matcher, hooks: [{ type: "command", command }] });
47111
+ list.push({ matcher: eventMatcher, hooks: [{ type: "command", command }] });
47106
47112
  }
47107
47113
  const turnCmd = `${hookCurlCommand(port, "/api/turn")} ${ERRATA_TAG}`;
47108
47114
  for (const event of ["Stop", "SubagentStop"]) {
@@ -47129,6 +47135,15 @@ async function installClaudeHooks(port) {
47129
47135
  writeFileSync16(file2, JSON.stringify(settings, null, 2) + "\n", "utf8");
47130
47136
  console.log(`installed Claude Code hooks \u2192 ${file2}`);
47131
47137
  await installClaudeMcpConfig();
47138
+ const claudeMd = join24(ROOT, "CLAUDE.md");
47139
+ const recall = writeManagedBlock(claudeMd, { body: RECALL_FIRST_BLOCK });
47140
+ if (recall.kind === "collision") {
47141
+ console.warn(
47142
+ ` \u26A0\uFE0F CLAUDE.md errata block was hand-edited \u2014 leaving it alone (expected ${recall.expectedHash}, found ${recall.actualHash})`
47143
+ );
47144
+ } else {
47145
+ console.log(`installed recall-first block \u2192 ${claudeMd}`);
47146
+ }
47132
47147
  console.log(` endpoint: http://127.0.0.1:${port}/api/hook`);
47133
47148
  }
47134
47149
  async function installClaudeMcpConfig() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inerrata-corporation/errata",
3
- "version": "2.0.0-dev.41",
3
+ "version": "2.0.0-dev.42",
4
4
  "description": "errata - local-first observation engine for AI coding agents",
5
5
  "type": "module",
6
6
  "bin": {
package/pass-worker.mjs CHANGED
@@ -25760,6 +25760,11 @@ function fileOf(store2, nodeId) {
25760
25760
  }
25761
25761
  return null;
25762
25762
  }
25763
+ var RECALL_FIRST_HEADER = "## errata \u2014 recall before you work";
25764
+ var RECALL_FIRST_BODY = "Before investigating any bug or error, your FIRST tool call must be `mcp__errata__errata_search` with a few words describing the problem. This machine's knowledge graph records previously solved problems \u2014 the answer may already be recorded. Read what it returns before touching any files.";
25765
+ var RECALL_FIRST_BLOCK = `${RECALL_FIRST_HEADER}
25766
+
25767
+ ${RECALL_FIRST_BODY}`;
25763
25768
 
25764
25769
  // ../../packages/context-writer/src/select-durable-memory.ts
25765
25770
  init_src2();