One Full Code Review Pass costs 25–30M tokens. A gate subagent reads about
31k tokens of graph docs and does mechanical work over about 90 turns; two axis
subagents wait on a frozen May 2026 autoreview fork; a Codex quota stall
blocked one pass for 200 minutes; reports live in the wiki (SPEC Context).
Move every one-answer step into scripts, call upstream autoreview unchanged
through a wrapper with Engine Fallback, keep one Adjudicator, and store a
temporary Pass Report, while delivery, the HI catalog, docs and consumers move
with the new contract (SPEC OUT-001–OUT-013).
Follow ARCHITECTURE FLOW-001: status → prepare → run (background) →
Adjudicator → retain → route. Module tree and interfaces: ARCHITECTURE
## Modules and Interfaces.
Work follows the eight provider Tasks and their native blockers; Tn are aliases
write-backlog readback 2026-10-23
P2
T2 owns deletion of tests/review-phase-graph.contract.test.mjs, tests/v43-frozen-review.contract.test.mjs and tests/fixtures/v43/IP-453/{retained-pass,prove-native}.mjs, because they import exports T2 removes; T3 adds tests/review-phase-cli.test.mjs
Codebase finding F3; keeps npm test green per Task
P3
Harness work continues on branch spec/review-phase-token-rebuild (based on main), one PR to main; skills work commits on skills main
SPEC Branch/Base Intent; root AGENTS.md
P4
The scaffolded wiki contract has no reviews/ section today (only review-phase creates it); AC-030's scaffold part is proved by inspection in T6, with no code change
Codebase finding F5
P5
T8 measures three passes of the rebuilt skill over already delivered real changes (merge commits of harness PRs #272, #274, #277), each in a scratch delivery folder; this delivery's own closing pass is not part of T8
SPEC AC-002; plan-reviewer finding (loop)
P6
$grilling found no open plan-shaping decision; the frontier was empty after P1–P5
Planning run 2026-10-23
P7
Skills tasks in one wave share the single main checkout. Each worker commits only its owned_paths with a pathspec commit; the wave gate runs npm test once after every task of the wave has committed, and a red test is attributed by owned path
Root AGENTS.md (skills on main only); plan-reviewer finding
P8
T3 tests use fixture prompt files under tests/fixtures/review-phase-cli/; review.mjs resolves references/axis-*.md at runtime, so T3 does not wait for T4
IMPLEMENTATION-NOTES.md is owned by the implement-spec parent; each task's Task Result carries its $writing-for-agents evidence and the parent records it (AC-032). T8 writes only ## Acceptance Measurement
implement-spec lifecycle
P10
.agents/skills/**, host agent files (.claude/agents, .codex, .cursor, .opencode) and other hi update outputs refresh in the next Baseline adoption after publication, outside this PR; root AGENTS.md (authored) changes in T6
hi update ownership; memory skills-sync-release-flow
F1: review-contract.mjs (1008 lines) is a library with no CLI; its exports are imported only by tests and fixtures (skills tests/review-phase-graph.contract.test.mjs:5-29, tests/v43-frozen-review.contract.test.mjs:10, tests/fixtures/v43/IP-453/*.mjs).
F2: Upstream engine seam --codex-bin/CODEX_BIN and --claude-bin/CLAUDE_BIN (upstream S:7301, S:7312); status sidecar fields S:8336-8347; exits S:8567.
F3: Text-pin tests that name review files: workflow-boundaries.contract.test.mjs:69-109 (autoreview SKILL.md and delivery text), matt-pocock-provenance.contract.test.mjs:19, show-me test :93, agent-workflow-contract:41, v43-delivery-continuity:28, v43-draft-review-transition:13.
F4: Harness consumers: apps/cli/src/data/catalog/skills.ts:841-857, packs.ts:266-268, apps/cli/src/data/registry/subagents/manifest.mjs:30,148, .agents/subagents/manifest.mjs:24,256, apps/cli/src/registry/publisher/sources/skills.test.ts:106, builders/prompts.ts:36, apps/cli/src/data/registry/prompts/root.md.tmpl:37,69 (line 69 still says the Standards axis covers simplification).
F5: No scaffold source writes a wiki reviews/ section (grep over apps/cli/src, packages/scaffold/src); only review-phase/references/durable-report.md creates it.
F6: hi update STEP-011 removes unedited stale copies and reports edited ones (apps/cli/src/registry/pipeline.ts:1135-1166); existing tests use a hook file (pipeline.test.ts:629,650), none a whole skill directory.
harness/entrypoints/review.mdx — selected by search review-phase; claims: two axes each run autoreview once, retained wiki report, explicit-only invocation; freshness fresh (matches skills 979a504freview-phase/SKILL.md); status verified implementation. T7 rewrites it.
review-phase (skill) ARC-001 procedure text only; owns no state scripts/review.mjs ARC-002 side effects: git, fs, processes; owns run dir + Pass Report writes scripts/review-contract.mjs ARC-003 pure policy: identity, budget, engine order, source context, routing, schema scripts/vendor/autoreview ARC-004 upstream review method + engine CLIs; unchanged references/adjudicator.md ARC-007 Adjudicator brief + adjudication.json schema references/axis-*.md, routing.md ARC-006, ARC-010delivery-phase (skill) ARC-010 consumes pass_report + review_run_id; owns repair routingHI CLI catalog/publisher ARC-013 distributes skills; owns no review policy
Must not absorb: review.mjs holds no policy that review-contract.mjs owns;
delivery-phase stores no review_count; the vendored helper receives no local edit.
Forbidden: any import of vendor/autoreview internals; review-contract.mjs
importing node:fs/node:child_process; delivery-phase reading wiki review
reports; any skill other than review-phase invoking the helper.
Disjoint paths (scripts/vendor/** vs scripts/review-contract.mjs + its tests)
W2
T3, T4
T3 owns scripts/review.mjs + CLI test; T4 owns skill text, references, removed skills and text-pin tests. T4 starts when T1 passes; T3 waits for T1 and T2
W3
T5
Needs T3 interface and T4 text
W4
T6
Needs skills main with T4 and T5
W5
T7, T8
Disjoint (wiki pages + changelog vs measurement section of IMPLEMENTATION-NOTES)
Skills repo: npm test (node --test tests/*.test.mjs) green after every Task; new tests/review-contract.test.mjs (T2) and tests/review-phase-cli.test.mjs (T3) with fake engine scripts on CODEX_BIN/CLAUDE_BIN that emit upstream-shaped JSON and status sidecars.
Harness: bun run --cwd apps/cli test for catalog, publisher, prompt and pipeline tests (T6); bun run --cwd apps/wiki check:health shows no finding beyond the 10 recorded on 2026-10-23 (T7).
read_dependencies: [SPEC AC-024, ARCHITECTURE ARC-004, upstream tag v0.6.0]
shared_runtime_resources: none; download into a new empty scratch dir, removed after copy
relevant_input_set: upstream commit aa2f8f7a; sha256 of the copied file before/after commit
wave_boundary: W1
description: Copy the upstream helper unchanged and executable; write UPSTREAM.md with repo, tag, commit and --version output.
validation: cmp with the tagged upstream file; python3 skills/phases/review-phase/scripts/vendor/autoreview --version equals UPSTREAM.md; npm test green.
shared_runtime_resources: per-test temp Git repos and $TMPDIR/hi-review/<run-id>/ dirs, created and removed by each test
relevant_input_set: library and helper sha256 before/after; fixture repo HEADs
wave_boundary: W2
description: Implement prepare, run, retain, status (one JSON line each), --standalone, review-target exclusion of .devpunks/delivery/**/reviews/, Engine Fallback, resume reuse, exclusive Pass Report create and pathspec commit, run-dir cleanup.
validation: node --test tests/review-phase-cli.test.mjs covers fallback, timeout to next engine, all-engines-fail blocker, resume reuse, exclusive ordinal, oversize blocker, standalone refusal of non-Git target, routing, retain refusal of an invalid adjudication.json (AC-014), per-attempt usage and subagent_tokens in the Pass Report (AC-001), no failure on large usage (AC-003), and status ignoring legacy wiki reports (AC-020); npm test green at the W2 wave gate (P7).
skill: tddapplicable_behavior: Drive each subcommand from a CLI-level test with fake engines; RED before code.
skill: codebase-designapplicable_behavior: Keep side effects in review.mjs; call the library for every decision; engine seam is CODEX_BIN/CLAUDE_BIN only.
skill: backend-recoverable-actionsapplicable_behavior: Make retain safe to retry: exclusive create first, then pathspec commit; a retry after a successful create reports the existing report instead of a second ordinal.
tdd_status: required
tdd_target: With a fake Claude engine that exits nonzero and a fake Codex engine that returns a clean report, run prints {"standards":{"outcome":"clean","engine":"codex","attempts":2},…}.
red_command: cd /home/stefan/repos/skills && node --test tests/review-phase-cli.test.mjs
expected_red_failure: review.mjs not found / non-zero exit with no JSON line
green_command: cd /home/stefan/repos/skills && node --test tests/review-phase-cli.test.mjs && npm test
reason_not_testable:
red_evidence:
green_evidence:
codebase_design_notes: Thin imperative shell over the pure library; two adapters at the engine seam (real CLIs, fake scripts).
relevant_input_set: Context Pointers; T3's CLI interface as fixed in ARCHITECTURE Modules and Interfaces
wave_boundary: W2
description: Write SKILL.md (status → prepare → run in background → Adjudicator → retain → route; no watch step), references/adjudicator.md, axis-standards.md (repo standards hard rules, smells P3 info, no simplify), axis-spec.md, routing.md; move mattpocock UPSTREAM.md/LICENSE; delete graph docs and the two skills; update text-pin tests.
validation: layout check per AC-025/AC-026; grep finds no watch/poll/sleep step and no simplify in axis-standards.md; npm test green at the W2 wave gate (P7); Task Result carries $writing-for-agents evidence (P9).
skill: writing-for-agentsapplicable_behavior: Steps end on checkable completion criteria; state positive targets; disclose references behind pointers; use the glossary terms as leading words.
tdd_status: not_applicable
tdd_target: Skill files and layout; text-pin tests updated to the new files.
red_command:
expected_red_failure:
green_command: cd /home/stefan/repos/skills && npm test
reason_not_testable: Prompt text and file removals; behaviour is proved by T3 tests and T8 runs.
red_evidence:
green_evidence:
codebase_design_notes: not_applicable
review_mode: cli
runtime_validation: not_required
runtime_target: not_applicable
runtime_evidence: not_applicable
runtime_cleanup: not_applicable
architecture_wave: A2
behavior_owner: review-phase skill
integration_surface: agents loading review-phase
public_seam: skill procedure text
topology_delta: graph gates and two skills removed
forbidden_ownership: mechanics owned by review.mjs
relevant_input_set: T3 and T4 commits on skills main
wave_boundary: W3
description: Replace retained-report fields with pass_report and review_run_id; derive the count from review.mjs status; rewrite ask-hi review references and the $review-phase invocations in debugging-phase and finder-phase; update pinned tests; push skills main.
validation: the T5 contract test passes; npm test green; Task Result carries $writing-for-agents evidence (P9); skills main pushed.
skill: writing-for-agentsapplicable_behavior: Keep one source of truth (the CLI derives the count); replace field lists instead of adding parallel ones.
tdd_status: required
tdd_target: A contract test in workflow-boundaries.contract.test.mjs asserts the delivery handoff field list in phase-handoff.md contains pass_report and review_run_id and no verified_retained_ref, report SHA or stored review_count field.
red_command: cd /home/stefan/repos/skills && node --test tests/workflow-boundaries.contract.test.mjs
expected_red_failure: assertion fails: verified_retained_ref still listed in phase-handoff.md
green_command: cd /home/stefan/repos/skills && npm test
reason_not_testable:
red_evidence:
green_evidence:
codebase_design_notes: not_applicable
review_mode: cli
runtime_validation: not_required
runtime_target: not_applicable
runtime_evidence: not_applicable
runtime_cleanup: not_applicable
architecture_wave: A3
behavior_owner: delivery-phase
integration_surface: review-phase CLI outputs
public_seam: delivery handoff fields
topology_delta: delivery stops storing the count and reading wiki reports
owned_paths: [apps/cli/scripts/sync-skills-repo.mjs, apps/cli/skills/, .agents/skills/, apps/cli/src/data/catalog/skills.ts, apps/cli/src/data/catalog/packs.ts, apps/cli/src/data/registry/subagents/manifest.mjs, .agents/subagents/manifest.mjs, apps/cli/src/registry/publisher/sources/skills.test.ts, apps/cli/src/registry/builders/prompts.ts, apps/cli/src/registry/builders/prompts.test.ts, apps/cli/src/registry/publisher/sources/prompts.test.ts, apps/cli/src/data/registry/prompts/root.md.tmpl, apps/cli/src/registry/pipeline.test.ts, AGENTS.md (root, line 7 review wording; CLAUDE.md is its symlink mirror)]
read_dependencies: [skills main after T5; SPEC AC-028, AC-029, AC-030; rules HI-REPO-002, HI-REPO-004, HI-CLI-003, HI-CLI-004]
shared_runtime_resources: network fetch of wearedevpunks/skills by sync:skills
relevant_input_set: skills commit SHA pinned in sync-skills-repo.mjs:22; sync receipt SHA
wave_boundary: W4
description: Pin the new skills commit and run bun run sync:skills; remove autoreview/review from catalog, packs and manifests (spec-reviewer keeps review-phase); pin skills/review-phase/scripts/vendor/autoreview executable; update prompt wording (line 69 drops simplify); add a pipeline test that a dropped skill directory is removed when unedited and reported when edited; confirm by inspection that no scaffold source writes a wiki reviews/ section (P4).
validation: bun run --cwd apps/cli test (catalog, publisher, prompts, pipeline); sync receipt SHA equals the pinned commit; root AGENTS.md names no autoreview; Task Result carries $writing-for-agents evidence (P9).
skill: tddapplicable_behavior: Change the publisher test to expect the vendored helper path first and capture RED before syncing.
skill: writing-for-agentsapplicable_behavior: Edit root.md.tmpl review lines with positive, minimal wording.
tdd_status: required
tdd_target: (1) Publisher test asserts skill-review-phase copies skills/review-phase/scripts/vendor/autoreview as executable and no skill-autoreview item exists. (2) pipeline.test.ts asserts a skill directory dropped from the Baseline is removed when unedited and stale-reported when edited (AC-029).
red_command: cd /home/stefan/repos/harness-intelligence && bun run --cwd apps/cli test src/registry/publisher/sources/skills.test.ts src/registry/pipeline.test.ts
expected_red_failure: missing file entry for skills/review-phase/scripts/vendor/autoreview; the new pipeline case fails only if whole-directory removal differs from file removal (record either result)
green_command: cd /home/stefan/repos/harness-intelligence && bun run --cwd apps/cli test
reason_not_testable:
red_evidence:
green_evidence:
codebase_design_notes: Catalog is data; publisher is the tested seam.
review_mode: cli
runtime_validation: not_required
runtime_target: not_applicable
runtime_evidence: not_applicable
runtime_cleanup: not_applicable
architecture_wave: A4
behavior_owner: HI catalog and publisher
integration_surface: hi init / hi update
public_seam: Registry Baseline items
topology_delta: two skill items removed; review-phase gains scripts
read_dependencies: [Pass Reports of ≥ 3 real passes; root-agent session logs ~/.claude/projects/**; SPEC AC-001–AC-003]
shared_runtime_resources: live engine CLIs (Claude, Codex); delivery folders of the measured deliveries
relevant_input_set: each pass's run_id and Pass Report path
wave_boundary: W5
description: Run three Full Code Review Passes of the rebuilt skill (from apps/cli/skills/review-phase after T6) over the merge commits of harness PRs #272, #274 and #277, each in a scratch delivery folder (P5); sum root review turns, Adjudicator subagent_tokens and recorded engine usage; record median tokens and turns.
validation: measurement table shows median ≤ 4M tokens and ≤ 10 root turns; no pass stopped for token use.
implementation_skill_guidance: none (no scoped skill trigger matches; record falsifiable evidence per pass and keep a failed target visible)
tdd_status: not_testable
tdd_target: Median pass cost over real runs.
red_command:
expected_red_failure:
green_command:
reason_not_testable: Acceptance measurement over live engine runs, not a unit behaviour.
red_evidence:
green_evidence:
codebase_design_notes: not_applicable
review_mode: cli
runtime_validation: required
runtime_target: Installed review-phase in a Claude Code host over real deliveries
runtime_evidence: Pass Reports with per-attempt usage and Adjudicator tokens; root session turn counts
runtime_cleanup: Each pass's $TMPDIR/hi-review/<run-id>/ removed by retain; scratch delivery folders and their Pass Report commits live on a throwaway branch that is deleted after the record is written
None blocking. The Codex host marker is source-proven only (ARCHITECTURE
Parked Work); T3 tests it with environment fixtures and T8 records the engine
actually used.