handoff-check 0.7.0 → 0.9.0

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.
@@ -0,0 +1,30 @@
1
+ # ADR 0008: current-clock verification before an explicit command
2
+
3
+ Status: accepted for 0.8.0.
4
+
5
+ Session-start checks become stale before later operations. Add an opt-in `run`
6
+ CLI adapter that uses existing config/profile selectors, strict input parsers
7
+ and the same pure verifier immediately before spawning one explicit executable.
8
+ Require content-aware input, a nonempty active set and the current clock; offer
9
+ no as-of/force/skip/policy override. Read each input once; never refresh a baseline.
10
+ No new manifest/handoff or verification result schema is needed.
11
+
12
+ Require `run` first and an explicit `--` boundary. Parse only preceding wrapper
13
+ options, pass the trailing executable/argv as an array with shell false, and
14
+ inherit cwd/environment/stdio. Do not infer the command from config or rules.
15
+ Keep stdout available for the child and emit phase diagnostics to shared stderr.
16
+ Block mismatch with 1, invalid preflight/launch with 2; preserve all child exit
17
+ codes after launch. Signal forwarding is best-effort to a direct child only;
18
+ there is no descendant supervision, forced termination or command timeout.
19
+ Cancel preflight without launch and bound stalled asynchronous reads with an
20
+ event-loop watchdog removed before spawning. Document platform and timing limits.
21
+
22
+ This narrows the gap between a declared-rule check and an explicitly requested
23
+ operation. It is not atomic with file changes, a model compliance check, an
24
+ authorization boundary, or a sandbox. The chosen program retains ordinary access
25
+ and may itself interpret commands or perform multiple actions. Existing verify,
26
+ init, snapshot, diff, setup and advisory lifecycle behavior stay unchanged.
27
+
28
+ Owner/review-by metadata and explicit source-file checks remain separate future
29
+ work: overdue review must not silently deactivate rules, and source edits do not
30
+ prove semantic policy changes. Do not bundle them into the command gate.
@@ -0,0 +1,34 @@
1
+ # ADR 0009: independent, reference-bound rule review maintenance
2
+
3
+ Status: accepted for 0.9.0.
4
+
5
+ Track owner/review windows separately from constraint applicability. Registry v1
6
+ stores exact id/revision/canonicalHash references plus owner/reviewedAt/reviewBy,
7
+ with matching optional portable project binding. Strict UTC/window/unique-ID
8
+ validation prevents ambiguous records. Reuse existing canonical hashes; do not
9
+ add maintenance fields to old manifests, snapshots or verification results.
10
+
11
+ Review uses explain's scope/global/lifecycle selection, then compares references
12
+ before temporal metadata. Primary precedence is missing, stale, future-reviewed,
13
+ overdue, current; reviewedAt <= evaluation < reviewBy is current. Known inactive
14
+ entries are ignored/count; true orphan IDs need attention project-wide. Zero
15
+ active rules also need attention. Exit 0 means current maintenance, 1 attention,
16
+ 2 invalid. Output JSON has its own v1 schema, independent of verification.
17
+
18
+ Review-record is an explicit record-after-review operation: capture selected/global
19
+ active references at one time with one chosen owner/deadline. Emit stdout JSON or
20
+ create an exclusive new file; no overwrite, merge, adoption, missing-directory
21
+ creation or implicit changes to handoffs. The output is a subset of a project-wide
22
+ registry; adopting it requires preserving/reviewing other scopes deliberately.
23
+
24
+ Overdue review is not expiration and must never silently deactivate restrictions.
25
+ Neither verify/run nor advisory lifecycle/doctor implicitly read the registry.
26
+ Records are unauthenticated declarations and may include personal owner data.
27
+ Do not claim authenticated authorship, review time, behavioral compliance or
28
+ permission. No source inspection, contact lookup, notification or model calls.
29
+ Explicit fixed clocks remain useful for reproducible fixtures, not authority.
30
+
31
+ Future source-file change checks and relationship diagnostics remain separate
32
+ proposals. A metadata feature must not evolve into implicit source fetching or
33
+ free-text contradiction inference. Pilot recruitment and real-user measurements
34
+ remain future work; implementation does not claim those experiments happened.
@@ -1,7 +1,6 @@
1
1
  # Development plan
2
2
 
