repo-harness 0.37.0 → 0.37.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 (48) hide show
  1. package/README.md +1 -1
  2. package/assets/reference-configs/external-tooling.md +62 -53
  3. package/assets/released-managed-values.v1.json +3 -1
  4. package/assets/skill-commands/repo-harness-architecture/references/worker.md +16 -14
  5. package/assets/skill-commands/repo-harness-check/references/architecture-evidence.md +29 -35
  6. package/assets/skill-commands/repo-harness-ship/references/worker.md +1 -2
  7. package/assets/skill-version.json +2 -2
  8. package/assets/skills/repo-harness-advisor/SKILL.md +14 -10
  9. package/assets/skills/repo-harness-issue-flow/references/acceptor.md +8 -2
  10. package/assets/skills/repo-harness-issue-flow/references/advisor.md +17 -15
  11. package/assets/skills/repo-harness-issue-flow/references/worker.md +6 -3
  12. package/assets/templates/helpers/capability-resolver.ts +3 -25
  13. package/assets/templates/runtime.gitignore +4 -0
  14. package/dist/hook-entry.js +8320 -1702
  15. package/package.json +3 -3
  16. package/scripts/axr5-archctx-clean-room.ts +148 -43
  17. package/scripts/check-cli-manifest.ts +1 -1
  18. package/scripts/check-managed-runtime.ts +1 -1
  19. package/scripts/check-protected-paths.ts +38 -7
  20. package/scripts/contract-worktree-runtime.ts +0 -16
  21. package/scripts/contract-worktree.sh +3 -18
  22. package/scripts/lib/axr5-clean-room-runtime.ts +13 -43
  23. package/scripts/select-test-suite.ts +3 -0
  24. package/src/cli/candidate-runtime-reconciliation.ts +0 -4
  25. package/src/cli/commands/architecture-setup.ts +1 -18
  26. package/src/cli/commands/board.ts +3 -3
  27. package/src/cli/commands/global-runtime.ts +2 -28
  28. package/src/cli/commands/refactor-actions.ts +58 -45
  29. package/src/cli/commands/refactor.ts +346 -122
  30. package/src/cli/hook/agent-notice.ts +25 -5
  31. package/src/cli/hook/host-adapter.ts +53 -14
  32. package/src/cli/installer/targets/antigravity.ts +11 -6
  33. package/src/core/architecture/contracts.ts +3 -25
  34. package/src/core/architecture/projection.ts +36 -31
  35. package/src/core/operator/architecture-map-model.ts +3 -3
  36. package/src/core/operator/architecture.ts +3 -3
  37. package/src/core/refactor/provider-contract.ts +323 -96
  38. package/src/effects/architecture/archctx-provider.ts +1188 -164
  39. package/src/effects/architecture/projection-apply.ts +3 -18
  40. package/src/effects/architecture/providers.ts +1 -2
  41. package/src/effects/board/closeout.ts +7 -19
  42. package/src/effects/operator/architecture-map-worker.ts +11 -3
  43. package/src/effects/operator/architecture.ts +1 -1
  44. package/src/effects/process-group-launcher.ts +38 -28
  45. package/src/effects/process-runner.ts +18 -1
  46. package/src/effects/process-supervisor.ts +15 -1
  47. package/src/effects/refactor/archctx-provider.ts +379 -126
  48. package/src/effects/refactor/recommendations.ts +84 -174
package/README.md CHANGED
@@ -331,6 +331,6 @@ None of these are bundled dependencies; see
331
331
 
332
332
  ## Release & license
333
333
 
334
- - npm: `repo-harness@0.37.0` · workflow stamp `repo-harness@0.37.0+template@0.37.0`
334
+ - npm: `repo-harness@0.37.1` · workflow stamp `repo-harness@0.37.1+template@0.37.1`
335
335
  - History: [`docs/CHANGELOG.md`](docs/CHANGELOG.md)
336
336
  - License: MIT — see [`LICENSE`](LICENSE)
@@ -1074,7 +1074,7 @@ never call the export. They take capability identity from the node id:
1074
1074
  `capability.<domain>.<name>` gives `<domain>-<name>` and its module document.
1075
1075
  Path ownership under `archcontext` comes only from the
1076
1076
  package-local archctx `resolve --paths-from` command. One process resolves one batch of
1077
- paths. It reads no daemon state and no CodeGraph index. The pre-edit hook,
1077
+ paths. It runs in-process and reads no CodeGraph index. The pre-edit hook,
1078
1078
  Effective State, `rh capability resolve match` and `rh capability context` all use
1079
1079
  this route. If archctx cannot run, Effective State reports the
1080
1080
  `capability_ownership:unavailable` blocker. A model fault or an ownership fault
@@ -1224,7 +1224,7 @@ root. Inspect
1224
1224
  another state dir reports an empty state. For initial setup, run `once`. If
1225
1225
  the archctx result reports missing code facts, read `data.worktreePath` from
1226
1226
  `status`, run `codegraph init -y <worktreePath>`, then run `once` again. Initialize only that
1227
- writer-owned worktree. Do not replace a shared daemon or index other workspaces.
1227
+ writer-owned worktree. Do not index other workspaces.
1228
1228
  Inspect facts again if archctx reports a stale index after the base moves; the
1229
1229
  command does not invent a repair.
1230
1230
 
@@ -1320,33 +1320,26 @@ All delivery points share the id marker. Claude also gets a one-sentence
1320
1320
  `systemMessage` from the same notice. Codex gets no human line.
