handoff-check 0.4.0 → 0.5.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.5.0 init --scope staging --agent both --dry-run
13
+ npx handoff-check@0.5.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.5.0.tgz handoff-check init --scope staging --agent both
43
+ npx --offline --yes --package=/absolute/path/handoff-check-0.5.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,12 @@ 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
+ Doctor inspects local inputs/integration metadata without executing host commands.
21
+ The bounded Claude lifecycle adapter reads an event envelope and explicit config,
22
+ then calls the same verifier. Hook-config prints a mergeable snippet, never writes
23
+ host settings. Advisory host transport success is distinct from verification.
24
+ See decisions/0005-local-diagnostics-and-lifecycle.md.
25
+
20
26
  Exit codes: 0 for verified IDs, 1 for rule mismatches, 2 for invalid input or an
21
27
  unreadable input file. JSON output is intended for agent adapters and automation.
22
28
 
@@ -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).
@@ -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
+ 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
 
@@ -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.5.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.5.0 explain --format json
10
+ npx handoff-check@0.5.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.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.5.0 snapshot --task "Review staging migrations" --include-content --output handoff.reviewed.json
24
+ npx handoff-check@0.5.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.4.0 init --scope staging --agent none
12
- npx handoff-check@0.4.0 verify --require-content
11
+ npx handoff-check@0.5.0 init --scope staging --agent none
12
+ npx handoff-check@0.5.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.5.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.5.0 snapshot --task "Review staging migration" --output handoff.reviewed.json
54
+ npx handoff-check@0.5.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.5.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.5.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.5.0 doctor --format json
10
+ npx handoff-check@0.5.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.5.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.5.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 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.
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.5.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.5.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.5.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.5.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,9 @@
1
1
  # Roadmap
2
2
 
3
+ Implemented in 0.5.0: read-only doctor, opt-in Claude advisory SessionStart adapter
4
+ and configuration snippet, host matrix and critical-action recipes.
5
+ See [lifecycle setup](lifecycle.md). Codex/Cursor adapters remain unshipped.
6
+
3
7
  See the [development plan](development-plan.md) for research evidence, proposed
4
8
  0.4–0.6 milestones, dependencies, pilot validation, and acceptance criteria.
5
9
  The plan distinguishes implemented releases from proposed milestones and dates.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "handoff-check",
3
- "version": "0.4.0",
3
+ "version": "0.5.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",
@@ -89,3 +89,18 @@ On resume, verify the saved baseline FIRST. Never run snapshot automatically to
89
89
  clear CHANGED findings, bypass --require-content, or silently downgrade to v1.
90
90
  Existing v1 handoffs need deliberate review/capture to adopt tracking. capturedAt
91
91
  is informational; do not reuse it as --as-of for real resumed work.
92
+
93
+ ## Installation diagnostics and lifecycle checks
94
+
95
+ Use `handoff-check doctor --format json` to diagnose local paths, input versions
96
+ and managed integration pins. Doctor exit 0 means local diagnostics are healthy,
97
+ not that a handoff verified or a host ran this skill. Exit 1 means attention
98
+ needed; exit 2 means invalid invocation. Review fixes explicitly.
99
+
100
+ `hook-config --host claude` emits a settings snippet only. Setup is opt-in: merge
101
+ it while preserving existing settings and install the reviewed project-local
102
+ package. Never redirect it over settings. Hook exit 0 is advisory transport
103
+ success and may contain FAIL or NOT VERIFIED. Re-run verify for details and
104
+ immediately before critical actions; startup context is not authorization or a
105
+ blocking guarantee. Codex/Cursor adapters are not shipped in 0.5; invoke the CLI
106
+ explicitly there.