3
- Status: 0.3.1 onboarding, 0.4 explainability and 0.5 diagnostics/lifecycle implemented;
4
- 0.6 project/profile/report support is also implemented; later milestones proposed.
3
+ Status: milestones through 0.9 are implemented; later milestones remain proposed.
5
4
  Research reviewed: 2026-11-24. Version labels below are targets, not release promises.
6
5
 
7
6
  ## Product direction
@@ -135,15 +134,33 @@ and optional retained field details; terminal-only new-project setup with exact
135
134
  preview and affirmative adoption of one real global rule. Existing init/verify
136
135
  contracts stay unchanged. See [usage](snapshot-diff-and-setup.md).
137
136
 
138
- ## Later: rule maintenance, gated by pilot demand
137
+ ## 0.8: fresh verification before critical commands (implemented)
138
+
139
+ Implemented under [ADR 0008](decisions/0008-verified-command-runner.md): opt-in
140
+ run wraps one explicit executable with current-clock content/nonempty checks
141
+ using the existing verifier. Invalid/mismatched preflight never starts the child;
142
+ successful launch inherits process context and preserves results. It is not a
143
+ sandbox, permission grant, atomic transaction or enforcement outside the wrapper.
144
+ See [usage and limits](verified-commands.md). Existing contracts remain compatible.
145
+
146
+ ## 0.9: rule ownership and review maintenance (implemented)
147
+
148
+ Implemented under [ADR 0009](decisions/0009-independent-rule-review-maintenance.md):
149
+ an independent reference-bound registry, explicit review-record capture and review
150
+ reports. Review deadlines never deactivate constraints or alter verify/run/hooks.
151
+ See [usage](rule-reviews.md). No human identity/time authentication, implicit
152
+ notifications, baseline refresh or automatic registry merge. Pilot evidence and
153
+ real-world maintenance measurements remain future work.
154
+
155
+ ## Later: source and relationship maintenance, gated by pilot demand
139
156
 
140
157
  Priority: medium. Keep source inspection separate from normal verify semantics.
141
158
 
142
159
  - Explore explicit local source bindings and a separate read-only source-check
143
160
  command. A referenced file edit can signal review needed; it does not prove the
144
161
  rule's meaning changed. Decide full-file versus section binding deliberately.
145
- - Consider owner/review-by metadata. Overdue review is distinct from rule expiry;
146
- it must not silently deactivate a restriction.
162
+ - Ownership/review-by shipped in 0.9 in a separate registry. Revisit team-specific
163
+ policies only with pilot demand, keeping overdue review distinct from expiry.
147
164
  - Consider explicitly declared relationships such as conflicts/requires. Validate
148
165
  these deterministically; defer free-text contradiction inference.
149
166
 
@@ -6,8 +6,8 @@ No service, model call or API key is needed.
6
6
  ## Understand the active set
7
7
 
8
8
  ```sh
9
- npx handoff-check@0.7.0 explain --format json
10
- npx handoff-check@0.7.0 explain --scope production --format markdown
9
+ npx handoff-check@0.9.0 explain --format json
10
+ npx handoff-check@0.9.0 explain --scope production --format markdown
11
11
  ```
12
12
 
13
13
  Explain reads the manifest but not the handoff. Every rule has an applicability
@@ -20,8 +20,8 @@ exits 0 even with zero active rules: use verify to compare a handoff.
20
20
  At a reviewed handoff creation, after upgrading all consumers to 0.4+:
21
21
 
22
22
  ```sh
23
- npx handoff-check@0.7.0 snapshot --task "Review staging migrations" --include-content --output handoff.reviewed.json
24
- npx handoff-check@0.7.0 verify --handoff handoff.reviewed.json --require-content --require-active --format markdown
23
+ npx handoff-check@0.9.0 snapshot --task "Review staging migrations" --include-content --output handoff.reviewed.json
24
+ npx handoff-check@0.9.0 verify --handoff handoff.reviewed.json --require-content --require-active --format markdown
25
25
  ```
26
26
 
27
27
  Review the new file before explicitly adopting it in config. Snapshot never
@@ -8,8 +8,8 @@ Bun, API keys, and GitHub Actions are not required. All rules below are syntheti
8
8
  ```sh
9
9
  mkdir handoff-check-demo
10
10
  cd handoff-check-demo
11
- npx handoff-check@0.7.0 init --scope staging --agent none
12
- npx handoff-check@0.7.0 verify --require-content
11
+ npx handoff-check@0.9.0 init --scope staging --agent none
12
+ npx handoff-check@0.9.0 verify --require-content
13
13
  ```
14
14
 
