Adaptive Review Effort Implementation Plan
For agentic workers: REQUIRED SUB-SKILL: Use superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (
- [ ]) syntax for tracking.
Goal: Astra's reasoning effort per pass comes from .conclave/reviewers.toml, by area tier and by the chain's last finding, and is applied by the dispatcher and recorded with its tier on every receipt.
Architecture: review_pin.py validates a new [schedule.effort] table and answers --effort KIND for a section from the reviews manifest through its shared manifest reader. scripts/codex-dispatch.sh asks it once the review range is settled and passes --effort to a vendored, patched copy of OpenAI's Codex companion, then writes effort and tier on the receipt.
Tech Stack: Python 3 (pytest), bash, Node 18+ (node --test), TOML.
Spec: docs/specs/2026-11-23-adaptive-review-effort-design.md
Global Constraints
- Levels are the companion's own list:
none, minimal, low, medium, high, xhigh. - Tiers, in precedence order:
deep=src/kernel/,include/kernel/,src/boot/;risky=src/desktop/,include/,src/libc/,src/libs/,src/installer/,user/,src/apps/,Makefile,scripts/build.sh;standard= everything else. A path matches a tier when it equals an entry or starts with an entry that ends in/. A section takes the highest tier any changed path matches. - Rounds 1-3: deep
high, riskymedium, standardmedium. Round 4 on: deepmedium, riskymedium, standardlow. Next round after a round whose highest is P1: deephigh, riskymedium, standardmedium. Every kind other thanroundandreconciliation(today plan, performance, completion; later any new kind such asredesign):medium, and it does not move the chain.reconciliationcounts as a round in the chain. - Eligibility is a marker, not a clock: the new dispatcher writes
"schedule": "effort"on every plan receipt while the pin has an effort table. A section is on the effort schedule only when its EARLIEST checked plan receipt carries the marker; a section with a plan receipt and no marker is grandfathered for ANY kind (the Codex config value applies), and a plan retry never changes that. A section with no plan receipt (owed) is decided by its late plan pass, which the new dispatcher marks. Section 70 is grandfathered; its passes carry no--effort. - The chain position is read only through
review_pin.py's shared manifest reader (the onenewest_receiptsuses),newest_receiptsandsection_chainboth call it, so the atomic-receipts section moves both call sites. - Claude never types
--effort;codex_model_flag_block.pyis unchanged and still refuses it. - Work happens in
../impossible-os-repair(the run is live in the primary tree). Commit withgit -C ../impossible-os-repair commit -F <msg> -- <paths>. Landing onmainis done by the safe-gap monitor (Task 6). - No em or en dashes in anything written. No AI attribution in commits.
todo/files are edited through Bash in this session until Task 1's hook fix reaches the primary tree (WORKAROUND: the primary tree's copy oftodo_graph_auto_rewrite.pyrewrites primary TODO files on a worktree Edit).
Review Focus
- A section that touches no tier path (docs only):
standard, not a refusal. Task 3. - An unreadable manifest line newer than the section's receipts:
--effortrefuses, and the dispatcher, AFTER the base checks pass, runs with no--effortand says why in the transcript. An ordinary round with an unknown base still refuses before dispatch. Tasks 3 and 4. - An owed section (built during an outage, no plan receipt): new under the table, chain at 0. Task 3.
- A pin with no
[schedule.effort]table: every pass runs with no--effort, exactly as today. Tasks 3 and 4. - A round still running (receipt not checked): only checked receipts count. Task 3.
Task 1: The TODO auto-rewrite hook repairs the edited file's own worktree (DONE)
Commits 7c600b87a, 9062f6ed6, ee23a5ef2 (pre-rebase 6f79a36ff, 94e9a551f, dc18dd760): root from the edited path, acting only on a registered worktree of the repository the hook is installed in (plan reviews 1 and 2, P1). Regressions: a linked worktree is repaired there; an unrelated repository and an unregistered tree pointing at this repository's metadata run none of their code. scripts/tests/test_todo_graph_auto_rewrite.py 12/12; each new case fails on the version before it.
Task 2: Vendor the Codex companion with --effort on adversarial-review
Files:
-
Create:
tools/vendor/codex-companion/= upstreamplugins/codex/{.claude-plugin,scripts,prompts,schemas,LICENSE,NOTICE}(scripts/lib/app-server.mjsreads.claude-plugin/plugin.jsonat load) plustests/{fake-codex-fixture.mjs,helpers.mjs}fromopenai/codex-plugin-ccat807e03ac9d5aa23bc395fdec8c3767500a86b3cf(v1.0.4), andtools/vendor/codex-companion/PATCHES.md(the patch, and the upstream PR once open). -
Modify:
tools/vendor/codex-companion/scripts/codex-companion.mjs:handleReviewCommandtakeseffortas a value option only whenconfig.reviewName === "Adversarial Review", else refuses--effortbefore creating a job; normalize withnormalizeReasoningEffort;executeReviewRunforwardsefforttorunAppServerTurnon the adversarial path. -
Modify:
src/libs/PROVENANCE.md,CREDITS.md(one row each: upstream URL, commit, Apache-2.0, vendoring commit) -
Test:
tools/vendor/codex-companion/tests/effort.test.mjs -
[ ] Step 1: Copy byte-exact; run
node scripts/codex-companion.mjs --helpfrom the copy to prove it starts; commit alone (vendor: OpenAI Codex companion 1.0.4, unmodified). -
[ ] Step 2: Failing tests (shape of upstream
runtime.test.mjsline 630):adversarial review forwards reasoning effort to turn/start(--effort high,fakeState.lastTurnStart.effort === "high");adversarial review without --effort sends null;adversarial review rejects an unknown effort(non-zero exit, stderr/Unsupported reasoning effort/);native review refuses --effort(review --effort highexits non-zero and the fake saw noreview/start). -
[ ] Step 3: Run
node --test tools/vendor/codex-companion/tests/; expected FAIL on the first and fourth. -
[ ] Step 4: Patch as in Files.
-
[ ] Step 5: Run; expected 4 PASS. Read the whole vendored tree (imported-code rule) and note anything surprising in
PATCHES.md. -
[ ] Step 6: Commit
vendor: the Codex companion forwards --effort on adversarial-reviewwith the PROVENANCE and CREDITS rows.
Task 3: The pin's effort table and review_pin.py --effort
Files:
- Modify:
.conclave/reviewers.toml(table below; replace the "There is noeffortkey here" comment with two lines: effort is set here by tier and finding, decided 2026-11-23, spec path) - Modify:
scripts/review_pin.py - Test:
scripts/overnight/tests/test_review_pin.py
[schedule.effort]
passes = "medium"
held_rounds = 3
[[schedule.effort.tiers]]
name = "deep"
paths = ["src/kernel/", "include/kernel/", "src/boot/"]
rounds = "high"
later = "medium"
after_p1 = "high"
[[schedule.effort.tiers]]
name = "risky"
paths = ["src/desktop/", "include/", "src/libc/", "src/libs/", "src/installer/", "user/", "src/apps/", "Makefile", "scripts/build.sh"]
rounds = "medium"
later = "medium"
after_p1 = "medium"
[[schedule.effort.tiers]]
name = "standard"
paths = []
rounds = "medium"
later = "low"
after_p1 = "medium"
Interfaces:
-
Produces:
load_pin(...)["effort"]=Noneor{"passes": str, "held_rounds": int, "tiers": ((name, paths, rounds, later, after_p1), ...)}in pin order;tier_for(pin, changed_paths) -> str | None;effort_for(pin, manifest, todo, section, kind, changed_paths) -> str | None;section_chain(manifest, todo, section) -> (on_schedule: bool | None, count, newest_highest)(Nonewhen the section has no checked plan receipt) in the shared reader; CLI--effort KIND --todo TODO --section-n N --manifest FILE --paths-file0 FILEprints one line,<level> <tier> <schedule>, each-when absent (no table, a grandfathered section, no pinned level), wherescheduleiseffortfor a plan pass whenever the pin has the table; exit 3 with the same line and the reason on stderr when the chain cannot be read (the schedule still printed), exit 2 when the pin itself is refused. -
[ ] Step 1: Failing tests:
test_effort_table_validates: repo pin loads,held_rounds == 3; an unknown level, a last tier with non-emptypaths, an unknown key,held_rounds = 0each raiserp.Refused.test_effort_absent_is_none: no table giveseffort is None,effort_for(...) is None.test_tier_precedence:include/kernel/a.hdeep;include/gfx.h+docs/x.mdrisky;user/x.crisky;Makefilerisky;Makefile.bakstandard;docs/x.mdand()standard.test_round_ladder_deep: 0, 1, 2 checked prior rounds givehigh; 3 prior (last P2)medium; last P1high; a P2 after itmedium.test_round_ladder_standard: rounds 1-3medium; round 4 after a P3low; after a P1medium.test_reconciliation_counts_as_round: 2 rounds + 1 reconciliation, next reconciliation is round 4.test_other_kinds_take_passes_level: plan, performance, completion and an unknown future kind name givemediumin every tier, and none of them moves the chain count.test_unchecked_rounds_do_not_count.test_grandfathered_section_gets_nothing_for_every_kind: an earliest plan receipt without the marker givesNonefor plan, round, performance, completion, reconciliation, even when a newer plan retry carries the marker.test_marked_section_is_on_schedule: an earliest plan receipt with the marker gives the ladder.test_owed_section_without_plan: round 1 level.test_unreadable_newer_line_refuses.test_cli_effort: printshigh deepfor a fresh deep round; nothing for a pin without the table.
-
[ ] Step 2: Run
pytest scripts/overnight/tests/test_review_pin.py -k "effort or tier" -v; expected FAIL. -
[ ] Step 3: Implement. Eligibility first (table present; earliest checked plan receipt marked, or none on record), then kind, then chain from
section_chain, which reads with the same newest-first loop and unreadable-line rule asnewest_receipts. Level =roundswhile count< held_rounds, elseafter_p1when the newest highest isP1, elselater. -
[ ] Step 4: Run the file and
bash scripts/overnight/tests/run-all.sh; expected PASS. -
[ ] Step 5: Commit
review: the pin sets reviewer effort by area tier and the chain's last finding.
Task 4: The dispatcher applies the effort and records it
Files:
-
Modify:
scripts/codex-dispatch.sh: defaultCOMPANION(line 128) to<repo root>/tools/vendor/codex-companion/scripts/codex-companion.mjs; ask--effortafter every base and range check has passed (after thePIN_LENSESstep at line 285 and the reconciliation range); keep the<level> <tier> <schedule>answer inEFFORT/TIER/SCHEDULE; a non-zero answer leavesEFFORTandTIERempty and holds the reason in a variable that is written to the transcript once it opens; the--has-effortquery named in an earlier draft was folded into this one call; the dispatcher line becomesnode "$COMPANION" adversarial-review ${EFFORT:+--effort "$EFFORT"} -- "$PROMPT"; the receipt (line 427) gains"opt:effort=${EFFORT:-}" "opt:tier=${TIER:-}", and a plan receipt gains"opt:schedule=effort"whenever the pin has an effort table (review_pin.py --has-effortexits 0); line 456 unchanged. -
Modify:
scripts/overnight/review-broker-codex-dispatch.sh:180(same default companion) -
Test:
scripts/overnight/tests/test_review_pin.py(its dispatcher tests drivecodex-dispatch.shwith a fakeCODEX_COMPANION_PATH; the fake appends its argv to a file) -
[ ] Step 1: Failing tests:
test_dispatch_passes_pinned_effort(fresh round on a deep change: argv has--effort highbefore--, receipteffort: high,tier: deep);test_dispatch_without_table_passes_no_effort(no--effort, noeffort/tierkeys);test_dispatch_effort_refusal_falls_back(an OWED round whose recorded base is readable, plus an unreadable line newer than its receipts: the review runs, no--effort, transcript holdseffort unknown);test_dispatch_unknown_base_still_refuses(an ordinary round with an unreadable line after its plan exits 2 before the companion runs);test_default_companion_is_vendored(grep of the script text for the new default);test_plan_receipt_marks_the_schedule(a plan pass with the table writesschedule: effort, without it writes noschedulekey);test_section_planned_before_landing_is_grandfathered(a plan receipt without the marker, then a round under the new dispatcher, runs with no--effort). -
[ ] Step 2: Run; expected FAIL except the base-refusal test, which already passes (it pins existing behaviour).
-
[ ] Step 3: Implement.
-
[ ] Step 4: Run the file,
bash scripts/overnight/tests/run-all.sh,bash scripts/lint.sh; expected PASS. -
[ ] Step 5: Commit
review: the dispatcher passes the pinned effort and writes it with its tier on the receipt.
Task 5: Record and docs
Files (todo/ through Bash):
-
todo/00-infrastructure/TODO-08-automation-hardening.md: section 70's threat-model item is replaced by an XREF line to the review-depth section's host-tooling threat-model item; its measurement item becomes- [/]naming its blocker ("waits for two weeks of receipts, 2026-12-07"); addtierto the receipt item; in section 62, thedeep_pathsitem is reworded to "the deep set is every tier abovestandardin[schedule.effort]; no second path list" with a reciprocal XREF to section 70. Thenbash scripts/todo-graph/build-and-validate.sh --keep-cache,python3 scripts/todo-plan.py --sync. -
CLAUDE.mdCodex Invocation Policy (effort is the operator's pin, applied by the dispatcher after the base checks; Claude never passes or chooses it; the Codex config value is the fallback and covers sections started before the table),docs/infrastructure/codex-invocation-policy.md(same, plus the vendored companion),.claude/skills/three-pass-review.md(one line: effort and tier come from the pin and are on the receipt). -
The docs page covering TODO-08 (
grep -rl "covers=todo/00-infrastructure/TODO-08" docs): bumpreviewed=. -
[ ] Step 1: Edit. Step 2: Verify
bash scripts/lint.sh,python3 scripts/site/build.py --check,python3 scripts/todo-plan.py --check; expected clean. Step 3: Committodo, docs: reviewer effort is the pin's, by area and finding.
Task 6: Review, upstream, stamp, land
Order: two plan passes ran (findings folded in, see the ledger). The section was rebased onto ac5581848 before landing, so every later pass carries REVIEW_BASE=385e23aad, the filing commit before section 70's code (pre-rebase 4a3755ff6), and a plan pass was dispatched to re-anchor the section start after the rebase; check each receipt's base.
- Step 1: Upstream (changed 2026-11-23, operator): two open upstream PRs (#677, #746) already make this change, so no third is opened; both are tracked in
PATCHES.mdand section 70. - Delivered and landed (2026-11-23): Tasks 2 to 5 are built, and the section is on
origin/mainatb5b0558d2(rebased ontoac5581848, the pre-push gates passed). Eleven review waves ran before it; their findings and fixes are in the commit messages and the ledger. - Step 2: One more round, performance and a completion pass (operator, 2026-11-23: stop at 12 rounds, land first): round 12 and a performance pass on the landed candidate with
REVIEW_BASE=385e23aad, then completion; every finding fixed with a test. Anything the operator's cap leaves open is filed as a tracked item and the section is stamped with it. Commit nothing while a pass is reading. - Step 3: Stamp section 70 when the passes end (the measurement item stays
[/]). - Step 4: CI for the landed commit green; remove the worktree when the stamp is on
main. - Step 5: First live check: the first receipt written after the land for a section whose earliest plan receipt is marked carries
effortandtier; record it in section 70.