@holmes-lab/holmes-kit 0.40.0 โ†’ 0.40.1

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 (56) hide show
  1. package/CHANGELOG.md +234 -0
  2. package/README.md +70 -4
  3. package/dist/.build-id +1 -1
  4. package/dist/holmes/cli/index.js +25 -19
  5. package/dist/holmes/cli/interactive-prompt.d.ts +39 -2
  6. package/dist/holmes/cli/interactive-prompt.js +98 -16
  7. package/dist/holmes/config/config.d.ts +17 -0
  8. package/dist/holmes/config/config.js +13 -1
  9. package/dist/holmes/governance/autonomy.d.ts +7 -0
  10. package/dist/holmes/governance/autonomy.js +36 -5
  11. package/dist/holmes/governance/push-gate-runner.d.ts +2 -0
  12. package/dist/holmes/governance/push-gate-runner.js +40 -3
  13. package/dist/holmes/governance/push-gate.d.ts +13 -2
  14. package/dist/holmes/governance/push-gate.js +106 -14
  15. package/dist/holmes/guardrail/advisory-line.d.ts +102 -0
  16. package/dist/holmes/guardrail/advisory-line.js +718 -0
  17. package/dist/holmes/guardrail/impact-gate.d.ts +6 -0
  18. package/dist/holmes/guardrail/impact-gate.js +32 -5
  19. package/dist/holmes/hooks/pre-tool-use.d.ts +11 -0
  20. package/dist/holmes/hooks/pre-tool-use.js +44 -5
  21. package/dist/holmes/hooks/session-start.js +17 -1
  22. package/dist/holmes/mcp/handlers/maintenance-analysis.d.ts +13 -0
  23. package/dist/holmes/mcp/handlers/maintenance-analysis.js +59 -2
  24. package/dist/holmes/mcp/handlers/test-execution.d.ts +470 -3
  25. package/dist/holmes/mcp/handlers/test-execution.js +199 -21
  26. package/dist/holmes/mcp/handlers.d.ts +468 -3
  27. package/dist/holmes/mcp/handlers.js +5 -1
  28. package/dist/holmes/mcp/maintenance-analyze.d.ts +5 -0
  29. package/dist/holmes/mcp/maintenance-analyze.js +4 -2
  30. package/dist/holmes/mcp/maintenance-evidence.d.ts +9 -0
  31. package/dist/holmes/mcp/maintenance-evidence.js +4 -1
  32. package/dist/holmes/mcp/tool-schemas.js +13 -7
  33. package/dist/holmes/project/baseline.d.ts +15 -2
  34. package/dist/holmes/project/baseline.js +11 -6
  35. package/dist/holmes/project/bounded-io.d.ts +1 -0
  36. package/dist/holmes/project/bounded-io.js +4 -2
  37. package/dist/holmes/project/change-source.d.ts +4 -0
  38. package/dist/holmes/project/change-source.js +13 -5
  39. package/dist/holmes/project/root.js +3 -1
  40. package/dist/holmes/review/evidence-mode.d.ts +21 -0
  41. package/dist/holmes/review/evidence-mode.js +33 -0
  42. package/dist/holmes/review/head-worktree.d.ts +55 -0
  43. package/dist/holmes/review/head-worktree.js +329 -0
  44. package/dist/holmes/review/mrp.js +13 -3
  45. package/dist/holmes/review/run-provenance.d.ts +45 -0
  46. package/dist/holmes/review/run-provenance.js +314 -0
  47. package/dist/holmes/review/test-evidence.d.ts +174 -0
  48. package/dist/holmes/review/test-evidence.js +330 -2
  49. package/dist/holmes/review/test-reports.d.ts +94 -0
  50. package/dist/holmes/review/test-reports.js +382 -0
  51. package/dist/holmes/review/test-runner.d.ts +176 -65
  52. package/dist/holmes/review/test-runner.js +531 -316
  53. package/dist/holmes/review/test-units.d.ts +159 -0
  54. package/dist/holmes/review/test-units.js +814 -0
  55. package/package.json +1 -1
  56. package/playbooks/publish/PLAYBOOK.md +2 -1