15
15
  The starter passes with `PASS (EMPTY)` and `0 active constraints checked`.
@@ -41,7 +41,7 @@ does not fetch it or check the contents of a referenced document.
41
41
  Before capturing a baseline, run:
42
42
 
43
43
  ```sh
44
- npx handoff-check@0.7.0 verify --require-content --require-active
44
+ npx handoff-check@0.9.0 verify --require-content --require-active
45
45
  ```
46
46
 
47
47
  Expect `MISSING MIGRATION-REVIEW`, one active constraint, and exit 1. The old
@@ -50,8 +50,8 @@ starter handoff does not include the new rule yet.
50
50
  ## Capture and verify a reviewed baseline
51
51
 
52
52
  ```sh
53
- npx handoff-check@0.7.0 snapshot --task "Review staging migration" --output handoff.reviewed.json
54
- npx handoff-check@0.7.0 verify --handoff handoff.reviewed.json --require-content --require-active
53
+ npx handoff-check@0.9.0 snapshot --task "Review staging migration" --output handoff.reviewed.json
54
+ npx handoff-check@0.9.0 verify --handoff handoff.reviewed.json --require-content --require-active
55
55
  ```
56
56
 
57
57
  Review the generated file before relying on it. The verification command should
@@ -70,7 +70,7 @@ In `constraints.json`, change the description to
70
70
  handoff unchanged, then run:
71
71
 
72
72
  ```sh
73
- npx handoff-check@0.7.0 verify --handoff handoff.reviewed.json --require-content --require-active --format json
73
+ npx handoff-check@0.9.0 verify --handoff handoff.reviewed.json --require-content --require-active --format json
74
74
  ```
75
75
 
76
76
  Expect `status: "mismatch"`, `activeConstraintCount: 1`, a `CHANGED` finding, and
package/docs/lifecycle.md CHANGED
@@ -6,8 +6,8 @@ calls, source fetches, API keys or transcript access.
6
6
  ## Diagnose the intended repository/worktree root
7
7
 
8
8
  ```sh
9
- npx handoff-check@0.7.0 doctor --format json
10
- npx handoff-check@0.7.0 doctor --host claude
9
+ npx handoff-check@0.9.0 doctor --format json
10
+ npx handoff-check@0.9.0 doctor --host claude
11
11
  ```
12
12
 
13
13
  Doctor reports resolved input paths/versions, managed integrations/pins and
@@ -22,10 +22,10 @@ host settings and effective trust are not comprehensively inspected.
22
22
 
23
23
  1. Initialize/review inputs and deliberately adopt a content-aware baseline.
24
24
  2. Install the exact package in the consuming project. For npm:
25
- `npm install --save-dev --save-exact handoff-check@0.7.0`. Installation uses
25
+ `npm install --save-dev --save-exact handoff-check@0.9.0`. Installation uses
26
26
  the registry; the hook later uses only this local package. Temporary npx caches
27
27
  and global installs do not meet that prerequisite.
28
- 3. Run `npx handoff-check@0.7.0 hook-config --host claude` and inspect the JSON.
28
+ 3. Run `npx handoff-check@0.9.0 hook-config --host claude` and inspect the JSON.
29
29
  4. In an editor, merge the returned SessionStart entries into the existing
30
30
  `.claude/settings.json` hooks object. Preserve other events, handlers,
31
31
  permissions and settings. Do not replace the whole file or blindly redirect
@@ -66,6 +66,17 @@ enterprise policies can disable hooks or require review.
66
66
 
67
67
  ## Critical actions need a fresh check
68
68
 
69
+ From 0.8.0, use the dedicated command wrapper with the reviewed local package:
70
+
71
+ ```sh
72
+ node ./node_modules/handoff-check/dist/cli.js run --profile production -- node scripts/preflight-demo.js
73
+ ```
74
+
75
+ Choose a configured profile and explicit reviewed program. The wrapper requires
76
+ nonempty content-aware inputs and the current clock, then preserves the child
77
+ result. It blocks only commands invoked through it, not other agent actions.
78
+ See [verified commands](verified-commands.md) for timing, process and platform limits.
79
+
69
80
  In Bash with the project-local package already installed:
70
81
 
71
82
  ```sh
@@ -56,10 +56,10 @@ Author `.handoff-check.json` as config v2:
56
56
  ```
57
57
 
