@holmes-lab/holmes-kit 0.35.6 → 0.35.8

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/CHANGELOG.md CHANGED
@@ -5,6 +5,39 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
  <!-- @implements A-SPEC-209 -->
8
+ ## [0.35.8] - 2026-10-06
9
+
10
+ ### Added
11
+
12
+ - **Codex sessions can start with the Holmes banner** (A-SPEC-751.6). Measured on codex-cli 0.160.0: Codex calls a
13
+ trusted SessionStart hook and passes its context to the model. On a machine with a runtime registry,
14
+ `runtime-binding setup --activate-hooks codex` (or `activate_hooks: ["codex"]` of the `runtime_binding` tool) now
15
+ writes `codex-session-start.js` beside the registry and adds one SessionStart entry to the workspace's project
16
+ hooks file `.codex/hooks.json`. Without activation no entry is added, and the user-level hooks file — shared by
17
+ every workspace — never gains one. An existing entry that runs a package's `session-start.js` directly is routed
18
+ to the wrapper. The entry runs only after you trust it in Codex (`/hooks`); a session start is not a gate, and
19
+ whatever goes wrong in it the wrapper exits 0 with no output. Not wired by `init`, and not for Antigravity, which
20
+ passes no hook output to the model.
21
+
22
+ ## [0.35.7] - 2026-10-05
23
+
24
+ ### Fixed
25
+
26
+ - **The Stop hook no longer judges repositories that are not Holmes projects** (A-SPEC-452.1). In a git repository
27
+ with no `.ax` directory and an untracked source file, the Stop hook answered a block: `[ART-1] … the changed source
28
+ has no @implements anchor`. Codex wires the Stop hook at user level, shared by every workspace on the machine, so
29
+ with that hook trusted every repository there had its turns held and was told to write Holmes specs. Where no
30
+ project can be found — no `.ax` marker and no wired spec directory at or above the working directory, and no
31
+ approval in a ledger there — the hook now answers nothing and creates nothing. Inside a project nothing changes,
32
+ and a project whose spec tree is gone while its ledger records approvals is still blocked with the
33
+ governance-lost reason. If you use Codex with Holmes hooks and saw turns blocked in unrelated repositories,
34
+ upgrade.
35
+ - **A Jest each-table written with a type argument is counted** (A-SPEC-750.1). The static case counter behind ART-4
36
+ recognised `it.each(table)(…)` and the template form, and stopped at the `<` of `it.each<Row>(table)(…)`, so a
37
+ TypeScript suite that types its tables on the call was counted below what Jest runs (measured: 7 where Jest ran 8).
38
+ The typed form now counts, including nested generics and arrow types in the argument. The counter remains a lower
39
+ bound: a type argument list that never closes counts nothing.
40
+
8
41
  ## [0.35.6] - 2026-10-05
9
42
 
10
43
  ### Added