1321
1321
 
1322
1322
  Manual projection apply remains available for explicitly authorized adoption
1323
- and repair. It is not a feature-PR freshness step. archctx owns observed-change
1324
- acceptance and committed-result readback; repo-harness keeps no second
1325
- candidate, receipt or approval store.
1326
-
1327
- Managed install/update also verifies `daemon status --json` through the same
1328
- exact package-local CLI and compatible Node runtime after static capabilities.
1329
- A running daemon must prove RPC and product-version compatibility; upstream
1330
- `versionUnsupported` diagnostics (including a replaced entrypoint) fail the
1331
- strict installed-runtime verifier with an explicit user-authorization reminder.
1332
- Install/update reports daemon readiness as pending (`skipped`) separately from
1333
- verified package installation, retaining the candidate so a daemon mismatch
1334
- cannot trigger package rollback and strand newer hoisted dependencies.
1335
- An upstream `staleConnection:true` response is unhealthy, not cleanly stopped. A stopped daemon needs no
1336
- replacement and this check never starts it. Upstream status may recover stale
1337
- control files; the check never upgrades the daemon or creates/clears indexes.
1338
-
1339
- Runtime failures with the typed `AC_RUNTIME_VERSION_UNSUPPORTED` code and
1340
- `upgrade-archctx-runtime` action preserve the reminder beyond the ordinary
1341
- 300-character process-error preview, including projection/refactor callers.
1342
- The Agent presents the reported discrepancy and asks for user authorization
1343
- before running `daemon upgrade` through the same managed CLI and Node runtime.
1344
- Explain that replacing a shared daemon interrupts other clients. After authorized
1345
- replacement, verify daemon compatibility and inspect this repository's configured
1346
- CodeGraph index. Request authorization to rebuild only when its authoritative
1347
- status reports it missing or stale; verify readiness before retrying the blocked
1348
- operation. CLI upgrade alone does not prove that an index needs rebuilding.
1349
- Never delete the shared database or all repository indexes as recovery.
1323
+ and repair. It is not a feature-PR freshness step. `archctx@0.18.4` runs every
1324
+ command in-process with no background service and no projection replay.
1325
+ `rh arch projection apply --json` returns its result directly; verify zero drift
1326
+ with `rh arch projection check --json` (or `rh arch sync --check --json`).
1327
+ repo-harness keeps no second candidate, receipt or approval store.
1328
+
1329
+ Managed install and update verify the exact pinned `archctx` and
1330
+ `archctx-contracts` package versions, package-local CodeGraph, compatible Node
1331
+ runtime and `capabilities --json` handshake. ArchContext runs in-process, so
1332
+ install, update and worktree cleanup manage no background service.
1333
+
1334
+ Worktree CodeGraph bootstrap runs `rh arch index seed --timeout-ms <ms> --json`.
1335
+ In a primary checkout with an existing `.codegraph/codegraph.db`, it refreshes
1336
+ the shared base index without initializing a missing primary index. In a linked
1337
+ worktree, it seeds from that shared base and falls back to package-local
1338
+ CodeGraph init only when `index seed` returns `AC_CODE_FACTS_UNAVAILABLE`
1339
+ (`index-missing` or `index-base-building`) on an absent or empty `.codegraph`
1340
+ directory. An occupied, symlinked or `AC_CODE_FACTS_NOT_READY` `.codegraph`
1341
+ directory fails closed without overwriting files.
1342
+
1350
1343
  The runtime snapshot excludes `.ai/harness/**`, so concurrent harness receipts
1351
1344
  and traces cannot invalidate a provider snapshot.
1352
1345
 
@@ -1442,33 +1435,49 @@ semantics. The retired `archcontext-boundaries-v1` format is rejected.
1442
1435
 
1443
1436
  ## Refactor recommendations
1444
1437
 
1445
- repo-harness supplies refactor evidence on demand. No hook scans for it and no
1438
+ repo-harness supplies pure-Git refactor evidence on demand through `archctx@0.18.4`
1439
+ in-process commands (`scan`, `decide`, `verify`). No hook scans for it and no
1446
1440
  setting enables it. The Bot reads the evidence and decides whether to schedule
1447
- work or ask the user. Incomplete code facts return `proof_required` with a
1448
- `codegraph init` hint. An import limit gets a `--import-node-limit` hint
1449
- instead. The command never creates an index, a model, a plan or a code edit.
1441
+ work or ask the user. Incomplete import coverage returns `proof_required` with a
1442
+ `codegraph init` hint (or a `--import-node-limit` hint on
1443
+ `code-facts-import-limit`). The read commands never create an index, model, plan
1444
+ or code edit.
1450
1445
 
1451
- Read evidence and record a decision with:
1446
+ Read evidence, record decisions and verify resolutions with:
1452
1447
 
