handoff-check 0.8.0 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.9.0
4
+
5
+ - Add independent review registries with rule owners, review windows and exact revision/hash references.
6
+ - Add review reports for missing, stale, future, overdue and orphan review metadata using existing active-rule selection.
7
+ - Add explicit review-record capture to stdout or exclusive new files after deliberate rule review.
8
+ - Share project/profile/path semantics without reading or refreshing handoff baselines.
9
+ - Publish registry/result schemas, synthetic fixtures and migration-free maintenance guidance.
10
+ - Keep old manifests, canonical hashes, verify/run and advisory lifecycle policy unchanged; review deadlines never deactivate constraints.
11
+
3
12
  ## 0.8.0
4
13
 
5
14
  - Add run to verify current content-aware, nonempty constraints before starting an explicit command.
package/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  A deterministic, local CLI that verifies active constraints before a coding agent
4
4
  resumes work.
5
5
 
6
- **Version: 0.8.0.**
6
+ **Version: 0.9.0.**
7
7
 
8
8
  A task summary may preserve the goal while losing an active rule, carrying an
9
9
  expired restriction, or moving a staging-only instruction into production.
@@ -18,8 +18,8 @@ Source references are review metadata and are never fetched.
18
18
  Run in the repository where your agent works:
19
19
 
20
20
  ```sh
21
- npx handoff-check@0.8.0 init --scope staging --agent both --dry-run
22
- npx handoff-check@0.8.0 init --scope staging --agent both
21
+ npx handoff-check@0.9.0 init --scope staging --agent both --dry-run
22
+ npx handoff-check@0.9.0 init --scope staging --agent both
23
23
  ```
24
24
 
25
25
  This creates `.handoff-check.json`, starter `constraints.json` and `handoff.json`,
@@ -33,7 +33,7 @@ on verification. Revisions and hashes detect edits under an unchanged rule ID.
33
33
  Ask a resuming agent to use the installed skill, or run:
34
34
 
35
35
  ```sh
36
- npx handoff-check@0.8.0 verify --format json --require-content
36
+ npx handoff-check@0.9.0 verify --format json --require-content
37
37
  ```
38
38
 
39
39
  The saved config supplies paths and scope. `init --ci` also creates a pinned GitHub
@@ -42,7 +42,7 @@ agent execution; CI enforces the declared-ID comparison when its workflow runs.
42
42
  Neither checks whether the agent obeys a rule's meaning.
43
43
 
44
44
  Node.js 22+ is required; end users do not need Bun. Global installation is also
45
- available: `npm install --global handoff-check@0.8.0`. For contributor builds or
45
+ available: `npm install --global handoff-check@0.9.0`. For contributor builds or
46
46
  offline package testing, see the [setup guide](docs/agent-integration.md).
47
47
 
48
48
  For a complete first-rule walkthrough, including a passing baseline and a detected
@@ -65,7 +65,7 @@ default but are explicitly marked. Unexpected reported IDs still fail.
65
65
  To require actual active rules, opt in:
66
66
 
67
67
  ```sh
68
- npx handoff-check@0.8.0 verify --require-content --require-active --format json
68
+ npx handoff-check@0.9.0 verify --require-content --require-active --format json
69
69
  ```
70
70
 
71
71
  A zero active set produces global NO_ACTIVE_CONSTRAINTS (no fake ID), mismatch
@@ -83,8 +83,8 @@ init and snapshot reject it. See the
83
83
  After reviewing rules at handoff creation, capture a new baseline:
84
84
 
85
85
  ```sh
86
- npx handoff-check@0.8.0 snapshot --task "Resume migration review" --output handoff.next.json
87
- npx handoff-check@0.8.0 verify --handoff handoff.next.json --require-content --format json
86
+ npx handoff-check@0.9.0 snapshot --task "Resume migration review" --output handoff.next.json
87
+ npx handoff-check@0.9.0 verify --handoff handoff.next.json --require-content --format json
88
88
  ```
89
89
 
90
90
  Snapshot creates a new file exclusively. Review it before deliberately replacing
@@ -106,9 +106,9 @@ hashed, but referenced documents are not fetched or checked.
106
106
  ## Explain rules and review field changes
107
107
 
108
108
  ```sh
109
- npx handoff-check@0.8.0 explain --format markdown
110
- npx handoff-check@0.8.0 snapshot --task "Review migration" --include-content --output handoff.reviewed.json
111
- npx handoff-check@0.8.0 verify --handoff handoff.reviewed.json --require-content --format markdown
109
+ npx handoff-check@0.9.0 explain --format markdown
110
+ npx handoff-check@0.9.0 snapshot --task "Review migration" --include-content --output handoff.reviewed.json
111
+ npx handoff-check@0.9.0 verify --handoff handoff.reviewed.json --require-content --format markdown
112
112
  ```
113
113
 
114
114
  `explain` shows every manifest rule's applicability for the selected scope/time,
