@punks/cli 3.1.10 → 3.1.12

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.
Files changed (76) hide show
  1. package/dist/BASELINE_CHANGELOG.md +61 -0
  2. package/dist/CHANGELOG.md +57 -0
  3. package/dist/data/subagents/manifest.mjs +11 -6
  4. package/dist/index.js +28 -28
  5. package/dist/skills/agnostic/cli/hi-cli/references/post-command-flow.md +5 -0
  6. package/dist/skills/agnostic/docs/writing-beats/LICENSE +21 -0
  7. package/dist/skills/agnostic/docs/writing-beats/UPSTREAM.md +11 -0
  8. package/dist/skills/agnostic/docs/writing-fragments/LICENSE +21 -0
  9. package/dist/skills/agnostic/docs/writing-fragments/UPSTREAM.md +11 -0
  10. package/dist/skills/agnostic/docs/writing-shape/LICENSE +21 -0
  11. package/dist/skills/agnostic/docs/writing-shape/UPSTREAM.md +11 -0
  12. package/dist/skills/agnostic/frontend/frontend-domain-structure/SKILL.md +24 -42
  13. package/dist/skills/agnostic/frontend/frontend-domain-structure/agents/openai.yaml +1 -1
  14. package/dist/skills/agnostic/frontend/frontend-domain-structure/references/react/structure.md +51 -78
  15. package/dist/skills/agnostic/frontend/frontend-domain-structure/references/structure.md +89 -212
  16. package/dist/skills/agnostic/generic/handoff/LICENSE +21 -0
  17. package/dist/skills/agnostic/generic/handoff/UPSTREAM.md +11 -0
  18. package/dist/skills/agnostic/planning/create-plan/REFERENCE.md +1 -1
  19. package/dist/skills/agnostic/planning/create-plan/SKILL.md +19 -7
  20. package/dist/skills/agnostic/planning/create-plan/references/plan-schema.md +19 -0
  21. package/dist/skills/agnostic/planning/create-plan/references/planner-task-graph.md +27 -10
  22. package/dist/skills/agnostic/planning/implement-spec/SKILL.md +6 -2
  23. package/dist/skills/agnostic/planning/implement-spec/assets/IMPLEMENTATION-NOTES-TEMPLATE.md +22 -6
  24. package/dist/skills/agnostic/planning/implement-spec/references/lifecycle.md +12 -0
  25. package/dist/skills/agnostic/planning/implement-spec/references/parallel-orchestration.md +10 -2
  26. package/dist/skills/agnostic/planning/implement-spec/references/parallel-worker-brief.md +10 -1
  27. package/dist/skills/agnostic/planning/implement-spec/references/parallel.md +2 -0
  28. package/dist/skills/agnostic/quality/autoreview/SKILL.md +11 -2
  29. package/dist/skills/agnostic/quality/codebase-design/LICENSE +21 -0
  30. package/dist/skills/agnostic/quality/codebase-design/UPSTREAM.md +11 -0
  31. package/dist/skills/agnostic/quality/review/LICENSE +21 -0
  32. package/dist/skills/agnostic/quality/review/SKILL.md +16 -11
  33. package/dist/skills/agnostic/quality/review/UPSTREAM.md +11 -0
  34. package/dist/skills/agnostic/quality/tdd/LICENSE +21 -0
  35. package/dist/skills/agnostic/quality/tdd/UPSTREAM.md +11 -0
  36. package/dist/skills/agnostic/research/improve-codebase-architecture/LICENSE +21 -0
  37. package/dist/skills/agnostic/research/improve-codebase-architecture/UPSTREAM.md +11 -0
  38. package/dist/skills/frameworks/effect/effect/SKILL.md +5 -12
  39. package/dist/skills/frameworks/effect/effect/references/CONFIG.md +10 -19
  40. package/dist/skills/frameworks/effect/effect/references/SERVICES_LAYERS.md +3 -63
  41. package/dist/skills/frameworks/effect/effect/references/TESTING.md +2 -72
  42. package/dist/skills/frameworks/effect/effect-backend-structure/SKILL.md +12 -29
  43. package/dist/skills/frameworks/effect/effect-backend-structure/agents/openai.yaml +1 -1
  44. package/dist/skills/frameworks/effect/effect-backend-structure/references/layout.md +9 -9
  45. package/dist/skills/frameworks/sqlalchemy/sqlalchemy-schema-design/SKILL.md +199 -0
  46. package/dist/skills/frameworks/sqlalchemy/sqlalchemy-schema-design/UPSTREAM.md +31 -0
  47. package/dist/skills/frameworks/sqlalchemy/sqlalchemy-schema-design/agents/openai.yaml +4 -0
  48. package/dist/skills/languages/python/python-backend-structure/SKILL.md +91 -0
  49. package/dist/skills/languages/python/python-backend-structure/agents/openai.yaml +4 -0
  50. package/dist/skills/languages/python/python-design-patterns/SKILL.md +93 -69
  51. package/dist/skills/languages/python/python-project-structure/SKILL.md +4 -247
  52. package/dist/skills/phases/delivery-phase/SKILL.md +13 -4
  53. package/dist/skills/phases/delivery-phase/phases/closeout.md +3 -0
  54. package/dist/skills/phases/delivery-phase/phases/debug.md +8 -1
  55. package/dist/skills/phases/delivery-phase/phases/implement.md +11 -2
  56. package/dist/skills/phases/delivery-phase/phases/review.md +50 -29
  57. package/dist/skills/phases/delivery-phase/phases/router.md +56 -36
  58. package/dist/skills/phases/delivery-phase/references/artifact-state.md +8 -2
  59. package/dist/skills/phases/delivery-phase/references/phase-handoff.md +60 -10
  60. package/dist/skills/phases/finder-phase/references/root-routing.md +6 -1
  61. package/dist/skills/phases/prototype-phase/agents/openai.yaml +2 -0
  62. package/dist/skills/phases/review-phase/AUTHORING-HANDOFF.md +622 -0
  63. package/dist/skills/phases/review-phase/SKILL.md +11 -42
  64. package/dist/skills/phases/review-phase/agents/openai.yaml +2 -0
  65. package/dist/skills/phases/review-phase/phases/prepare-review.md +105 -0
  66. package/dist/skills/phases/review-phase/phases/retain-report.md +113 -0
  67. package/dist/skills/phases/review-phase/phases/return-route.md +95 -0
  68. package/dist/skills/phases/review-phase/phases/router.md +78 -0
  69. package/dist/skills/phases/review-phase/phases/run-review.md +128 -0
  70. package/dist/skills/phases/review-phase/references/durable-report.md +153 -0
  71. package/dist/skills/phases/review-phase/references/runtime-handoff.md +138 -0
  72. package/dist/skills/phases/review-phase/references/state-graph.md +69 -0
  73. package/dist/skills/phases/review-phase/references/targets.md +156 -0
  74. package/dist/skills/phases/review-phase/scripts/review-contract.mjs +819 -0
  75. package/package.json +56 -2
  76. package/dist/skills/phases/review-phase/REFERENCE.md +0 -147