58
58
  ```sh
59
- npx handoff-check@0.7.0 explain --profile stage
60
- npx handoff-check@0.7.0 snapshot --profile stage --task "Review staging work" --output handoffs/staging.reviewed.json
61
- npx handoff-check@0.7.0 verify --profile stage --require-content
62
- npx handoff-check@0.7.0 doctor --profile stage
59
+ npx handoff-check@0.9.0 explain --profile stage
60
+ npx handoff-check@0.9.0 snapshot --profile stage --task "Review staging work" --output handoffs/staging.reviewed.json
61
+ npx handoff-check@0.9.0 verify --profile stage --require-content
62
+ npx handoff-check@0.9.0 doctor --profile stage
63
63
  ```
64
64
 
65
65
  These assume you deliberately adopted a baseline at the configured handoff path;
@@ -83,8 +83,8 @@ bindings produce NOT VERIFIED context; hook transport success is not a pass.
83
83
  ## Record exactly what was checked
84
84
 
85
85
  ```sh
86
- npx handoff-check@0.7.0 verify --profile stage --require-content --report --format json
87
- npx handoff-check@0.7.0 verify --profile stage --require-content --report --git-context --format markdown
86
+ npx handoff-check@0.9.0 verify --profile stage --require-content --report --format json
87
+ npx handoff-check@0.9.0 verify --profile stage --require-content --report --git-context --format markdown
88
88
  ```
89
89
 
90
90
  --report is optional and verify-only. It adds package version, requested policies,
package/docs/releasing.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # Releasing
2
2
 
3
3
  The npm package name is `handoff-check`; the binary is `handoff-check` and the
4
- current version is 0.7.0. The package is already published; subsequent releases
4
+ current version is 0.9.0. The package is already published; subsequent releases
5
5
  use the configured trusted publisher and the reviewed-artifact process below.
6
6
 
7
7
  ## Release a reviewed version
@@ -19,12 +19,12 @@ use the configured trusted publisher and the reviewed-artifact process below.
19
19
  publish-run artifact and compare it before claiming artifact continuity.
20
20
  For first-publication bootstrap or an explicitly chosen manual release, use
21
21
  `npm login` and publish the reviewed tarball directly with
22
- `npm publish /absolute/path/handoff-check-0.7.0.tgz --ignore-scripts --access public`.
22
+ `npm publish /absolute/path/handoff-check-0.9.0.tgz --ignore-scripts --access public`.
23
23
  Complete interactive two-factor authentication directly with npm.
24
24
  5. Verify registry name, version, binary and integrity, then test
25
- `npx --yes handoff-check@0.7.0 --version` and fresh-project init/verify using a
25
+ `npx --yes handoff-check@0.9.0 --version` and fresh-project init/verify using a
26
26
  new package cache and the public registry, rather than the local tarball.
27
- 6. Create tag `v0.7.0` and a GitHub release on the reviewed main commit, attach the
27
+ 6. Create tag `v0.9.0` and a GitHub release on the reviewed main commit, attach the
28
28
  same tarball, and describe features, requirements and known limits.
29
29
 
30
30
  Publishing is immutable for a given npm name/version. Fix failed candidates on a
package/docs/roadmap.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Roadmap
2
2
 
3
+ Implemented in 0.9.0: independent rule ownership/review windows and reference-bound
4
+ maintenance reports, without changing verification policy.
5
+ See [rule reviews](rule-reviews.md).
6
+
7
+ Implemented in 0.8.0: explicit current-clock verification before a supplied
8
+ command, with mandatory content/nonempty checks and preserved child results.
9
+ See [verified commands](verified-commands.md).
10
+
3
11
  Implemented in 0.7.0: explicit saved-snapshot diff and guided new-project setup.
4
12
  See [snapshot diff and setup](snapshot-diff-and-setup.md).
5
13
 
@@ -12,7 +20,7 @@ and configuration snippet, host matrix and critical-action recipes.
12
20
  See [lifecycle setup](lifecycle.md). Codex/Cursor adapters remain unshipped.
13
21
 
14
22
  See the [development plan](development-plan.md) for research evidence, proposed
15
- 0.4–0.6 milestones, dependencies, pilot validation, and acceptance criteria.
23
+ milestones, dependencies, pilot validation, and acceptance criteria.
16
24
  The plan distinguishes implemented releases from proposed milestones and dates.
17
25
 
18
26
  Implemented in 0.4.0: shared-lifecycle explain, opt-in retained-content v3