@@ -153,15 +153,32 @@ or revisioned v2 manifests. Scope must match the v2 handoff's saved scope.
153
153
  Review current rules, capture a new v2 baseline, and deliberately update the saved
154
154
  handoff. Existing inputs are preserved by init, not silently upgraded. Review
155
155
  installed skills, instruction blocks and CI commands to update their pinned
156
- version to 0.8.0 and add `--require-content`. Init refuses to overwrite differing
156
+ version to 0.9.0 and add `--require-content`. Init refuses to overwrite differing
157
157
  integrations; compare them with the new packaged templates and update reviewed
158
158
  copies explicitly. Never refresh before checking resumed work or reuse capturedAt
159
159
  as the clock for real resumed work.
160
160
 
161
+ ## Rule ownership and review deadlines
162
+
163
+ After deliberately reviewing the applicable rules, record their ownership in a
164
+ separate registry and check it independently:
165
+
166
+ ```sh
167
+ npx handoff-check@0.9.0 review-record --profile stage --owner platform-team --review-by 2027-01-01T00:00:00Z --output rules.review.next.json
168
+ npx handoff-check@0.9.0 review --profile stage --registry rules.review.next.json
169
+ ```
170
+
171
+ Choose the intended profile, owner and deadline; one owner/deadline applies to all
172
+ selected/global active rules in that record. Review reports missing, stale,
173
+ future, overdue and orphan metadata with explicit counts. Stale revision/hash
174
+ references cannot approve edited rules. A record captures a subset and never
175
+ merges or overwrites an aggregate registry automatically. Review deadlines do not
176
+ expire constraints or change verify/run/hooks. See [rule reviews](docs/rule-reviews.md).
177
+
161
178
  ## Verify before running a command
162
179
 
163
180
  ```sh
164
- npx handoff-check@0.8.0 run --profile production -- node scripts/preflight-demo.js
181
+ npx handoff-check@0.9.0 run --profile production -- node scripts/preflight-demo.js
165
182
  ```
166
183
 
167
184
  Use the intended configured profile and an explicitly chosen program. `run`
@@ -175,7 +192,7 @@ after the check. See [verified commands](docs/verified-commands.md).
175
192
 
176
193
  ## Snapshot diff and guided setup
177
194
 
178
- Run `npx handoff-check@0.8.0 setup` in a terminal to create a new project-bound
195
+ Run `npx handoff-check@0.9.0 setup` in a terminal to create a new project-bound
179
196
  configuration with explicit environments and one real rule you author. Review
180
197
  the exact retained baselines before typing `yes`; existing files are never replaced.
181
198
  No agent integrations or dependencies are installed. Use `--dry-run` to preview.
@@ -192,8 +209,8 @@ See [the guide](docs/snapshot-diff-and-setup.md).
192
209
  reproducibility metadata. Existing unbound files/default JSON stay compatible.
193
210
 
194
211
  ```sh
195
- npx handoff-check@0.8.0 verify --profile stage --require-content --report --format json
196
- npx handoff-check@0.8.0 doctor --profile stage
212
+ npx handoff-check@0.9.0 verify --profile stage --require-content --report --format json
213
+ npx handoff-check@0.9.0 doctor --profile stage
197
214
  ```
198
215
 
199
216
  These commands require an explicitly authored config v2 profile. Bound manifest
@@ -203,12 +220,12 @@ record the exact input/config bytes parsed, package version and policies; Git is
203
220
  read only with separate --git-context. They are not signed attestations or proof
204
221
  of compliance. See [setup, migration and examples](docs/project-context.md).
205
222
 
206
- For read-only installation diagnostics, run `npx handoff-check@0.8.0 doctor`.
223
+ For read-only installation diagnostics, run `npx handoff-check@0.9.0 doctor`.
207
224
  `doctor --format json` reports paths, supported input versions and managed
208
225
  integration pins. Its exit codes are 0 healthy, 1 attention and 2 invalid invocation;
209
226
  it does not verify a handoff or prove a host ran the integration.
210
227
 
211
- `npx handoff-check@0.8.0 hook-config --host claude` emits an opt-in advisory
228
+ `npx handoff-check@0.9.0 hook-config --host claude` emits an opt-in advisory
212
229
  SessionStart snippet to merge manually into existing settings. It never overwrites
213
230
  settings, and requires a pinned project-local package. The local adapter uses the
214
231
  same verifier without network/model calls; startup/resume/clear/compact checks
@@ -351,6 +368,14 @@ handoff-check diff --before <snapshot> --after <snapshot>
351
368
 
352
369
  handoff-check setup [--dry-run]
353
370
 