package/CHANGELOG.md CHANGED
@@ -7,6 +7,240 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
  <!-- @implements A-SPEC-209 -->
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.40.1] - 2026-11-09
11
+
12
+ ### Upgrading
13
+ - **Run full push evidence again.** The push gate now accepts only a full `test_run` that ran in a clean worktree of HEAD (`ranIn: head-worktree`). Records written by 0.40.0, and any scoped run, are refused: run `test_run({ root, full: true })` once at the commit you push. Nothing has to be added to `.gitignore`.
14
+ - **New `ax.config.json` settings, both optional:** `testRun.prepare` (an argv run in HEAD's worktree before the suite, for example `["npm", "run", "build"]`), `testRun.linkWalk` (`{ "entries", "seconds" }`, the node_modules walk bound, default 500000 entries and 20 s) and `testRun.pythonNames` (the module-name cap of the environment question, default 20000).
15
+ - A pytest project needs python 3.11 or later for push evidence.
16
+
17
+ ### Known limitations
18
+ - A package that requires your work tree by absolute path (`node-abs-require`) is not detected.
19
+ - Forgery resistance is not claimed: a HEAD conftest can rewrite the loaded-module record (the environment question still holds).
20
+ - A legacy sparse checkout (`core.sparseCheckout` in the shared git config) keeps HEAD's worktree sparse, because turning it off would write the shared configuration.
21
+ - A JavaScript workspace monorepo whose `node_modules` links into the work tree is refused as `environment` (re-pointing the links to HEAD is a 0.41 candidate).
22
+ - A `NODE_PATH` entry inside the work tree is refused as `environment`.
23
+ - The environment question imports HEAD's packages to find their submodules, so a package `__init__` runs during it.
24
+ - xdist is judged by the environment question; no xdist run was measured.
25
+
26
+ ### Added
27
+ - **`test_run` takes `workers` (A-SPEC-466.1 to 466.3).** An integer from 1 to 64 reaches jest as `--maxWorkers` on a scoped and on a full run. A non-number is refused by the argument validator; a number outside 1 to 64 is refused as a handler refusal before anything is derived or run; `null` reads as omitted. Omitted, jest keeps the project's own setting, as before.
28
+ - The answer carries `workers`, the count that reached the jest argv (`null` when none did), and the green evidence record keeps the same value.
29
+ - Runners other than jest take no count. When they ran, they are listed in `workersIgnoredBy`, in the answer and in the evidence.
30
+ - When nothing took the count, `workersIgnored` says why: `mutate`, `no jest group` or `nothing ran`.
31
+ - **`test_run` takes `timeoutMinutes` (A-SPEC-466.6).**
32
+ - It is a time budget for each runner child of the run: an integer from 1 to 180 minutes, 30 when omitted or `null`. Any other number is refused before the run, never clamped.
33
+ - Every runner child takes it, a `mutate` run's jest runs included. It bounds each child, not the run as a whole: a run with jest and pytest children can take up to twice the budget. Every answer, `mutate` included, and the green evidence record carry the applied value.
34
+ - A run past the budget still ends "not judged" and records nothing. No gate judges on the value.
35
+ - Before this, a two-worker full run could not finish inside the fixed 30 minutes (measured 2026-11-04: stopped, not judged).
36
+ - **Limit:** the pre-push gate does not read the recorded worker count. Running the push-gate evidence at two workers is an operating promise, with no machine check.
37
+
38
+ ### Changed
39
+ - **BREAKING (gate behaviour, tightens): push evidence is a full `test_run`, asked for with `full: true` (A-SPEC-128.2, 128.3, 128.4, 128.5).**
40
+ - **Each push now needs a full run at the pushed commit.** Its cost is the whole suite: on this repository, about 40 minutes at two workers.
41
+ - `full: true` defaults to a 120-minute budget.
42
+ - A run stopped at its budget answers with the next call (`nextCall`, a doubled budget up to 180, keeping `workers`). At 180 it says the ceiling is reached instead.
43
+ - A scoped run is never push evidence.
44
+ - **The gate counts the tests the runner ran (`testsRun`), not their attribution to A-SPECs.** A full run of a Go module, or of tests that carry no anchor, used to attribute nothing. The gate then refused with "executed 0" and named the same call again (A-SPEC-128.5).
45
+ - **Every detected ecosystem must have run at least one test (`testsRunBy`).**
46
+ - Push evidence is one predicate, shared by the writer, the gate and `review mrp`. It needs an integer `testsRun` of at least 1 and a per-ecosystem count of at least 1 for each detected ecosystem (A-SPEC-128.6).
47
+ - Before this, a Go module beside an all-skipped jest suite passed.
48
+ - **Build-file ecosystems are detected at the run root only.** go.mod, Cargo.toml, pom.xml/build.gradle and *.csproj/*.sln count there, so a nested test-fixture module no longer makes a jest repository "need" go.
49
+ - A `tox.ini` counts only with a `[pytest]` or `[tool:pytest]` section.
50
+ - jest and pytest test files still count at any depth.
51
+ - **The newest observation decides.** A failed full attempt is written first and then voids the older test evidence, whatever head that evidence was taken at; when the evidence cannot be removed, the attempt is written over it in place. Its record names the ecosystems that ran nothing (`missing`). A record that could not be written or voided is named in the answer (`recordFailed`) (A-SPEC-128.7, A-SPEC-128.8).
52
+ - **A full run runs exactly the detected ecosystems.** An impacted test file of an undetected ecosystem (a fixture go test in a jest repository) is named in `notRun` instead of running its runner at the root. Nested build files are named in `notDetected`, and the push gate repeats them as a notice (A-SPEC-128.7).
53
+ - **Every push refusal names the act that clears it.** That act is the full call or "the fix is the tests" (a real red run, a repository with no test, or a suite with every test skipped). A record of the wrong shape (a string `detected` or `missing`, an array `testsRunBy`, a `testsRun` that is not the sum of its parts) is refused by name. An exception inside the judgement now refuses the push instead of exiting 0 (A-SPEC-128.7).
54
+ - **`testRun.excludeDirs` takes a root-relative path prefix.** An entry with a `/` (`test/fixtures/pyproj`) is a path from the root. An entry without one is still a directory name at any depth (A-SPEC-128.7).
55
+ - `./x` and `x/` are root paths too, and doubled or dotted segments fold.
56
+ - Absolute entries, entries that leave the root, and entries that name nothing are ignored, and the answer names them in `excludeDirsIgnored` (A-SPEC-128.8).
57
+ - **The push refusal never suggests an exclusion** (A-SPEC-128.8). Its acts are "run the full call" and "fix the tests"; a red run is always "fix the tests". 128.7 named an `excludeDirs` entry for a tree it judged foreign. That inference could hide the project's own red suite, and it alternated between two trees.
58
+ - **A full run runs every execution unit, each in its own directory** (A-SPEC-128.9). A unit is the root or a directory with its own build or configuration file, holding something of its language to test.
59
+ - Covered: a nested go module, a go.work member, a cargo, gradle/maven or dotnet project, a `frontend/` with its own package.json, a `backend/` with its own pyproject.toml.
60
+ - jest and pytest trees under a root that already runs them stay with the root.
61
+ - A sub-module's red test is refused. 128.8 allowed it unrun, and that hid the red.
62
+ - jest is assumed only beside a root `package.json`, and only where there is code to test.
63
+ - **A push without evidence is allowed only when nothing is testable**: no test file and no implementation code, as with README, settings or docs (owner, 2026-11-06). It comes with a notice and a `{ts, head, reason: "no-tests"}` line in `no-evidence-pushes.jsonl`. Implementation code without tests is refused: "write tests" (A-SPEC-128.9).
64
+ - **`.gitignore` and `testRun.excludeDirs` reach the runners.** jest's exclusions are appended to the patterns `jest --showConfig` resolves, so a `jest.config.*` list survives. pytest gets `--ignore`, and go gets a package filter. A tree the user excludes is not detected, counted or run. cargo, gradle/maven and dotnet take no directory exclusion (A-SPEC-128.9, A-SPEC-128.10).
65
+ - **The file universe is what git sees** (`git ls-files --cached --others --exclude-standard`) minus `excludeDirs`. Nested `.gitignore` files count, and a tracked file under a later ignore pattern stays in (A-SPEC-128.10).
66
+ - **After the run, every detected test must have run** (A-SPEC-128.10). jest and pytest are checked per file, go per package, and cargo, gradle/maven and dotnet per build root.
67
+ - A test that a runner configuration (jest `roots` or `testPathIgnorePatterns`, pytest `testpaths`) left unrun is named, and the push is refused as `collect`.
68
+ - A directory with its own jest or pytest configuration is its own unit, and its parent skips it.
69
+ - **Code is judged per build root.** A build root whose code has no executed test is refused, and code with no build file names the file to add. Configuration and docs files (`*.config.*`, `conf.py`, `.eslintrc.*`, `setup.py`) are not code; `.groovy` and `.scala` are (A-SPEC-128.10).
70
+ - **A refusal is `fix-tests`, `collect`, `rerun` or `environment`.**
71
+ - `environment` is the runner itself missing, or a stop at the 180-minute ceiling: install the runner, or split the suite or ask the owner. An ENOENT inside a test, or a module a test imports, is the tests. Neither act names an exclusion.
72
+ - pytest runs with `-p no:cacheprovider`, so a run leaves no `.pytest_cache` (A-SPEC-128.9, A-SPEC-128.10).
73
+ - **A `test_*.py` with no test function, under no collection rule, is not a test.** It is named in `notTests` and never required (A-SPEC-128.10).
74
+ - **Every module name, and the channels themselves** (A-SPEC-128.17).
75
+ - The environment question now asks every dotted module name of HEAD's tracked python files. That covers namespace packages, `python/` and `packages/x/src` layouts, and a finder that redirects only a submodule. HEAD is appended last to `sys.path`, so a parent package resolves.
76
+ - The cap is `testRun.pythonNames` (default 20,000).
77
+ - An interpreter import-path entry or a `NODE_PATH` entry inside the work tree is environment on its own.
78
+ - `loadConfig` now keeps `testRun.linkWalk` (it was dropped, so the setting never took effect).
79
+ - The question runs with `-P`, so HEAD's own `json.py` cannot run in it; python 3.11 or later is needed.
80
+ - The answer is read from a file, not stdout, and the question runs within the run's budget and process group.
81
+ - **The run's environment is asked where HEAD's own names resolve, before any test** (A-SPEC-128.16). The 128.15 record was one snapshot of the main process. A subprocess import, xdist workers and a fixture that restores `sys.modules` all escaped it, because all three use an environment that already resolves HEAD's names to the work tree.
82
+ - The interpreter is started in HEAD's worktree with the unit's environment, the current directory removed from `sys.path`. It reports `find_spec` for each of HEAD's top-level names (the unit, its `src/`, the root and the root's `src/`). One resolving into the work tree is environment.
83
+ - node resolves HEAD's package names from each package directory, `NODE_PATH` included.
84
+ - Exemptions are the interpreter's library directories (sysconfig stdlib, platstdlib, purelib, platlib), so a venv at the work tree root no longer exempts the whole tree.
85
+ - `testRun.linkWalk` sets the walk bound, and an unreadable directory is environment.
86
+ - Install detection reads `pnpm@8`, `npm exec -- โ€ฆ` and `--workspace <x>`.
87
+ - **The run's provenance is judged by what it loaded, not by listing channels** (A-SPEC-128.15). A re-review of 128.14 found two channels the list missed:
88
+ - a `.pth` import that installs a `sys.meta_path` finder (how editables, hatch, pdm, scikit-build-core and meson-python work);
89
+ - a workspace link deeper than two levels of `node_modules`.
90
+ - What changed:
91
+ - pytest now runs with a holmes plugin that records every loaded module; one from the work tree, outside HEAD's worktree and the interpreter's prefixes, is environment. The import-path pre-check is gone.
92
+ - Every link of a linked `node_modules` is resolved at any depth (bounded: 500,000 entries or 20 s).
93
+ - GOFLAGS is go's own value (`go env`, so a `go env -w` file counts), and `-test.run`/`-test.skip` count.
94
+ - `PYTEST_PLUGINS` is dropped.
95
+ - `--confcutdir` is the inifile's directory again, pytest's own default.
96
+ - Short-option clusters stop at a value-taking option, so `-Wmodule` and `-pmypkg` are not selections. An indented line continues addopts.
97
+ - The worktree base is `holmes-headwt-<user>`, not `holmes-run-<user>`: run exec sweeps `<tmp>/holmes-run-*`. A group- or world-writable base is refused. A worktree git cannot remove is named in the answer (`worktreeLeft`). Empty key directories are removed. Sparsity inherited through the worktree's own config is turned off there.
98
+ - Install detection skips flag values and reads through `npx`, `corepack` and `sh -c`. Prepare and the units share one budget.
99
+ - **HEAD's worktree moves out of the repository, and holmes removes only what git lists there** (A-SPEC-128.14, security). In 128.13 the leftover sweep built a path from any `*.owner.json` name and deleted it without asking git. A file named `...owner.json` removed the repository root and `.git`; a link with an owner file removed a user's linked worktree and its uncommitted work.
100
+ - The location is `<os tmp>/holmes-run-<user>/<key>/<id>/`. The base directories are 0700 and refused when they are a link or another user's. `.holmes-run/` no longer has to be gitignored.
101
+ - Removal is `git worktree remove --force` of an exact listed path that is id-shaped and directly under the key directory. No `rmSync`, no repository-wide `git worktree prune`.
102
+ - The worktree is made with `--no-checkout`, then `reset --hard` with sparsity off for that call: no post-checkout hook runs, and the shared `.git/config` is untouched.
103
+ - `testRun.prepare` runs within the run's `timeoutMinutes`. A package-manager install is refused.
104
+ - **The run reads only HEAD:**
105
+ - a `node_modules` entry linking into the work tree, or a python import path inside it (editable install), is environment;
106
+ - pytest gets HEAD's configuration file with `-c` (an empty one when HEAD has none) and `--confcutdir` at the worktree root;
107
+ - attribution and RED-first records read HEAD's anchors.
108
+ - **Selection is judged conservatively:**
109
+ - `-k`, `-m`, a clustered `k`/`m`, `--deselect`, `--lf` or `--sw` anywhere in the addopts of any pytest configuration file at or above the unit is environment, in INI continuation, TOML string and multi-line array forms alike;
110
+ - `PYTEST_ADDOPTS` is dropped;
111
+ - `GOFLAGS -run/-skip` is environment.
112
+ - The outside-the-repository judgement is made from the repository root.
113
+ - **A full test_run tests the commit: a clean worktree of HEAD** (A-SPEC-128.13; location amended by 128.14). Untracked, ignored, modified, assume-unchanged and skip-worktree files never reach the run. 128.12 refused only modified or deleted tracked source; a red HEAD still pushed with an untracked helper, a modified json, snap or jest config, or an assume-unchanged file (both re-reviewers reproduced it).
114
+ - holmes links the gitignored `node_modules` and runs `ax.config.json` `testRun.prepare` (an argv; never guessed) before the units. This repository declares `npm run build`.
115
+ - The record carries `ranIn: head-worktree` and the times of creation, preparation and run. The push gate accepts no full record without the marker; an older one is rerun.
116
+ - The work-tree rule of 128.12 is removed, and editing after a green run no longer voids the commit's evidence.
117
+ - **Passed means exit 0 and no failure in the report**: jest `numFailedTests`/runtime errors, JUnit failures/errors, go `fail` events. `testFailureExitCode: 0`, pytest `session.exitstatus = 0` and `TestMain`'s `os.Exit(0)` no longer pass a red.
118
+ - Code is credited only by executed tests of the scanned universe; a test outside the repository is environment. A gitlink under a dot directory is excluded and named too.
119
+ - go expects only the `_test.go` files `go list` builds on this platform with no tags; the others are named in `notBuilt`. A red behind a build tag is a named limit.
120
+ - Also outside the surface: test files of rust, java, C# or go under no build root; unsupported build files (Gemfile, composer.json, โ€ฆ); pytest `python_functions`, `python_classes`, `-k`/`-m` in addopts; jest `testNamePattern`. "Nothing to test" also needs no test file.
121
+ - jest: one configuration source (the root's or one directory's); a script's `--config` is outside the surface, a `jest.config.base.js` fragment is not. pytest skips its default norecursedirs and gets `--confcutdir`.
122
+ - **Push evidence only on the 0.40.x supported surface; outside it, one honest refusal** (A-SPEC-128.12, owner decision 2026-11-08). The same axis broke a third time on new inputs, so 0.40.x was narrowed. README opens with the table.
123
+ - Evidenced: jest with one configuration and one project, pytest under default names, go. Refused as `environment`, "์ด ๊ตฌ์„ฑ์€ 0.40.x๊ฐ€ ์ฆ๋น™ํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค โ€” 0.41 / ์˜ค๋„ˆ ๊ฒฐ์ •":
124
+ - cargo, maven/gradle and dotnet build roots;
125
+ - jest `projects`, several jest configurations, or one chosen with `--config`;
126
+ - a declared pytest `python_files`;
127
+ - a work tree whose tracked tests or code differ from HEAD.
128
+ - holmes passes jest no ignore argument and makes no `--listTests` call. Exclusions (`.gitignore`, `excludeDirs`, submodules) are judged after the run. A test jest reported under one leaves the judgement; if it ran red, the push is `environment`, naming it. 128.11 merged every project's ignore list onto the CLI, and jest applied it to every project, so one project's red was hidden.
129
+ - A build root's code is tested only by an executed test whose own nearest build root is that root. 128.11 also counted "a unit ran at this root", and a root unit that ran a nested package's tests credited the root.
130
+ - A git submodule is excluded whatever `excludeDirs` says. Before, an entry naming the gitlink dropped it from the exclusions and its red ran.
131
+ - go: GOOS/GOARCH file names are matched to this platform; test names are Unicode identifiers; the module's `vendor/` is not expected (a nested `internal/vendor` is, since go runs it).
132
+ - No runner reader throws: a config logging a JSON list of paths that do not exist made 128.11 throw out of the handler.
133
+ - A run that names an environment is never "nothing to test": a cargo crate whose only code held its tests passed that way.
134
+ - The jest, JUnit and go report readers moved to `review/test-reports.ts`; `test-runner.ts` is 1,073 lines.
135
+ - **No inference before the run; an unreadable output is refused, never defaulted** (A-SPEC-128.11).
136
+ - The expected tests are named by default naming only, plus a declared pytest `python_files`. pytest `testpaths` and a narrower `python_files` no longer remove a file, so a test they leave unrun is refused as `collect`.
137
+ - A build root's code is tested only by a test whose own nearest build root is that root, or by a unit run at it. Before, a nested jest package's tests counted for the root's python code.
138
+ - jest's report is read from `--outputFile`, and `--listTests` / `--showConfig` from well-shaped JSON only. A config that logs `[โ€ฆ]` or `{โ€ฆ}` no longer drops the user's patterns to jest's default. Every project's `testPathIgnorePatterns` is kept. An output that cannot be read makes the unit `environment`. pytest gets `--rootdir=<unit>`.
139
+ - A git submodule is an excluded tree, named in `notDetected`. A sparse checkout that leaves a test file out of the work tree is `environment`.
140
+ - go: a package whose tests all skip counts as run; `testdata/` and `_`/`.` directories are not expected; a `_test.go` with no test function is in `notTests`.
141
+ - The scan decides each directory once: 20,000 files under 2,000 build roots scan in about 0.55 s measured alone.
142
+ - Named limits: a pytest `-k` deselection inside a file, and go build tags, are below the evidence granularity.
143
+ - **A full run is evidence only when every test ecosystem the project has ran.**
144
+ - Detection also reads configuration files: `pytest.ini`, `tox.ini`, `setup.cfg` with `[tool:pytest]`, `pyproject.toml` with `[tool.pytestโ€ฆ]`, `go.mod`, `Cargo.toml`, `pom.xml`, `build.gradle` and `*.csproj`.
145
+ - A green full run that missed one records a full attempt and names the missing ecosystem (`notFullBecause`).
146
+ - **`reference/` is no longer skipped by default.** List vendored or reference trees in `ax.config.json` under `testRun.excludeDirs`.
147
+ - A full run that is red, stopped or short of an ecosystem leaves a `full-attempt` record. A push after it is refused instead of passing as an unrun repository.
148
+ - A test-evidence file that exists but cannot be read is a push refusal. Before, it passed with the activation notice.
149
+ - `full: true` is refused together with `mutate`, or with `base` or `head` alone; a `null` base or head reads as omitted.
150
+ - The defect this closes: in 0.40.0 a passing scoped run wrote the same two records a full run writes. Those were the test evidence the push gate reads and the `last-green` baseline that later runs narrow against.
151
+ - Measured on this repository on 2026-11-05:
152
+ - one scoped run of 25 tests passed after two full runs of the same line had failed;
153
+ - the push gate then accepted the head;
154
+ - `last-green` held a tree no full run had verified.
155
+ - **`test_run({root, full: true})`** runs the whole suite whatever changed. It is refused together with `base`/`head`.
156
+ - The push refusal, the gate's no-ledger notice and the publish playbook all name this call.
157
+ - Running exactly that call clears the refusal.
158
+ - Only a full run writes the test evidence and a baseline. Both carry `mode: full` and the tier. The test evidence also carries the number of test files that executed (`ranFileCount`) and the ecosystems that ran (`ranWith`).
159
+ - **A full run runs every test ecosystem the project has** (for example jest and pytest), not only those the change touched. A full run can therefore now fail on an ecosystem it used to skip.
160
+ - A scoped run writes `.ax/ledger/scoped-evidence.json`. It does not write the test evidence or any baseline, so `mark` on a scoped run records nothing. The answer says `baselineSkipped: "not a full run"`. A noop run writes nothing.
161
+ - The push gate accepts only full evidence, and so does `holmes-kit review mrp`. The refusal names the record's tier and mode and says "full test_run ํ•„์š”".
162
+ - A record written before this release has no mode. It is refused once, until the next full run replaces it.
163
+ - A repository with only scoped records is refused too, and so is one whose scoped record exists but cannot be read.
164
+ - One with no record at all still passes with the activation notice.
165
+ - Narrowing trusts a baseline only when its provenance anchor says `mode:full`.
166
+ - The first `test_run` after the upgrade therefore runs the full suite.
167
+ - A label written with `mark` before this release is untrusted.
168
+ - Known limitation: a full Go run is not attributed to package directories, and a cargo run is not attributed to crate files, so the Stop hook's ART-4 sees no execution for Go and Rust A-SPECs after a full run. The push gate does not depend on it.
169
+ - Known limitation: the Stop hook's execution counts, `requirement_triage` and `maintenance_analyze` read the test evidence only.
170
+ - Between full runs they see it as stale; scoped runs do not refresh it.
171
+ - The Stop hook's "an explicit 0 is a violation" check therefore sees fewer zeros.
172
+ - `requirement_triage` reports fewer requirements as fulfilled.
173
+ - **BREAKING (gate-behavior, owner decision 2026-11-05): `holmes-kit init`'s autonomy question defaults to Y on a first install at a person's own terminal (A-SPEC-552.2, 552.3).**
174
+ - There, Enter turns autonomous spec approval on, and the question shows `[Y/n]`. Only low-risk specs approve themselves; governance-critical, high-risk and irreversible ones still ask.
175
+ - Under an agent harness or with `CI` set, Enter keeps the current value, and a first install stays off (`[y/N]`). Only a typed `y` turns it on. A harness is a harness marker in the environment or a harness among init's parent processes. Any other answer turns it off.
176
+ - A re-init defaults to the project's current value, read as the runtime reads it.
177
+ - Enter on a re-init writes nothing, so the value stays where it was. A switch another server entry holds is never copied into Holmes-Kit's own entry (A-SPEC-552.4).
178
+ - A `.mcp.json` that cannot be read or parsed counts as off. So do `{}`, a non-object `mcpServers` and a dangling link.
179
+ - To turn the project default off: `holmes-kit init --no-autonomy`, or remove `HOLMES_AUTONOMOUS_APPROVAL` from `.mcp.json`. `holmes-kit autonomy off` ends session autonomy only.
180
+ - When another server entry in `.mcp.json` still holds the switch, `init --no-autonomy` names that entry and exits 1. It does not edit another entry's env. `--no-autonomy` with `--no-mcp` prints a note that the posture is unchanged.
181
+ - Every non-interactive path is unchanged: with no terminal and no flag the posture is preserved, and `--autonomy` still needs an out-of-band `autonomy-grant` approval.
182
+ - **Limits:** a program that types `y` into a terminal it drives is a forgery this does not stop; the hook prevents accidents and is not a security boundary.
183
+ - **BREAKING (narrow): `test_run` refuses a key its schema does not declare (A-SPEC-466.2).** A call such as `{ root, maxWorkers: 2 }` used to run with the key ignored; it is now refused before the run.
184
+ - **BREAKING (text only): in a Claude Code session, a pre-edit impact warning is said once, then not again while it is in context (A-SPEC-333.1 to 333.8).**
185
+ - Under `warn`, the warning is a line that says the verdict's strength and the outcome first: `[Holmes-Kit:<codes>] <file> โ€” refuseโ†’allowed (warn); to clear: run maintenance_analyze naming this file โ€ฆ [<analysis digest>]`.
186
+ - Each code's explanation (what was found and how to clear it, with the call's arguments) is added once per compaction epoch. SessionStart opens a new epoch, first thing, for every source, compaction included.
187
+ - The epoch is void when the transcript shrank or a newer compact boundary is in its tail. A boundary counts only when its line parses as one, and the void persists.
188
+ - The same line is not said again in the epoch until 29 more warnings have passed, until that file has been judged silent 5 times since it was last said, or until its detail changes (another analysis, another file). A target-drift step says to re-analyze before the commit, not before every edit.
189
+ - `contract-untested` belongs to the analysis, not to the edited file. It is said in the first warning under an analysis in each epoch, and the same agent's later warnings under that analysis leave it out of their line (A-SPEC-333.7, 333.8).
190
+ - A subagent and its parent each hear it once: one's context does not hold what the other was told.
191
+ - Beside other codes it is left out only while recent: after 29 judgements it is said again (A-SPEC-333.9).
192
+ - A warning whose only code it is says nothing, under the same caps as every other silence: it is said again after 29 judgements or 5 silences of that file.
193
+ - The ledger row keeps every code.
194
+ - An allowed `git commit` carries, once per epoch, one line naming up to 3 files whose last judgement was a refuse verdict, and how many more. The line counts every agent of the session: a subagent's warned file is named at the parent's commit. The command is read with quotes, line continuations, `sh -c` scripts and the `env`, `command`, `time` and `nohup` prefixes; `git commit --dry-run` does not count.
195
+ - Each committed warning, in every harness, appends one row to a judgement ledger kept outside the epoch store, rotated at 1MB and kept to 5 rotated files per session. The behaviour metric over it is descriptive, not a gate.
196
+ - The row holds `said`, `line` or `silent`, its project, its tool_use id and `wording_version`.
197
+ - It also holds `said_chars` and `full_chars` (A-SPEC-333.8), and `harness` and `compress` (A-SPEC-333.9). A later holdout can judge occupancy from the ledger alone. A said commit reminder is a `reminder` row.
198
+ - **Limits:**
199
+ - The store and the ledger live under the OS temp directory, so a reboot or a temp cleanup can erase them.
200
+ - A commit made outside Bash, through an alias or a script file, is not reminded.
201
+ - The commit reader misses a commit inside backticks, after `xargs`, `sudo`, `exec`, `timeout`, `nice` or `env -u`, inside a `{ โ€ฆ; }` group, or after `!`. It counts one in a here-document's body or after a `#` comment mark.
202
+ - W and K rows written without a time by an earlier build are read as time 0.
203
+ - Two hooks evicting the same table at once can lose one append.
204
+ - Eviction keeps the newest 50 W, K, P and streak rows.
205
+ - Codex and Antigravity warnings stay in full: their compaction signal is not observed yet.
206
+ - Nothing is recorded while judging. Only what the final allow actually carried is recorded, so a counterfactual re-ask or a later layer's deny never counts as "said".
207
+ - The decision, the codes, the ledgers and every `block` denial are unchanged.
208
+ - The warning stays in full when:
209
+ - the hook input has no session id;
210
+ - this hook saw no SessionStart for the session;
211
+ - the store under `<tmp>/holmes-kit-<uid>` cannot be trusted. That means inside the project, a link, another owner, group- or other-writable, not a regular file, or over its 64KB bound (old keys are evicted at the bound). It also covers any I/O error or a read over 50ms.
212
+ - **Target not met (grey zone).** The registered target is c/d โ‰ค 0.15, both pooled and as the session median. The pooled value is under it and the median over it.
213
+ - The replay ran the shipped code and keys over this repository's transcripts.
214
+ - Scope: 5 sessions with their subagents (379 files, listed with their sizes), uuid de-duplicated across files, the commit reminder included, an epoch opened at every compact boundary.
215
+ - Counted: 9,405 warnings. Left out: 212 (2.2%), split as follows:
216
+ - 0 unparsable lines;
217
+ - 0 lines already in the compact form;
218
+ - 206 uuid duplicates;
219
+ - 6 with a target the replay could not place.
220
+ - The 9,279 of an earlier count is the same corpus before its sessions grew.
221
+ - The advisory change alone brings the warning text to 0.174 of its size. Per session: 0.166, 0.179, 0.221, 0.331, 0.263 (median 0.221).
222
+ - The architecture-axis change below is measured by a model replay that takes a tree as dirty after an edit and clean after a commit. It removes 3,455 of the 3,621 `architecture-unchecked` warnings. With it the replay gives 0.145 pooled; per session 0.133, 0.156, 0.195, 0.264, 0.263 (median 0.195).
223
+ - These replace the 0.147 and 0.198 stated in the earlier draft. They were re-measured after the review repairs (A-SPEC-333.8, 333.9). One repair applies the repeat rule before `contract-untested` is left out, so an identical warning on the same file stays silent.
224
+ - The two largest sessions hold 94.8% of the text, so this is a development-set estimate. The final judgement is left to a prospective holdout of at least 8 sessions of a compressing harness, read from the ledger's `said_chars`, `full_chars`, `harness` and `compress`. Today only Claude Code compresses, so a second-harness condition waits until another harness does.
225
+
226
+ - **`maintenance_analyze` assesses the architecture axis from the working tree's own diff when no `changedFiles` is given (A-SPEC-293.1).**
227
+ - The diff (`git diff --name-only --relative HEAD` plus untracked files under the analysed root, without the governance store's runtime state) feeds the architecture axis only. The prediction is the same with or without it, and it is never recorded as the caller's `changedFiles`, which the pre-edit gate reads as "named by the request".
228
+ - The two git children run with the repository's programs switched off (no fsmonitor, no hooks path, no untracked cache, no optional locks) and share one 5-second deadline. Decision and C-SPEC documents are taken first into the 2,000-file bound, and a cut list says so in `unknowns` (A-SPEC-333.8).
229
+ - `unknowns` also says the basis came from the working tree's diff, which holds no file the request has yet to change.
230
+ - The persisted analysis records the governing files that basis held (`uncertainty.architectureTouched`).
231
+ - The pre-edit gate keeps `architecture-unchecked` (widen) for an edit of a decision or C-SPEC document the basis did not hold (A-SPEC-333.9).
232
+ - It reads the persisted `changedFilesSource`, not the explaining sentence, which the persisted analysis never held (A-SPEC-333.10).
233
+ - **Limit:** the hook does not run the pre-edit evidence gate on an edit of a governing document, so this edge holds through `impact_gate_check` and the library only. Wiring the hook to it is listed for a later release.
234
+ - A timeout under that deadline is the analysis's own and blocks no later git call for the root.
235
+ - A clean or non-git tree keeps the axis disclosed as not assessed. The answer and the persisted analysis say `changedFilesSource`: `caller`, `git-diff-default` or `none`.
236
+ - Measured on this repository's transcripts: `architecture-unchecked` rode 38% of the pre-edit warnings, all from analyses asked without `changedFiles`.
237
+
238
+ ### Fixed
239
+ - **A red `test_run` names its failing tests (A-SPEC-466.3, 466.4).** The names came first, but one tail over the names and jest's stderr kept only the last 40 lines, so a long stderr pushed every name out (measured: a five-failure run named none).
240
+ - The names and the stderr are now bounded apart: up to five names, each `file โ€บ title` cut at 200 characters and its first message line cut at 300, then the last 30 lines of stderr (at most 4,000 characters). The whole red tail stays under 7,000 characters.
241
+ - A suite that failed to run is named with its cause line, the one after jest's `โ— Test suite failed to run` header. Such suites come before failing assertions, so the five-name bound always shows them (A-SPEC-466.5).
242
+ - **The verify-release stale-sweep row and the two doctor FIFO rows no longer depend on the clock (A-SPEC-466.1, 466.2).** The stale-sweep row sets the kept file's time to exactly the build start. The two FIFO rows take the same budget as their sibling rows.
243
+
10
244
  ## [0.40.0] - 2026-11-03
11
245
 
12
246
  The orchestration hardening, the full profile's push and publish flags, the gate's reading of commands that build a path into `.ax`, the full profile named where people look, and a published package that names no consumer workspace or personal host. The hook prevents accidents; its forgery resistance is not verified (Known limitations).
package/README.md CHANGED
@@ -11,10 +11,53 @@
11
11
  <!-- holmes-kit:attest:begin -->
12
12
  ![traced files](.ax/badges/traced.svg)
13
13
 
14
- **536/536** source files (100%) trace to an approved spec ยท **1170/1266** approved A-SPECs (92.4%) are anchored from code.
15
- Measured at `b487a60cb479` (specs `sha256:4432137ee912`) โ€” reproduce with `holmes-kit attest --exclude docs/goals/probes/`.
14
+ **542/542** source files (100%) trace to an approved spec ยท **1210/1307** approved A-SPECs (92.5%) are anchored from code.
15
+ Measured at `582e92298192` (specs `sha256:3fce6501f474`) โ€” reproduce with `holmes-kit attest --exclude docs/goals/probes/`.
16
16
  <!-- holmes-kit:attest:end -->
17
17
 
18
+ ### 0.40.x push evidence: the supported surface
19
+
20
+ The pre-push gate accepts a full `test_run` as evidence only where holmes can check the run afterwards without changing your runner configuration. Outside that surface the push is refused as `environment`, with one message: "์ด ๊ตฌ์„ฑ์€ 0.40.x๊ฐ€ ์ฆ๋น™ํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค โ€” 0.41 / ์˜ค๋„ˆ ๊ฒฐ์ •". General support is planned for 0.41.
21
+
22
+ **A full run tests the commit, not your work tree.**
23
+ - It checks HEAD out as a temporary git worktree **outside the repository**, in `<os tmp>/holmes-headwt-<user>/<repository key>/<id>/`, made with no git hooks and no write to your git configuration. It links your gitignored `node_modules`, runs `ax.config.json` `testRun.prepare` there if you declare one (for example `["npm", "run", "build"]`; nothing is guessed, and a package-manager install is refused because `node_modules` is your work tree's), runs the suite within the run's time budget, and removes the worktree.
24
+ - holmes removes only a worktree git lists at that exact path, through `git worktree remove`; it never deletes a directory itself and never runs `git worktree prune`. A leftover of a run whose process is gone is removed by the next run.
25
+ - Untracked, ignored, modified, assume-unchanged and skip-worktree files never reach the run, so a red commit cannot pass on a green work tree. Nothing is written inside your repository, and nothing has to be added to `.gitignore`.
26
+ - **The run must read only HEAD, judged by what it loaded.**
27
+ - A symbolic link anywhere in a linked `node_modules` that resolves into your work tree (a workspace package, at any depth) is `environment`, naming the link.
28
+ - Before any test, the pytest interpreter is started in HEAD's worktree (`python -P`, so 3.11 or later) and asked where every dotted module name of HEAD's python files resolves (every layout and namespace package; capped by `testRun.pythonNames`, default 20000). An import-path entry or a `NODE_PATH` entry inside your work tree is `environment` by itself. A name that resolves into your work tree is `environment`, naming it, whatever the tests later do: subprocesses, xdist workers, a `sys.modules` restore. Typical causes are an editable install, a `.pth` finder or `PYTHONPATH`.
29
+ - pytest also runs with a holmes plugin that records every module it loaded, judged the same way. The exempt locations are the interpreter's own library directories.
30
+ - node is asked the same question for HEAD's package names, `NODE_PATH` included. The `node_modules` walk is bounded by `ax.config.json` `testRun.linkWalk` (`{ "entries": 500000, "seconds": 20 }` by default), and a directory it cannot read is `environment`.
31
+ - Named limits:
32
+ - a HEAD conftest that rewrites the plugin's record (a forgery; the environment question still holds);
33
+ - a package that requires your work tree by absolute path;
34
+ - a legacy sparse checkout (`core.sparseCheckout` in the shared config) keeps the worktree sparse, since turning it off would write your shared git configuration;
35
+ - a JavaScript workspace monorepo whose `node_modules` links into the work tree, and a `NODE_PATH` entry inside the work tree, are refused as `environment`;
36
+ - the environment question imports HEAD's packages to find their submodules, so a package `__init__` runs during it;
37
+ - xdist is judged by the environment question; no xdist run was measured.
38
+ - After upgrading to 0.40.1, run `test_run({ root, full: true })` once at the commit you push: records of 0.40.0 and scoped runs are no longer push evidence. A pytest project needs python 3.11 or later.
39
+ - pytest reads HEAD's own configuration file, pinned with `-c`.
40
+ - `PYTEST_ADDOPTS` and `PYTEST_PLUGINS` are dropped.
41
+ - `GOFLAGS` with `-run` or `-skip` (also `-test.run`, and also set through `go env -w`) is `environment`.
42
+ - The pytest interpreter is still the work tree's (a `.venv` is not in HEAD).
43
+ - A scoped run stays in the work tree.
44
+
45
+ | Runner | Evidenced in 0.40.x | Refused as `environment` |
46
+ |---|---|---|
47
+ | jest | One jest configuration source (the root's, or one directory's) with one project. holmes passes jest no ignore argument. Passed means exit 0 **and** no failure in the report. | `projects`; jest tests at the root beside another directory's configuration, or two configurations; a package.json script that runs jest with `--config`/`-c`; a configured `testNamePattern`; output `--showConfig` cannot print |
48
+ | pytest | Default test names (`test_*.py`, `*_test.py`), outside pytest's default norecursedirs. `--rootdir` and `--confcutdir` are the unit, and `--ignore` adds your exclusions. Passed means exit 0 **and** no JUnit failure or error. | a declared `python_files`, `python_functions` or `python_classes`; `-k`/`-m` in `addopts` |
49
+ | go | The `_test.go` files `go list` builds on this platform with no tags, per package. Passed means exit 0 **and** no failed test event. Files go does not build here are named in `notBuilt`. | go test files under no `go.mod` |
50
+ | cargo, maven/gradle, dotnet | โ€” | a build root holding tests or code; test files of those languages under no build root |
51
+ | others | โ€” | a build file 0.40.x has no runner for (Gemfile, composer.json, Package.swift, build.sbt, mix.exs, CMakeLists.txt, pubspec.yaml) |
52
+
53
+ - **Exclusions** (`.gitignore`, `ax.config.json` `testRun.excludeDirs`, git submodules) differ by runner:
54
+ - pytest takes them as `--ignore`, and go leaves those packages out;
55
+ - jest is told nothing, and the tests it reports under an excluded tree leave the judgement. If such a test ran red, the push is `environment`, naming the file: the runner's own configuration must leave it out too;
56
+ - a git submodule is empty in HEAD's worktree, and named.
57
+ - **Code** is tested only by an executed test of the scanned universe whose own nearest build root is the code's. That a unit ran is not evidence, and a test outside the repository credits nothing.
58
+ - **A push without evidence** is allowed only when there is nothing to test: no test file and no implementation code.
59
+ - **Named limits:** a red behind a go build tag; a `-k` deselection that is not declared in configuration; a linked `node_modules` that differs from the lockfile.
60
+
18
61
  ---
19
62
 
20
63
  ## ๐Ÿ•ต๏ธ Philosophy & Vision: Beyond Code Generation
@@ -127,7 +170,7 @@ Measured at `b487a60cb479` (specs `sha256:4432137ee912`) โ€” reproduce with `hol
127
170
  - ๐Ÿ“‹ **Requirements & specification governance**: strict **"No Spec, No Code"** across a 4-tier chain (`REQ โž” H-SPEC โž” A-SPEC โž” T-SPEC`) with `// @implements A-SPEC-XXX` code anchors โ€” comma-lists and every anchor in a file participate in the gate.
128
171
  - ๐Ÿ”ด **Inbuilt TDD โ€” RED-first, recorded and judged** *(0.9.0)*: constitution article **ART-8** reads a recorded `red-assertion โ†’ green` sequence in the ledger, and a `red-error` (a test that could not run) is not a valid RED โ€” so "the covering test failed *correctly*" is judged from the record, not on trust. It ships observe-first (`redFirstEvidence: track`): it reports, and blocks only under `strict`. Where superpowers *asks* for RED-first, holmes-kit *records* whether it happened.
129
172
  - ๐Ÿงฑ **Deterministic gate** *(0.8.0, 0.13.0)*: shell writes are judged at the segment's **effective working directory**, the governing anchor is the whole set rather than the first match, a project is governed when **any** spec exists, and `cp`/`mv` are classified by **destination**.
130
- - ๐Ÿค– **Autonomous approval โ€” three layers** *(0.8.0, reworked 0.13.0; session UX 0.29.0)*: a project default (`init --autonomy`) and an expiring per-session envelope let the agent seal **low-risk** specs itself under an `autonomous:<client>` actor. Ordinary unclassified HITL work queues without a form; governance-critical, high-risk or irreversible work asks for an in-session confirmation (an approval the same user's agent shell can forge: Known limitations); a form that is not answered returns to the approval queue *(since 0.35.3 โ€” it was recorded as an approval before)*. No holmes-kit tool grants autonomy to the agent (its own shell writing approval files is the Known limitation above: not a security boundary), the posture is surfaced at every session start, and off is byte-identical to a human-gated project.
173
+ - ๐Ÿค– **Autonomous approval โ€” three layers** *(0.8.0, reworked 0.13.0; session UX 0.29.0)*: a project default (`init --autonomy`, or Enter at `init`'s question: since 0.41 the default is Y on a first install at a person's own terminal, the current value on a re-init (Enter then writes nothing), and the current value or off under an agent harness or CI; only low-risk specs approve themselves, governance-critical, high-risk and irreversible ones still ask; `holmes-kit init --no-autonomy`, or removing `HOLMES_AUTONOMOUS_APPROVAL` from `.mcp.json`, turns it off, while `holmes-kit autonomy off` ends session autonomy only) and an expiring per-session envelope let the agent seal **low-risk** specs itself under an `autonomous:<client>` actor. Ordinary unclassified HITL work queues without a form; governance-critical, high-risk or irreversible work asks for an in-session confirmation (an approval the same user's agent shell can forge: Known limitations); a form that is not answered returns to the approval queue *(since 0.35.3 โ€” it was recorded as an approval before)*. No holmes-kit tool grants autonomy to the agent (its own shell writing approval files is the Known limitation above: not a security boundary), the posture is surfaced at every session start, and off is byte-identical to a human-gated project.
131
174
  - ๐Ÿงญ **Compatibility and evolution gates** *(0.14.0, 0.15.0)*: a new A-SPEC seals only with `harness_impact:` and `os_impact:` declared and machine-cross-checked against Files-to-Touch; separately, a changed in-scope source that **newly introduces an external dependency** raises a spec-reappraisal โ€” a warning when manual, a queued item under autonomy, never a blocked turn.
132
175
  - ๐Ÿšข **Release autonomy + docs-currency gate** *(0.13.0, machine-checked in 0.23.2)*: `npm publish` runs `verify-release` through `prepublishOnly`, which refuses a dirty tree, a missing or old release test-lane receipt and a badge that has not moved, and checks the docs โ€” a stale doc is a false claim. Without a full profile the hook gives `npm publish` no decision (measured on a scratch project); under one, it follows `--allow-publish`. The risk rules for a release are in the publish playbook and are a procedure: nothing runs the classifier for you.
133
176
  - ๐Ÿง  **3-tier semantic layer** *(local preparation default in 0.29.0)*: BGE-M3 is prepared and verified locally during a normal npm installation (zero repository-text egress); `HOLMES_SKIP_MODEL_INSTALL=1` is the explicit opt-out. `cloud` remains the opt-in `gemini-embedding-001` tier. Measured on 305 traceability cases: recall 0.486 โ†’ 0.667 โ†’ **0.887**; on lexical-zero requests 0% โ†’ 52% โ†’ **92%**. Surfaced additively, never as a hard filter.
@@ -138,7 +181,30 @@ Measured at `b487a60cb479` (specs `sha256:4432137ee912`) โ€” reproduce with `hol
138
181
  - ๐Ÿ”” **Approval UX** *(0.3.1; inbox split 0.15.0; in-session recovery 0.29.0)*: the agent-session UI is primary; the tracked queue is the fallback when the client cannot present it. A form timeout is distinguished from cancel/unavailable, and in every mode it returns the request to the queue. The queue holds **decision-seeking requests only** โ€” plain gate refusals live in a local per-machine log (raw commands never leave the machine), after 1,404 single-shot refusals were measured burying a 2-item inbox.
139
182
  - โฌ†๏ธ **Zero-config upgrades & session banner** *(0.8.0โ€“0.12.2)*: `holmes-kit upgrade` re-pins **every** recorded workspace in one command (`--dry-run`/`--yes`), and every session start states the version, the governance rule and any newer published version โ€” from every harness's MCP startup, not just Claude's. The write stays your explicit choice, never a silent auto-install.
140
183
  - ๐Ÿงฐ **Governance UX tools** *(0.10.0)*: `spec_unseal` (return a sealed spec to editable `draft` in one act, out-of-band approval required), `approval_status` and `ledger_timeline` for read-only observability, and a structured `conflict` on optimistic-concurrency refusal.
141
- - ๐Ÿšฆ **Push & server-side re-validation** *(hardened in 0.8.0)*: a local `pre-push` evidence gate (test-run ledger head == push HEAD, green, executed > 0) plus a server-side workflow that re-runs `npm ci โ†’ build โ†’ full suite โ†’ tarball install probe`. Where that workflow runs, a `--no-verify` push or a hook-less clone shows as a failed run; it detects, it does not prevent, and write access can change or cancel it.
184
+ - ๐Ÿšฆ **Push & server-side re-validation** *(hardened in 0.8.0)*: a local `pre-push` evidence gate (a FULL test run โ€” `test_run({root, full: true})` โ€” at the push HEAD, green, with at least one executed test in every detected test ecosystem; a scoped run is never push evidence, and an unreadable or mis-shaped ledger is refused) plus a server-side workflow that re-runs `npm ci โ†’ build โ†’ full suite โ†’ tarball install probe`. Where that workflow runs, a `--no-verify` push or a hook-less clone shows as a failed run; it detects, it does not prevent, and write access can change or cancel it.
185
+ - **What a full run runs.** HEAD, checked out in a temporary worktree outside the repository (see the top of this README). The files are what git sees there minus `ax.config.json` `testRun.excludeDirs`. A tracked file stays in even under a later ignore pattern. The record carries `ranIn: head-worktree` and the times of creation, preparation and run; the push gate accepts no full record without that marker.
186
+ - Every execution unit runs with its own directory as cwd.
187
+ - The supported surface is the table at the top of this README; everything outside it is refused as `environment`.
188
+ - The jest unit is the root, or the one directory with its own jest configuration (a `jest.config.*` or package.json `jest` field). pytest units are the root and each directory with pytest configuration (`pytest.ini`, pyproject `[tool.pytestโ€ฆ]`, setup.cfg `[tool:pytest]`, tox.ini `[pytest]`); a parent skips its configured children.
189
+ - A go unit is each `go.mod` holding go code.
190
+ - Holmes never replaces your runner configuration. jest gets no ignore argument; pytest gets `--ignore` (it adds to your configuration) and `--rootdir=<unit>`.
191
+ - Runner output is read from jest's `--outputFile` report or from well-shaped JSON only, so your own console output cannot break it. An output that cannot be read is refused as `environment`, never replaced by a default.
192
+ - A git submodule is always outside the evidence and named in `notDetected`. A sparse work tree does not matter: HEAD's worktree is a whole checkout.
193
+ - **What is checked after the run.** Every detected test must have run, at the granularity its runner reports: jest and pytest per file, go per package. Every build root holding code must have an executed test whose own nearest build root is that root: neither a nested package's tests nor a unit having run stands for its parent's code.
194
+ - The expected tests are named by default naming only (jest's testMatch, pytest's `test_*.py` / `*_test.py`, go's `_test.go`). A runner rule that narrows collection, such as pytest `testpaths`, never removes one, so a test it leaves unrun is refused as `collect`.
195
+ - go: a package whose tests all skip counts as run; a `_test.go` with no test function is named in `notTests`; test names are Unicode identifiers.
196
+ - Named limits: a pytest `-k` deselection inside a file is below file granularity, and go build tags are below package granularity.
197
+ - **What a refusal says.** It names one of four acts. It never recommends hiding a red test.
198
+ - `fix-tests`: a red run, a unit that ran no test, code without tests in a build root, or code with no build file (it names the file to add);
199
+ - `collect`: detected tests that did not run, named. Make the runner collect them, or exclude them if they are not the project's.
200
+ - `rerun`: run the full call at the pushed head, pushing branches one at a time;
201
+ - `environment`: the runner itself is missing, its output cannot be read, the configuration is outside the 0.40.x surface, an excluded tree's test ran red, a test outside the repository ran, HEAD's worktree could not be made or prepared (a run location that is a link or another user's, a failing or installing `testRun.prepare`, a linked work-tree package or import path), or the run stopped at the 180-minute ceiling (split the suite or ask the owner).
202
+ - **Nothing to test.** A repository with no test file and no implementation code (README, settings, docs, configuration files such as `*.config.*`, `conf.py`, `.eslintrc.*`, `setup.py`) pushes with a notice and a `{ts, head, reason: "no-tests"}` line in `.ax/ledger/no-evidence-pushes.jsonl`.
203
+ - **Exclusions are yours.** `.gitignore` and `testRun.excludeDirs` keep a tree out of the universe. An ignored, uncommitted tree is not in HEAD's worktree at all. For a committed excluded tree, pytest and go do not run it; jest is told nothing, and its report of the tree leaves the judgement (a red there is `environment`).
204
+ - An `excludeDirs` entry with a `/` is a root-relative path, so `test/fixtures/pyproj`, `./vendor` and `fixtures/` all start at the root. One without is a directory name at any depth (`pyproj`).
205
+ - Absolute entries, entries that leave the root, and entries that name nothing are ignored and named in `excludeDirsIgnored`.
206
+ - **pytest collection.** Every `test_*.py` / `*_test.py` outside pytest's default norecursedirs is expected; `testpaths` does not narrow the list, and a declared `python_files`, `python_functions`, `python_classes` or `-k`/`-m` in `addopts` is outside the 0.40.x surface. A `test_*.py` that holds no test function is not a test: it is named in `notTests` and never required.
207
+ - **Limit.** If the evidence file and the ledger directory are both made read-only, a red run cannot replace an older green record. The answer names that failure in `recordFailed`.
142
208
  - ๐Ÿงช **Self-healing & diagnostic doctor**: integrity checks that name the fix for each failing one (`doctor`), repair of the recovery skills (`holmes-kit skills refresh`) and of a blocked spec (`spec_remediate`), plus a live report of holmes-kit's own advertised MCP schema token cost.
143
209
  - ๐Ÿ”ข **Sensible spec numbering** *(0.12.1)*: a brand-new project's first slice is **REQ-100**; existing projects keep `max(existing)+1` exactly, and 4-digit ids (including `ADR-1000+`) work cleanly.
144
210
  - ๐ŸŒ **English CLI & hook surface** *(0.13.0)*: the operator-facing CLI, `doctor` output, hook `deny` reasons and interactive prompts are English, guarded by a hangul-absence test over the **rendered runtime output** rather than a source scan. Not yet English: a few strings outside that test (a truncation marker, one `init --dry-run` hint) and the comments in the files `init` writes for roles and `.gitattributes`; planned for 0.41.
package/dist/.build-id CHANGED
@@ -1 +1 @@
1
- bf78b204-mw2004s8
1
+ b33d8589-mw8gsg6z
@@ -37,7 +37,7 @@ exports.isBrokenPipe = void 0;
37
37
  exports.packageRoot = packageRoot;
38
38
  exports.main = main;
39
39
  exports.installPipeGuard = installPipeGuard;
40
- // @implements A-SPEC-794.59, A-SPEC-794.58, A-SPEC-794.55, A-SPEC-794.43, A-SPEC-794.42, A-SPEC-794.41, A-SPEC-794.36, A-SPEC-792.48, A-SPEC-792.49, A-SPEC-704, A-SPEC-773, A-SPEC-770.11,A-SPEC-709, A-SPEC-734,A-SPEC-751, A-SPEC-752, A-SPEC-772.4, A-SPEC-779, A-SPEC-102.2, A-SPEC-774.20, A-SPEC-102.7, A-SPEC-779.2, A-SPEC-792.3, A-SPEC-102.10, A-SPEC-102.12, A-SPEC-774.34, A-SPEC-794.30, A-SPEC-794.32, A-SPEC-794.33, A-SPEC-102.29, A-SPEC-102.30, A-SPEC-102.31
40
+ // @implements A-SPEC-552.4, A-SPEC-552.3, A-SPEC-794.59, A-SPEC-794.58, A-SPEC-794.55, A-SPEC-794.43, A-SPEC-794.42, A-SPEC-794.41, A-SPEC-794.36, A-SPEC-792.48, A-SPEC-792.49, A-SPEC-704, A-SPEC-773, A-SPEC-770.11,A-SPEC-709, A-SPEC-734,A-SPEC-751, A-SPEC-752, A-SPEC-772.4, A-SPEC-779, A-SPEC-102.2, A-SPEC-774.20, A-SPEC-102.7, A-SPEC-779.2, A-SPEC-792.3, A-SPEC-102.10, A-SPEC-102.12, A-SPEC-774.34, A-SPEC-794.30, A-SPEC-794.32, A-SPEC-794.33, A-SPEC-102.29, A-SPEC-102.30, A-SPEC-102.31
41
41
  // @implements A-SPEC-549.2
42
42
  // @implements A-SPEC-591, A-SPEC-626
43
43
  const cli_execution_1 = require("./cli-execution");
@@ -1276,24 +1276,14 @@ async function main(argv, deps = {}) {
1276
1276
  // non-interactive spellings (enabling then needs an out-of-band approval, enforced in runInit);
1277
1277
  // otherwise, at a real TTY, ASK โ€” a `y` there is a human answer (autonomyInteractive), so it
1278
1278
  // needs no token. Non-TTY with no flag leaves it undefined = preserve the current posture.
1279
- let autonomy;
1280
- let autonomyInteractive = false;
1281
- if (flags.autonomy === true) {
1282
- autonomy = true;
1283
- }
1284
- else if (flags['no-autonomy'] === true) {
1285
- autonomy = false;
1286
- }
1287
- else if (process.stdin.isTTY && process.stdout.isTTY && flags['dry-run'] !== true
1288
- && flags.remove !== true && flags['no-mcp'] !== true) {
1289
- const { promptAutonomy } = require('./interactive-prompt');
1290
- if (await promptAutonomy()) {
1291
- autonomy = true;
1292
- autonomyInteractive = true;
1293
- }
1294
- else {
1295
- autonomy = false;
1296
- }
1279
+ // @implements A-SPEC-552.2, A-SPEC-552.3 โ€” the whole decision is resolveInitAutonomy's: Enter means ON on a person's own
1280
+ // terminal for a first install, the current value on a re-init, and OFF under an agent harness or CI
1281
+ const { resolveInitAutonomy, terminalAutonomyIO } = require('./interactive-prompt');
1282
+ const autonomyTarget = path.resolve(typeof flags.target === 'string' ? flags.target : process.cwd());
1283
+ const { autonomy, interactive: autonomyInteractive } = await resolveInitAutonomy(flags, autonomyTarget, terminalAutonomyIO(autonomyTarget));
1284
+ // @implements A-SPEC-552.4 โ€” with no .mcp.json written, --no-autonomy cannot change the posture; say so
1285
+ if (flags['no-autonomy'] === true && flags['no-mcp'] === true) {
1286
+ process.stderr.write('note: --no-autonomy has no effect with --no-mcp โ€” no .mcp.json is written, so the autonomy posture is unchanged\n');
1297
1287
  }
1298
1288
  const opts = {
1299
1289
  agents,
@@ -1396,6 +1386,22 @@ async function main(argv, deps = {}) {
1396
1386
  const { runModelSetup } = await Promise.resolve().then(() => __importStar(require('../semantic/local-model')));
1397
1387
  runModelSetup({ automatic: true });
1398
1388
  }
1389
+ // @implements A-SPEC-552.4 โ€” `--no-autonomy` is judged by what the runtime will read afterwards: another server entry
1390
+ // still holding the switch keeps autonomy on, and init says so instead of a silent success. Another entry's env is
1391
+ // not init's to edit (A-SPEC-179), so it names the entries rather than removing their keys.
1392
+ if (res.ok && flags['no-autonomy'] === true && !opts.dryRun && opts.mcp) {
1393
+ const { projectAutonomyState } = require('../governance/autonomy');
1394
+ if (projectAutonomyState(opts.target) === true) {
1395
+ let holders = [];
1396
+ try {
1397
+ const servers = JSON.parse(fs.readFileSync(path.join(opts.target, '.mcp.json'), 'utf8')).mcpServers ?? {};
1398
+ holders = Object.entries(servers).filter(([, s]) => typeof s?.env?.HOLMES_AUTONOMOUS_APPROVAL === 'string' && s.env.HOLMES_AUTONOMOUS_APPROVAL !== '').map(([k]) => k);
1399
+ }
1400
+ catch { /* the reader already said ON; the names are a courtesy */ }
1401
+ process.stderr.write(`autonomous spec approval is still ON: HOLMES_AUTONOMOUS_APPROVAL is set in .mcp.json for ${holders.length > 0 ? holders.map(doctor_1.terminalSafe).join(', ') : 'another server entry'} โ€” remove it there to turn the project default off\n`);
1402
+ return 1;
1403
+ }
1404
+ }
1399
1405
  return res.exitCode;
