handoff-check 0.4.0 → 0.6.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.
@@ -9,8 +9,8 @@ infers rules from a summary.
9
9
  From the consuming repository root:
10
10
 
11
11
  ```sh
12
- npx handoff-check@0.4.0 init --scope staging --agent both --dry-run
13
- npx handoff-check@0.4.0 init --scope staging --agent both
12
+ npx handoff-check@0.6.0 init --scope staging --agent both --dry-run
13
+ npx handoff-check@0.6.0 init --scope staging --agent both
14
14
  ```
15
15
 
16
16
  Choose `codex`, `claude`, `both` (default), or `none`. Generated integrations:
@@ -39,8 +39,8 @@ npm pack
39
39
  From a separate consuming project, substitute the actual absolute tarball path:
40
40
 
41
41
  ```sh
42
- npx --offline --yes --package=/absolute/path/handoff-check-0.4.0.tgz handoff-check init --scope staging --agent both
43
- npx --offline --yes --package=/absolute/path/handoff-check-0.4.0.tgz handoff-check verify --format json --require-content
42
+ npx --offline --yes --package=/absolute/path/handoff-check-0.6.0.tgz handoff-check init --scope staging --agent both
43
+ npx --offline --yes --package=/absolute/path/handoff-check-0.6.0.tgz handoff-check verify --format json --require-content
44
44
  ```
45
45
 
46
46
  Bun is not required for these consumer commands. Generated agent commands use the