371
+ handoff-check review --registry <review-file>
372
+ [--config <path>] [--profile <name> | --scope <scope>] [--constraints <path>]
373
+ [--as-of <UTC time>] [--format text|json|markdown]
374
+
375
+ handoff-check review-record --owner <owner> --review-by <UTC time>
376
+ [--config <path>] [--profile <name> | --scope <scope>] [--constraints <path>]
377
+ [--as-of <UTC time>] [--output <new-file>] [--format text|json]
378
+
354
379
  handoff-check run
355
380
  [--config <path>] [--profile <name> | --scope <scope>]
356
381
  [--constraints <path>] [--handoff <path>] -- <executable> [arguments...]
@@ -367,6 +392,7 @@ handoff-check hook --host claude --config <absolute-path> [--require-active]
367
392
  ```
368
393
 
369
394
  Verify/snapshot/explain/doctor/hook/hook-config/run accept explicit `--profile`;
395
+ review and review-record also accept profiles without reading handoffs;
370
396
  init does not. Profile selection rejects scope/input-path overrides, but permits
371
397
  --config. Verify-only --report requires JSON or Markdown; --git-context additionally
372
398
  requires --report and Git with an existing commit. No reports are saved automatically.
@@ -394,6 +420,12 @@ After launch it preserves the child's exit code, including 1/2, or maps an
394
420
  unhandled signal to 128 + the OS signal number. Read stderr phases to distinguish
395
421
  blocked verification from a failed program. Run has no format/policy/time override.
396
422
 
423
+ Review exit 0 means all active rules have current maintenance metadata with no
424
+ orphan IDs; 1 means maintenance attention (including zero active); 2 means invalid.
425
+ Review-record succeeds with 0 or fails with 2. Its stdout record is JSON; --format
426
+ controls the acknowledgement only when --output creates a new file. These commands
427
+ never refresh saved handoffs or implicitly gate verify/run.
428
+
397
429
  Per-rule findings include `MISSING`, `EXPIRED`, `REVOKED`, `SUPERSEDED`, `OUT_OF_SCOPE`,
398
430
  `UNKNOWN`, and (for v2) `CHANGED`, ordered by ID. A reported ID receives one primary finding according to
399
431
  the precedence in the lifecycle ADR.
package/dist/cli.js CHANGED
@@ -1,13 +1,13 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  // src/cli.ts
4
- import { open as open4 } from "node:fs/promises";
5
- import { resolve as resolve7 } from "node:path";
4
+ import { open as open5 } from "node:fs/promises";
5
+ import { resolve as resolve8 } from "node:path";
6
6
  import { parseArgs } from "node:util";
7
7
  // package.json
8
8
  var package_default = {
9
9
  name: "handoff-check",
10
- version: "0.8.0",
10
+ version: "0.9.0",
11
11
  description: "A deterministic, local CLI that verifies active constraints before a coding agent resumes work.",
12
12
  type: "module",
13
13
  packageManager: "bun@1.2.10",
@@ -1389,10 +1389,230 @@ function reportMarkdown(report) {
1389
1389
  `);
1390
1390
  }
1391
1391
 