1400
1406
  }
1401
1407
  // @implements A-SPEC-543.2 โ€” one-command upgrade. Preparation is zero-config (init records the
@@ -12,11 +12,48 @@ export declare function promptAgentSelection(availableAgents?: readonly Agent[],
12
12
  * The project autonomy-posture prompt. TTY-only (its raw-terminal read is the human-presence proof โ€”
13
13
  * an agent's non-TTY Bash cannot reach it, so a `true` here is a human answer, not a self-grant).
14
14
  * Non-TTY returns false (leave HITL); the caller does not treat that as an interactive answer.
15
- * Default is NO โ€” autonomy is opt-in.
15
+ * A-SPEC-552.2: Enter means the default โ€” ON for a first install, the current value on a re-init.
16
16
  */
17
17
  /**
18
18
  * @implements A-SPEC-769.1 โ€” what the prompt says matches the grader (X1, 2026-10-12: the old text said REQ/H-SPEC
19
19
  * "ALWAYS ask", while A-SPEC-587 seals an upstream autonomously when every A-SPEC beneath it is low-risk).
20
20
  */
21
21
  export declare const AUTONOMY_PROMPT_TEXT: string;
22
- export declare function promptAutonomy(): Promise<boolean>;
22
+ /**
23
+ * @implements A-SPEC-552.2, A-SPEC-552.3 โ€” Enter takes the default: the current value, else ON at a person's own
24
+ * terminal and OFF under an agent harness or CI; y/yes and n/no decide; anything else is OFF.
25
+ */
26
+ export declare function autonomyAnswer(answer: string, current: boolean | undefined, underHarness?: boolean): boolean;
27
+ /** The question, its brackets naming what Enter means. */
28
+ export declare function autonomyQuestion(current: boolean | undefined, underHarness?: boolean): string;
29
+ /** @implements A-SPEC-552.3 โ€” the target's current posture, read by the runtime's own reader (governance/autonomy). */
30
+ export declare function currentAutonomyAt(target: string): boolean | undefined;
31
+ /**
32
+ * @implements A-SPEC-552.3 โ€” whether init runs where an agent could be answering: an agent harness among its parents
33
+ * (operatorActGuard names one, A-SPEC-102.29) or a CI environment. A pty an agent allocated still has one.
34
+ */
35
+ export declare function initUnderHarness(target: string, env?: NodeJS.ProcessEnv): boolean;
36
+ export interface AutonomyPromptIO {
37
+ stdinTTY: boolean;
38
+ stdoutTTY: boolean;
39
+ underHarness: boolean;
40
+ write: (text: string) => void;
41
+ ask: (question: string) => Promise<string>;
42
+ }
43
+ export interface InitAutonomy {
44
+ autonomy: boolean | undefined;
45
+ interactive: boolean;
46
+ }
47
+ /**
48
+ * @implements A-SPEC-552.2 โ€” init's interactive choice. No TTY asks nothing and decides nothing (`autonomy` undefined:
49
+ * the posture is preserved, A-SPEC-552.1). ON is returned only with `interactive: true`, the proof a person answered.
50
+ */
51
+ export declare function initAutonomyChoice(target: string, io: AutonomyPromptIO): Promise<InitAutonomy>;
52
+ /**
53
+ * @implements A-SPEC-552.3 โ€” init's whole autonomy decision, so index.ts makes none of its own: the flags first
54
+ * (`--autonomy` is gated in runInit, `--no-autonomy` is free), then the acts that ask nothing, then the question.
55
+ */
56
+ export declare function resolveInitAutonomy(flags: Record<string, unknown>, target: string, io: AutonomyPromptIO): Promise<InitAutonomy>;
57
+ /** The real terminal's io for `target`. */
58
+ export declare const terminalAutonomyIO: (target: string) => AutonomyPromptIO;
59
+ export declare function promptAutonomy(target?: string): Promise<boolean>;