1453
1448
  ```bash
1454
- rh arch refactor recommendations [--json] [--import-node-limit <n>] [--timeout-ms <ms>]
1455
- rh arch refactor decide <recommendation-id> accept|defer|reject --reason "<text>" --snapshot-digest <digest> [--import-node-limit <n>] [--timeout-ms <ms>]
1449
+ rh arch refactor recommendations [--import-node-limit <n>] [--timeout-ms <ms>] [--json]
1450
+ rh arch refactor list [--status <status>] [--import-node-limit <n>] [--timeout-ms <ms>] [--json]
1451
+ rh arch refactor show <recommendation-id> [--import-node-limit <n>] [--timeout-ms <ms>] [--json]
1452
+ rh arch refactor decide <recommendation-id> accept|defer|reject|acknowledge|waive --reason "<text>" [--kill-symbol <path#sym>...] [--kill-path <path>...] [--kill-relation <id>...] [--import-node-limit <n>] [--timeout-ms <ms>] [--json]
1453
+ rh arch refactor verify <recommendation-id> [--import-node-limit <n>] [--timeout-ms <ms>] [--json]
1454
+ rh arch refactor resolve <recommendation-id> --resolution-digest <sha256:...> --reason "<text>" [--import-node-limit <n>] [--timeout-ms <ms>] [--json]
1456
1455
  ```
1457
1456
 
1458
- `recommendations` shows each open suggestion with its explanation, the metrics
1459
- and bounded `evidence` of its observation (`kind`, `totalCount`, `truncated`
1460
- and the first items) and the statistics of every affected module (files, lines,
1461
- fan-in, fan-out, cycles, direction violations, unresolved imports). Direction
1462
- violations are filled only when the model declares constraints. repo-harness
1463
- does not show instability or test file counts in module statistics. A suggestion
1464
- recorded by an earlier scan has `snapshot: "earlier"`, keeps its recorded
1465
- metrics and evidence, and shows no module statistics.
1466
-
1467
- Open suggestions are the ArchContext `open` records plus scan candidates not yet
1468
- recorded. `decide` stores the decision in one ArchContext call, for a recorded
1469
- id or a scan candidate. A suggestion with a recorded decision is not shown again
1470
- in the same worktree path and branch (Ancienttwo/arch-context#321). Pass the
1471
- same `--import-node-limit` to `decide` that the scan used. repo-harness keeps no
1472
- local delivery state; ArchContext owns the recommendation lifecycle. Execution
1473
- of an accepted suggestion uses the normal
1474
- plan and pull request workflow.
1457
+ `recommendations` returns `repo-harness.refactor-recommendations/v3` with
1458
+ `status` (`recommended`, `no_action`, `proof_required`, `unavailable`),
1459
+ `headSha`, `snapshotDigest`, `scope`, `coverage` (`imports`, `gitHistory`,
1460
+ `reasonCodes`), `findings` (each with `recommendationId`, `detector`, `severity`,
1461
+ `blocking`, `capabilityId`, `affectedNodeIds`, `affectedPaths`, `killList`,
1462
+ `metrics` and bounded `evidence` scalars) and `suppressed`.
1463
+
1464
+ `decide` writes one Git-tracked decision file at
1465
+ `.archcontext/refactor-decisions/<recommendation-id>.json` in one step
1466
+ (`--kill-symbol`, `--kill-path` and `--kill-relation` apply to `accept`). Keep
1467
+ `.archcontext/refactor-decisions/` unignored in `.gitignore` so every clone
1468
+ reads the same decisions. `list` and `show` inspect recorded decision files
1469
+ (`list`'s `openFindings` is best-effort; `recommendations` is the authoritative
1470
+ scan with coverage). Pass the same `--import-node-limit` to `decide`, `verify`
1471
+ and `resolve` when the scan used one.
1472
+
1473
+ `verify` is read-only: it checks `killListChecks` and `metricChecks`, prints
1474
+ `disposition`, `headSha`, `resolutionDigest`, `blockingReasons` and
1475
+ `historicalReceipt`, and exits 0 only when `disposition === "resolved"`.
1476
+ `resolve` requires `--resolution-digest <sha256:...>` from `verify` and updates
1477
+ `.archcontext/refactor-decisions/<recommendation-id>.json` to `resolved`.
1478
+ Because `verify` hashes live `headSha` into live `resolutionDigest`, committing
1479
+ the resolved decision file shifts subsequent live `resolutionDigest` while
1480
+ preserving the committed digest in `historicalReceipt.resolutionDigest`.
1481
+ repo-harness keeps no local delivery state; Git-tracked decision
1482
+ files and ArchContext own the recommendation lifecycle. Execution of an accepted
1483
+ finding uses the normal plan and pull request workflow.
@@ -103,7 +103,8 @@
103
103
  "v0.35.0",
104
104
  "v0.35.1",
105
105
  "v0.35.2",
106
- "v0.36.1"
106
+ "v0.36.1",
107
+ "v0.37.0"
107
108
  ],