1392
+ // src/review-cli.ts
1393
+ import { open as open3 } from "node:fs/promises";
1394
+ import { resolve as resolve5 } from "node:path";
1395
+
1396
+ // src/review.ts
1397
+ function object2(input, allowed, path) {
1398
+ if (!input || typeof input !== "object" || Array.isArray(input))
1399
+ throw new InputError(`${path}: expected an object`);
1400
+ const value = input;
1401
+ for (const key of Object.keys(value).sort())
1402
+ if (!allowed.includes(key))
1403
+ throw new InputError(`${path}: unknown field '${key}'`);
1404
+ return value;
1405
+ }
1406
+ function text(input, path) {
1407
+ if (typeof input !== "string" || !input.trim())
1408
+ throw new InputError(`${path}: expected a non-empty string`);
1409
+ return input;
1410
+ }
1411
+ function parseReviewRegistry(input) {
1412
+ const root = object2(input, ["schemaVersion", "projectId", "rules"], "review registry");
1413
+ if (root.schemaVersion !== 1)
1414
+ throw new InputError("review registry.schemaVersion: expected 1");
1415
+ const projectId = Object.hasOwn(root, "projectId") ? identifier(root.projectId, "review registry.projectId") : undefined;
1416
+ if (!Array.isArray(root.rules))
1417
+ throw new InputError("review registry.rules: expected an array");
1418
+ const seen = new Set;
1419
+ const rules = root.rules.map((input2, index) => {
1420
+ const path = `review registry.rules[${index}]`;
1421
+ const entry = object2(input2, ["id", "revision", "contentHash", "owner", "reviewedAt", "reviewBy"], path);
1422
+ const id = identifier(entry.id, `${path}.id`);
1423
+ if (seen.has(id))
1424
+ throw new InputError(`${path}: duplicate ID '${id}'`);
1425
+ seen.add(id);
1426
+ if (!Number.isSafeInteger(entry.revision) || entry.revision < 1)
1427
+ throw new InputError(`${path}.revision: expected a positive safe integer`);
1428
+ const contentHash = text(entry.contentHash, `${path}.contentHash`);
1429
+ if (!/^sha256:[a-f0-9]{64}(?![\s\S])/.test(contentHash))
1430
+ throw new InputError(`${path}.contentHash: expected canonical sha256 reference`);
1431
+ const reviewedAt = timestamp(entry.reviewedAt, `${path}.reviewedAt`);
1432
+ const reviewBy = timestamp(entry.reviewBy, `${path}.reviewBy`);
1433
+ if (reviewBy <= reviewedAt)
1434
+ throw new InputError(`${path}: reviewBy must be later than reviewedAt`);
1435
+ return {
1436
+ id,
1437
+ revision: entry.revision,
1438
+ contentHash,
1439
+ owner: text(entry.owner, `${path}.owner`),
1440
+ reviewedAt: new Date(reviewedAt).toISOString(),
1441
+ reviewBy: new Date(reviewBy).toISOString()
1442
+ };
1443
+ });
1444
+ return {
1445
+ schemaVersion: 1,
1446
+ ...projectId === undefined ? {} : { projectId },
1447
+ rules
1448
+ };
1449
+ }
1450
+ function recordReview(manifest, scope, asOf, owner, reviewBy) {
1451
+ text(owner, "--owner");
1452
+ const explanation = explain(manifest, scope, asOf);
1453
+ const active = new Set(explanation.rules.filter((r) => r.decision === "ACTIVE").map((r) => r.id));
1454
+ if (!active.size)
1455
+ throw new InputError("review-record requires at least one active constraint; no review record created");
1456
+ return parseReviewRegistry({
1457
+ schemaVersion: 1,
1458
+ ...manifest.projectId === undefined ? {} : { projectId: manifest.projectId },
1459
+ rules: manifest.constraints.filter((r) => active.has(r.id)).sort((a, b) => a.id < b.id ? -1 : a.id > b.id ? 1 : 0).map((rule) => ({
1460
+ ...reference(rule),
1461
+ owner,
1462
+ reviewedAt: explanation.asOf,
1463
+ reviewBy
1464
+ }))
1465
+ });
1466
+ }
1467
+ function reviewRules(manifest, registry, scope, asOf) {
1468
+ const projectId = checkProject(manifest);
1469
+ if (projectId !== registry.projectId)
1470
+ throw new InputError("Review registry and manifest must have matching project binding (both bound or both unbound)");
1471
+ const explanation = explain(manifest, scope, asOf);
1472
+ const time = timestamp(explanation.asOf, "asOf");
1473
+ const active = new Set(explanation.rules.filter((r) => r.decision === "ACTIVE").map((r) => r.id));
1474
+ const known = new Set(manifest.constraints.map((r) => r.id));
1475
+ const entries = new Map(registry.rules.map((r) => [r.id, r]));
1476
+ const rules = manifest.constraints.filter((r) => active.has(r.id)).sort((a, b) => a.id < b.id ? -1 : a.id > b.id ? 1 : 0).map((rule) => {
1477
+ const expected = reference(rule);
1478
+ const entry = entries.get(rule.id);
1479
+ let status;
1480
+ if (!entry)
1481
+ status = "MISSING_REVIEW";
1482
+ else if (entry.revision !== expected.revision || entry.contentHash !== expected.contentHash)
1483
+ status = "STALE_REVIEW";
1484
+ else if (timestamp(entry.reviewedAt, "reviewedAt") > time)
1485
+ status = "FUTURE_REVIEW";
1486
+ else if (timestamp(entry.reviewBy, "reviewBy") <= time)
1487
+ status = "OVERDUE_REVIEW";
1488
+ else
1489
+ status = "CURRENT";
1490
+ return {
1491
+ id: rule.id,
1492
+ status,
1493
+ expected,
1494
+ ...entry ? {
1495
+ recorded: {
1496
+ id: entry.id,
1497
+ revision: entry.revision,
1498
+ contentHash: entry.contentHash
1499
+ },
1500
+ owner: entry.owner,
1501
+ reviewedAt: entry.reviewedAt,
1502
+ reviewBy: entry.reviewBy
1503
+ } : {}
1504
+ };
1505
+ });
1506
+ const findings = [];
1507
+ if (!active.size)
1508
+ findings.push({ code: "NO_ACTIVE_CONSTRAINTS" });
1509
+ for (const rule of rules)
1510
+ if (rule.status !== "CURRENT")
1511
+ findings.push({ code: rule.status, id: rule.id });
1512
+ for (const entry of registry.rules)
1513
+ if (!known.has(entry.id))
1514
+ findings.push({ code: "UNKNOWN_RULE", id: entry.id });
1515
+ findings.sort((a, b) => (a.id ?? "") < (b.id ?? "") ? -1 : (a.id ?? "") > (b.id ?? "") ? 1 : 0);
1516
+ return {
1517
+ schemaVersion: 1,
1518
+ kind: "rule-review",
1519
+ status: findings.length ? "attention" : "current",
1520
+ ...projectId === undefined ? {} : { projectId },
1521
+ scope,
1522
+ asOf: explanation.asOf,
1523
+ activeConstraintCount: active.size,
1524
+ currentReviewCount: rules.filter((r) => r.status === "CURRENT").length,
1525
+ registryEntryCount: registry.rules.length,
1526
+ ignoredEntryCount: registry.rules.filter((r) => known.has(r.id) && !active.has(r.id)).length,
1527
+ rules,
1528
+ findings,
1529
+ notice: "Local maintenance record, not authenticated review or permission. Review deadlines never deactivate constraints or change verify/run results. Known inactive rules are ignored; orphan registry IDs require attention. Record only after reviewing the current rules; never refresh merely to clear findings."
1530
+ };
1531
+ }
1532
+ function reviewText(result, markdown) {
1533
+ const safe = markdown ? markdownText : terminalText;
1534
+ const lines = [
1535
+ markdown ? `# Handoff Check rule review
1536
+ ` : "RULE REVIEW",
1537
+ `${result.status.toUpperCase()} | ${result.currentReviewCount}/${result.activeConstraintCount} active rules have current review | scope ${safe(result.scope)} | as of ${safe(result.asOf)}${result.projectId ? ` | project ${safe(result.projectId)}` : ""}`,
1538
+ `${result.registryEntryCount} registry entries | ${result.ignoredEntryCount} known inactive entries ignored`
1539
+ ];
1540
+ for (const rule of result.rules) {
1541
+ lines.push(`${rule.status} ${safe(rule.id)}${rule.owner === undefined ? "" : ` | owner ${safe(rule.owner)} | reviewed ${safe(rule.reviewedAt ?? "")} | review by ${safe(rule.reviewBy ?? "")}`}`);
1542
+ if (rule.status === "MISSING_REVIEW" || rule.status === "STALE_REVIEW")
1543
+ lines.push(` Current reference: revision ${rule.expected.revision} ${rule.expected.contentHash}`);
1544
+ }
1545
+ for (const finding of result.findings)
1546
+ if (!finding.id || finding.code === "UNKNOWN_RULE")
1547
+ lines.push(`${finding.code}${finding.id ? ` ${safe(finding.id)}` : ""}`);
1548
+ lines.push(safe(result.notice));
1549
+ return `${lines.join(markdown ? `
1550
+
1551
+ ` : `
1552
+ `)}
1553
+ `;
1554
+ }
1555
+
1556
+ // src/review-cli.ts
1557
+ async function reviewCommand(cwd, command, options) {
1558
+ if (options.profile !== undefined && [options.scope, options.constraints].some((v) => v !== undefined))
1559
+ throw new InputError("--profile cannot be combined with --scope or --constraints");
1560
+ for (const key of ["config", "constraints", "registry", "output"])
1561
+ if (options[key] !== undefined && !options[key].trim())
1562
+ throw new InputError(`--${key}: expected a non-empty path`);
1563
+ if (command === "review" && options.registry === undefined)
1564
+ throw new InputError("review requires --registry <review-file>; no review file is discovered implicitly");
1565
+ if (command === "review-record" && (options.owner === undefined || options["review-by"] === undefined))
1566
+ throw new InputError("review-record requires --owner and --review-by after reviewing the current rules");
1567
+ if (command === "review-record" && options.format === "markdown")
1568
+ throw new InputError("review-record supports text or json acknowledgement; its record is always JSON");
1569
+ const loaded = await loadConfig(cwd, options.config, true);
1570
+ const config = selectProfile(loaded.config, options.profile);
1571
+ const scope = identifier(options.scope ?? config.scope, "--scope (or config.scope)");
1572
+ const manifest = parseManifest(await readJson(options.constraints !== undefined ? resolve5(cwd, options.constraints) : resolve5(loaded.directory, config.constraints ?? "constraints.json"), true));
1573
+ checkProject(manifest, undefined, config.projectId);
1574
+ if (command === "review") {
1575
+ const registry = parseReviewRegistry(await readJson(resolve5(cwd, options.registry), true));
1576
+ const asOf2 = options["as-of"] ?? new Date().toISOString();
1577
+ timestamp(asOf2, "--as-of");
1578
+ const result = reviewRules(manifest, registry, scope, asOf2);
1579
+ process.stdout.write(options.format === "json" ? `${JSON.stringify(result, null, 2)}
1580
+ ` : reviewText(result, options.format === "markdown"));
1581
+ return result.status === "current" ? 0 : 1;
1582
+ }
1583
+ const asOf = options["as-of"] ?? new Date().toISOString();
1584
+ timestamp(asOf, "--as-of");
1585
+ const record = recordReview(manifest, scope, asOf, options.owner, options["review-by"]);
1586
+ const content = `${JSON.stringify(record, null, 2)}
1587
+ `;
1588
+ if (options.output === undefined)
1589
+ process.stdout.write(content);
1590
+ else {
1591
+ const path = resolve5(cwd, options.output);
1592
+ let handle;
1593
+ try {
1594
+ handle = await open3(path, "wx", 420);
1595
+ } catch {
1596
+ throw new InputError(`Cannot create review record '${path}'; choose a new file with an existing parent directory`);
1597
+ }
1598
+ try {
1599
+ await handle.writeFile(content, "utf8");
1600
+ } catch {
1601
+ throw new InputError(`Cannot finish review record '${path}'; the new file may be partial. Inspect it before retrying.`);
1602
+ } finally {
1603
+ await handle.close();
1604
+ }
1605
+ process.stdout.write(options.format === "json" ? `${JSON.stringify({ schemaVersion: 1, status: "recorded", path, entries: record.rules.length })}
1606
+ ` : `RECORDED ${terminalText(path)} | ${record.rules.length} reviewed rule references
1607
+ `);
1608
+ }
1609
+ return 0;
1610
+ }
1611
+
1392
1612
  // src/run.ts