package/README.md CHANGED
@@ -24,6 +24,8 @@ Measured at `173b99650442` (specs `sha256:215f84d4e9f4`) — reproduce with `hol
24
24
  ### 🛡️ Currently Supported Features (Production Features)
25
25
 
26
26
  - **The protected store is recognised however a shell command spells it** *(new in 0.35.2 — security fix, upgrade recommended)*: through 0.35.1 a path into `.ax/specs`, `.ax/ledger`, `.ax/approvals` or `.ax/state` written directly after a shell expansion, a variable, or a character the shell removes at run time was not seen as protected, so a removal, move or overwrite of governance state could pass the gate. The store spelling now counts wherever it appears in a command, and an output redirect to a computed target is not a read. Reads still pass. A directory that merely ends in `.ax` and has a child named like the store's is judged as the store. Limit: a path assembled so the spelling never appears in the command text is outside this rule.
27
+ - **The session-start banner in Codex** *(new in 0.35.8)*: with a runtime registry, `runtime-binding setup --activate-hooks codex` (or the `runtime_binding` tool) adds a SessionStart entry to the workspace's `.codex/hooks.json`, so a Codex session starts by being told which Holmes build governs it and whether autonomous approval is on — as Claude Code sessions are. It runs after you trust it in Codex's `/hooks`. Antigravity passes no hook output to the model, so nothing is wired there.
28
+ - **The Stop hook leaves other repositories alone** *(new in 0.35.7 — upgrade recommended for Codex users)*: Codex wires the Holmes Stop hook at user level, so it is called in every repository on the machine. Through 0.35.6 it blocked the end of a turn in a repository that is not a Holmes project (`[ART-1] … no @implements anchor`). It now answers nothing where no project can be found; inside a project nothing changes.
27
29
  - **Re-apply a registered runtime binding without leaving the session** *(new in 0.35.6)*: the MCP tool `runtime_binding` previews and applies the plan `runtime-binding setup` would make for the registered workspace, including `activate_hooks`. It never chooses a build — it uses the package the operator registry already names — and it writes only when you answer approve in the approval dialog, which shows the plan digest and the files. No answer, a denial, a client without the dialog, or autonomous approval write nothing and leave the usual queue request. Native hook trust in Codex is still given in Codex's `/hooks`.
28
30
  - **`doctor` shows when a checkout's hooks are not the ones its sessions run** *(new in 0.35.5)*: when you develop Holmes-Kit itself with sessions routed to a released install, the `development hooks` row compares the compiled files and has both hook programs judge the same payloads, so a hook change that is not live yet is visible instead of assumed. In the same release, `runtime-binding setup` refuses a plan that would write the Codex gate where Codex has it switched off *(security fix — if you ran setup with 0.35.2–0.35.4, check `doctor` for `FAIL codex user hooks`)*.
29
31
  - **No in-session shortcut around a person while autonomy is on** *(new in 0.35.4 — security fix, upgrade recommended)*: on a client without the MCP form dialog, the `approval_commit` continuation is no longer offered or accepted while autonomous approval is on — the request goes to the approval queue. Its only human check is the host's own tool confirmation, which an allow rule or auto mode removes. With autonomy off it works as before; seals made through it are recorded as `host-gated:<harness>`.
package/dist/.build-id CHANGED
@@ -1 +1 @@
1
- be58f332-muva91ep
1
+ 60474c12-muvgbymb
@@ -41,7 +41,7 @@ exports.registryOwnedWiring = registryOwnedWiring;
41
41
  exports.runtimeBindingStatus = runtimeBindingStatus;
42
42
  exports.runRuntimeBinding = runRuntimeBinding;
43
43
  exports.trackedWorkspacePaths = trackedWorkspacePaths;
44
- // @implements A-SPEC-752.10, A-SPEC-752.9, A-SPEC-751.5, A-SPEC-751, A-SPEC-752, A-SPEC-752.7, A-SPEC-752.8
44
+ // @implements A-SPEC-752.10, A-SPEC-752.9, A-SPEC-751.5, A-SPEC-751.6, A-SPEC-751, A-SPEC-752, A-SPEC-752.7, A-SPEC-752.8
45
45
  const fs = __importStar(require("node:fs"));
46
46
  const os = __importStar(require("node:os"));
47
47
  const path = __importStar(require("node:path"));
@@ -251,7 +251,7 @@ function runRuntimeBinding(opts) {
251
251
  const sessionStartWrapper = path.join(dir, 'claude-session-start.js');
252
252
  add(sessionStartWrapper, `// @implements A-SPEC-751.5\nrequire('./dispatch.js').runDispatch(${JSON.stringify({ registryPath: destination, harness: 'claude', entry: 'session-start' })});\n`);
253
253
  const sessionStartCommand = runtimeHookCommand(destination, 'claude', 'session-start');