@@ -0,0 +1,138 @@
1
+ # Review Runtime Handoff
2
+
3
+ This is the single runtime resume contract for review gates and router-owned
4
+ stateful outcomes. Retained reports remain finding and pass authority. Delivery
5
+ handoffs remain delivery-route and repair authority.
6
+
7
+ ## Storage
8
+
9
+ Delivery mode reuses the caller-provided delivery handoff:
10
+
11
+ 1. The explicit invocation context supplies `delivery_handoff_path`.
12
+ 2. Resolve that path from the repository root. It must already be the durable
13
+ delivery handoff for the same `delivery_goal_identity`; otherwise return
14
+ `review_context_blocked` without writing.
15
+ 3. Append review records under its `Review Phase Runtime Handoffs` section.
16
+ Review never creates a second delivery handoff.
17
+
18
+ Standalone mode stores records at this deterministic repository-local path:
19
+
20
+ `<repo-root>/.devpunks/review-phase/handoffs/<review_lineage_id>/<review_run_id>.md`
21
+
22
+ Both path components are the canonical lowercase 64-character identities. A
23
+ standalone record cannot be written until both identities are derived. This
24
+ local workflow state is not a retained review report, pass record, or reviewed
25
+ target artifact. Keep it uncommitted, never push or retain it, and exclude it
26
+ from the report retention envelope and reviewed artifact bytes.
27
+
28
+ ## Record Schema
29
+
30
+ Append one fenced `review-handoff-v1` record per stateful attempt. Use every
31
+ category and nested field exactly; write `null`, `[]`, or `none` rather than
32
+ omitting an inapplicable value.
33
+
34
+ ```review-handoff-v1
35
+ Phase: prepare-review | run-review | retain-report | return-route | router
36
+ Status: complete | retryable | failed | blocked | checkpoint
37
+ Scope:
38
+ mode: delivery | standalone
39
+ review_lineage_id:
40
+ target_locator:
41
+ inclusive_scope_hash:
42
+ Artifacts:
43
+ accepted_bounds_identity:
44
+ accepted_bounds_hash:
45
+ normalized_target_locator:
46
+ frozen_target_evidence_locator:
47
+ frozen_source_evidence_locator:
48
+ snapshot_hash:
49
+ source_set_hash:
50
+ local_report_path:
51
+ local_report_sha256:
52
+ report_commit:
53
+ retained_ref:
54
+ stable_finding_ids: []
55
+ primary_route:
56
+ secondary_architecture_follow_up:
57
+ Validation:
58
+ outcome:
59
+ evidence_locator:
60
+ Review state:
61
+ Next suggested route:
62
+ Blockers:
63
+ Resume identity:
64
+ review_run_id:
65
+ review_ordinal:
66
+ recovered_review_count:
67
+ attempt:
68
+ ```
69
+
70
+ `Review state` is exactly one of `review_due`, `review_running`,
71
+ `report_retention_pending`, `retained_ref_approval_required`,
72
+ `review_context_blocked`, `review_routed`, `review_complete`, or
73
+ `review_failed`. `Next suggested route` is optional advice represented by
74
+ `none` when absent and is always lowest authority. `attempt` starts at 1 for a
75
+ run and increases by one for each new stateful record. Persist locators and
76
+ hashes, not reconstructible raw target, source, report, validation, or finding
77
+ bytes.
78
+
79
+ ## Write And Reconciliation
80
+
81
+ Before writing, revalidate storage identity, mode, lineage, run identity, scope,
82
+ and the evidence supporting the declared exit. Append only after the gate owns
83
+ a complete record. A partial or malformed trailing fence is invalid and cannot
84
+ advance state.
85
+
86
+ Appending the same canonical record for the same attempt is an idempotent
87
+ no-op. Two different valid records for the same attempt are
88
+ `review_state_conflict`; preserve both authorities, write nothing, and return
89
+ their exact evidence. Markdown defines this protocol but cannot guarantee
90
+ exclusive writers or atomic persistence; use the repository's existing safe
91
+ writer when those guarantees matter.
92
+
93
+ ## Cold-Resume Discovery
94
+
95
+ 1. Resolve mode from current direct invocation evidence.
96
+ 2. For delivery, open only the validated caller-provided
97
+ `delivery_handoff_path`. For standalone, derive the exact deterministic path
98
+ from current lineage and run identity.
99
+ 3. Parse complete `review-handoff-v1` records. Reject records with another mode,
100
+ lineage, run, target scope, or malformed schema.
101
+ 4. Select the highest valid `attempt` for the applicable run. A missing attempt,
102
+ a gap, or different records at one attempt is `review_state_conflict`.
103
+ 5. Recompute current bounds, target, source, report, and retained-pass evidence.
104
+ Direct current evidence outranks fresh workflow artifacts, which outrank the
105
+ selected handoff; its suggested route remains last.
106
+ 6. Project the route from the highest fresh valid evidence. A stale or
107
+ contradictory handoff never advances the router and remains exact diagnostic
108
+ evidence.
109
+
110
+ Delivery recovery may scan earlier records in the same caller handoff only to
111
+ match the active lineage and run. Standalone recovery reads no sibling lineage
112
+ or run file. Retained report discovery and delivery counter projection continue
113
+ to use the retained-pass contract, not handoff recency.
114
+
115
+ ## Required Writes And No-Write Outcomes
116
+
117
+ Every gate exit and router-owned checkpoint writes a record when storage and run
118
+ identity are valid, including successful completion, retryable return, failure,
119
+ blocker, and retained-ref approval checkpoint.
120
+
121
+ The following already-authoritative outcomes write no new runtime record:
122
+
123
+ - `review_budget_exhausted`, which preserves the caller's valid delivery
124
+ handoff and retained-count authority unchanged;
125
+ - `review_not_due`, whose caller-provided delivery handoff already proves a
126
+ delivery-owned state;
127
+ - pre-run `review_failed` from an unsupported target, invalid bounds, or
128
+ non-retryable identity failure, before a valid run and storage identity exist;
129
+ - pre-storage `review_context_blocked`, when safe storage, lineage, or run
130
+ identity cannot be established; return exact direct evidence instead;
131
+ - `review_state_conflict`, because conflicting handoff authority cannot safely
132
+ authorize another append;
133
+ - rediscovery of an identical already-recorded terminal, blocker, checkpoint,
134
+ `review_routed`, or `review_complete` outcome.
135
+
136
+ These are idempotent no-write returns, not missing handoffs. Once storage and
137
+ run identity are valid, a new stateful failure or blocker uses the normal record
138
+ schema.
@@ -0,0 +1,69 @@
1
+ # Review And Repair State Graph
2
+
3
+ Review owns normalization, frozen inspection, report retention, routing output,
4
+ and termination. Delivery owns debugging, implementation, debt, docs, closeout,
5
+ and clean handoff.
6
+
7
+ | State | Event | Guard | Owner | Next state | Counter effect | Required evidence |
8
+ | --- | --- | --- | --- | --- | --- | --- |
9
+ | Current delivery state | Review considered | Unsupported target | Delivery caller | Return `review_failed` | None; zero handoff or status writes | Exact target failure; no report |
10
+ | Current delivery state | Review considered | Invalid accepted bounds | Delivery caller | Return `review_failed` | None; zero handoff or status writes | Exact bounds failure; no report |
11
+ | `review_due` | Explicit review invocation | Delivery; accepted bounds and target valid; recovered `review_count < 3` | Delivery caller | `review_running` | Preallocate ordinal `review_count + 1`; no completed-pass change | Lineage, run id, ordinal, bounds identity/hash, normalized target |
12
+ | `review_due` | Explicit review invocation | Standalone; accepted bounds and target valid | Standalone caller | `review_running` | None | Lineage, run id, bounds identity/hash, normalized target |
13
+ | Current delivery state | Review considered | Delivery; in-memory accepted bounds and target valid; recovered `review_count >= 3` | Delivery caller | Return `review_budget_exhausted` | None; zero handoff or status writes | Exact current route, lineage, counters; no report or status mutation |
14
+ | `review_running` | All lenses and parent verification complete | One frozen snapshot; complete local report exists | `review-phase` | `report_retention_pending` | None; no completed-pass change | Complete report and fresh target/source hashes |
15
+ | `review_running` | Validation mutation detected | Frozen-target hash differs after validation | `review-phase` | `review_due` | None | Before/after hashes, command, mutation evidence; no report or pass |
16
+ | `review_running` | Retryable infrastructure failure or partial run | No immutable report | `review-phase` | `review_due` | None | Exact retryable evidence; unchanged counters |
17
+ | `review_running` | Non-retryable contract or infrastructure failure | No immutable report | `review-phase` | `review_failed` | None | Exact terminal evidence; no report; unchanged counters |
18
+ | `report_retention_pending` | Retention verified | Delivery; valid retained-pass predicate; ordinal at most 3; hashes fresh | Report writer | `review_routed` | Unique retained commit establishes authoritative ordinal; reconcile projection | Path, SHA-256, commit, retained ref, ordinal, run id |
19
+ | `report_retention_pending` | Retention rejected | Delivery; ordinal is greater than 3 | Report writer | `review_budget_exhausted` | None | Exact ordinal rejection/current route; no authoritative pass |
20
+ | `report_retention_pending` | Retention verified | Standalone; valid retained-pass predicate; hashes fresh | Report writer | `review_routed` | None | Path, SHA-256, commit, retained ref |
21
+ | `report_retention_pending` | Idempotent retention recovery | Same lineage/run has identical valid path, report blob SHA-256, and commit | Report writer | `review_routed` | Reuse existing pass; project its ordinal at most once | Existing unique authority and containment evidence |
22
+ | `report_retention_pending` | Same-run conflict | Same lineage/run has two valid candidates with different path, blob, or commit | Report writer | `review_failed` | None | `same_run_conflict`, both authorities; no pass or counter change |
23
+ | `report_retention_pending` | Retained-pass validation rejected | Active candidate is malformed or has wrong derived identity, hash, paths, containment, or ordinal | Report writer | `review_failed` | None | Exact failed predicate; no pass or counter change |
24
+ | `report_retention_pending` | Retryable retention failure | Hashes fresh | Report writer | `report_retention_pending` | None | Exact retryable evidence; no authoritative pass |
25
+ | `report_retention_pending` | Non-retryable retention failure | Retry cannot succeed | Report writer | `review_failed` | None | Exact terminal evidence; no authoritative pass |
26
+ | `report_retention_pending` | Freshness changed | Target or source hash changed | `review-phase` | `review_due` | None | Stale local report; unchanged counters |
27
+ | `review_routed` | Readonly return | Standalone | Standalone caller | `review_complete` | None | Retained report output and route |
28
+ | `review_routed` | Resume debug route | Handoff already records run id, debug route, and `debug_active` | `delivery-phase` | `debug_active` | None | Existing atomic handoff; no guard fallthrough |
29
+ | `review_routed` | Resume implementation route | Handoff already records run id, implementation route, and `repair_active` | `delivery-phase` | `repair_active` | None | Existing atomic handoff; no guard fallthrough |
30
+ | `review_routed` | Mixed or single finding route | Runtime evidence exists; run id unrecorded | `delivery-phase` | `debug_active` | Atomic handoff opens corresponding repair | Primary debug route, stable findings, atomic handoff, optional architecture follow-up |
31
+ | `review_routed` | Mixed or single finding route | No runtime evidence; in-scope non-runtime blocker exists; run id unrecorded | `delivery-phase` | `repair_active` | Atomic handoff opens corresponding repair | Primary implementation route, stable findings, atomic handoff, optional architecture follow-up |
32
+ | `review_routed` | Finding route | No higher blocker; broad architecture debt exists | `delivery-phase` | `debt_follow_up` | None | Debt route and stable findings |
33
+ | `review_routed` | No-blocker route | Required documentation remains | `delivery-phase` | `docs_ingest` | None | Report and docs route |
34
+ | `review_routed` | No-blocker route | Documentation complete | `delivery-phase` | `closeout` | None | Report and closeout route |
35
+ | `repair_active` or `debug_active` | Ordinary repair completes | `review_count < 3` | `delivery-phase` | `review_due` | None | Stale prior report, changed target identity, preserved counters |
36
+ | `repair_active` or `debug_active` | Fix 3 completes | `review_count = 3` and `repair_count = 3` | `delivery-phase` | `focused_validation` | None | Fix-3 changes and required focused validation |
37
+ | `focused_validation` | Focused validation fails | Repair epoch 3 remains open | `delivery-phase` | `repair_active` or `debug_active` | None; unchanged counters | Failed validation and recorded owning route |
38
+ | `focused_validation` | Focused validation passes | Repair epoch 3 complete | `delivery-phase` | `clean_handoff` | None | Passing validation, final changes, report-3 link, clean status |
39
+
40
+ ## Durable Budget
41
+
42
+ Only a unique valid retained report commit is an authoritative pass record.
43
+ Identical rediscovery reuses it. A conflicting same-run candidate supplies no
44
+ authority. Recover `review_count` from unique valid retained ordinals for the
45
+ lineage, using the highest valid retained ordinal; the handoff counter is a projection reconciled after interrupted
46
+ updates.
47
+
48
+ Repair opening is one atomic durable handoff write containing active state,
49
+ primary route, `repair_count = review_count`, and idempotency `review_run_id`.
50
+ This enforces the corresponding numbered repair and rejects mismatched or
51
+ already-consumed ordinals. Complete the transition only after the write. An
52
+ already recorded run ID resumes its active state without another increment and
53
+ cannot fall through to an unrecorded guard.
54
+
55
+ Review 1 may open fix 1, review 2 fix 2, and review 3 fix 3. Fix 3 never opens
56
+ review 4. A failed focused validation stays in repair epoch 3 until that same
57
+ validation passes.
58
+
59
+ Same-goal bounds revisions preserve delivery lineage and counters. Resume,
60
+ rebase, new commit, process retry, and handoff preserve them. Only an explicitly
61
+ new delivery goal with materially changed accepted bounds creates a new lineage
62
+ and resets counters.
63
+
64
+ `review_budget_exhausted` is a terminal no-op for the route evaluation: exact
65
+ current route evidence, no handoff write, report, counter or status change, and no block on clean
66
+ continuation. `review_failed` is only a non-retryable invocation-level contract
67
+ or infrastructure failure and consumes no counter.
68
+
69
+ External GitHub and Codex PR reviewer integration is excluded.
@@ -0,0 +1,156 @@
1
+ # Review Target And Identity Contract
2
+
3
+ Validate accepted bounds and normalize a supported target before mode-specific
4
+ budget evaluation. Both target forms then enter the same review graph, lens
5
+ composition, report, routing, and freshness contracts.
6
+
7
+ ## Scope
8
+
9
+ Record the smallest certain inclusive scope. Full-repository expansion requires
10
+ an explicit caller request. Unsupported targets or invalid accepted bounds enter
11
+ `review_failed` with exact evidence, no report, and no counter change, including
12
+ when a delivery counter is already 3.
13
+
14
+ ## Delivery Git/Diff Adapter
15
+
16
+ Freeze and record:
17
+
18
+ - locator
19
+ - actual base ref
20
+ - merge-base or fixed-point SHA
21
+ - head or dirty-worktree identity
22
+ - inclusive scope
23
+ - canonical patch hash
24
+
25
+ Use the actual PR base when a PR exists. Record the exact bounded diff command
26
+ and environment. `canonical_patch_hash` is SHA-256 of its unmodified output
27
+ bytes.
28
+
29
+ The normalized object has exactly these keys:
30
+
31
+ ```text
32
+ kind: delivery-git-diff
33
+ locator:
34
+ actual_base_ref:
35
+ fixed_point_sha:
36
+ head_identity:
37
+ inclusive_scope: [sorted unique paths]
38
+ canonical_patch_hash: <64 lowercase hex>
39
+ ```
40
+
41
+ The validator receives the same primitive locator/base/fixed-point/head/scope
42
+ evidence plus the canonical patch bytes, hashes those bytes itself, and rejects
43
+ any missing, extra, malformed, or inconsistent normalized field.
44
+
45
+ ## Standalone Artifact Adapter
46
+
47
+ Plans, specs, and documentation freeze exact selected file bytes into one
48
+ deterministic ordered bundle. Sort file identities by their UTF-8 bytes. Hash
49
+ each file's raw bytes, then hash alternating identity/content-hash fields with
50
+ the canonical record below. Record:
51
+
52
+ - locator
53
+ - ordered file identities
54
+ - inclusive scope
55
+ - ordered bundle content hash
56
+ - explicit absence of a Git fixed point
57
+
58
+ The normalized target does not embed raw selected bytes. Standalone mode never
59
+ reads, increments, resets, or persists delivery counters.
60
+
61
+ The normalized object has exactly these keys:
62
+
63
+ ```text
64
+ kind: standalone-artifact
65
+ locator:
66
+ ordered_file_identities: [sorted unique paths]
67
+ inclusive_scope: [the same sorted unique paths]
68
+ ordered_bundle_content_hash: <64 lowercase hex>
69
+ git_fixed_point: null
70
+ ```
71
+
72
+ The validator receives primitive file identities and bytes, recomputes the
73
+ ordered bundle, and rejects any missing, extra, malformed, or inconsistent
74
+ normalized field.
75
+
76
+ ## Canonical Hash Record
77
+
78
+ All identities use lowercase hexadecimal SHA-256. The executable reference is
79
+ [`../scripts/review-contract.mjs`](../scripts/review-contract.mjs).
80
+
81
+ `record(label, fields)` is this exact byte sequence:
82
+
83
+ 1. UTF-8 bytes `review-identity-v1\n`.
84
+ 2. `frame(label)`.
85
+ 3. One `frame(value)` for each field in the stated fixed order.
86
+
87
+ `frame(value)` is the ASCII decimal UTF-8 byte length with no leading zero,
88
+ then ASCII `:`, then the exact UTF-8 bytes. Inputs receive no JSON encoding,
89
+ Unicode normalization, case folding, or newline rewriting. Sort set-like path
90
+ lists by unsigned UTF-8 byte order before framing. Hash raw file or patch bytes
91
+ directly before placing their lowercase hash in a record.
92
+
93
+ ## Derived Identities
94
+
95
+ Use these labels and field orders exactly:
96
+
97
+ - `inclusive_scope_hash = hash(record("inclusive-scope", sorted scope entries))`
98
+ - `accepted_bounds_hash = hash(record("accepted-bounds", [accepted_bounds_identity, inclusive_scope_hash]))`
99
+ - `delivery_snapshot_hash = hash(record("delivery-snapshot", [locator, actual_base_ref, fixed_point_sha, head_identity, inclusive_scope_hash, canonical_patch_hash]))`
100
+ - `ordered_bundle_content_hash = hash(record("artifact-bundle", [file_1_identity, file_1_raw_sha256, ...]))`
101
+ - `ordered_file_identities_hash = hash(record("ordered-files", [file_1_identity, ...]))`
102
+ - `standalone_snapshot_hash = hash(record("standalone-snapshot", [locator, ordered_file_identities_hash, inclusive_scope_hash, ordered_bundle_content_hash, "no-git-fixed-point"]))`
103
+ - `source_set_hash = hash(record("source-set", [source_1_path, source_1_blob_sha256, ...]))`, with sources sorted by path bytes
104
+ - `delivery_review_lineage_id = hash(record("delivery-lineage", [delivery_goal_identity]))`
105
+ - `standalone_review_lineage_id = hash(record("standalone-lineage", [locator, accepted_bounds_hash]))`
106
+ - `delivery_review_run_id = hash(record("delivery-run", [review_lineage_id, decimal_ordinal]))`
107
+ - `standalone_review_run_id = hash(record("standalone-run", [review_lineage_id, snapshot12]))`
108
+
109
+ `snapshot12` is the first 12 lowercase hexadecimal characters of the mode's
110
+ 64-character snapshot hash. `review-scope-slug` is `review-` plus the first 20
111
+ characters of `review_lineage_id`. Report UTC uses `YYYYMMDDTHHMMSSZ`.
112
+
113
+ Delivery lineage derives only from stable delivery-goal identity. Accepted-
114
+ bounds identity and hash do not enter delivery lineage. Standalone lineage
115
+ derives from target locator plus accepted-bounds hash. Delivery run identity
116
+ derives from lineage plus decimal ordinal; standalone run identity derives from
117
+ lineage plus `snapshot12`; the filename slug derives from lineage. Delivery preallocates ordinal
118
+ `recovered review_count + 1` only on explicit entry to `review_running`.
119
+ Standalone mode has no delivery-budget guard.
120
+
121
+ ## Fixed Vectors
122
+
123
+ These values detect serialization drift:
124
+
125
+ - Delivery goal `goal:HI-104`, bounds identity `bounds:v1:HI-104`, scope
126
+ `apps/cli/src/a.ts` plus `apps/wiki/spec.md`:
127
+ - scope hash: `5fb7f4cd0577ad89de00916c8c18b122b264e50fb61df0c79249b88aba23a306`
128
+ - bounds hash: `90dddda98e886e9b2ef511790f32d1d359847af24f5950361d25aedfe729bd8a`
129
+ - lineage: `291c26957263b22b0cd5ad8a209415ff2992cc9a645f0018ed46ac4ba48de33b`
130
+ - With locator `repo:wearedevpunks/harness-intelligence`, base `origin/main`,
131
+ fixed point `1111111111111111111111111111111111111111`, head
132
+ `2222222222222222222222222222222222222222`, patch hash of 64 `a`
133
+ characters, and ordinal 2:
134
+ - snapshot: `f116049b650180523f8dd9ee48b900394f090a425ca8a1d7f369c56ca9d5998b`
135
+ - run id: `9b164c914a883778fd5d4a3e242aaa2d261a44ce7601df10d1530bd9dd777e32`
136
+ - slug: `review-291c26957263b22b0cd5`
137
+ - report suffix identity: `20260811T120000Z-f116049b6501`
138
+ - Standalone locator `artifact:spec-v1`, bounds identity
139
+ `bounds:v1:artifact`, files `docs/b.md` containing `beta\n` and `docs/a.md`
140
+ containing `alpha\n`:
141
+ - bundle hash: `107ee7c127b10e1826bf2d2899a36cc21291392ee6702af8d9e39b3e13553cb7`
142
+ - bounds hash: `8dfde7eafe7f68b6ee5f763d23d01310f414fd5b7fca6393d5e92e90d963aa7f`
143
+ - lineage: `ba4a5082445cac8ab133b533cfb090f936d69915266728bc9c6bd4b5b786f95a`
144
+ - snapshot: `d4c43491a0aef9aaeb604dc224792222d0fb6c85caec76d03ff763896563a58a`
145
+ - run id: `f165ab99100afe180bea68b41eb730fd2b61b2122347be0e50c91549140629d4`
146
+ - slug: `review-ba4a5082445cac8ab133`
147
+
148
+ ## Resume And Freshness
149
+
150
+ Delivery recovery keys on lineage and unique valid retained passes. Reconcile
151
+ the handoff projection from their highest ordinal. Separately recompute target,
152
+ accepted-bounds, and governing source hashes and select the highest fresh pass.
153
+
154
+ Standalone resume matches lineage, bounds, normalized target, and inclusive
155
+ scope; recomputes freshness; and selects the most recent unique valid report by
156
+ `reviewed_at`. It changes no delivery counter.