handoff-check 0.3.1 → 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.
- package/CHANGELOG.md +17 -0
- package/README.md +71 -14
- package/dist/cli.js +760 -200
- package/docs/agent-integration.md +15 -7
- package/docs/architecture.md +11 -0
- package/docs/decisions/0004-explainable-verification.md +78 -0
- package/docs/decisions/0005-local-diagnostics-and-lifecycle.md +73 -0
- package/docs/development-plan.md +16 -3
- package/docs/explainability.md +63 -0
- package/docs/first-check.md +9 -8
- package/docs/lifecycle.md +99 -0
- package/docs/releasing.md +4 -4
- package/docs/roadmap.md +9 -1
- package/examples/retained-content/constraints.json +12 -0
- package/examples/retained-content/handoff.json +20 -0
- package/examples/retained-content/original.json +12 -0
- package/package.json +1 -1
- package/schemas/handoff.v3.schema.json +116 -0
- package/skills/handoff-check/SKILL.md +33 -5
|
@@ -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.
|
|
13
|
-
npx handoff-check@0.
|
|
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.
|
|
43
|
-
npx --offline --yes --package=/absolute/path/handoff-check-0.
|
|
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
|
|
@@ -64,7 +64,14 @@ At handoff creation, review current rules and run the configured CLI's
|
|
|
64
64
|
`snapshot --task "Resume the task" --output handoff.next.json`. Review that file
|
|
65
65
|
before explicitly promoting it to the configured handoff. On resume, verify the
|
|
66
66
|
saved baseline first; do not regenerate it to hide a CHANGED finding. Snapshot
|
|
67
|
-
records revisions/hashes
|
|
67
|
+
records revisions/hashes by default, and capturedAt is not the evaluation clock.
|
|
68
|
+
0.4 optionally retains old text in v3 with explicit `--include-content` at reviewed
|
|
69
|
+
capture time. This copies full rule content into the handoff: review sensitive
|
|
70
|
+
data before committing/sharing. Default v2 capture is unchanged; upgrade every
|
|
71
|
+
consumer before adopting v3. Both v2 and v3 satisfy `--require-content`.
|
|
72
|
+
Use `explain` for applicability diagnostics and `verify --format markdown` for
|
|
73
|
+
review reports; explain exit 0 does not verify a handoff. See the
|
|
74
|
+
[explainability guide](explainability.md).
|
|
68
75
|
|
|
69
76
|
Existing v1 inputs are preserved. Review/capture a v2 handoff and explicitly update
|
|
70
77
|
old skill/managed-block/CI pins before relying on content tracking. Existing v1
|
|
@@ -74,8 +81,9 @@ See [upgrade instructions](../README.md#upgrade-from-01).
|
|
|
74
81
|
Skill discovery depends on the host agent. Skills/instructions are guidance, not
|
|
75
82
|
guaranteed hooks. `init --ci` adds `.github/workflows/handoff-check.yml` pinned to
|
|
76
83
|
the installed version and using saved config. This checks committed IDs on push/PR,
|
|
77
|
-
not every agent turn.
|
|
78
|
-
|
|
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.
|
|
79
87
|
|
|
80
88
|
## Upgrades and contributor instructions
|
|
81
89
|
|
package/docs/architecture.md
CHANGED
|
@@ -8,10 +8,21 @@ The CLI owns argument parsing, local file I/O, clock capture, rendering, and exi
|
|
|
8
8
|
codes. Validation rejects malformed contracts before verification begins. The
|
|
9
9
|
pure core receives validated objects, an explicit scope, and an explicit time.
|
|
10
10
|
|
|
11
|
+
Explain uses the same lifecycle classifier as verification, without consuming a
|
|
12
|
+
handoff. Optional v3 snapshots retain validated old content for field-level diffs;
|
|
13
|
+
default snapshots remain v2. Pure renderers provide text and Markdown output.
|
|
14
|
+
See decisions/0004-explainable-verification.md for contracts and compatibility.
|
|
15
|
+
|
|
11
16
|
No verification operation writes inputs, accesses a network, calls a model,
|
|
12
17
|
executes source references, or reads agent transcripts. Output order must be
|
|
13
18
|
independent of manifest and handoff ordering.
|
|
14
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
|
+
|
|
15
26
|
Exit codes: 0 for verified IDs, 1 for rule mismatches, 2 for invalid input or an
|
|
16
27
|
unreadable input file. JSON output is intended for agent adapters and automation.
|
|
17
28
|
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
# ADR 0004: Explainable verification
|
|
2
|
+
|
|
3
|
+
Status: accepted for 0.4.0.
|
|
4
|
+
|
|
5
|
+
## Compatibility and retention
|
|
6
|
+
|
|
7
|
+
Manifest formats remain v1/v2. Default snapshot remains handoff v2. Existing
|
|
8
|
+
handoff v1/v2 JSON result shapes and canonical hash algorithm v1 are unchanged.
|
|
9
|
+
`--require-content` accepts handoff v2 or v3 and rejects ID-only v1.
|
|
10
|
+
|
|
11
|
+
Explicit snapshot `--include-content` produces handoff schemaVersion 3. Each
|
|
12
|
+
reference requires `content`: a standalone v2 constraint object with required
|
|
13
|
+
positive safe revision and the same strict field/date/pair validation as manifest
|
|
14
|
+
rules. ID, revision and canonical hash must agree with the outer reference or
|
|
15
|
+
parsing fails with exit 2. Unknown fields and null input values remain invalid.
|
|
16
|
+
IDs remain unique. Stored content rejects self-replacement, but replacement
|
|
17
|
+
targets need not occur in the captured set; it is not a replacement manifest.
|
|
18
|
+
Global relationship checks still apply to the actual manifest.
|
|
19
|
+
|
|
20
|
+
Capture makes independent copies, preserves exact description/source strings,
|
|
21
|
+
normalizes lifecycle timestamps to UTC milliseconds, and supplies implicit revision
|
|
22
|
+
1 for manifest v1 rules. Empty captures are valid. Capture does not read the old
|
|
23
|
+
handoff or sources, infer rules, or promote/replace a baseline.
|
|
24
|
+
|
|
25
|
+
Retention copies full descriptions, source references and lifecycle fields into
|
|
26
|
+
handoffs and potentially reports. It is opt-in, with no auto-upgrade or default
|
|
27
|
+
retention. Review sensitive content and repository access before sharing. Consistent
|
|
28
|
+
hashes detect changes, not authorship or authorization. Someone controlling content
|
|
29
|
+
and reference can replace both. Older CLIs reject v3; upgrade consumers first.
|
|
30
|
+
|
|
31
|
+
## Deltas and results
|
|
32
|
+
|
|
33
|
+
V3 verification results use schemaVersion 3 with content tracking and active count.
|
|
34
|
+
Active reported CHANGED rules have `changes`, an ordered array of objects with
|
|
35
|
+
`field`, `before` (saved), and `after` (current). Values are strings, revision
|
|
36
|
+
numbers, or null for an absent optional field; null is not permitted in rule input.
|
|
37
|
+
Field order is id, scope, description, source, expiresAt, revokedAt, replacedBy,
|
|
38
|
+
supersededAt, revision. Equivalent normalized timestamps do not create changes.
|
|
39
|
+
Revision-only changes are included, despite revision being outside the content hash.
|
|
40
|
+
|
|
41
|
+
Scope/lifecycle precedence is unchanged. Inactive/unknown/missing rules do not get
|
|
42
|
+
invented deltas. V1/v2 findings do not gain fields. V2 CHANGED text/Markdown clearly
|
|
43
|
+
states old content is unavailable; hashes cannot reconstruct previous text.
|
|
44
|
+
Verification is read-only and never refreshes a baseline to clear a finding.
|
|
45
|
+
|
|
46
|
+
## Explain
|
|
47
|
+
|
|
48
|
+
`explain` reads only config/manifest, not the handoff. Its JSON contract is an
|
|
49
|
+
independent schemaVersion 1 object: scope, normalized asOf, activeConstraintCount,
|
|
50
|
+
and rules sorted by ID. Each rule has id, scope, description, source, decision,
|
|
51
|
+
and reason. Decision is ACTIVE, OUT_OF_SCOPE, REVOKED, SUPERSEDED, or EXPIRED.
|
|
52
|
+
The shared classifier uses the established scope-before-lifecycle precedence;
|
|
53
|
+
global rules apply everywhere and transitions take effect at their exact instant.
|
|
54
|
+
Reasons explain applicability of the supplied data, not prose meaning or history.
|
|
55
|
+
|
|
56
|
+
Valid explain exits 0 even when rules are inactive or the active set is empty;
|
|
57
|
+
this must never be presented as successful handoff verification. Invalid inputs
|
|
58
|
+
exit 2. No nonempty policy, handoff/task/output flag or include-content flag is
|
|
59
|
+
accepted by explain. It does not authenticate input or prove agent compliance.
|
|
60
|
+
|
|
61
|
+
## Rendering and command boundaries
|
|
62
|
+
|
|
63
|
+
Verify/explain support text, JSON and Markdown. Markdown reports include scope,
|
|
64
|
+
time, count and findings; verify additionally reports tracking and requested
|
|
65
|
+
policies. They do not include uncontrolled HTML, link syntax, fences or extra rows:
|
|
66
|
+
untrusted values are escaped as numeric entities and control/format characters
|
|
67
|
+
render visibly. JSON stays machine-readable; Markdown is a presentation format,
|
|
68
|
+
not an input contract. Both reports are deterministic for supplied inputs/options.
|
|
69
|
+
|
|
70
|
+
Verify exit codes remain 0 verified, 1 mismatch/policy failure, 2 invalid input.
|
|
71
|
+
Report output goes to stdout, errors to stderr; Markdown errors are terminal-safe
|
|
72
|
+
plain diagnostics. Shell redirection is external to the CLI and can overwrite its
|
|
73
|
+
destination: documentation must warn against directing reports onto input paths.
|
|
74
|
+
|
|
75
|
+
Markdown is rejected for init/snapshot, and include-content is snapshot-only.
|
|
76
|
+
Snapshot stdout remains JSON; text/json format controls its acknowledgement only
|
|
77
|
+
when an exclusive output file is requested. Skills and generated CI keep using
|
|
78
|
+
the single verifier; no automatic retention or new enforcement hook is installed.
|
|
@@ -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).
|
package/docs/development-plan.md
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# Development plan
|
|
2
2
|
|
|
3
|
-
Status:
|
|
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
|
|
@@ -45,7 +46,13 @@ Acceptance: execute the walkthrough using a built package from a separate consum
|
|
|
45
46
|
directory; observe expected statuses/codes and verify that verification does not
|
|
46
47
|
rewrite the saved baseline. Check documented flags against actual CLI behavior.
|
|
47
48
|
|
|
48
|
-
## 0.4: explainable verification
|
|
49
|
+
## 0.4: explainable verification (implemented)
|
|
50
|
+
|
|
51
|
+
Implemented in 0.4.0 under [ADR 0004](decisions/0004-explainable-verification.md):
|
|
52
|
+
manifest-only explain, opt-in v3 retained-content snapshots and field-level deltas,
|
|
53
|
+
and Markdown reports. Default v2 snapshots and existing v1/v2 JSON remain compatible.
|
|
54
|
+
The following acceptance criteria govern the implementation; pilot measurements
|
|
55
|
+
remain future work and are not implied by shipping these features.
|
|
49
56
|
|
|
50
57
|
Priority: high. Dependencies: an ADR for snapshot evolution and privacy/storage choices.
|
|
51
58
|
|
|
@@ -66,7 +73,13 @@ Acceptance:
|
|
|
66
73
|
- Reports and verification never silently recapture or adopt a baseline.
|
|
67
74
|
- Evaluate storage size and sensitive-content exposure before choosing defaults.
|
|
68
75
|
|
|
69
|
-
## 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.
|
|
70
83
|
|
|
71
84
|
Priority: high, after explainability. No second verification engine.
|
|
72
85
|
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# Explain applicability and review changes
|
|
2
|
+
|
|
3
|
+
Requires Handoff Check 0.5.0+ and Node.js 22+. Run from your configured repository.
|
|
4
|
+
No service, model call or API key is needed.
|
|
5
|
+
|
|
6
|
+
## Understand the active set
|
|
7
|
+
|
|
8
|
+
```sh
|
|
9
|
+
npx handoff-check@0.5.0 explain --format json
|
|
10
|
+
npx handoff-check@0.5.0 explain --scope production --format markdown
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Explain reads the manifest but not the handoff. Every rule has an applicability
|
|
14
|
+
decision and reason; global rules count once. Use `--as-of` for an explicitly fixed
|
|
15
|
+
evaluation. It cannot reconstruct historic file contents. A valid explanation
|
|
16
|
+
exits 0 even with zero active rules: use verify to compare a handoff.
|
|
17
|
+
|
|
18
|
+
## Opt in to saved content
|
|
19
|
+
|
|
20
|
+
At a reviewed handoff creation, after upgrading all consumers to 0.4+:
|
|
21
|
+
|
|
22
|
+
```sh
|
|
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
|
+
```
|
|
26
|
+
|
|
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
|
|
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.
|
|
31
|
+
|
|
32
|
+
After a same-ID description edit, verification produces CHANGED and exit 1.
|
|
33
|
+
V3 JSON adds typed `changes`; text and Markdown show the saved/current fields.
|
|
34
|
+
Revision-only edits appear too; null indicates an absent optional field. Expired,
|
|
35
|
+
revoked or superseded rules retain their primary lifecycle finding instead.
|
|
36
|
+
V2 detects changes but cannot show old text. V3 validates retained data against
|
|
37
|
+
its reference; it does not authenticate who reviewed or changed the rule.
|
|
38
|
+
|
|
39
|
+
Never recapture a saved baseline before checking resumed work. Resolve findings
|
|
40
|
+
and review changes before deliberately capturing and adopting a new baseline.
|
|
41
|
+
|
|
42
|
+
## Reports in local review or CI
|
|
43
|
+
|
|
44
|
+
Use `verify --format markdown` for a deterministic report with the same 0/1/2 exit
|
|
45
|
+
codes. Redirect it only to a separate report file; shell redirection can truncate
|
|
46
|
+
the destination before verification starts, including an input if misconfigured.
|
|
47
|
+
CI can upload that file as an artifact or display it in a job summary. Preserve
|
|
48
|
+
the verifier exit code so a report upload does not turn a mismatch into a pass.
|
|
49
|
+
|
|
50
|
+
Reports contain escaped user data, not commands to execute. A PASS checks declared
|
|
51
|
+
constraints, not their semantic enforcement, authenticity, or permission to act.
|
|
52
|
+
|
|
53
|
+
## Reproducible example
|
|
54
|
+
|
|
55
|
+
From the source checkout after building, run:
|
|
56
|
+
|
|
57
|
+
```sh
|
|
58
|
+
node dist/cli.js explain --constraints examples/retained-content/constraints.json --scope staging --as-of 2026-11-24T10:00:00Z --format markdown
|
|
59
|
+
node dist/cli.js verify --constraints examples/retained-content/constraints.json --handoff examples/retained-content/handoff.json --scope staging --as-of 2026-11-24T10:00:00Z --require-content --format markdown
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
The second command deliberately exits 1 and shows the old/current description.
|
|
63
|
+
See [ADR 0004](decisions/0004-explainable-verification.md) for precise contracts.
|
package/docs/first-check.md
CHANGED
|
@@ -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.
|
|
12
|
-
npx handoff-check@0.
|
|
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.
|
|
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.
|
|
54
|
-
npx handoff-check@0.
|
|
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.
|
|
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
|
|
@@ -79,8 +79,9 @@ deliberate policy update, also increment its revision during review.
|
|
|
79
79
|
|
|
80
80
|
Do not recapture a baseline just to make a resumed check pass. Review the changed
|
|
81
81
|
rule and resolve affected work first; only then deliberately capture and adopt a
|
|
82
|
-
new baseline.
|
|
83
|
-
|
|
82
|
+
new baseline. Default v2 snapshots detect changes without retaining old descriptions.
|
|
83
|
+
For opt-in v3 field-level diffs and Markdown reports, see the
|
|
84
|
+
[0.4 guide](explainability.md). Do not recapture a resumed baseline to add retention.
|
|
84
85
|
|
|
85
86
|
## Interpret the result correctly
|
|
86
87
|
|
|
@@ -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
|
+
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.
|
|
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.
|
|
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.
|
|
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,8 +1,16 @@
|
|
|
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.
|
|
10
|
+
|
|
11
|
+
Implemented in 0.4.0: shared-lifecycle explain, opt-in retained-content v3
|
|
12
|
+
snapshots and field deltas, and escaped Markdown verify/explain reports.
|
|
13
|
+
See [the guide](explainability.md).
|
|
6
14
|
|
|
7
15
|
0.3.1 improves published-package onboarding and CLI reference accuracy, and adds
|
|
8
16
|
a [first-rule walkthrough](first-check.md). Verifier behavior is unchanged.
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"task": "Review staging migrations",
|
|
3
|
+
"scope": "staging",
|
|
4
|
+
"capturedAt": "2026-11-24T10:00:00.000Z",
|
|
5
|
+
"schemaVersion": 3,
|
|
6
|
+
"activeConstraints": [
|
|
7
|
+
{
|
|
8
|
+
"id": "MIGRATION-REVIEW",
|
|
9
|
+
"revision": 1,
|
|
10
|
+
"contentHash": "sha256:3639b7d8f89fd4efc202dc6c396aea295247b167e0c4d55d2dde7b98a5239f89",
|
|
11
|
+
"content": {
|
|
12
|
+
"id": "MIGRATION-REVIEW",
|
|
13
|
+
"scope": "staging",
|
|
14
|
+
"description": "Require review before applying staging migrations",
|
|
15
|
+
"source": "synthetic:migration-policy",
|
|
16
|
+
"revision": 1
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
]
|
|
20
|
+
}
|
package/package.json
CHANGED