1393
1613
  import { spawn } from "node:child_process";
1394
1614
  import { constants as constants3 } from "node:os";
1395
- import { resolve as resolve5 } from "node:path";
1615
+ import { resolve as resolve6 } from "node:path";
1396
1616
  async function runVerified(cwd, options, argv) {
1397
1617
  const executable = argv[0];
1398
1618
  if (!executable?.trim())
@@ -1436,8 +1656,8 @@ async function runVerified(cwd, options, argv) {
1436
1656
  const loaded = await loadConfig(cwd, options.config, true);
1437
1657
  const config = selectProfile(loaded.config, options.profile);
1438
1658
  const scope = identifier(options.scope ?? config.scope, "--scope (or config.scope)");
1439
- const manifest = parseManifest(await readJson(options.constraints !== undefined ? resolve5(cwd, options.constraints) : resolve5(loaded.directory, config.constraints ?? "constraints.json"), true));
1440
- const handoff = parseHandoff(await readJson(options.handoff !== undefined ? resolve5(cwd, options.handoff) : resolve5(loaded.directory, config.handoff ?? "handoff.json"), true));
1659
+ const manifest = parseManifest(await readJson(options.constraints !== undefined ? resolve6(cwd, options.constraints) : resolve6(loaded.directory, config.constraints ?? "constraints.json"), true));
1660
+ const handoff = parseHandoff(await readJson(options.handoff !== undefined ? resolve6(cwd, options.handoff) : resolve6(loaded.directory, config.handoff ?? "handoff.json"), true));
1441
1661
  if (handoff.schemaVersion === 1)
1442
1662
  throw new InputError("run requires a content-aware v2/v3/v4 handoff; review and capture a baseline explicitly");
1443
1663
  const result = verify(manifest, handoff, scope, new Date().toISOString(), {
@@ -1504,8 +1724,8 @@ async function runVerified(cwd, options, argv) {
1504
1724
  }
1505
1725
 
1506
1726
  // src/setup.ts
1507
- import { lstat as lstat3, open as open3, readdir } from "node:fs/promises";
1508
- import { resolve as resolve6 } from "node:path";
1727
+ import { lstat as lstat3, open as open4, readdir } from "node:fs/promises";
1728
+ import { resolve as resolve7 } from "node:path";
1509
1729
  import { createInterface } from "node:readline/promises";
1510
1730
  function setupPlan(answers, asOf) {
1511
1731
  const projectId = identifier(answers.projectId, "Project ID");
@@ -1552,7 +1772,7 @@ async function assertSetupTargets(root, files) {
1552
1772
  if (existing.has(file.path.normalize("NFC").toLowerCase()))
1553
1773
  throw new InputError(`Setup requires new files; target already exists: '${file.path}'.`);
1554
1774
  try {
1555
- await lstat3(resolve6(root, file.path));
1775
+ await lstat3(resolve7(root, file.path));
1556
1776
  } catch (error) {
1557
1777
  if (error.code === "ENOENT")
1558
1778
  continue;
@@ -1566,7 +1786,7 @@ async function writeSetup(root, files) {
1566
1786
  const written = [];
1567
1787
  for (const file of files) {
1568
1788
  try {
1569
- const handle = await open3(resolve6(root, file.path), "wx", 420);
1789
+ const handle = await open4(resolve7(root, file.path), "wx", 420);
1570
1790
  try {
1571
1791
  await handle.writeFile(file.content, "utf8");
1572
1792
  } finally {
@@ -1648,6 +1868,8 @@ Edit and review constraints before relying on them. Never refresh a baseline bef
1648
1868
  var help = `Handoff Check
1649
1869
 
1650
1870
  Usage: handoff-check verify --scope <scope> [options]
1871
+ handoff-check review --registry <review-file> [--profile <name>] [--format text|json|markdown]
1872
+ handoff-check review-record --owner <owner> --review-by <UTC time> [--output <new-file>] [options]
1651
1873
  handoff-check run [--profile <name> | --scope <scope>] [--config <path>] -- <executable> [args...]
1652
1874
  handoff-check diff --before <snapshot> --after <snapshot> [--format text|json|markdown]
1653
1875
  handoff-check setup [--dry-run]
@@ -1659,6 +1881,9 @@ Usage: handoff-check verify --scope <scope> [options]
1659
1881
  handoff-check hook --host claude --config <absolute-path> [--require-active]
1660
1882
 
1661
1883
  Options:
1884
+ --registry <path> review: explicit review registry (resolved from cwd)
1885
+ --owner <owner> review-record: owner of explicitly reviewed active rules
1886
+ --review-by <UTC> review-record: review deadline, later than capture time
1662
1887
  --before <path> diff: saved snapshot before the change
1663
1888
  --after <path> diff: saved snapshot after the change
1664
1889
  --constraints <path> Manifest file (default: constraints.json)
@@ -1672,9 +1897,9 @@ Options:
1672
1897
  --require-content verify: require a v2/v3/v4 content-aware handoff
1673
1898
  --require-active verify: fail if empty; hook/hook-config: opt-in nonempty policy
1674
1899
  --task <task> snapshot: task description (required)
1675
- --output <path> snapshot: create a new baseline file, never overwrite
1900
+ --output <path> snapshot/review-record: create a new file, never overwrite
1676
1901
  --include-content snapshot: retain old rule text in unbound v3/bound v4 (opt-in)
1677
- --format text|json|markdown Markdown is verify/explain/diff-only (default: text)
1902
+ --format text|json|markdown Markdown is verify/explain/diff/review-only (default: text)
1678
1903
  --agent <agent> init: codex, claude, both (default), or none
1679
1904
  --host <host> doctor: integration target; hook/hook-config: claude
1680
1905
  --dry-run init/setup: preview proposed files without writes
@@ -1683,6 +1908,7 @@ Options:
1683
1908
  --help Show this help
1684
1909
 
1685
1910
  Exit codes: verify 0 verified / 1 mismatch; diff 0 unchanged / 1 different; doctor 0 healthy / 1 attention.
1911
+ Review: 0 current maintenance / 1 attention (including zero active); never changes verify/run policy.
1686
1912
  Run: mandatory content/nonempty/current-clock preflight; 1 blocked / 2 invalid or launch error.
1687
1913
  After launch run returns the child exit code (or 128 + signal); diagnostics use stderr.
1688
1914
  Hook 0 means advisory response delivered (may report FAIL/INVALID), not verified.
@@ -1721,7 +1947,10 @@ async function main() {
1721
1947
  task: { type: "string" },
1722
1948
  output: { type: "string" },
1723
1949
  before: { type: "string" },
1724
- after: { type: "string" }
1950
+ after: { type: "string" },
1951
+ registry: { type: "string" },
1952
+ owner: { type: "string" },
1953
+ "review-by": { type: "string" }
1725
1954
  }
1726
1955
  });
1727
1956
  format = values.format;
@@ -1746,11 +1975,30 @@ async function main() {
1746
1975
  "hook-config",
1747
1976
  "diff",
1748
1977
  "setup",
1749
- "run"
1978
+ "run",
1979
+ "review",
1980
+ "review-record"
1750
1981
  ].includes(positionals[0] ?? ""))
1751
- throw new InputError("Expected command: verify, snapshot, explain, init, setup, diff, run, doctor, hook or hook-config (use --help for usage)");
1982
+ throw new InputError("Expected command: verify, snapshot, explain, init, setup, diff, run, review, review-record, doctor, hook or hook-config (use --help for usage)");
1752
1983
  const cwd = process.cwd();
1753
1984
  const command = positionals[0];
1985
+ if (command === "review" || command === "review-record") {
1986
+ const allowed = [
1987
+ "config",
1988
+ "profile",
1989
+ "scope",
1990
+ "constraints",
1991
+ "as-of",
1992
+ "format",
1993
+ ...command === "review" ? ["registry"] : ["owner", "review-by", "output"]
1994
+ ];
1995
+ for (const key of Object.keys(values))
1996
+ if (!allowed.includes(key))
1997
+ throw new InputError(`--${key} is not supported by ${command}`);
1998
+ return await reviewCommand(cwd, command, values);
1999
+ }
2000
+ if (values.registry !== undefined || values.owner !== undefined || values["review-by"] !== undefined)
2001
+ throw new InputError("--registry, --owner and --review-by are review/review-record-only");
1754
2002
  if (command === "run") {
1755
2003
  if (!runCommand || separator < 0)
1756
2004
  throw new InputError("Use run as the first argument and include -- <executable> [arguments...]");
@@ -1777,8 +2025,8 @@ async function main() {
1777
2025
  }
1778
2026
  if (!values.before?.trim() || !values.after?.trim())
1779
2027
  throw new InputError("diff requires --before <snapshot> and --after <snapshot>");
1780
- const before = parseHandoff((await readJsonRecord(resolve7(cwd, values.before))).input);
1781
- const after = parseHandoff((await readJsonRecord(resolve7(cwd, values.after))).input);
2028
+ const before = parseHandoff((await readJsonRecord(resolve8(cwd, values.before))).input);
2029
+ const after = parseHandoff((await readJsonRecord(resolve8(cwd, values.after))).input);
1782
2030
  const result2 = diffSnapshots(before, after);
1783
2031
  process.stdout.write(format === "json" ? `${JSON.stringify(result2, null, 2)}
1784
2032
  ` : diffText(result2, format === "markdown"));
@@ -1929,7 +2177,7 @@ ${result2.notice}
1929
2177
  for (const key of ["constraints", "handoff", "config"])
1930
2178
  if (values[key] !== undefined && !values[key].trim())
1931
2179
  throw new InputError(`--${key}: expected a non-empty path`);
1932
- const manifestRecord = await readJsonRecord(values.constraints !== undefined ? resolve7(cwd, values.constraints) : resolve7(directory, config.constraints ?? "constraints.json"));
2180
+ const manifestRecord = await readJsonRecord(values.constraints !== undefined ? resolve8(cwd, values.constraints) : resolve8(directory, config.constraints ?? "constraints.json"));
1933
2181
  const manifest = parseManifest(manifestRecord.input);
1934
2182
  checkProject(manifest, undefined, config.projectId);
1935
2183
  if (command === "explain") {
@@ -1954,10 +2202,10 @@ ${result2.notice}
1954
2202
  else {
1955
2203
  if (!values.output.trim())
1956
2204
  throw new InputError("--output: expected a non-empty path");
1957
- const path = resolve7(cwd, values.output);
2205
+ const path = resolve8(cwd, values.output);
1958
2206
  let handle;
1959
2207
  try {
1960
- handle = await open4(path, "wx", 420);
2208
+ handle = await open5(path, "wx", 420);
1961
2209
  } catch {
1962
2210
  throw new InputError(`Cannot create snapshot '${path}'; choose a new file with an existing parent directory`);
1963
2211
  }
@@ -1980,7 +2228,7 @@ ${result2.notice}
1980
2228
  }
1981
2229
  if (values.task !== undefined || values.output !== undefined)
1982
2230
  throw new InputError("--task and --output are only supported by snapshot");
1983
- const handoffRecord = await readJsonRecord(values.handoff !== undefined ? resolve7(cwd, values.handoff) : resolve7(directory, config.handoff ?? "handoff.json"));
2231
+ const handoffRecord = await readJsonRecord(values.handoff !== undefined ? resolve8(cwd, values.handoff) : resolve8(directory, config.handoff ?? "handoff.json"));
1984
2232
  const handoff = parseHandoff(handoffRecord.input);
1985
2233
  if (values["require-content"] && handoff.schemaVersion === 1)
1986
2234
  throw new InputError("Content tracking requires a schemaVersion 2, 3 or 4 handoff; review current rules and capture a snapshot before resuming");
@@ -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.8.0 init --scope staging --agent both --dry-run
13
- npx handoff-check@0.8.0 init --scope staging --agent both
12
+ npx handoff-check@0.9.0 init --scope staging --agent both --dry-run
13
+ npx handoff-check@0.9.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.8.0.tgz handoff-check init --scope staging --agent both
43
- npx --offline --yes --package=/absolute/path/handoff-check-0.8.0.tgz handoff-check verify --format json --require-content
42
+ npx --offline --yes --package=/absolute/path/handoff-check-0.9.0.tgz handoff-check init --scope staging --agent both
43
+ npx --offline --yes --package=/absolute/path/handoff-check-0.9.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
@@ -42,6 +42,12 @@ are inherited and exit codes preserved. It never expands the pure verifier into
42
42
  an execution engine. See ADR 0008 for cancellation, time-of-check/time-of-use and
43
43
  platform limits; the supplied program's side effects are outside verification.
44
44
 
45
+ Review maintenance is independent of verification. A strict separate registry
46
+ binds ownership/deadlines to existing rule references; review reuses explain's
47
+ active selection and never modifies applicability. Review-record explicitly
48
+ captures selected active references without merging or refreshing handoffs.
49
+ Neither verify/run nor lifecycle/doctor load the registry. See ADR 0009.
50
+
45
51
  Exit codes: 0 for verified IDs, 1 for rule mismatches, 2 for invalid input or an
46
52
  unreadable input file. JSON output is intended for agent adapters and automation.
47
53