254
- const routeSessionStart = (file) => {
254
+ const routeSessionStart = (file, routed = sessionStartCommand) => {
255
255
  const raw = planned.get(file)?.after ?? readOptional(file);
256
256
  if (raw === null)
257
257
  return;
@@ -264,10 +264,10 @@ function runRuntimeBinding(opts) {
264
264
  if (!object(group) || !Array.isArray(group.hooks))
265
265
  continue;
266
266
  for (const hook of group.hooks) {
267
- if (!object(hook) || typeof hook.command !== 'string' || hook.command === sessionStartCommand)
267
+ if (!object(hook) || typeof hook.command !== 'string' || hook.command === routed)
268
268
  continue;
269
269
  if (/dist[/\\]+holmes[/\\]+hooks[/\\]+session-start\.js/.test(hook.command)) {
270
- hook.command = sessionStartCommand;
270
+ hook.command = routed;
271
271
  changed = true;
272
272
  }
273
273
  }
@@ -275,6 +275,23 @@ function runRuntimeBinding(opts) {
275
275
  if (changed)
276
276
  add(file, json(doc));
277
277
  };
278
+ // @implements A-SPEC-751.6 — Codex delivers a trusted SessionStart hook's context to the model (measured 2026-10-06).
279
+ // The wrapper is always written; the entry is added only to the workspace's project hooks file and only under
280
+ // explicit activation — the user-level file is shared by every workspace on the machine. Not a gate: Codex's
281
+ // switched-off keys are not consulted and the entry never makes a plan a conflict.
282
+ add(path.join(dir, 'codex-session-start.js'), `// @implements A-SPEC-751.6\nrequire('./dispatch.js').runDispatch(${JSON.stringify({ registryPath: destination, harness: 'codex', entry: 'session-start' })});\n`);
283
+ const codexSessionStartCommand = runtimeHookCommand(destination, 'codex', 'session-start');
284
+ const addCodexSessionStart = (file) => {
285
+ const doc = document(planned.get(file)?.after ?? readOptional(file), file);
286
+ if (doc.hooks !== undefined && !object(doc.hooks))
287
+ throw new Error(`Invalid hooks configuration: ${file}`);
288
+ const groups = doc.hooks?.SessionStart;
289
+ if (groups !== undefined && !Array.isArray(groups))
290
+ throw new Error(`Invalid SessionStart hook groups: ${file}`);
291
+ if ((groups ?? []).some((g) => object(g) && Array.isArray(g.hooks) && g.hooks.some((h) => object(h) && h.command === codexSessionStartCommand)))
292
+ return;
293
+ add(file, json({ ...doc, hooks: { ...(doc.hooks ?? {}), SessionStart: [...(groups ?? []), { hooks: [{ type: 'command', command: codexSessionStartCommand, timeout: 30 }] }] } }));
294
+ };
278
295
  const command = (harness, entry) => runtimeHookCommand(destination, harness, entry);
279
296
  const owns = (cmd) => {
280
297
  if (typeof cmd !== 'string')
@@ -557,6 +574,10 @@ function runRuntimeBinding(opts) {
557
574
  }
558
575
  }
559
576
  native(path.join(root, agents_1.CODEX_PLUGIN_DIR, 'hooks.json'), 'codex', false);
577
+ // @implements A-SPEC-751.6 — after the Codex lifecycles are planned, so the entry joins the planned document.
578
+ codexFiles.forEach((f) => routeSessionStart(f, codexSessionStartCommand));
579
+ if (activate.has('codex'))
580
+ addCodexSessionStart(codexFiles[1]);
560
581
  const claudeFiles = [path.join(home, '.claude/settings.json'), path.join(root, '.claude/settings.local.json'), path.join(root, '.claude/settings.json')];
561
582
  const claudeDocs = claudeFiles.map((f) => document(readOptional(f), f));
562
583
  const claudeEvents = claudeFiles.map(() => new Set());
@@ -567,7 +588,7 @@ function runRuntimeBinding(opts) {
567
588
  claudeEvents[existing >= 0 ? existing : activate.has('claude') ? 1 : empty >= 0 ? empty : 1].add(event);
568
589
  }
569
590
  claudeFiles.forEach((f, i) => native(f, 'claude', claudeEvents[i]));
570
- claudeFiles.forEach(routeSessionStart);
591
+ claudeFiles.forEach((f) => routeSessionStart(f));
571
592
  mcp(path.join(root, '.mcp.json'), 'claude');
572
593
  mcp(path.join(root, '.agents/mcp_config.json'), 'antigravity');
573
594
  const agyUser = (0, agents_1.agyUserHooksPath)(home);
@@ -219,6 +219,25 @@ export declare function rolledBackLedgers(root: string): string[] | undefined;
219
219
  * Returns the reason to block with, or null when there is nothing to report.
220
220
  */
221
221
  export declare function governanceLostPreflight(specsDir: string, projectRoot?: string): string | null;
222
+ /**
223
+ * @implements A-SPEC-452.1
224
+ * Is this turn outside every Holmes project?
225
+ *
226
+ * Measured 2026-10-05: in a plain git repository with no `.ax` directory and one untracked `a.js` this hook answered
227
+ * an ART-1 block. Codex wires Stop at user level, shared by every workspace on the machine, so every repository there
228
+ * had its turns held and was told to write Holmes specs. A-SPEC-452 guarded "no repository" and missed the
229
+ * repository that is not a project.
230
+ *
231
+ * All three must hold: the project lookup found nothing (no `.ax` marker and no wired spec directory at or above the
232
+ * working directory), the wired spec directory does not exist, and no ledger here records an approval. A project
233
+ * whose spec tree is gone while its ledger remembers approvals is NOT outside — that is A-SPEC-175's block, and the
234
+ * caller checks it first.
235
+ */
236
+ export declare function outsideAnyProject(a: {
237
+ foundRoot: string | null;
238
+ specsDir: string;
239
+ cwd: string;
240
+ }): boolean;
222
241
  /**
223
242
  * One line per ARTICLE, each under its own name.
224
243
  *
@@ -47,6 +47,7 @@ exports.escalateReappraisals = escalateReappraisals;
47
47
  exports.unrecordedApprovals = unrecordedApprovals;
48
48
  exports.rolledBackLedgers = rolledBackLedgers;
49
49
  exports.governanceLostPreflight = governanceLostPreflight;
50
+ exports.outsideAnyProject = outsideAnyProject;
50
51
  exports.trackedLines = trackedLines;
51
52
  exports.evaluateStop = evaluateStop;
52
53
  exports.stopDebtAction = stopDebtAction;
@@ -676,6 +677,23 @@ function governanceLostPreflight(specsDir, projectRoot) {
676
677
  const root = projectRoot ?? path.resolve(specsDir, '..', '..');
677
678
  return (0, governance_history_1.hasGovernanceHistory)(root) ? governance_history_1.GOVERNANCE_LOST_HINT : null;
678
679
  }
680
+ /**
681
+ * @implements A-SPEC-452.1
682
+ * Is this turn outside every Holmes project?
683
+ *
684
+ * Measured 2026-10-05: in a plain git repository with no `.ax` directory and one untracked `a.js` this hook answered
685
+ * an ART-1 block. Codex wires Stop at user level, shared by every workspace on the machine, so every repository there
686
+ * had its turns held and was told to write Holmes specs. A-SPEC-452 guarded "no repository" and missed the
687
+ * repository that is not a project.
688
+ *
689
+ * All three must hold: the project lookup found nothing (no `.ax` marker and no wired spec directory at or above the
690
+ * working directory), the wired spec directory does not exist, and no ledger here records an approval. A project
691
+ * whose spec tree is gone while its ledger remembers approvals is NOT outside — that is A-SPEC-175's block, and the
692
+ * caller checks it first.
693
+ */
694
+ function outsideAnyProject(a) {
695
+ return a.foundRoot === null && !fs.existsSync(a.specsDir) && !(0, governance_history_1.hasGovernanceHistory)(a.cwd);
696
+ }
679
697
  // @implements A-SPEC-578.1
680
698
  /** What each article's track observations are called on the operator's screen. */
681
699
  const TRACK_LABELS = {
@@ -1293,6 +1311,10 @@ if (require.main === module) {
1293
1311
  process.stderr.write(`${lost}\n`);
1294
1312
  return;
1295
1313
  }
1314
+ // @implements A-SPEC-452.1 — a user-level entry (Codex) is called in every repository on the machine. Where
1315
+ // there is no project this hook has nothing to judge: no answer, no notice, no file.
1316
+ if (outsideAnyProject({ foundRoot: findProjectRoot(wired), specsDir, cwd: process.cwd() }))
1317
+ return;
1296
1318
  const specs = (0, pre_tool_use_1.readSpecsSync)(specsDir);
1297
1319
  // H1 evidence: count EXECUTABLE test cases per anchored A-SPEC (countTestCases strips comments/
1298
1320
  // strings — sham-resistant). A scan FAILURE yields `undefined` (ART-4 skipped this turn, true
@@ -41,7 +41,7 @@ exports.countTestCases = countTestCases;
41
41
  exports.extractAnchors = extractAnchors;
42
42
  exports.scanTestAnchors = scanTestAnchors;
43
43
  exports.computeTestScope = computeTestScope;
44
- // @implements A-SPEC-121.2, A-SPEC-734, A-SPEC-750
44
+ // @implements A-SPEC-121.2, A-SPEC-734, A-SPEC-750, A-SPEC-750.1
45
45
  const anchor_ids_1 = require("./anchor-ids");
46
46
  const fs = __importStar(require("node:fs"));
47
47
  const path = __importStar(require("node:path"));
@@ -356,6 +356,33 @@ function skipGroup(code, j) {
356
356
  }
357
357
  return code.length;
358
358
  }
359
+ /**
360
+ * @implements A-SPEC-750.1
361
+ * Index just past the type argument list opened by the `<` at `j`, or -1 when it does not close. Round, square and
362
+ * curly groups inside it are skipped whole, and the `>` of an arrow does not close it. A `;` outside every group ends
363
+ * the search: no type argument holds one.
364
+ */
365
+ function skipTypeArguments(code, j) {
366
+ let depth = 0;
367
+ for (; j < code.length; j++) {
368
+ const ch = code[j];
369
+ if (ch === '(' || ch === '[' || ch === '{' || ch === '`') {
370
+ j = skipGroup(code, j) - 1;
371
+ continue;
372
+ }
373
+ if (ch === '<')
374
+ depth++;
375
+ else if (ch === '=' && code[j + 1] === '>')
376
+ j++;
377
+ else if (ch === '>') {
378
+ if (--depth === 0)
379
+ return j + 1;
380
+ }
381
+ else if (ch === ';' || ch === ')' || ch === ']' || ch === '}')
382
+ return -1;
383
+ }
384
+ return -1;
385
+ }
359
386
  const JEST_HEADS = ['it', 'test', 'fit'];
360
387
  // @implements A-SPEC-653 — the platform helpers of A-SPEC-220.3 (`posixOnly('why')(…)`) are heads too: a POSIX-only suite
361
388
  // written with the REPORTING skip must not read as "no real cases". `.skip` on a helper is still not a head.
@@ -391,6 +418,10 @@ function jestCount(code) {
391
418
  }
392
419
  const names = [...direct, ...[...JEST_HELPERS].filter((h) => !direct.has(h))].map((s) => s.replace(/\$/g, '\\$'));
393
420
  let cases = 0;
421
+ // @implements A-SPEC-750.1 — a type argument list that does not close is searched to the end of the text. The searches
422
+ // of one file share an allowance of two passes over it; a file that spends it (it is not TypeScript that compiles)
423
+ // has its later typed tables left uncounted, which is the direction a lower bound may err in.
424
+ let typeArgumentWork = 2 * code.length + 1024;
394
425
  for (const m of code.matchAll(new RegExp(`(?<![\\w$.])(?:${names.join('|')})(?![\\w$])`, 'g'))) {
395
426
  let j = m.index + m[0].length;
396
427
  if (!direct.has(m[0])) {
@@ -410,6 +441,15 @@ function jestCount(code) {
410
441
  if (!code.startsWith('each', k) || /[\w$]/.test(code[k + 4] ?? ''))
411
442
  continue;
412
443
  k = skipSpace(code, k + 4);
444
+ if (code[k] === '<') {
445
+ if (typeArgumentWork <= 0)
446
+ continue;
447
+ const end = skipTypeArguments(code, k);
448
+ typeArgumentWork -= (end < 0 ? code.length : end) - k;
449
+ if (end < 0)
450
+ continue;
451
+ k = skipSpace(code, end);
452
+ }
413
453
  if (code[k] !== '(' && code[k] !== '`')
414
454
  continue;
415
455
  k = skipSpace(code, skipGroup(code, k));
@@ -34,7 +34,7 @@ var __importStar = (this && this.__importStar) || (function () {
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.runDispatch = runDispatch;
37
- // @implements A-SPEC-751, A-SPEC-751.1, A-SPEC-751.5, A-SPEC-754
37
+ // @implements A-SPEC-751, A-SPEC-751.1, A-SPEC-751.5, A-SPEC-751.6, A-SPEC-754
38
38
  const path = __importStar(require("node:path"));
39
39
  const node_child_process_1 = require("node:child_process");
40
40
  const binding_1 = require("./binding");
@@ -92,8 +92,10 @@ async function runDispatch(opts) {
92
92
  // standard output (the reason goes to standard error). It never emits a refusal and never holds a session up.
93
93
  if (opts.entry === 'session-start') {
94
94
  try {
95
- if (opts.harness !== 'claude')
96
- throw new Error('session-start is routed for claude only');
95
+ // @implements A-SPEC-751.6 — Codex delivers a trusted SessionStart hook's context to the model (measured
96
+ // 2026-10-06); Antigravity passes no output shape on, so nothing is routed for it.
97
+ if (opts.harness !== 'claude' && opts.harness !== 'codex')
98
+ throw new Error('session-start is routed for claude and codex only');
97
99
  const budget = (0, hook_process_1.boundedHookBudget)(opts.hookBudgetMs, hook_process_1.HOOK_BUDGET_MS);
98
100
  const input = await hookInput(budget);
99
101
  const hints = hintsFromInput(input);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "//": "@implements A-SPEC-209",
3
3
  "name": "@holmes-lab/holmes-kit",
4
- "version": "0.35.6",
4
+ "version": "0.35.8",
5
5
  "description": "Holmes-Kit — deterministic Agentic Software Engineering (ASE) harness with causal traceability (spec chain + D-CPG + RTM + phase guardrail)",
6
6
  "main": "dist/holmes/mcp/server.js",
7
7
  "types": "dist/holmes/mcp/server.d.ts",