@@ -81,8 +81,9 @@ See [upgrade instructions](../README.md#upgrade-from-01).
81
81
  Skill discovery depends on the host agent. Skills/instructions are guidance, not
82
82
  guaranteed hooks. `init --ci` adds `.github/workflows/handoff-check.yml` pinned to
83
83
  the installed version and using saved config. This checks committed IDs on push/PR,
84
- not every agent turn. Host-specific hooks are a future integration because host
85
- events and context-reset behavior differ.
84
+ not every agent turn. 0.5 adds a separate opt-in Claude advisory lifecycle adapter.
85
+ See [setup and host limits](lifecycle.md) for doctor diagnostics and explicit local
86
+ installation. Codex/Cursor adapters are not shipped.
86
87
 
87
88
  ## Upgrades and contributor instructions
88
89
 
@@ -17,6 +17,19 @@ No verification operation writes inputs, accesses a network, calls a model,
17
17
  executes source references, or reads agent transcripts. Output order must be
18
18
  independent of manifest and handoff ordering.
19
19
 
20
+ Bound input formats compare explicit project IDs in the pure core. Config v2
21
+ profiles are selected explicitly in the CLI and shared with doctor/lifecycle.
22
+ Optional report metadata hashes the SAME byte reads used to parse inputs/config.
23
+ Git subprocesses are fixed-argument, read-only, bounded and separately opt-in for
24
+ reports; the verifier itself never reads Git. See ADR 0006 for non-atomicity and
25
+ authentication limits.
26
+
27
+ Doctor inspects local inputs/integration metadata without executing host commands.
28
+ The bounded Claude lifecycle adapter reads an event envelope and explicit config,
29
+ then calls the same verifier. Hook-config prints a mergeable snippet, never writes
30
+ host settings. Advisory host transport success is distinct from verification.
31
+ See decisions/0005-local-diagnostics-and-lifecycle.md.
32
+
20
33
  Exit codes: 0 for verified IDs, 1 for rule mismatches, 2 for invalid input or an
21
34
  unreadable input file. JSON output is intended for agent adapters and automation.
22
35
 
@@ -0,0 +1,73 @@
1
+ # ADR 0005: Local diagnostics and lifecycle adapters
2
+
3
+ Status: accepted for 0.5.0. Host references checked 2026-11-25.
4
+
5
+ ## Commands and compatibility
6
+
7
+ Verify/snapshot/explain and their schemas remain unchanged. Doctor is read-only,
8
+ hook-config writes only stdout, and hook invokes the existing pure verifier.
9
+ None installs packages, edits host settings, reads transcripts/source references,
10
+ calls models, runs arbitrary commands, or recaptures a baseline.
11
+
12
+ Doctor accepts config/path/scope overrides and optional host claude/codex/cursor.
13
+ JSON schemaVersion 1 includes packageVersion, status (healthy/attention), paths,
14
+ optional scope, diagnostics and notice. Each diagnostic has code, level
15
+ (ok/info/warning/error), message and optional path. Ordering is deterministic for
16
+ the same files/options; no applicability clock is used. Exit 0 means no local
17
+ warning/error, 1 means diagnosed attention, and 2 means invalid invocation or an
18
+ unexpected diagnostic failure. Bad project data are diagnostics on stdout.
19
+
20
+ Doctor validates input schemas and compares managed skill text/instruction pins
21
+ and textual CI pins. It inspects project .claude/settings.json for the recognized
22
+ generated handler and checks its local package prerequisite. It never executes
23
+ inspected hooks or imports inspected packages. Missing unselected integrations are
24
+ informational; selected-host omissions warn. Custom prose/commands, global/local/
25
+ managed settings, effective host trust and runtime execution are not inferred.
26
+ Symlink input reads follow verify semantics and are identified. No repair occurs.
27
+
28
+ ## Explicit advisory adapter
29
+
30
+ Hook-config emits a mergeable JSON fragment for Claude SessionStart only. Users
31
+ preserve all existing handlers/permissions while merging; no settings are written.
32
+ The handler uses exec-form node plus separate args with CLAUDE_PROJECT_DIR
33
+ placeholders, avoiding shell evaluation and preserving special characters in paths.
34
+ A pinned project-local package and a host supporting this documented exec form
35
+ are prerequisites; temporary npx/global installations are insufficient.
36
+
37
+ The matcher selects startup/resume/clear/compact. Fork and other events are not
38
+ supported in 0.5. Timeout is 10 seconds. --require-active is copied only on explicit
39
+ request. The adapter always requires content-aware v2/v3; empty checks are valid
40
+ and explicitly marked by default.
41
+
42
+ Hook consumes one JSON envelope from stdin. Required event/source/cwd fields are
43
+ validated; extra host metadata is ignored, including transcript_path. cwd must be
44
+ an existing absolute directory inside the canonical explicit config directory.
45
+ Subdirectories and canonicalized symlink roots work; other worktrees/siblings fail.
46
+ The caller selects its worktree config explicitly; no parent search or environment
47
+ guessing occurs. Scope comes from saved config and current time is captured once.
48
+
49
+ Input is bounded to 65536 bytes and a 2-second wait; a CLI watchdog caps the entire
50
+ adapter at 5 seconds, including stuck file reads. Output is only
51
+ hookSpecificOutput {hookEventName: SessionStart, additionalContext: string}.
52
+ Context distinguishes PASS/PASS (EMPTY)/FAIL/NOT VERIFIED (INVALID), with
53
+ scope/time/count/finding codes and IDs. Arbitrary descriptions/sources/task text
54
+ are not injected as instructions. Summaries mark truncation and point to verify.
55
+
56
+ Valid envelopes with invalid project inputs still emit NOT VERIFIED and transport
57
+ exit 0 so the advisory result reaches context. Invalid envelopes/containment or
58
+ config invocation, stream errors and timeouts exit 2 with safe stderr, no success
59
+ JSON. SessionStart is nonblocking: transport success is not verification success
60
+ or permission to act. No permission/continue/bypass fields are emitted.
61
+
62
+ ## Operational limits
63
+
64
+ Critical operations re-run verify in their own execution path, independently of
65
+ this advisory hook. Permissions/approvals remain separate; files may change after
66
+ a check. Protocol fixtures and generated-command subprocess tests do not prove a
67
+ particular live host loaded settings or delivered model context. Confirm that
68
+ with the host's /hooks/debug surfaces. Other hosts have hook mechanisms, but this
69
+ release does not ship/test adapters for those protocols.
70
+
71
+ References: [Claude hooks](https://code.claude.com/docs/en/hooks),
72
+ [Codex hooks](https://learn.chatgpt.com/docs/hooks),
73
+ [Cursor hooks](https://cursor.com/docs/hooks).
@@ -0,0 +1,87 @@
1
+ # ADR 0006: Explicit projects, profiles and reproducibility reports
2
+
3
+ Status: accepted for 0.6.0.
4
+
5
+ ## Portable opt-in binding
6
+
7
+ Manifest v3 requires projectId (the existing case-sensitive identifier syntax)
8
+ and v2 revisioned constraints/relationship validation. Handoff v4 requires the
9
+ same projectId, scope, task, capturedAt, contentMode and activeConstraints.
10
+ contentMode is hashes or retained: every reference follows that mode; hashes
11
+ rejects content, retained requires full validated content consistent with the
12
+ reference. Canonical rule hashing is unchanged: outer projectId is not added to
13
+ the frozen eight-field hash algorithm. Standalone retained replacement semantics
14
+ remain unchanged.
15
+
16
+ If either input is bound, or an expected config projectId is supplied, verify
17
+ requires BOTH bound input formats with exactly matching IDs and expected identity.
18
+ Mixed binding, missing identity and mismatches are invalid input (exit 2), before
19
+ findings. Scope mismatch remains invalid. The pure verifier receives the expected
20
+ ID explicitly; it reads no config, Git or filesystem. With no binding requested,
21
+ old manifest v1/v2 and handoff v1/v2/v3 behave unchanged, including default JSON.
22
+
23
+ Snapshot from a bound manifest creates v4 hashes by default or v4 retained with
24
+ --include-content. Unbound capture still creates v2/v3. Expected binding cannot
25
+ turn an unbound manifest into a bound snapshot. Init defaults stay unbound and no
26
+ existing inputs are silently migrated. Upgrade consumers, verify/review the old
27
+ baseline FIRST, then deliberately migrate the manifest and capture/adopt a new
28
+ baseline. Do not refresh merely to clear findings.
29
+
30
+ Project IDs are explicit portable labels, not absolute paths or inferred remotes.
31
+ Worktrees can share one reviewed identity while resolving their own inputs. This
32
+ prevents accidental baseline interchange, not malicious edits: someone controlling
33
+ config/inputs can change labels together. It does not prove the cwd belongs to a
34
+ trusted repository or grant production authorization.
35
+
36
+ ## Config v2 and environment profiles
37
+
38
+ Config v1 is unchanged. Config v2 adds optional projectId and optional profiles,
39
+ a nonempty object of identifier-named profiles. Each profile requires scope and
40
+ may override constraints/handoff paths. Omitted paths fall back to top-level
41
+ paths, then ordinary filenames. All configured paths resolve relative to the
42
+ config directory. All profiles are structurally validated when config loads;
43
+ unknown keys/null/invalid scopes/empty paths are rejected. JSON object semantics
44
+ apply; duplicate JSON property spellings are not an authenticated change history.
45
+
46
+ --profile selects explicitly; no default profile, saved selection, branch/cwd
47
+ inference, or environment permission is introduced. Reject combinations with
48
+ explicit --scope/--constraints/--handoff, even if values agree. --config remains
49
+ allowed. Missing profile/config v1 selection returns exit 2. Init rejects profiles;
50
+ author the reviewed config deliberately. Existing config without selection keeps
51
+ its ordinary top-level behavior.
52
+
53
+ Verify, snapshot, explain, doctor and lifecycle use one profile selector. A hook
54
+ configuration may carry explicit --profile in its exec-form args. The lifecycle
55
+ adapter validates binding and reports concise project/profile context, preserving
56
+ its advisory transport semantics and limits. Doctor diagnoses binding mismatches
57
+ as attention (exit 1); invalid profile selection is invocation error (exit 2).
58
+ Explain adds projectId only for bound manifests; it still compares no handoff.
59
+
60
+ ## Reproducibility reports
61
+
62
+ Explicit verify --report requires --format json or markdown. JSON is a separate
63
+ schemaVersion 1 verification-report wrapper with packageVersion, policies,
64
+ inputs, optional profile/projectId/git, nested result and notice. Existing default
65
+ JSON is untouched. Markdown appends safely escaped metadata. No report file is
66
+ written automatically; stdout redirection must not target inputs.
67
+
68
+ Each input/config is read once as bytes; those exact bytes are both parsed and
69
+ hashed using sha256:lowercasehex. The config digest describes the original loaded
70
+ file even when CLI overrides are used. Absent implicit config is explicitly null,
71
+ never an invented digest. Paths are absolute resolved read paths; hashes describe
72
+ byte formatting as well as content, unlike the semantic rule hash. No source
73
+ documents are read. Report schema validates the wrapper and basic nested-result
74
+ structure; the nested result's behavior remains defined by verifier contracts.
75
+
76
+ --git-context is verify-only and requires --report. Fixed execFile argument vectors
77
+ read the invocation cwd's Git top-level worktree, HEAD commit and branch (null
78
+ when detached), without shell, fetch, index write or dirty-status inspection.
79
+ Requests are bounded to 2 seconds/256 KiB per Git command. Nonrepo/unborn/missing
80
+ Git/failure returns exit 2 and no successful report. If config is elsewhere, Git
81
+ still describes the invocation cwd, not an inferred identity for every input.
82
+
83
+ Reports are local records, not authenticated attestations, agent compliance proofs
84
+ or globally atomic snapshots. Git metadata and separate input reads may race with
85
+ other writers. Exact digests identify the bytes evaluated; revalidate before acting.
86
+ Paths/branch/project labels can disclose local information: review before sharing.
87
+ No default Git subprocess, telemetry, report persistence or signing is introduced.
@@ -1,6 +1,7 @@
1
1
  # Development plan
2
2
 
3
- Status: 0.3.1 onboarding and 0.4 explainability implemented; later milestones proposed.
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.
4
5
  Research reviewed: 2026-11-24. Version labels below are targets, not release promises.
5
6
 
6
7
  ## Product direction
@@ -72,7 +73,13 @@ Acceptance:
72
73
  - Reports and verification never silently recapture or adopt a baseline.
73
74
  - Evaluate storage size and sensitive-content exposure before choosing defaults.
74
75
 
75
- ## 0.5: automatic checks and installation diagnostics
76
+ ## 0.5: automatic checks and installation diagnostics (implemented)
77
+
78
+ Implemented under [ADR 0005](decisions/0005-local-diagnostics-and-lifecycle.md):
79
+ read-only doctor, stdout-only snippet and Claude advisory SessionStart adapter.
80
+ Codex/Cursor interfaces were investigated/documented; adapters are not shipped.
81
+ Tests simulate host protocol and execute generated commands; live model-context
82
+ delivery is not claimed. Pilot recruitment remains future work.
76
83
 
77
84
  Priority: high, after explainability. No second verification engine.
78
85
 
@@ -95,7 +102,13 @@ Acceptance:
95
102
  - No automatic baseline refresh, silent policy opt-in, or hook installation overwrite.
96
103
  - No claim that doctor can see every instruction or hidden host memory.
97
104
 
98
- ## 0.6: project and environment correctness
105
+ ## 0.6: project and environment correctness (implemented)
106
+
107
+ Implemented under [ADR 0006](decisions/0006-project-profiles-and-reports.md):
108
+ opt-in manifest3/handoff4 project binding, config2 explicit profiles and optional
109
+ reproducibility reports with separately requested Git metadata. Existing unbound
110
+ workflows are preserved; no profile/identity is inferred. Pilot recruitment and
111
+ real-world measurements remain future work, not completed validation claims.
99
112
 
100
113
  Priority: medium/high; validate with worktree and multi-environment pilots first.
101
114
 
@@ -1,13 +1,13 @@
1
1
  # Explain applicability and review changes
2
2
 
3
- Requires Handoff Check 0.4.0+ and Node.js 22+. Run from your configured repository.
3
+ Requires Handoff Check 0.6.0+ and Node.js 22+. Run from your configured repository.
4
4
  No service, model call or API key is needed.
5
5
 
6
6
  ## Understand the active set
7
7
 
8
8
  ```sh
9
- npx handoff-check@0.4.0 explain --format json
10
- npx handoff-check@0.4.0 explain --scope production --format markdown
9
+ npx handoff-check@0.6.0 explain --format json
10
+ npx handoff-check@0.6.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,14 +20,14 @@ 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.4.0 snapshot --task "Review staging migrations" --include-content --output handoff.reviewed.json
24
- npx handoff-check@0.4.0 verify --handoff handoff.reviewed.json --require-content --require-active --format markdown
23
+ npx handoff-check@0.6.0 snapshot --task "Review staging migrations" --include-content --output handoff.reviewed.json
24
+ npx handoff-check@0.6.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
28
- overwrites a path. Default snapshots remain v2; the flag creates v3 containing
28
+ overwrites a path. Unbound snapshots remain v2; the flag creates v3 containing
29
29
  full old descriptions, sources, revision and lifecycle values. Consider sensitive
30
- content before storing or sharing. Old v1/v2 files do not require migration.
30
+ content before storing or sharing. Old v1/v2 files do not require migration. Bound manifest v3 capture creates handoff v4; see project-context.md.
31
31
 
32
32
  After a same-ID description edit, verification produces CHANGED and exit 1.
33
33
  V3 JSON adds typed `changes`; text and Markdown show the saved/current fields.
@@ -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.4.0 init --scope staging --agent none
12
- npx handoff-check@0.4.0 verify --require-content
11
+ npx handoff-check@0.6.0 init --scope staging --agent none
12
+ npx handoff-check@0.6.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.4.0 verify --require-content --require-active
44
+ npx handoff-check@0.6.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.4.0 snapshot --task "Review staging migration" --output handoff.reviewed.json
54
- npx handoff-check@0.4.0 verify --handoff handoff.reviewed.json --require-content --require-active
53
+ npx handoff-check@0.6.0 snapshot --task "Review staging migration" --output handoff.reviewed.json
54
+ npx handoff-check@0.6.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.4.0 verify --handoff handoff.reviewed.json --require-content --require-active --format json
73
+ npx handoff-check@0.6.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
@@ -0,0 +1,99 @@
1
+ # Installation diagnostics and lifecycle checks
2
+
3
+ Requires Handoff Check 0.6.0+ and Node.js 22+. Checks run locally without model
4
+ calls, source fetches, API keys or transcript access.
5
+
6
+ ## Diagnose the intended repository/worktree root
7
+
8
+ ```sh
9
+ npx handoff-check@0.6.0 doctor --format json
10
+ npx handoff-check@0.6.0 doctor --host claude
11
+ ```
12
+
13
+ Doctor reports resolved input paths/versions, managed integrations/pins and
14
+ recognized project hooks without executing them. Config/path/scope overrides work
15
+ as with verify. Exit 0 means no local attention found, 1 means warnings/errors,
16
+ and 2 means invalid invocation. It does not verify applicability or prove hooks
17
+ ran. Empty starters get a coverage warning. Older pins/skills need explicit review;
18
+ init still refuses conflicting integrations. Custom, user/global/local/enterprise
19
+ host settings and effective trust are not comprehensively inspected.
20
+
21
+ ## Opt in to Claude Code lifecycle checks
22
+
23
+ 1. Initialize/review inputs and deliberately adopt a content-aware baseline.
24
+ 2. Install the exact package in the consuming project. For npm:
25
+ `npm install --save-dev --save-exact handoff-check@0.6.0`. Installation uses
26
+ the registry; the hook later uses only this local package. Temporary npx caches
27
+ and global installs do not meet that prerequisite.
28
+ 3. Run `npx handoff-check@0.6.0 hook-config --host claude` and inspect the JSON.
29
+ 4. In an editor, merge the returned SessionStart entries into the existing
30
+ `.claude/settings.json` hooks object. Preserve other events, handlers,
31
+ permissions and settings. Do not replace the whole file or blindly redirect
32
+ stdout onto it. The generator writes no files.
33
+ 5. Run doctor; confirm the entry in Claude's `/hooks` and host debug output, then
34
+ test startup/resume/compact delivery before relying on it.
35
+
36
+ The snippet uses documented exec-form node/args and CLAUDE_PROJECT_DIR placeholders.
37
+ Use a current Claude Code version supporting that interface. Each path is a
38
+ separate argument, including paths with spaces/metacharacters. Every linked
39
+ worktree needs its own local package/config and correct host project root.
40
+ Payload cwd must canonicalize inside the explicit config directory; subdirectories
41
+ are allowed, other worktrees are rejected. No upward discovery occurs.
42
+
43
+ The adapter requires v2/v3/v4 content tracking and uses the current clock. Generate
44
+ with `hook-config --host claude --require-active` only when explicitly requiring
45
+ a nonempty active set. Neither mode writes/captures a baseline.
46
+
47
+ Host context shows pass, empty pass, mismatch or invalid inputs. Transport exit 0
48
+ means a host response was produced, not necessarily verification passed. Malformed
49
+ events/timeouts return 2; SessionStart errors do not block work. Descriptions/source
50
+ text are not injected as instructions. Re-run verify for full findings.
51
+
52
+ ## Host capabilities
53
+
54
+ | Host | CLI | Skill | Lifecycle adapter in 0.5 | Limits |
55
+ | --------------- | --- | ---------------------- | ----------------------------------------- | ------------------------------------------------------------------------------------- |
56
+ | Claude Code | Yes | Yes | SessionStart startup/resume/clear/compact | Advisory; fork/action-blocking hooks not provided. Confirm host loading manually. |
57
+ | Codex | Yes | Yes | Not shipped | Hooks/trust/worktree interfaces documented, but no adapter certified in this release. |
58
+ | Cursor | Yes | No dedicated installer | Not shipped | Own hooks/third-party compatibility exist; not certified here. |
59
+ | Other agents/CI | Yes | Manual portable use | Not shipped | Invoke CLI explicitly and preserve exit codes. |
60
+
61
+ Reviewed 2026-11-25: [Claude](https://code.claude.com/docs/en/hooks),
62
+ [Codex](https://learn.chatgpt.com/docs/hooks), [Cursor](https://cursor.com/docs/hooks).
63
+ Tests exercise protocol fixtures and generated Node commands. Live host/model
64
+ context delivery is a separate check, not implied by fixture tests. Host/user/
65
+ enterprise policies can disable hooks or require review.
66
+
67
+ ## Critical actions need a fresh check
68
+
69
+ In Bash with the project-local package already installed:
70
+
71
+ ```sh
72
+ node ./node_modules/handoff-check/dist/cli.js verify --require-content --require-active --format json
73
+ VERIFY_EXIT=$?
74
+ if [ "$VERIFY_EXIT" -ne 0 ]; then
75
+ exit "$VERIFY_EXIT"
76
+ fi
77
+ # The team's independently reviewed deployment step follows here.
78
+ ```
79
+
80
+ CI shells with fail-fast already stop on a nonzero verifier result. Keep report/
81
+ upload steps from masking that failure. Choose scope explicitly. Verification
82
+ checks declared constraints, not credentials, semantic enforcement or action
83
+ authorization; files can still change after a check. Retain normal isolation and
84
+ approval controls.
85
+
86
+ ## Troubleshooting
87
+
88
+ - Missing local package: install the reviewed version in this worktree, rather
89
+ than replacing the hook with an unpinned network download.
90
+ - NOT VERIFIED: run doctor and verify; fix inputs without refreshing a baseline
91
+ merely to hide findings.
92
+ - No context: inspect /hooks, disabled/managed settings, Node availability,
93
+ exec-form support and CLAUDE_PROJECT_DIR for this worktree.
94
+ - Wrong event/cwd: use the generated matcher/config. Fork/other events need explicit
95
+ verification in this release.
96
+ - Input/output limits: envelopes are capped at 64 KiB/2 seconds; the whole check
97
+ has a 5-second watchdog. Truncation directs you to complete verify findings.
98
+
99
+ See [ADR 0005](decisions/0005-local-diagnostics-and-lifecycle.md) for exact contracts.
@@ -0,0 +1,120 @@
1
+ # Project binding, explicit profiles and reports
2
+
3
+ Requires Handoff Check 0.6.0+. Existing unbound workflows require no data migration.
4
+ Node.js 22+ remains sufficient; verification has no network or model dependency.
5
+
6
+ ## Bind reviewed files to a portable project label
7
+
8
+ Use a stable case-sensitive identifier such as `payments-api`. Upgrade every
9
+ consumer before adopting manifest v3 and handoff v4; older CLIs reject these formats.
10
+
11
+ 1. Verify the existing saved baseline first and resolve/review findings.
12
+ 2. Deliberately change the reviewed manifest to schemaVersion 3, add projectId,
13
+ and keep positive revisions on every rule.
14
+ 3. Capture a NEW reviewed baseline. Bound manifests automatically capture v4;
15
+ --include-content optionally retains old text as before.
16
+ 4. Review/adopt it and optionally set expected projectId in config v2.
17
+
18
+ Example manifest:
19
+
20
+ ```json
21
+ {
22
+ "schemaVersion": 3,
23
+ "projectId": "payments-api",
24
+ "constraints": [
25
+ {
26
+ "id": "MIGRATION-REVIEW",
27
+ "revision": 1,
28
+ "scope": "staging",
29
+ "description": "Require review before staging migrations",
30
+ "source": "synthetic:migration-policy"
31
+ }
32
+ ]
33
+ }
34
+ ```
35
+
36
+ A bound manifest requires a matching bound handoff; mixing with unbound files or
37
+ another project returns exit 2. Rule content hashes do not change just because a
38
+ project label is added. Worktrees share the reviewed project ID but use their own
39
+ local config/input paths. The ID is not a signature, inferred Git remote, proof
40
+ that a directory is trustworthy, or deployment permission.
41
+
42
+ ## Select environments explicitly
43
+
44
+ Author `.handoff-check.json` as config v2:
45
+
46
+ ```json
47
+ {
48
+ "schemaVersion": 2,
49
+ "projectId": "payments-api",
50
+ "constraints": "constraints.json",
51
+ "profiles": {
52
+ "stage": { "scope": "staging", "handoff": "handoffs/staging.json" },
53
+ "prod": { "scope": "production", "handoff": "handoffs/production.json" }
54
+ }
55
+ }
56
+ ```
57
+
58
+ ```sh
59
+ npx handoff-check@0.6.0 explain --profile stage
60
+ npx handoff-check@0.6.0 snapshot --profile stage --task "Review staging work" --output handoffs/staging.reviewed.json
61
+ npx handoff-check@0.6.0 verify --profile stage --require-content
62
+ npx handoff-check@0.6.0 doctor --profile stage
63
+ ```
64
+
65
+ These assume you deliberately adopted a baseline at the configured handoff path;
66
+ snapshot does not adopt or overwrite it. Create parent directories before output.
67
+ Profiles require scope; omitted paths inherit top-level values then defaults.
68
+ Paths resolve from config location, not from the invocation subdirectory.
69
+ Use --config for an explicit config elsewhere.
70
+
71
+ There is no default/remembered profile. Without --profile, ordinary top-level
72
+ scope/path behavior applies; a profile-only config therefore needs explicit
73
+ selection. Combining --profile with --scope/--constraints/--handoff is rejected.
74
+ Profiles never infer authorization from a branch, folder or the name `prod`.
75
+ Init stays unchanged; configure profiles and CI commands through reviewed edits.
76
+
77
+ For the opt-in Claude adapter, generate with
78
+ `hook-config --host claude --profile stage`. Merge the snippet while preserving
79
+ existing settings, install the pinned local package, and confirm host delivery.
80
+ The existing advisory/error/time bounds remain unchanged. Unknown/mismatched
81
+ bindings produce NOT VERIFIED context; hook transport success is not a pass.
82
+
83
+ ## Record exactly what was checked
84
+
85
+ ```sh
86
+ npx handoff-check@0.6.0 verify --profile stage --require-content --report --format json
87
+ npx handoff-check@0.6.0 verify --profile stage --require-content --report --git-context --format markdown
88
+ ```
89
+
90
+ --report is optional and verify-only. It adds package version, requested policies,
91
+ selected profile/project and exact input/config byte digests around the existing
92
+ result. --git-context separately requests invocation-worktree/commit/branch data;
93
+ detached branches are null. Git is not consulted otherwise. Unborn/nonrepo/missing
94
+ Git returns 2 without a successful report. No dirty-state claim is made.
95
+
96
+ Absent implicit config is null. Digest bytes are the SAME read used for parsing,
97
+ not a later read that could describe different contents. Raw file whitespace affects
98
+ these digests; the existing canonical rule hash still ignores JSON formatting.
99
+ The nested result keeps its schema (1/2/3, or 4 for bound handoffs). Default JSON
100
+ without --report is unchanged. Verification mismatches still exit 1, invalid inputs
101
+ exit 2, and reports go to stdout. Use a separate destination for shell redirection,
102
+ never a manifest/handoff/config path.
103
+
104
+ Review path, branch and project disclosures before sharing a report. This is not
105
+ an authenticated attestation or proof of agent compliance. Git metadata and the
106
+ separate input reads are not atomic; re-run verification before acting.
107
+
108
+ ## Reproducible repository example
109
+
110
+ ```sh
111
+ node dist/cli.js verify --config examples/project-profiles/config.json --profile stage --require-content --report --format json --as-of 2026-11-25T08:00:00Z
112
+ node dist/cli.js verify --config examples/project-profiles/config.json --profile prod --require-content --report --format markdown --as-of 2026-11-25T08:00:00Z
113
+ ```
114
+
115
+ Both examples are synthetic and pass with their separately reviewed scoped files.
116
+ See [ADR 0006](decisions/0006-project-profiles-and-reports.md),
117
+ [config v2 schema](../schemas/config.v2.schema.json),
118
+ [manifest v3](../schemas/constraints.v3.schema.json),
119
+ [handoff v4](../schemas/handoff.v4.schema.json) and
120
+ [report wrapper](../schemas/report.v1.schema.json).
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.4.0. The package is already published; subsequent releases
4
+ current version is 0.6.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.4.0.tgz --ignore-scripts --access public`.
22
+ `npm publish /absolute/path/handoff-check-0.6.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.4.0 --version` and fresh-project init/verify using a
25
+ `npx --yes handoff-check@0.6.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.4.0` and a GitHub release on the reviewed main commit, attach the
27
+ 6. Create tag `v0.6.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.6.0: opt-in portable project IDs, explicit environment profiles,
4
+ and verification metadata reports with separately requested Git context.
5
+ See [project/profile/report guide](project-context.md).
6
+
7
+ Implemented in 0.5.0: read-only doctor, opt-in Claude advisory SessionStart adapter
8
+ and configuration snippet, host matrix and critical-action recipes.
9
+ See [lifecycle setup](lifecycle.md). Codex/Cursor adapters remain unshipped.
10
+
3
11
  See the [development plan](development-plan.md) for research evidence, proposed
4
12
  0.4–0.6 milestones, dependencies, pilot validation, and acceptance criteria.
5
13
  The plan distinguishes implemented releases from proposed milestones and dates.
@@ -0,0 +1,15 @@
1
+ {
2
+ "schemaVersion": 2,
3
+ "projectId": "sample-project",
4
+ "constraints": "constraints.json",
5
+ "profiles": {
6
+ "stage": {
7
+ "scope": "staging",
8
+ "handoff": "staging.json"
9
+ },
10
+ "prod": {
11
+ "scope": "production",
12
+ "handoff": "production.json"
13
+ }
14
+ }
15
+ }
@@ -0,0 +1,27 @@
1
+ {
2
+ "schemaVersion": 3,
3
+ "projectId": "sample-project",
4
+ "constraints": [
5
+ {
6
+ "id": "G-01",
7
+ "scope": "global",
8
+ "revision": 1,
9
+ "description": "Review unresolved findings before affected work",
10
+ "source": "synthetic:global-policy"
11
+ },
12
+ {
13
+ "id": "S-01",
14
+ "scope": "staging",
15
+ "revision": 1,
16
+ "description": "Require review before staging migrations",
17
+ "source": "synthetic:staging-policy"
18
+ },
19
+ {
20
+ "id": "P-01",
21
+ "scope": "production",
22
+ "revision": 1,
23
+ "description": "Require approval before production changes",
24
+ "source": "synthetic:production-policy"
25
+ }
26
+ ]
27
+ }