@@ -0,0 +1,120 @@
1
+ # Rule ownership and review deadlines
2
+
3
+ Maintenance metadata lives in a separate versioned registry. It identifies an
4
+ owner and review window for an exact rule revision/hash without changing a rule,
5
+ handoff, canonical hash or existing verification result. A deadline needing
6
+ attention never expires, revokes or disables the underlying constraint.
7
+
8
+ ## Record a deliberate review
9
+
10
+ Read the current applicable descriptions with explain, then review them through
11
+ your normal process. Only after that review, explicitly record the selected
12
+ scope's active rules (including global rules):
13
+
14
+ ```sh
15
+ npx handoff-check@0.9.0 explain --profile stage
16
+ npx handoff-check@0.9.0 review-record --profile stage --owner platform-team --review-by 2027-01-01T00:00:00Z --output rules.review.next.json
17
+ ```
18
+
19
+ The owner/deadline are examples. One owner and deadline apply to **every** active
20
+ rule captured by that invocation, including global rules. Choose the intended
21
+ owner and review interval explicitly. Review the resulting file before adopting
22
+ it as your team's registry. To assign different owners, deliberately edit and
23
+ validate the separate entries or combine independently reviewed records by unique
24
+ ID. This command does not discover people, send notifications or authenticate
25
+ who reviewed a rule.
26
+
27
+ Without `--output`, review-record writes JSON to stdout. With it, exclusive
28
+ creation requires a new file with an existing parent; existing files, symlink
29
+ leaves and directories are refused. The record is computed once and input files
30
+ are never rewritten. An I/O failure can leave a partial new output; inspect it
31
+ before retrying. Shell redirection can itself truncate files, so do not redirect
32
+ stdout onto an existing registry, config, manifest or handoff.
33
+
34
+ This captures a **subset**, not an update/merge of an existing project registry.
35
+ Replacing an aggregate registry with one scope's subset can drop ownership data
36
+ for other scopes. There is no automatic merge, adoption, baseline refresh or
37
+ registry discovery. Record after reviewing changes, never merely to clear a
38
+ maintenance finding. No-active-rules capture fails with exit 2.
39
+
40
+ ## Check maintenance independently
41
+
42
+ ```sh
43
+ npx handoff-check@0.9.0 review --profile stage --registry rules.review.next.json
44
+ npx handoff-check@0.9.0 review --profile stage --registry rules.review.next.json --format json
45
+ npx handoff-check@0.9.0 review --profile stage --registry rules.review.next.json --format markdown
46
+ ```
47
+
48
+ An explicit `--registry` path is required and resolves from cwd. `--config`
49
+ chooses the config, configured manifest paths resolve from its directory, and
50
+ explicit `--constraints` paths resolve from cwd. Profiles are explicit and reject
51
+ scope/manifest overrides, exactly as other commands. Neither command reads a
52
+ handoff, even if config contains a missing handoff path. Config project binding
53
+ still applies. Both unbound inputs and same-project bound manifests/registries
54
+ are supported; mixed binding or different IDs are invalid. No data migration or
55
+ new config/manifest/handoff format is needed. Inputs must be regular readable
56
+ files (symlinks to regular files work); no source references are fetched.
57
+
58
+ The current clock is captured after reads. `--as-of <UTC time>` is available for
59
+ reproducible checks and records, not proof that a person reviewed at that time.
60
+ Rule applicability uses the same scope/global/lifecycle decisions as explain.
61
+
62
+ Each active rule has one primary status, in this order:
63
+
64
+ | Status | Meaning |
65
+ | -------------- | ----------------------------------------------------------------------------------------------------------- |
66
+ | MISSING_REVIEW | No entry exists for this active ID. |
67
+ | STALE_REVIEW | Recorded revision or canonical content hash differs. Owner/time shown belong to the old reviewed reference. |
68
+ | FUTURE_REVIEW | The matching record claims a reviewedAt later than the evaluation time. |
69
+ | OVERDUE_REVIEW | The matching record's reviewBy is at or before evaluation time. |
70
+ | CURRENT | Matching reference and reviewedAt <= evaluation time < reviewBy. |
71
+
72
+ Revision-only changes, including regressions, are stale even when the content hash
73
+ is unchanged. Same-ID content edits are stale without requiring a revision bump.
74
+ Stale takes precedence over future/overdue time. Known inactive/out-of-scope entries
75
+ are ignored and counted; they are not orphaned. IDs absent from the whole manifest
76
+ produce UNKNOWN_RULE findings regardless of the selected scope, because the registry
77
+ is project-wide. A zero-active check produces NO_ACTIVE_CONSTRAINTS without a fake ID.
78
+ Output sorts IDs and reports active/current/registry/ignored counts separately.
79
+
80
+ Exit codes: **0** all selected active rules have current review and no orphan IDs;
81
+ **1** maintenance attention (including zero active); **2** invalid invocation,
82
+ contract, project binding or unreadable file. Review-record succeeds with 0 or
83
+ fails with 2. Reports go to stdout, invalid errors to stderr. Text and Markdown
84
+ escape untrusted owner data. JSON remains structured data, not executable text.
85
+
86
+ ## Registry contract and privacy
87
+
88
+ See [registry schema](../schemas/review-registry.v1.schema.json) and
89
+ [result schema](../schemas/review-result.v1.schema.json). Each registry entry
90
+ requires id, positive safe revision, canonical lowercase SHA-256, nonempty owner,
91
+ reviewedAt and reviewBy. Runtime validation additionally requires unique IDs,
92
+ real calendar dates and reviewBy strictly later than reviewedAt. Timestamps use
93
+ UTC with up to millisecond precision. Rule references reuse the existing frozen
94
+ hash contract; owner/review times do not enter that hash. Registries store no full
95
+ rule text but owner names may still be sensitive; review before sharing them.
96
+
97
+ This is an unauthenticated local declaration of review, not an attestation,
98
+ authorization grant, human identity check or evidence of agent behavior. It does
99
+ not inspect the contents of referenced policy documents. An unchanged source
100
+ reference does not detect edits inside the referenced document.
101
+
102
+ `verify`, `run`, doctor and lifecycle hooks never implicitly load this registry.
103
+ An overdue/missing/broken registry cannot silently change their policy. A fresh
104
+ review record also cannot clear a CHANGED handoff: verify the saved handoff and
105
+ resolve its findings through the existing explicit workflow. If a team wants
106
+ maintenance attention to stop a pipeline, invoke review as a separate explicit
107
+ step and handle its exit code through that team's normal process.
108
+
109
+ ## Reproducible synthetic example
110
+
111
+ From a checkout, use the shipped fixtures:
112
+
113
+ ```sh
114
+ npx handoff-check@0.9.0 review --config examples/rule-reviews/config.json --profile stage --registry examples/rule-reviews/reviews.json --as-of 2026-11-26T08:00:00Z --format json
115
+ ```
116
+
117
+ Expect current/exit 0 with two active rules. At `2026-11-27T08:00:00Z` expect two
118
+ OVERDUE_REVIEW findings/exit 1. Selecting `--profile prod` at the first time instead
119
+ reports missing P-01 and one known inactive entry ignored. These fixtures are
120
+ maintenance-only and intentionally contain no handoff.
@@ -5,7 +5,7 @@
5
5
  With Node.js 22 or newer, run in the intended project root:
6
6
 
7
7
  ```sh
8
- npx handoff-check@0.7.0 setup
8
+ npx handoff-check@0.9.0 setup
9
9
  ```
10
10
 
11
11
  Enter a portable project ID, comma-separated environments, a rule ID, a real rule
@@ -31,7 +31,7 @@ For environments `staging,production`, setup creates `.handoff-check.json`,
31
31
  is no default profile. Choose the intended environment explicitly:
32
32
 
33
33
  ```sh
34
- npx handoff-check@0.7.0 verify --profile staging --require-content --require-active
34
+ npx handoff-check@0.9.0 verify --profile staging --require-content --require-active
35
35
  ```
36
36
 
37
37
  Add environment-specific rules later through deliberate review and capture;
@@ -44,9 +44,9 @@ portable skill. Do not use setup as a migration or baseline-repair command.
44
44
  ## Compare two saved snapshots
45
45
 
46
46
  ```sh
47
- npx handoff-check@0.7.0 diff --before handoff.saved.json --after handoff.next.json
48
- npx handoff-check@0.7.0 diff --before handoff.saved.json --after handoff.next.json --format json
49
- npx handoff-check@0.7.0 diff --before handoff.saved.json --after handoff.next.json --format markdown
47
+ npx handoff-check@0.9.0 diff --before handoff.saved.json --after handoff.next.json
48
+ npx handoff-check@0.9.0 diff --before handoff.saved.json --after handoff.next.json --format json
49
+ npx handoff-check@0.9.0 diff --before handoff.saved.json --after handoff.next.json --format markdown
50
50
  ```