108
109
  "packageScripts": {
109
110
  "check:architecture-sync": [
@@ -2306,6 +2307,7 @@
2306
2307
  "## Progressive Due Diligence": [
2307
2308
  "sha256:141673ad4479b00c58dd81f2269c26abdf513f9929f98f529830b7c0bcb0a30c",
2308
2309
  "sha256:15c465482dcca01e25cbdbdf48d9f5d36b8bd1b5a7051a6ff5f7187552d5a0c2",
2310
+ "sha256:5919a0c534dd2823de7df0634f37016a3d732e6d1c1dbfd2e4680a59f765f812",
2309
2311
  "sha256:f50494041e62dfdf778891d306fdfb14cc70415b7dd3efa7fc454d337ac0eed9"
2310
2312
  ],
2311
2313
  "## Reporting": [
@@ -5,7 +5,7 @@ Worker reference. Use only within the assigned architecture scope.
5
5
  ## Protocol
6
6
 
7
7
  1. Confirm the target repo path and architecture scope. Run every archctx command as `rh arch <command>` in the target repo. Do not run a bare archctx from PATH: a PATH copy can have another version and can print a help envelope with `"ok": true`.
8
- Projection diagnostics need CodeGraph code facts. In a new worktree run `codegraph init -y .`; when `.codegraph/` exists, run `codegraph sync .`.
8
+ Projection diagnostics need CodeGraph code facts. In a linked worktree when the primary checkout has a CodeGraph index, run `rh arch index seed --json` (or `codegraph init -y .` for a new standalone index); when `.codegraph/` exists, run `codegraph sync .`.
9
9
  2. Inspect the committed architecture entry for the projection profile (`docs/architecture/index.md`, or the capability pages under `docs/architecture/modules/` for `repo-harness/v1`) and `.archcontext/model/nodes/`. For a coverage or registration scope, follow the coverage procedure below.
10
10
  3. When the scope maps to repo code or config, resolve the capability with:
11
11
  - `rh capability resolve match --repo <repo> --path <path> --format json`
@@ -38,7 +38,7 @@ of the rolling PR accepts the proven major changes in it.
38
38
 
39
39
  ## Drift signals
40
40
 
41
- - Generated sections: `rh arch projection check --json`.
41
+ - Generated sections: `rh arch projection check --json`, or `rh arch sync --check --json` for an in-process exit-code check (0 fresh, 2 drifted or pending).
42
42
  `changes[].outputChanged` reports render changes. When generated output differs, inspect `rh arch projection publish status` and the open rolling PR.
43
43
  - Human-written sections: `rh arch projection anchors --json`.
44
44
  It runs `docs anchors` and writes no file. It lists cited paths that are
@@ -98,14 +98,14 @@ write nodes.
98
98
  `.archcontext/tmp/` and delete it before commit.
99
99
  - Inspect the draft and preview, then run
100
100
  `rh arch apply --id <same-id> --approved --expected-worktree-digest <draft.base.worktreeDigest>`.
101
- A draft lives in daemon memory. Plan again after a daemon restart or any worktree
102
- change. `--approved` records the authorized Agent decision; it does not grant extra scope.
103
- - After `apply` returns a `journalId`, run
104
- `rh arch ledger receipt --journal-id <id> --json` and record the
105
- receipt in the PR body. The receipt lists the base and result model digests and
106
- each file path, operation and `bodyHash`. It is unsigned: its
107
- `approvalAuthenticity` is `unverified`. It exists only on the machine that
108
- applied the ChangeSet. Export one receipt for each apply.
101
+ `plan` caches the draft in the local SQLite store; plan again after any HEAD,
102
+ worktree or model change. `--approved` records the authorized Agent decision;
103
+ it does not grant extra scope.
104
+ - `apply` returns the applied ChangeSet inline (`status: "applied"`, base digests
105
+ and operations). Verify the result with `git diff -- .archcontext/model/`,
106
+ `rh arch validate --format json` and `rh arch projection check --json`
107
+ (or `rh arch sync --check --json`), and summarize the changed model paths in
108
+ the PR body.
109
109
  - A component footprint is `source.include` on the `component.*` node, with an
110
110
  optional `source.exclude`. ArchContext validation owns the include and exclude
111
111
  shapes. repo-harness resolves path ownership only through
@@ -151,10 +151,12 @@ Then the repository has no complete ArchContext model, and `apply.enabled` is
151
151
  The output is a JSON array of complete `archcontext.node/v2` capability nodes.
152
152
  An empty registry gives an empty array. Then author the first nodes as
153
153
  "Coverage and Agent-owned registration" describes.
154
- 3. Run `rh arch init --name <product name>`. It writes
155
- `.archcontext/manifest.yaml`, `.archcontext/product.yaml` and one sample node
156
- `capability.architecture.context`. The sample node has no `responsibilities`
157
- or `extensions`, so repo-harness cannot read it.
154
+ 3. Run `rh arch init --model-only --name <product name>`. `--model-only`
155
+ disables ArchContext hook, skill and instruction-block projection
156
+ (`projection.instructions: false`) because repo-harness owns those surfaces.
157
+ It writes `.archcontext/manifest.yaml`, `.archcontext/product.yaml` and one
158
+ sample node `capability.architecture.context`. The sample node has no
159
+ `responsibilities` or `extensions`, so repo-harness cannot read it.
158
160
  4. Write one ChangeSet. Create one node file per exported node at
159
161
  `.archcontext/model/nodes/<id>.yaml`. JSON text is valid YAML, so the body can
160
162
  be the exported node. Delete the sample node with the hash from
@@ -19,10 +19,10 @@ evidence.
19
19
  At `done`, run only the cheap checks below: path ownership, and
20
20
  `rh arch projection check` when the model or documents changed. Do not run
21
21
  `rh arch refactor recommendations --json` at `done` or on worker `Stop`
22
- hooks. Run the full-repo scan once per merge on a fixed checkout and branch
23
- (the `main` checkout after the merge), or run a scoped scan (`--node` /
24
- `--path`) during `advisor` audit or when the user asks about refactors. A
25
- full-repo scan takes about 30 s and gives the same output on every branch.
22
+ hooks. Run the repository-scoped scan once per merge on a fixed checkout and
23
+ branch (the `main` checkout after the merge), during `advisor` audit, or when
24
+ the user asks about refactors. A full-repo scan takes about 30 s and gives the
25
+ same output on every branch.
26
26
 
27
27
  When a PR modifies `.archcontext/**`, `docs/architecture/**`, or carries
28
28
  `tier:high` cross-module boundary changes, read
@@ -52,14 +52,10 @@ Read the cheap signal first:
52
52
  or `rh arch module review-prompt` with `--projection-check <file>`. Then
53
53
  `generated_summary` is `fresh` or `stale`. Without the file it is `unknown`.
54
54
  The file must come from a check at the current HEAD.
55
- 3. ChangeSet receipt. When the diff changes files under `.archcontext/model/`,
56
- read the ChangeSet receipt JSON (`ledger receipt`) in the PR body. Compare each receipt
57
- `bodyHash` and file path with the changed model files at HEAD. A `bodyHash` is
58
- `sha256:` plus the hex SHA-256 of the canonical JSON `{"body":"<file text>"}`
59
- (keys sorted, UTF-8). It is not a Git blob id or a SHA-256 of the file bytes. A deletion has
60
- `bodyHash: missing`. Every changed model path must have a receipt record.
61
- The receipt is unsigned (`approvalAuthenticity: unverified`); it shows
62
- recorded content, not human approval.
55
+ 3. Model diff and validation. When the diff changes files under `.archcontext/model/`,
56
+ inspect `git diff -- .archcontext/model/` and the inline `rh arch apply`
57
+ output in the PR body. Confirm `rh arch validate --format json` and
58
+ `rh arch projection check --json` (or `rh arch sync --check --json`) pass at HEAD.
63
59
 
64
60
  Human-written sections have a citation signal. Run
65
61
  `rh arch projection anchors --json`. The command is read-only
@@ -91,33 +87,31 @@ writer publishes generated files. Do not run apply to refresh a feature PR.
91
87
 
92
88
  ## Refactor suggestions
93
89
 
94
- Run `rh arch refactor recommendations --json` (pass `--node <capability-id>` or
95
- `--path <repo-relative-path>` once `#3346` lands). Use `--node` or `--path`
96
- for scoped reads during `advisor` health audits and pre-refactor intake,
97
- alongside full-repo post-merge scans (without `--node` or `--path`). Never call
98
- `archctx` from `PATH`. The result `repo-harness.refactor-recommendations/v2` has
99
- a `status`
100
- and `candidates`. Each candidate gives its kind, subject, risk, confidence,
101
- uncertainty, `metrics`, bounded `evidence` and module statistics. The
102
- `evidence` has a `kind`, a `totalCount`, a `truncated` flag and the first
103
- items. Module statistics are files, lines, fan-in, fan-out, cycles, direction
104
- violations (filled only when the model declares constraints) and unresolved
105
- imports. repo-harness does not show instability or test file counts in module
106
- statistics. A suggestion recorded by an earlier scan has
107
- `snapshot: "earlier"` and its own `baselineSnapshotDigest`. It keeps its
108
- recorded metrics and evidence and shows no module statistics, because the
109
- current scan measured a different snapshot.
90
+ Run `rh arch refactor recommendations --json` (repository-scoped so every
91
+ reported ID resolves in `decide` and `show`). Never
92
+ invoke `archctx` from `PATH`. The result `repo-harness.refactor-recommendations/v3`
93
+ carries `status`, `headSha`, `snapshotDigest`, `scope`, `coverage` (`imports`,
94
+ `gitHistory`, `reasonCodes`), `findings` and `suppressed`. Each finding lists
95
+ its `recommendationId`, `detector`, `severity`, `blocking`, `capabilityId`,
96
+ `affectedNodeIds`, `affectedPaths`, `killList`, `metrics` and bounded `evidence`
97
+ scalars. Inspect committed decisions with `rh arch refactor list --json` (whose
98
+ `openFindings` is best-effort; `recommendations` is the authoritative scan with
99
+ coverage) and `rh arch refactor show <id> --json`.
110
100
 
111
101
  | Status | Bot decision |
112
102
  | --- | --- |
113
- | `recommended` | Show the candidates and their evidence to the user, or schedule a bounded refactor task in the normal plan and pull request flow. |
103
+ | `recommended` | Show the findings and their evidence to the user, or schedule a bounded refactor task in the normal plan and pull request flow. |
114
104
  | `no_action` | Schedule nothing. |
115
- | `proof_required` | The message names the cause. Missing code facts: run `codegraph init`. `code-facts-import-limit`: run again with a larger `--import-node-limit <n>` and use the same value on `decide`. Ambiguous ownership: schedule a model ownership fix. |
105
+ | `proof_required` | Read `coverage` and the message. Missing code facts: run `codegraph init` (or `rh arch index seed --json` in a linked worktree). `code-facts-import-limit`: run again with a larger `--import-node-limit <n>` and pass the same value to `decide`, `verify` and `resolve`. |
116
106
  | `unavailable` | Read `code`, `action` and `message`. A missing model or provider means schedule nothing. A code with an `action` has a fix: do it first. |
117
107
 
118
108
  Record only a decision that the user made:
119
- `rh arch refactor decide <id> accept|defer|reject --reason "<text>" --snapshot-digest <digest>`.
120
- A decided suggestion is not shown again in the same worktree path and branch
121
- (Ancienttwo/arch-context#321). `decide` works for a recorded id or a fresh
122
- candidate in one call. Pass `--import-node-limit` if the scan used one. A
123
- suggestion is evidence. It does not authorize a refactor.
109
+ `rh arch refactor decide <id> accept|defer|reject|acknowledge|waive --reason "<text>"`
110
+ (add optional `--kill-symbol <path#sym>`, `--kill-path <path>` or
111
+ `--kill-relation <id>` targets on `accept`, and pass `--import-node-limit <n>`
112
+ if the scan used one). `decide` writes `.archcontext/refactor-decisions/<id>.json` in Git in one step. Commit that
113
+ decision file with the work. After a code fix lands, verify it read-only with
114
+ `rh arch refactor verify <id> --json` (exit 0 only when `disposition === "resolved"`),
115
+ then close the decision with
116
+ `rh arch refactor resolve <id> --resolution-digest <resolutionDigest> --reason "<text>"`.
117
+ A finding is evidence. It does not authorize a refactor.
@@ -41,11 +41,10 @@ guard rechecks merge proof, dirty state, lock, branch/path and both OIDs.
41
41
 
42
42
  ```sh
43
43
  rh worktrees runtime cleanup --repo <primary> --worktree <canonical-path>
44
- rh worktrees runtime stop-architecture-daemons --repo <primary> --worktree <canonical-path>
45
44
  rh worktrees runtime remove-exact --repo <primary> --worktree <canonical-path> --branch <exact-branch> --head <observed-head> --target <local-target-ref> --target-oid <observed-target-oid> --merge <confirmed-merge-sha>
46
45
  ```
47
46
 
48
- Stop on a failed runtime cleanup. Report a daemon-stop failure as the existing
47
+ Stop on a failed runtime cleanup. Report a CodeGraph server stop failure as the existing
49
48
  cleanup path does. Runtime cleanup precedes marker release and Git removal.
50
49
  When notification returns `owner_gone`, the orchestrator uses the same closeout.
51
50
  Notification is not a deletion prerequisite or a new grant. Keep and report any
@@ -1,6 +1,6 @@
1
1
  {
2
- "version": "0.37.0",
3
- "templateVersion": "0.37.0",
2
+ "version": "0.37.1",
3
+ "templateVersion": "0.37.1",
4
4
  "skillName": "repo-harness",
5
5
  "contractId": "tasks-first-harness-v1",
6
6
  "compatibility": {
@@ -81,16 +81,20 @@ agent starts. Report the `limits` of the `seats argv` JSON.
81
81
  The advisor seat reads structural observations before planning a module refactor or
82
82
  during its periodic health audit (`repo-harness-issue-flow` `references/advisor.md` §2):
83
83
 
84
- - Run `rh arch refactor recommendations --json` (or pass `--node <capability-id>`
85
- / `--path <path>` for a scoped slice; inspect recorded decisions with
86
- `rh arch refactor list` / `rh arch refactor show <id>`). Never run this on
84
+ - Run `rh arch refactor recommendations --json` (and inspect recorded decisions
85
+ with `rh arch refactor list` / `rh arch refactor show <id>`). Never run this on
87
86
  worker `Stop` hooks or call `archctx` from `PATH`.
88
- - Present `recommended` observations and proposals to the owner and record each
89
- owner decision with
90
- `rh arch refactor decide <id> accept|defer|reject|acknowledge|waive --reason "<text>" --snapshot-digest <digest>`
91
- (persist an unscanned assessment first when needed via `rh arch refactor record`).
87
+ - Present `recommended` findings to the owner and record each owner decision
88
+ with
89
+ `rh arch refactor decide <id> accept|defer|reject|acknowledge|waive --reason "<text>"`
90
+ (optional `--kill-symbol`, `--kill-path` and `--kill-relation` targets on `accept`).
91
+ `decide` writes `.archcontext/refactor-decisions/<id>.json` in Git directly.
92
+ After a worker commits the fix, `rh arch refactor verify <id> --json` and
93
+ `rh arch refactor resolve <id> --resolution-digest <resolutionDigest> --reason "<text>"`
94
+ close the decision.
92
95
  - Bind `accepted` recommendation IDs (`refactor_ids`) on the owning issue in
93
96
  `rh board triage-apply --manifest <path>`. For a cross-capability cycle or
94
- boundary split, attach the `RefactorRecommendation` metrics and
95
- `rh arch module review-prompt <capability-id> --json` output to the L3
96
- `council` consultation brief (`rh seats council --issue <n> --members <csv>`).
97
+ boundary split, attach the finding `metrics`, `evidence`, `affectedPaths` and
98
+ `killList` with `rh arch module review-prompt <capability-id> --json` output
99
+ to the L3 `council` consultation brief
100
+ (`rh seats council --issue <n> --members <csv>`).
@@ -75,8 +75,14 @@ never synthesize a pass):
75
75
 
76
76
  When an issue in the PR carries `Refactor IDs:` (`recommendation.<hex>`) or the
77
77
  diff resolves an entry in `.archcontext/refactor-decisions/`, run
78
- `rh arch refactor verify <id> --json` and verify `disposition === "resolved"`
79
- (or record an explicit code-facts observation gap when the index is unavailable).
78
+ `rh arch refactor verify <id> --json` at the PR head and verify
79
+ `disposition === "resolved"`, `blockingReasons` is empty (`[]`), and `headSha`
80
+ matches the PR head (or record an explicit code-facts observation gap when the
81
+ index is unavailable). Because `verify` hashes live `headSha` into live
82
+ `resolutionDigest`, committing `.archcontext/refactor-decisions/<id>.json`
83
+ changes live `resolutionDigest`; confirm the committed decision file's stored
84
+ `resolutionDigest` matches `historicalReceipt.resolutionDigest` (and matches the
85
+ pre-commit `verify`/`resolve` evidence in the PR body).
80
86
 
81
87
  ### 2.2 Rounds
82
88
 
@@ -52,12 +52,11 @@ Each selected member opens a read-only `council` pane in the `council` tab and w
52
52
  - **Read the council files, not the scrollback.** Read each `/tmp/rh-council/<repo>/issue-<n>-<member>.md` file with `Read` or `hc file read <path>`. Do not take proposals from `hc read` scrollback: long answers truncate in alternate-screen TUIs.
53
53
  - **Keep the authority.** Every `council` member is read-only and ephemeral. Synthesize the blind `/tmp/rh-council/` proposals into one unified proposal for the orchestrator (§3). Never forward raw council files to the orchestrator or to a worker; workers never read `/tmp/rh-council/`.
54
54
  - **Cross-capability cycle or boundary split.** Run
55
- `rh arch refactor recommendations --json` (scoped with `--node <capability-id>`
56
- or `--path <path>`) and
55
+ `rh arch refactor recommendations --json` and
57
56
  `rh arch module review-prompt <capability-id> --json` for each affected
58
- capability. Attach the `RefactorRecommendation` metrics (`metrics`,
59
- `evidence`, `modules`) and the `review-prompt` output to the L3 `council`
60
- consultation brief (`--question` / issue context).
57
+ capability. Attach the finding `metrics`, `evidence`, `affectedPaths` and
58
+ `killList` with the `review-prompt` output to the L3 `council` consultation
59
+ brief (`--question` / issue context).
61
60
 
62
61
  ### 1.2 Pre-dispatch intake triage and multi-issue bundling
63
62
 
@@ -114,23 +113,26 @@ the change, so the check must come from outside its session.
114
113
  `[rh-notice] lessons-retro due: <watermark> is <n> days and <n>
115
114
  first-parent commits behind origin/main`.
116
115
  9. Structural refactor intake (periodic health audit and pre-refactor
117
- check). Run `rh arch refactor recommendations --json` (scoped with
118
- `--node <capability-id>` or `--path <path>`), and inspect existing
116
+ check). Run `rh arch refactor recommendations --json`, and inspect existing
119
117
  decisions via `rh arch refactor list --json` or
120
118
  `rh arch refactor show <id> --json`.
121
119
  Never invoke `archctx` from `PATH` and never run this scan on worker
122
120
  `Stop` hooks. Follow this decision flow:
123
- 1. Present `recommended` structural observations or proposals and their
124
- evidence to the owner.
121
+ 1. Present `recommended` findings and their evidence to the owner.
125
122
  2. Record each owner decision via
126
- `rh arch refactor decide <id> accept|defer|reject|acknowledge|waive --reason "<text>" --snapshot-digest <digest>`
127
- (pass the same `--import-node-limit` if the scan used one). A
128
- recommendation never auto-schedules or auto-executes a refactor.
129
- 3. Route `accepted` single-module observations into `advisor` PR
123
+ `rh arch refactor decide <id> accept|defer|reject|acknowledge|waive --reason "<text>"`
124
+ (pass optional `--kill-symbol`, `--kill-path` or `--kill-relation` on
125
+ `accept`, and the same `--import-node-limit` if the scan used one). `decide` writes
126
+ `.archcontext/refactor-decisions/<id>.json` in Git directly; after a
127
+ worker commits the fix, `rh arch refactor verify <id> --json` and
128
+ `rh arch refactor resolve <id> --resolution-digest <resolutionDigest> --reason "<text>"`
129
+ close the decision. A finding never auto-schedules or auto-executes a
130
+ refactor.
131
+ 3. Route `accepted` single-module findings into `advisor` PR
130
132
  bundles (§1.2 / `orchestrator.md` §4.2) and bind `refactor_ids` on
131
133
  each owning issue in the `rh board triage-apply` manifest. For a
132
- cross-capability cycle or boundary split, attach the
133
- `RefactorRecommendation` metrics and
134
+ cross-capability cycle or boundary split, attach the finding `metrics`,
135
+ `evidence`, `affectedPaths` and `killList` with
134
136
  `rh arch module review-prompt <capability-id> --json` output to an L3
135
137
  `council` consultation (`rh seats council`, §1.1).
136
138
  10. Items for the owner: security and production only.
@@ -133,10 +133,13 @@ Otherwise skip it.
133
133
  or fix it. On a `stale-context` finding, run step 1 again.
134
134
  4. **When the issue binds `Refactor IDs:` (`recommendation.<hex>`):** commit your
135
135
  code fix first, run `rh arch refactor verify <id> --json` to confirm
136
- `disposition === "resolved"`, then run
137
- `rh arch refactor resolve <id> --evidence-digest <resolutionDigest> --reason "Resolved in #<issue>"`
136
+ `disposition === "resolved"` and read `resolutionDigest`, then run
137
+ `rh arch refactor resolve <id> --resolution-digest <resolutionDigest> --reason "Resolved in #<issue>"`,
138
+ record that pre-commit `verify`/`resolve` `resolutionDigest` in the PR body,
138
139
  and commit the updated `.archcontext/refactor-decisions/<id>.json` file on
139
- the PR branch.
140
+ the PR branch. Committing the decision file advances `HEAD` and shifts
141
+ subsequent live `resolutionDigest`, while `verify` preserves the committed
142
+ digest in `historicalReceipt.resolutionDigest`.
140
143
 
141
144
  This section names commands only. Practice text, matching rules and
142
145
  checker logic stay in ArchContext. A model change follows the
@@ -933,7 +933,7 @@ export function toArchContextNodeV2(capability: Capability, isExistingDirectory:
933
933
  * plugin is selected; a port without a provider is a typed unavailable
934
934
  * result, never a fallback.
935
935
  */
936
- export const ARCHITECTURE_CONTRACT_VERSION = 2;
936
+ export const ARCHITECTURE_CONTRACT_VERSION = 3;
937
937
  export type ArchitectureContractVersion = typeof ARCHITECTURE_CONTRACT_VERSION;
938
938
 
939
939
  export type ProjectionProvider = 'disabled' | 'archctx';
@@ -956,13 +956,12 @@ export interface ArchitectureProjectionReadinessV1 {
956
956
  */
957
957
  projectionProvider: { provider: ProjectionProvider; state: 'disabled' | 'missing' | 'mismatch' | 'error' | 'ready'; binaryPath: string | null; nodePath: string | null; command: [string, string] | null; version: string | null; reason: string; reasonCode?: string };
958
958
  codeFacts: { requirement: 'required'; state: 'not-evaluated' | 'ready' | 'not-ready' | 'index-missing' | 'unavailable'; issues?: Array<{ code: string; message: string }>; reasonCode?: string; message?: string };
959
- daemonRuntime: { state: 'not-evaluated' | 'compatible' | 'mismatch' | 'error' };
960
959
  apply: { mode: ProjectionApplyMode; enabled: boolean };
961
960
  /** The next operator step for adoption, code facts or provider repair; null when none is needed. */
962
961
  next: string | null;
963
962
  }
964
963
 
965
- export interface ArchctxProcessResult { status: number | null; signal: NodeJS.Signals | null; stdout: string; stderr: string; error?: string; timedOut?: boolean }
964
+ export interface ArchctxProcessResult { status: number | null; signal: NodeJS.Signals | null; stdout: string; stderr: string; error?: string; timedOut?: boolean; launchFailed?: boolean }
966
965
  export type RunArchctxProcess = (binary: string, args: readonly string[], options: { cwd: string; timeoutMs: number; env: NodeJS.ProcessEnv }) => ArchctxProcessResult;
967
966
 
968
967
  export interface ArchctxProviderOptions {
@@ -1060,30 +1059,11 @@ export interface ResolvedArchctxPackage {
1060
1059
  version: string;
1061
1060
  }
1062
1061
 
1063
- export interface ArchitectureDaemonStopFailure {
1064
- /** Null when the daemon listing failed before a state directory was known. */
1065
- stateDir: string | null;
1066
- code: string;
1067
- action: string;
1068
- reasonCode?: string;
1069
- retryable?: boolean;
1070
- message: string;
1071
- }
1072
-
1073
- export interface ArchitectureDaemonStopReportV1 {
1074
- schemaVersion: 'repo-harness.architecture-daemon-stop/v1';
1075
- worktree: string;
1076
- provider: ArchitectureProjectionPolicy['provider'];
1077
- stopped: string[];
1078
- failures: ArchitectureDaemonStopFailure[];
1079
- }
1080
-
1081
- /** The managed archctx runtime for the setup check and the worktree closeout. */
1062
+ /** The managed archctx runtime for the setup check. */
1082
1063
  export interface ArchitectureRuntimePort {
1083
1064
  readonly contractVersion: ArchitectureContractVersion;
1084
1065
  readonly requiredArchctxVersion: string;
1085
1066
  resolvePackageLocalArchctx(consumerRoot: string): ResolvedArchctxPackage;
1086
- stopWorkspaceDaemons(repoRoot: string, canonicalWorktree: string): ArchitectureDaemonStopReportV1;
1087
1067
  }
1088
1068
 
1089
1069
  export interface ArchitectureDoctorCheck {
@@ -1137,8 +1117,6 @@ export interface ArchitectureSetupPort {
1137
1117
  readonly codegraphVersion: string;
1138
1118
  /** archctx and archctx-contracts as declared, the archctx Node range, its CodeGraph, and one handshake. */
1139
1119
  readManagedPackages(globalPackageRoot: string, cwd: string, env: NodeJS.ProcessEnv): ManagedArchctxReadback;
1140
- /** Throws when the shared daemon is not compatible and does not stop cleanly. */
1141
- verifyDaemon(cwd: string, env: NodeJS.ProcessEnv): void;
1142
1120
  /** Migrates a retired section and writes the default section when it is absent. */
1143
1121
  ensureGlobalConfiguration(env: NodeJS.ProcessEnv, write: GlobalConfigurationWrite): ArchitectureSetupStep;
1144
1122
  readiness(repoRoot: string, env?: NodeJS.ProcessEnv): ArchitectureProjectionReadinessV1;
@@ -18,6 +18,10 @@ _ref/
18
18
  !.archcontext/model/relations/
19
19
  !.archcontext/model/flows/
20
20
  !.archcontext/decisions/
21
+ !.archcontext/refactor-decisions/
22
+ .archcontext/refactor-decisions/*
23
+ !.archcontext/refactor-decisions/recommendation.[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f].json
24
+ .archcontext/refactor-decisions/*/
21
25
  !.archcontext/policies/
22
26
  !.archcontext/practices/
23
27
  !.archcontext/projections/