51
51
 
52
52
  Both operands are strictly validated handoff files. Unbound v2/v3 can be compared
@@ -0,0 +1,104 @@
1
+ # Verify immediately before a command
2
+
3
+ `run` performs a current-clock verification and starts an explicitly supplied
4
+ executable only after a nonempty, content-aware handoff passes. It calls the same
5
+ verifier as `verify`; the pure core and existing input formats are unchanged.
6
+
7
+ With Node.js 22 or newer, use an existing reviewed project configuration:
8
+
9
+ ```sh
10
+ npx handoff-check@0.9.0 run --profile production -- node scripts/preflight-demo.js
11
+ ```
12
+
13
+ The profile is an example: select the intended configured profile, or use
14
+ `--scope <scope>` with optional `--constraints <path>`/`--handoff <path>`.
15
+ `--config <path>` selects an explicit config. Config paths resolve relative to
16
+ that config, CLI input paths relative to the invocation directory. The child
17
+ always inherits the invocation working directory, environment and stdin/stdout/
18
+ stderr; selecting a config elsewhere does not move the child. Project/scope
19
+ binding and profile override restrictions are identical to verify.
20
+
21
+ Use a reviewed installed or project-local version for critical workflows so a
22
+ network download is not part of each operation. `npx` installation may access the
23
+ registry; `run` itself performs no network, Git or model calls. The supplied
24
+ program may access networks or mutate files as any normal command can.
25
+
26
+ ## Command boundary and mandatory policy
27
+
28
+ `run` must be the first CLI argument. A literal `--` separates wrapper options
29
+ from the executable and its argv. Everything after it is passed literally,
30
+ including `--help`, `--version`, `--profile`, spaces, empty strings and shell
31
+ metacharacters. The wrapper uses `spawn` with `shell: false`; it never constructs
32
+ a command string or reads an executable from project rules/config.
33
+
34
+ Only `--config`, `--profile`, `--scope`, `--constraints`, and `--handoff` are
35
+ supported wrapper options. `run --help` prints usage without starting a child.
36
+ `--as-of`, policy overrides, output/report formats and force/skip modes are not
37
+ supported. Content-aware v2/v3/v4 and at least one active constraint are mandatory.
38
+ An empty starter that passes ordinary verify therefore cannot start a command.
39
+ There is no automatic migration, snapshot refresh, baseline adoption or input edit.
40
+
41
+ The evaluation clock is captured after input reads, immediately before the pure
42
+ verification. Missing/changed/stale declarations produce a blocked result; invalid
43
+ JSON, mismatched binding/scope, unsupported legacy v1 and unreadable files fail
44
+ without starting the child. A five-second event-loop watchdog bounds stalled
45
+ asynchronous preflight reads; it is removed before command launch, not applied as
46
+ a runtime limit to the command. Run opens inputs nonblocking and requires regular
47
+ files (file symlinks to regular files remain supported); FIFOs/devices/directories
48
+ are rejected. The watchdog cannot preempt synchronous JavaScript or guarantee
49
+ termination of an unresponsive operating-system/filesystem operation.
50
+
51
+ Executable lookup uses the inherited PATH; a path containing spaces is one argv
52
+ token. On Windows, prefer `node path/to/script.js` or a native executable.
53
+ `.cmd`/`.bat` scripts require a command interpreter and have no implicit shell
54
+ fallback. An explicitly chosen shell is itself the supplied program; its own
55
+ parsing and side effects are the caller's responsibility.
56
+
57
+ ## Diagnostics and exit codes
58
+
59
+ Wrapper diagnostics go to stderr, leaving stdout for the supplied program:
60
+
61
+ - `RUN CHECKING`: preflight begun; no child has started.
62
+ - `RUN BLOCKED`: mismatch, including finding codes/IDs; exit 1, no child.
63
+ - `INVALID` or `RUN INVALID`: invalid invocation/input or stalled preflight;
64
+ exit 2, no child.
65
+ - `RUN VERIFIED`: count, scope, evaluation time and optional project/profile;
66
+ verification passed, but launch has not yet been proven.
67
+ - `RUN LAUNCH ERROR`: executable could not start; exit 2.
68
+ - `RUN STARTED`: spawn succeeded; wait for the program's result.
69
+ - `RUN EXIT`: child exit code is preserved, including 1, 2, 42 or 127. After
70
+ launch, codes 1/2 describe the child, not a new verifier finding.
71
+
72
+ Child stderr shares the same inherited stream and may interleave with diagnostics;
73
+ these prefixes are human diagnostics, not an authenticated machine protocol.
74
+ No full argv, rule descriptions or source references are printed by the wrapper.
75
+ For structured verification details run `verify --format json` separately.
76
+
77
+ On POSIX, SIGINT/SIGTERM received during preflight cancel with 130/143 and no
78
+ launch. While running, forwarding is best-effort to the direct child only. The
79
+ wrapper waits for its exit; a handler's chosen exit code wins. An unhandled child
80
+ signal maps to 128 plus the OS signal number (unknown signals fall back to 129).
81
+ Terminal process groups may deliver a signal to both processes independently.
82
+ Windows console/termination semantics differ and POSIX forwarding is not promised.
83
+ There is no automatic forced termination, command timeout or descendant cleanup;
84
+ a child ignoring a signal can keep running. `RUN PROCESS ERROR` or forwarding
85
+ failure diagnostics after launch do not reclassify it as a launch failure.
86
+
87
+ ## Test the gate without running a real operation
88
+
89
+ In a disposable configured project with a reviewed active baseline:
90
+
91
+ ```sh
92
+ npx handoff-check@0.9.0 run --profile production -- node -e 'console.log("example command started")'
93
+ ```
94
+
95
+ Edit a rule description in that disposable manifest without refreshing its saved
96
+ baseline, then repeat. Expect `RUN BLOCKED CHANGED`, exit 1, and no example output.
97
+ Review and resolve the difference explicitly before real work. The command is
98
+ never retried automatically.
99
+
100
+ This is a preflight gate around one explicitly invoked command, not a sandbox,
101
+ authorization grant or proof of behavior. Inputs can change or expire after the
102
+ check, and the supplied program can perform additional actions or spawn children.
103
+ It cannot stop agent actions outside this wrapper. Re-run it per intended action;
104
+ a previous pass is not a reusable execution permission.
@@ -0,0 +1,9 @@
1
+ {
2
+ "schemaVersion": 2,
3
+ "projectId": "review-demo",
4
+ "constraints": "constraints.json",
5
+ "profiles": {
6
+ "stage": { "scope": "staging" },
7
+ "prod": { "scope": "production" }
8
+ }
9
+ }
@@ -0,0 +1,27 @@
1
+ {
2
+ "schemaVersion": 3,
3
+ "projectId": "review-demo",
4
+ "constraints": [
5
+ {
6
+ "id": "G-01",
7
+ "revision": 1,
8
+ "scope": "global",
9
+ "description": "Review migrations before applying them",
10
+ "source": "synthetic:review-policy"
11
+ },
12
+ {
13
+ "id": "S-01",
14
+ "revision": 1,
15
+ "scope": "staging",
16
+ "description": "Use synthetic records in staging",
17
+ "source": "synthetic:staging-policy"
18
+ },
19
+ {
20
+ "id": "P-01",
21
+ "revision": 1,
22
+ "scope": "production",
23
+ "description": "Obtain the designated deployment review",
24
+ "source": "synthetic:production-policy"
25
+ }
26
+ ]
27
+ }
@@ -0,0 +1,22 @@
1
+ {
2
+ "schemaVersion": 1,
3
+ "projectId": "review-demo",
4
+ "rules": [
5
+ {
6
+ "id": "G-01",
7
+ "revision": 1,
8
+ "contentHash": "sha256:5ce323472413c1d2e932615aaed992ea565dec9833ea022ec92fb13fc37f8f5c",
9
+ "owner": "platform-team",
10
+ "reviewedAt": "2026-11-26T08:00:00.000Z",
11
+ "reviewBy": "2026-11-27T08:00:00.000Z"
12
+ },
13
+ {
14
+ "id": "S-01",
15
+ "revision": 1,
16
+ "contentHash": "sha256:8f2041c107968fcd3933003541a6cc0dcd6ac67c0005dbd743dd266840af34bb",
17
+ "owner": "platform-team",
18
+ "reviewedAt": "2026-11-26T08:00:00.000Z",
19
+ "reviewBy": "2026-11-27T08:00:00.000Z"
20
+ }
21
+ ]
22
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "handoff-check",
3
- "version": "0.7.0",
3
+ "version": "0.9.0",
4
4
  "description": "A deterministic, local CLI that verifies active constraints before a coding agent resumes work.",
5
5
  "type": "module",
6
6
  "packageManager": "bun@1.2.10",