Agent skill
method:autonomous-ratchet
Autonomous-only artifact-centric method for overnight quality improvement runs on an existing codebase. 17 steps across 6 phases: Triage -> Stabilize -> Envision -> Plan -> Execute -> Finalize. Use when asked to run this overnight, improve while I sleep, ratchet quality autonomously, or do an autonomous quality pass. Do not use for interactive steering, greenfield feature work, architecture decisions, cleanup-only sweeps, one-off fixes, or repos without explicit build/test/verify commands.
Install this agent skill to your Project
npx add-skill https://github.com/petekp/claude-code-setup/tree/main/skills/method-autonomous-ratchet
SKILL.md
Autonomous Ratchet
Autonomous Ratchet is a bounded overnight improvement loop: freeze the mission, restore baseline trust, generate better options, turn them into an executable charter, deliver the work in batches, and publish a truthful closeout packet. The artifact chain is the source of truth. Relay handoffs and child roots are supporting evidence, not the workflow state. This method exists to prevent a common unattended-run failure mode: ambitious changes built on an untrusted baseline, vague quality bars, hidden reopen logic, and stale downstream packets that still look current after a session dies. The topology stays static, judgment becomes durable artifacts, and every reopen or partial closeout is explicit.
When to Use
- Existing codebase improvement work that should continue while the user is away
- Requests like "run this overnight", "improve while I sleep", "ratchet quality", or "autonomous quality pass"
- Multi-step polish, refinement, cleanup-plus-improvement, or reliability work that needs a truthful baseline first
- Repositories where build, test, and optional verify commands can be named concretely
- Cases where an evidence-backed closeout packet matters more than chat narration Do NOT use for interactive steering, net-new feature delivery, architecture decisions, cleanup-only sweeps, trivial fixes, or repos that cannot support explicit verification. See the frontmatter for the full negative scope.
Glossary
- Artifact - Canonical method output under
${RUN_ROOT}/artifacts/. - Authoritative packet - The ratchet artifact that supersedes an earlier draft or review artifact for downstream use.
- Review coverage - The explicit table proving which
RQ-*,MP-*, batch, or baseline items were actually checked. - Governing issue - The exact problem id and summary that justifies a reopen or an admitted additional step.
- Injection ledger - The durable record inside a ratchet packet showing what extra work was admitted, rejected, executed, or left unused.
- Child root - A parent-owned relay workspace used by
manage-codex. - Command set - A named build/test/verify bundle captured in
mission-brief.md. - Reopen marker - The root-level redirect artifact that tells a fresh session where to resume after downstream state has been archived.
Principles
- Artifacts, not chat. Progress is the artifact chain on disk. Commentary is helpful, but it is never authoritative.
- Stabilize before improve. An overnight run that cannot trust its baseline should not design bigger changes on top of that uncertainty.
- Calibration is an interface. Stable ids in
quality-calibration.mdwork like an internal API for taste, correctness, and severity. - Review diagnoses; ratchet decides. Review steps gather evidence and route outcomes. Only the following ratchet step can admit extra work or publish the authoritative packet.
- Static topology, dynamic judgment. The step graph does not mutate at runtime. Extra work lives inside ratchet-step relay state and ledgers.
- Reopen invalidates downstream state. Once evidence disconfirms a later packet, that packet must be archived before resume can be honest.
- Batch and verify. Delivery happens in ordered, reversible units with explicit verification, janitor passes, and truthful dispositions.
Setup
RUN_SLUG="<scope-slug>"
RUN_ROOT=".relay/method-runs/${RUN_SLUG}-autonomous-ratchet"
mkdir -p "${RUN_ROOT}/artifacts" "${RUN_ROOT}/phases"
Setup only defines RUN_ROOT. Step 1 captures every runtime input that varies
by run: scope, constraints, file boundaries, quality bar, and verification.
Domain Skill Selection
Domain skills are chosen by rule, not by prompt-time improvisation:
mission-brief.mddeclares repo surfaces and allowed scope ids.quality-calibration.mddeclares## Domain Skill Hints.execution-charter.mdfreezes the actual per-batch domain skills.- Autonomous dispatches use at most 2 domain skills, and at most 3 total
skills including
manage-codex, unless the current artifact explicitly documents a justified exception. Default mapping: | Surface | Preferred skills | |---|---| | Rust, systems, persistence |rust| | Swift, SwiftUI, Apple platforms |swift-apps,swiftui| | React, Next, web UI |next-best-practices,vercel-react-best-practices,frontend-design| | Architecture, seams, boundaries |clean-architecture,seam-ripper| | Testing, regressions, bug proof |tdd| | Cleanup residue sweeps |dead-code-sweep| Selection rules:
- Pick one primary platform skill for the dominant files being changed.
- Optionally add one secondary skill for architecture, testing, or UI quality.
- Use zero domain skills rather than filler skills when the step is mostly orchestration or evidence review.
- Review-only steps usually use zero domain skills unless the domain semantics would otherwise be underspecified.
Canonical Header Schema
Every dispatch header must include:
## Mission## Inputs## Output## Success Criteria## Handoff InstructionsThe## Outputsection names the exact artifact path and the required section names, not a loose prose description. Diagnose-only review steps must say they do not edit source code or authoritative artifacts. Handoff instructions must include these exact relay headings:### Files Changed### Tests Run### Verification### Verdict### Completion Claim### Issues Found### Next Steps
Shared Dispatch Recipe
All non-manage-codex dispatch steps use the same relay recipe:
STEP_ROOT="${RUN_ROOT}/phases/step-<n>"
mkdir -p "${STEP_ROOT}/handoffs" "${STEP_ROOT}/last-messages"
./scripts/relay/compose-prompt.sh \
--header "${STEP_ROOT}/prompt-header.md" \
--skills "<skills>" \
--root "${STEP_ROOT}" \
--out "${STEP_ROOT}/prompt.md"
cat "${STEP_ROOT}/prompt.md" | \
codex exec --full-auto \
-o "${STEP_ROOT}/last-messages/last-message.txt" -
Parallel steps use per-worker subdirectories to avoid file collisions:
WORKER_ROOT="${STEP_ROOT}/<worker-id>"
mkdir -p "${WORKER_ROOT}/handoffs" "${WORKER_ROOT}/last-messages"
Each worker's --header, --root, --out, and -o paths reference its own
WORKER_ROOT. The parent step reads all worker artifacts after all workers finish.
Phase 1: Triage
Step 1: Mission Freeze - synthesis
Mission: Turn the user's freeform overnight request into a falsifiable run
contract before any scanning or delivery begins.
Consumes: Invocation instructions, repo context, project rules.
Writes: ${RUN_ROOT}/artifacts/mission-brief.md
Schema: Mission; In Scope; Out Of Scope; Scope Ceiling; Allowed File Scopes; Verification Command Sets; Quality Bar Translation;
Non Goals; Constraints; Success Definition.
Gate: outputs_present
- Exact headings are present.
Allowed File Scopesincludes at least one named scope row.Verification Command Setscontains explicit commands or explicitNOT AVAILABLE.ConstraintsandSuccess Definitionuse stableMB-*ids.Quality Bar TranslationandNon Goalsare falsifiable bullets, not vague wishes.
Step 2: Triage Probes - dispatch, parallel
Mission: Capture the starting state from 3 independent angles: baseline,
quality calibration, and improvement inventory.
Consumes: mission-brief.md
Writes:
${RUN_ROOT}/artifacts/baseline-audit.md${RUN_ROOT}/artifacts/quality-calibration.md${RUN_ROOT}/artifacts/improvement-backlog.mdWorkers:baseline-> system boundary, failing boundaries, residue/noise, verification baseline, evidence refsquality-> domain frame, reusable quality ids, severity rubric, review questions, domain skill hintsbacklog-> ranked opportunities, defers, and explicit scope rejections Schemas:baseline-audit.md:System Boundary;Failing Boundaries;Residue and Noise;Verification Baseline;Evidence Referencesquality-calibration.md:Domain Frame;Quality Bar Translation;Positive Influences;Concrete Anti-Patterns;Must-Preserve Properties;Severity Rubric;Review Questions;Domain Skill Hintsimprovement-backlog.md:Backlog Ordering Rule;Ranked Opportunities;Deferred Opportunities;Scope RejectionsDispatch: Createprompt-header-baseline.md,prompt-header-quality.md, andprompt-header-backlog.mdunder${RUN_ROOT}/phases/step-2/. Use the shared dispatch recipe once per worker. Triage usually needs zero domain skills; add one only if the repo's domain would otherwise make the output generic. Gate:outputs_present- All 3 artifacts contain the promised section names.
- Every failing boundary and residue item in
baseline-audit.mdhas aBA-*id. quality-calibration.mdassigns stable ids to every reusable bullet:DF-*,QB-*,PI-*,AP-*,MP-*,SR-*,RQ-*.- The calibration bullets are concrete and domain-specific.
- Every backlog row is ranked and tagged exactly
BASELINE_RESTORE,IMPROVEMENT, orDEFER, with at least one citedBA-*orMB-*id.
Phase 2: Stabilize
Step 3: Baseline Repair - dispatch via manage-codex
Mission: Restore trust in the baseline before broader improvement work
starts. Fix only what belongs to the baseline-restoration boundary.
Consumes: mission-brief.md, baseline-audit.md, quality-calibration.md
Writes: ${RUN_ROOT}/artifacts/stabilization-report.md
Schema: Attempt Ledger; Issues Addressed; Files and Scope Used;
Verification Results; Deferred or Blocked Items; Revert or Escalation Record.
Adapter: Use the shared manage-codex seam contract below. Step 3 uses
attempt roots under ${RUN_ROOT}/phases/step-3/attempts/<attempt-id> and a
step-specific charter focused on unresolved BA-* issues and residue items.
Retry budget: Maximum 2 attempts. Retry only when convergence says the
remaining issue is a local, fixable baseline problem.
Gate: outputs_present
- Every addressed item cites a
BA-*id. Files and Scope Usednames only allowed scope ids frommission-brief.md.Verification Resultsrecords command-set ids and outcomes.Deferred or Blocked Itemsseparates fixable residue from reopen candidates.Revert or Escalation Recordmakes any reverted attempt explicit.
Step 4: Stability Audit - dispatch
Mission: Independently check whether the repaired baseline is trustworthy.
This step is diagnose-only and does not consume injections.
Consumes: mission-brief.md, baseline-audit.md, stabilization-report.md, quality-calibration.md
Writes: ${RUN_ROOT}/artifacts/stability-findings.md
Schema: Scope Reviewed; Review Coverage; Findings By Severity;
Recommended Additional Steps; Verdict; Ready Means; Reopen Recommendation.
Dispatch: Write ${RUN_ROOT}/phases/step-4/prompt-header.md, state
explicitly that no code may be changed, and use the shared dispatch recipe.
Review steps normally use zero domain skills.
Gate: outputs_present
Review Coveragewalks everyBA-*, everyMP-*, and everyRQ-*.Findings By Severitycites exactMB-*,BA-*,MP-*, orRQ-*ids and exactSR-*clauses.Recommended Additional Stepsuses the exact table or explicitNONE.Verdictis exactly one ofstable,repair_again,retriage.Ready Meansexplains why the verdict is valid against the reviewed boundaries.Reopen Recommendationis explicitNONEor records a governing issue and target.
Step 5: Stabilize Ratchet - dispatch
Mission: Consume the audit, admit or reject same-phase follow-up work, and
publish the authoritative Stabilize packet.
Consumes: stability-findings.md, stabilization-report.md, mission-brief.md, quality-calibration.md
Writes: ${RUN_ROOT}/artifacts/stability-gate.md
Schema: Findings Consumed; Additional Step Decisions; Injection Ledger
with Budget Summary and Injection Entries; Restoration Summary;
Verification Summary; Remaining Risks; Verdict; Ready Means;
Reopen Decision.
Dispatch: Write ${RUN_ROOT}/phases/step-5/prompt-header.md, reference the
shared injection protocol, and use the shared dispatch recipe. Any admitted
additional-step specs live under ${RUN_ROOT}/phases/step-5/injections/.
Gate: verdict-consistency
stable-> continuerepair_again-> reopenbaseline-repairretriage-> reopentriage-probesstablemeans critical/high Stabilize findings are closed, admitted injections are resolved or rejected, and verification supports a trustworthy baseline.repair_againmeans the blocker is still inside the baseline-repair boundary.retriagemeans Triage framing, backlog, or calibration has been invalidated. Checks:Findings Consumedaccounts for every finding and recommended step fromstability-findings.md.Injection Ledgerrecords admitted, rejected, remaining, and per-injection results.Verdict,Ready Means, andReopen Decisionagree with the evidence.- Any reopen uses the shared reopen invalidation protocol and records archive details.
Phase 3: Envision
Step 6: Exploration Fanout - dispatch, parallel
Mission: Explore improvement directions from inside the codebase and from
outside exemplars without yet committing to a solution packet.
Consumes: mission-brief.md, quality-calibration.md, stability-gate.md, improvement-backlog.md
Writes:
${RUN_ROOT}/artifacts/inside-out-digest.md${RUN_ROOT}/artifacts/outside-in-digest.mdWorkers:inside-out-> current system shape, leverage points, constraints, local opportunities, evidence refsoutside-in-> external exemplars, differentiators, anti-pattern matches, transferable moves, evidence refs Schemas:inside-out-digest.md:Current System Shape;Leverage Points;Constraints;Local Opportunities;Evidence Referencesoutside-in-digest.md:External Exemplars;Differentiators;Anti-Pattern Matches;Transferable Moves;Evidence ReferencesDispatch: Createprompt-header-inside-out.mdandprompt-header-outside-in.mdunder${RUN_ROOT}/phases/step-6/and use the shared dispatch recipe once per worker. Gate:outputs_present- Both digests contain the promised sections.
inside-out-digest.mdcites concrete backlog ids or baseline facts, not only generic ideas.outside-in-digest.mdcites calibration ids for each influence or anti-pattern match.- Both digests carry enough evidence to synthesize a proposal without guesswork.
Step 7: Proposal Synthesis - synthesis
Mission: Collapse the exploration fanout into a bounded improvement proposal
that is specific enough to review but not yet authoritative.
Consumes: inside-out-digest.md, outside-in-digest.md, mission-brief.md, quality-calibration.md
Writes: ${RUN_ROOT}/artifacts/improvement-proposal.md
Schema: Proposal Thesis; Opportunity Clusters; Ranked Slices;
Calibration Mapping; Deferred or Rejected Ideas; Open Questions.
Gate: outputs_present
- Every ranked slice has a stable
IP-*id. - Every slice maps to at least one
MB-*id and one calibration id. Deferred or Rejected Ideasis explicit rather than implied.Open Questionscontains only bounded unknowns that still belong to Envision.
Step 8: Design Review - dispatch
Mission: Stress-test the proposal without editing code or changing the
authoritative chain. This step is diagnose-only.
Consumes: improvement-proposal.md, mission-brief.md, quality-calibration.md, stability-gate.md
Writes: ${RUN_ROOT}/artifacts/design-review.md
Schema: Scope Reviewed; Review Coverage; Findings By Severity;
Recommended Additional Steps; Verdict; Ready Means; Reopen Recommendation.
Dispatch: Write ${RUN_ROOT}/phases/step-8/prompt-header.md, state that the
worker may not modify source or authoritative artifacts, and use the shared
dispatch recipe.
Gate: outputs_present
Review Coveragewalks everyRQ-*and every proposedIP-*slice.Findings By Severitycites exactMB-*,QB-*,AP-*,MP-*, orRQ-*ids and exactSR-*clauses.Recommended Additional Stepsuses the exact table or explicitNONE.Verdictis exactly one ofready,needs_more_exploration,retriage.Reopen Recommendationis explicitNONEor records a governing issue and target.
Step 9: Envision Ratchet - dispatch
Mission: Decide what survives Envision, admit or reject bounded extra work,
and publish the packet that downstream planning must obey.
Consumes: improvement-proposal.md, design-review.md, mission-brief.md, quality-calibration.md
Writes: ${RUN_ROOT}/artifacts/envisioned-packet.md
Schema: Approved Direction; Slice Set; Calibration Mapping;
Rejected or Deferred Ideas; Injection Ledger with Budget Summary and
Injection Entries; Verdict; Ready Means; Reopen Decision.
Dispatch: Write ${RUN_ROOT}/phases/step-9/prompt-header.md, reference the
shared injection protocol, and use the shared dispatch recipe. Any admitted
specs live under ${RUN_ROOT}/phases/step-9/injections/.
Gate: verdict-consistency
ready-> continueneeds_more_exploration-> reopenexploration-fanoutretriage-> reopentriage-probesreadymeans the approved direction closes all critical/high design findings and is concrete enough to plan without hidden assumptions.needs_more_explorationmeans the blocker still belongs to Envision evidence or comparison work.retriagemeans the blocker invalidates Triage assumptions or calibration. Checks:Approved DirectionandSlice Setaccount for everyIP-*item.Injection Ledgercarries the full budget summary and per-injection rows.Verdict,Ready Means, andReopen Decisionagree withdesign-review.md.- Any reopen uses the shared reopen invalidation protocol.
Phase 4: Plan
Step 10: Plan Synthesis - synthesis
Mission: Turn the approved direction into an executable batch plan with
verification, rollback, janitor, and risk boundaries made explicit.
Consumes: envisioned-packet.md, mission-brief.md, quality-calibration.md, stability-gate.md
Writes: ${RUN_ROOT}/artifacts/implementation-plan.md
Schema: Plan Thesis; Dependency Order; Candidate Batches;
Verification Strategy; Rollback Triggers; Janitor Checkpoints;
Calibration Mapping; Open Risks.
Gate: outputs_present
Candidate Batchesassigns stablePB-*ids and clear boundaries.Dependency Orderstates real sequencing instead of implied prose.Verification StrategyandRollback Triggersare per batch or by named shared command set.Janitor Checkpointssays when cleanup happens and what counts as residue.
Step 11: Plan Review - dispatch
Mission: Audit the plan for execution safety, rollback honesty, and quality
alignment. This step is diagnose-only.
Consumes: implementation-plan.md, mission-brief.md, quality-calibration.md, envisioned-packet.md
Writes: ${RUN_ROOT}/artifacts/plan-review.md
Schema: Scope Reviewed; Review Coverage; Findings By Severity;
Recommended Additional Steps; Verdict; Ready Means; Reopen Recommendation.
Dispatch: Write ${RUN_ROOT}/phases/step-11/prompt-header.md, state that
no code or authoritative artifact may be changed, and use the shared dispatch
recipe.
Gate: outputs_present
Review Coveragewalks everyRQ-*, everyPB-*, every rollback trigger, and every janitor checkpoint.Findings By Severitycites exact plan sections and exactSR-*clauses.Recommended Additional Stepsuses the exact table or explicitNONE.Verdictis exactly one ofready,re_envision,retriage.Reopen Recommendationis explicitNONEor records a governing issue and target.
Step 12: Plan Ratchet - dispatch
Mission: Freeze the executable charter that Execute must obey, including
batch order, domain skills, verification matrix, and reopen rules.
Consumes: implementation-plan.md, plan-review.md, envisioned-packet.md, quality-calibration.md
Writes: ${RUN_ROOT}/artifacts/execution-charter.md
Schema: Charter Thesis; Ordered Batch Plan; Batch Definitions;
Verification Matrix; Janitor Integration; Rollback and Reopen Rules;
Domain Skills; Injection Ledger with Budget Summary and Injection Entries;
Verdict; Ready Means; Reopen Decision.
Dispatch: Write ${RUN_ROOT}/phases/step-12/prompt-header.md, reference
the shared injection protocol, and use the shared dispatch recipe. Admitted
specs live under ${RUN_ROOT}/phases/step-12/injections/.
Gate: verdict-consistency
ready-> continuere_envision-> reopenenvision-ratchetretriage-> reopentriage-probesreadymeans the charter is ordered, scoped, verifiable, reversible, and skill-bounded for unattended execution.re_envisionmeans solution shape is still wrong.retriagemeans mission framing or calibration has to be rebuilt. Checks:Ordered Batch Planuses these exact columns:Order,Batch ID,Priority Tier,Goal,Depends On,Scope IDs,Verification Set IDs,Janitor Focus,Retry Budget,Rollback Trigger,Domain Skills.Batch Definitionscontains one subsection per named batch.Domain Skillsobeys the autonomous skill ceiling.Injection Ledgerrecords admitted, rejected, remaining, and per-injection results.Verdict,Ready Means, andReopen Decisionagree withplan-review.md.
Phase 5: Execute
Step 13: Execute Batches - dispatch via manage-codex
Mission: Execute the charter in deterministic batch order without
improvising a new sequence or silently expanding scope.
Consumes: execution-charter.md, quality-calibration.md, stability-gate.md, mission-brief.md
Writes: ${RUN_ROOT}/artifacts/execution-log.md
Schema: Charter Reference; Batch Order Applied; Batch Ledger;
Per-Batch Details; Janitor Passes; Scope Rejections;
Deferred or Reverted Batches; Aggregate Verification.
Adapter: Use the shared manage-codex seam contract below. Step 13 derives
one batch root from each Ordered Batch Plan row, preserves charter order, and
runs janitor after each converged batch and before the next batch starts.
Retry budget: Per batch, use the charter's Retry Budget with a default
ceiling of 3. A batch retry is local to that batch, not permission to reorder
the rest of the plan.
Gate: outputs_present
- Every charter batch appears exactly once in
Batch Ledger. - Every per-batch detail names attempts, convergence verdict, janitor verdict, verification results, and final disposition.
Scope Rejectionsexplicitly lists any rejected scope expansion.Deferred or Reverted Batchesseparates intentional defers from revert-on-failure cases.Aggregate Verificationsummarizes command-set outcomes across the whole run.
Step 14: Execution Audit - dispatch
Mission: Independently assess what Execute produced, including correctness,
residue, verification gaps, and slop. This step is diagnose-only.
Consumes: execution-log.md, execution-charter.md, mission-brief.md, quality-calibration.md
Writes: ${RUN_ROOT}/artifacts/execution-audit.md
Schema: Scope Reviewed; Review Coverage; Findings By Severity;
Recommended Additional Steps; Verdict; Ready Means; Reopen Recommendation.
Dispatch: Write ${RUN_ROOT}/phases/step-14/prompt-header.md, state that
the worker may not modify source or authoritative artifacts, and use the shared
dispatch recipe.
Gate: outputs_present
Review Coveragewalks everyRQ-*, every batch goal, every must-preserve property, and every remaining execution obligation.Findings By Severityincludes explicit sections for contract drift, residue, verification gaps, and slop audit.- Every finding cites exact
MB-*,QB-*,AP-*,MP-*,RQ-*, or batch ids plus exactSR-*clauses. Recommended Additional Stepsuses the exact table or explicitNONE.Verdictis exactly one ofready,partial,reopen_plan.Reopen Recommendationis explicitNONEor records a governing issue and target.
Step 15: Execution Ratchet - dispatch via manage-codex
Mission: Consume execution findings, repair only what belongs to Execute,
and publish the honest delivery packet for Finalize.
Consumes: execution-log.md, execution-audit.md, execution-charter.md, quality-calibration.md
Writes: ${RUN_ROOT}/artifacts/execution-report.md
Schema: Execution Summary; Findings Consumed; Repair Actions;
Injection Ledger with Budget Summary and Injection Entries;
Remaining Obligations; Verification Summary; Verdict; Ready Means;
Reopen Decision.
Adapter: Use the shared manage-codex seam contract below. Step 15 derives
repair roots only from admitted repair batches or grouped execution findings.
It may not invent new product scope.
Retry budget: Maximum 2 repair attempts per child root.
Gate: verdict-consistency
ready-> continuepartial-> continuereopen_plan-> reopenplan-ratchetreadymeans the charter converged without blocking execution findings and the verification summary supports the delivered scope.partialmeans the mission minimum shipped and every remaining obligation is non-blocking and explicit.reopen_planmeans execution evidence invalidated the charter's batch order, scope boundaries, rollback model, or repair boundary. Checks:Findings Consumedaccounts for every audit finding and recommended step.Repair Actionsnames what changed or was explicitly refused.Injection Ledgercarries the full budget summary and per-injection rows.Remaining Obligationsis explicit;partialis invalid without it.- Any reopen uses the shared reopen invalidation protocol and records archive details.
Phase 6: Finalize
Step 16: Final Review - dispatch
Mission: Decide whether the run is ship-ready, honestly partial, or still
blocked inside Execute. This step is diagnose-only and terminal.
Consumes: mission-brief.md, quality-calibration.md, execution-report.md, execution-charter.md
Writes: ${RUN_ROOT}/artifacts/final-review.md
Schema: Scope Reviewed; Review Coverage; Findings By Severity;
Deferred Debt; Blockers; Verdict; Ready Means; Reopen Decision.
Dispatch: Write ${RUN_ROOT}/phases/step-16/prompt-header.md, state that
no code or authoritative artifact may be changed, and use the shared dispatch
recipe. Finalize does not consume injections.
Gate: verdict-reopen
ship_ready-> continuepartial-> continuereopen_execute-> reopenexecution-ratchetship_readymeans no blocker remains, must-preserve properties still hold, and the closeout packet can be published without misleading omission.partialmeans the delivered scope is safe and truthful and only non-blocking debt remains.reopen_executemeans a named blocker still lives inside Execute or its repair boundary. Checks:Review Coveragewalks everyRQ-*, everyMP-*, every batch goal, and every remaining obligation.Findings By Severity,Deferred Debt, andBlockersare separate sections.Verdictis exactly one ofship_ready,partial,reopen_execute.Reopen Decisionrecords a governing issue and target when verdict isreopen_execute.
Step 17: Closeout Packet - synthesis
Mission: Publish the truthful overnight handoff, the PR-ready summary, and
the deferred work surface without hiding partials or reopen state.
Consumes: final-review.md, execution-report.md, mission-brief.md, quality-calibration.md
Writes:
${RUN_ROOT}/artifacts/overnight-handoff.md${RUN_ROOT}/artifacts/pr-brief.md${RUN_ROOT}/artifacts/deferred-work.mdSchemas:overnight-handoff.md:Run Verdict;Scope Delivered;Verification Snapshot;Deferred or Reopened Work;Resume Notespr-brief.md:Summary;Key Changes;Verification;Risks and Follow-Upsdeferred-work.md:Deferred Items;Governing Issues;Recommended Next MethodGate:outputs_present- All 3 closeout artifacts contain the promised section names.
Run Verdictinovernight-handoff.mdmatchesfinal-review.md.deferred-work.mdincludes every deferred item named byfinal-review.mdorexecution-report.md.pr-brief.mdandovernight-handoff.mdsummarize the same delivered scope and verification snapshot.
manage-codex Adapter Seam Contract
The method uses one shared manage-codex seam with step-specific charters.
Parent steps own the child roots and synthesize the canonical parent artifact.
Common Child Root Layout
Use these parent-owned child roots:
- Step 3:
${RUN_ROOT}/phases/step-3/attempts/<attempt-id> - Step 13:
${RUN_ROOT}/phases/step-13/batches/<batch-id> - Step 15:
${RUN_ROOT}/phases/step-15/repairs/<repair-id>Every child root must contain: CHARTER.mdbatch.jsonhandoffs/handoff-converge.mdhandoffs/handoff-<last-slice-id>.mdlast-messages/last-message-manage-codex.txtAnd the parent creates:archive/handoffs/last-messages/review-findings/
Shared Dispatch and Readback Contract
For every child root:
- Write
CHARTER.mdfrom the authoritative parent packet. - Write
prompt-header.mdusing the canonical header schema. - Derive
DOMAIN_SKILLSfrom the child charter'sDomain Skillssection. - Dispatch from the child root with the shared dispatch recipe, replacing the
skill string with
manage-codexplus any domain skills, and writing the last message tolast-message-manage-codex.txt. - Read back in this order:
handoffs/handoff-converge.mdbatch.jsonhandoffs/handoff-<last-slice-id>.mdIf the last slice handoff is missing or clearly looks like review output, usebatch.jsonplus the convergence handoff to reconstruct the implementation story instead of guessing from chat residue.
Shared Failure Handling
- Missing
handoff-converge.md: mark the child rootINVALID, archive it, and retry only if budget remains. - Malformed
batch.json: mark the child rootINVALID; if convergence is still enough for truthful synthesis, record the limitation, otherwise retry. - Missing verification commands in
CHARTER.md: treat this as a parent contract failure and reopen upstream instead of inventing commands. - Out-of-scope edits: revert the whole attempt, record
SCOPE VIOLATION, and reopen upstream if the problem repeats or invalidates the plan. - Convergence verdict
ISSUES REMAIN: retry locally only when the issue is narrow and fixable; reopen upstream when it invalidates scope, ordering, or mission framing. - Inner
manage-codexuser escalation (slice attempt limit exceeded): treat as convergenceISSUES REMAINfor the parent step. The autonomous adapter must not pause for interactive input. Record the inner escalation in the parent artifact'sDeferred or Blocked Itemsand apply the parent retry/reopen rule. - Revert mechanism: every
manage-codexdispatch must record the pre-dispatch commit SHA in the childCHARTER.mdunder## Baseline Commit. Revert meansgit reset --hard <baseline-commit>for the allowed file scope. The parent artifact records the reverted SHA and reason.
Step 3 Additions
Each Step 3 CHARTER.md must contain:
MissionBaseline IssuesResidue ItemsAllowed File ScopeVerification CommandsDomain SkillsBaseline Restoration RuleRevert RuleStep 3 rules:- Derive the attempt manifest from unresolved
BA-*items inbaseline-audit.md. - Maximum 2 attempts total.
- Any verification failure reverts the entire attempt, never individual slices.
- Parent synthesis writes
stabilization-report.mdfrom all valid attempt roots.
Step 13 Additions
Each row in execution-charter.md Ordered Batch Plan becomes exactly one
batch root. Execute batches in this order:
- Ascending
Order - Dependency-safe topological order from
Depends On - Within the same dependency band:
FOUNDATIONbeforeSTRUCTURALbeforePOLISH - Remaining ties break lexically by
Batch IDEach Step 13CHARTER.mdmust contain:
MissionBatch IdentityGoverning Charter ReferencesIn-Scope ChangesOut-Of-Scope ChangesAllowed File ScopeVerification CommandsDomain SkillsJanitor RuleRetry TriggerRevert RuleStep 13 rules:Janitor Rulesays cleanup runs after a converged batch and before the next batch starts.- Store janitor state under
${BATCH_ROOT}/janitor/. - Require a
Janitor SummarywithRemoved Residue,Verification,Remaining Concerns, andVerdict. - Retry a batch when convergence is locally fixable, janitor reports high-severity residue inside batch scope, or child output is invalid/incomplete.
- Revert the entire batch on verification failure or scope violation.
- After max attempts, mark the batch
REVERTEDand record the governing issue. - Parent synthesis appends a normalized
Batch Ledgerrow and aBatch <id>detail block intoexecution-log.md.
Step 15 Additions
Each Step 15 CHARTER.md must contain:
MissionGoverning FindingsAllowed Repair ScopeVerification CommandsDomain SkillsRemaining Obligations BoundaryRevert RuleStep 15 rules:- Derive one repair root per admitted repair batch or grouped execution finding.
- Maximum 2 attempts per repair root.
- Do not invent new product scope; only consume admitted execution findings.
- Parent synthesis writes
execution-report.mdfrom repair roots plusexecution-log.md.
Autonomous Step Injection Protocol
Injection is a ratchet-step-internal mechanism, not a topology mutation. That means:
- Review steps may propose additional work.
- Only the immediately following ratchet step may admit or reject that work.
- No review step, external orchestrator, or hidden runtime loop may consume injections directly.
- Injected work never edits
method.yamland never creates new topology steps. Triggering review artifacts: stability-findings.mddesign-review.mdplan-review.mdexecution-audit.mdRequired proposal table inside each triggering artifact:Proposed IDKindGoverning IssueWhy Direct Revision Is InsufficientConsumesProducesExpected CostSeverityAllowedKindvalues:evidence-probecomparison-passrepair-batchcleanup-passretest-passAdmission rule inside a ratchet step:- The governing issue is high or critical by
SR-*. - The proposed work stays inside the current phase boundary.
- The work needs fresh evidence or isolated execution, not editorial cleanup alone.
- The work has a named output artifact. Materialization rule:
- Write admitted specs under
${RUN_ROOT}/phases/step-<ratchet-step>/injections/<nn>-<proposed-id>.md. - These files are relay state, not topology nodes.
- Execute them by highest severity first, then lower expected cost, then lexical
Proposed ID. Durable ledger contract inside every ratchet packet: Injection LedgerBudget SummarywithAdmitted Count,Rejected Count,Remaining BudgetInjection EntrieswithInjection ID,Governing Issue,Kind,Decision,Result,EvidenceCeilings:- Hard ceiling: 3 admitted injections per phase
- Dispatch ceiling: at most 2 admitted dispatches per phase
- Injected work may not propose more injected work Closure rule:
- Once the ratchet packet is written, injection closes for that phase.
- Unadmitted proposals become rejected ledger entries with result
not_admitted_before_phase_close. This is the key control mechanism that keeps the topology static while still allowing bounded quality escalation.
Reopen Invalidation Protocol
Any real reopen must invalidate downstream state before resume. This applies to
ratchet steps and to Step 16 when it emits reopen_execute.
Archive Rule
When a step reopens upstream:
- Compute an archive timestamp.
- Create
${RUN_ROOT}/artifacts/archive/<timestamp>/. - Move every non-archived downstream artifact produced after the reopen target into that archive directory.
- Keep archived artifacts readable for audit, but never eligible for fresh-session resume.
Marker Rule
Write ${RUN_ROOT}/artifacts/reopen-marker.md with these exact sections:
Governing IssueReopen TargetSource StepArchived ArtifactsResume InstructionMarker StatusRequired content:Governing Issuenames the issue id and summary.Reopen Targetnames the exact step id.Source Stepnames the step that emitted the reopen.Archived Artifactslists every moved file.Resume Instructionsaysresume from <step-id>.Marker StatusisOPENuntil the target step produces a fresh passing artifact.
Resume Rule
- A fresh session checks
reopen-marker.mdbefore any other artifact. - If the marker exists and status is
OPEN, resume from the marker target. - Only non-archived artifacts count toward resume.
- When the reopened target completes successfully, archive the old marker beside the archived artifacts and clear the root marker. The archive removes stale packets from the scan. The marker is the durable pointer that keeps resume from drifting to a later but obsolete artifact.
Artifact Chain Summary
mission-brief.md
-> baseline-audit.md
-> quality-calibration.md
-> improvement-backlog.md
-> stabilization-report.md
-> stability-findings.md
-> stability-gate.md
-> inside-out-digest.md
-> outside-in-digest.md
-> improvement-proposal.md
-> design-review.md
-> envisioned-packet.md
-> implementation-plan.md
-> plan-review.md
-> execution-charter.md
-> execution-log.md
-> execution-audit.md
-> execution-report.md
-> final-review.md
-> overnight-handoff.md
-> pr-brief.md
-> deferred-work.md
Promotion rules:
stability-gate.mdis the authoritative Stabilize packet.envisioned-packet.mdsupersedesimprovement-proposal.md.execution-charter.mdsupersedesimplementation-plan.md.execution-report.mdsupersedesexecution-log.mdfor Finalize. Supporting but non-canonical state:- Relay handoffs under each step root
manage-codexchild roots and theirbatch.json- Admitted injection specs under ratchet step relay directories
Resume Awareness
Global order:
- Check
${RUN_ROOT}/artifacts/reopen-marker.md. - If it is
OPEN, resume from the named target. - Otherwise scan non-archived artifacts in canonical chain order.
- Resume from the first missing or gate-failing artifact.
- For any
manage-codexstep, inspect child roots before deciding to rerun. - For any ratchet step, reconcile existing injection specs against the ledger before admitting more. Phase notes:
- Triage: Step 2 is complete only when all 3 triage artifacts exist and pass gate. Missing workers rerun individually.
- Stabilize: Inspect
${RUN_ROOT}/phases/step-3/attempts/before rerunning Step 3. Ifstability-findings.mdexists butstability-gate.mddoes not, resume at Step 5 and reconcile any existing injections first. - Envision: Treat
inside-out-digest.mdandoutside-in-digest.mdas a pair. Ifdesign-review.mdexists butenvisioned-packet.mddoes not, resume at Step 9 and reconcile its injection ledger before admitting more. - Plan: If
implementation-plan.mdexists butexecution-charter.mddoes not, continue at Step 11 or Step 12 based on the last valid artifact. Archived packets never satisfy resume. - Execute: Reconcile batch roots into
execution-log.mdbefore rerunning Step 13. Ifexecution-audit.mdexists butexecution-report.mddoes not, inspect${RUN_ROOT}/phases/step-15/repairs/before rerunning Step 15. - Finalize: Never reuse an archived
final-review.md. If any closeout artifact is missing, rerun Step 17 from the latest validfinal-review.mdandexecution-report.md. Fresh-session safety: - Archived artifacts never satisfy resume.
- The reopen marker always outranks artifact order.
- Child-root state is inspected before a
manage-codexrerun. - Injection ledgers are reconciled before any new admissions.
Circuit Breaker
Stop and redirect when:
- The same governing issue reopens the same upstream target twice.
- A phase exhausts its injection ceiling and a critical issue still cannot close.
- Execute exhausts retry budgets for multiple charter-critical batches.
- Build, test, or verify commands cannot be made explicit enough for honest verification.
- The request is really greenfield feature delivery, a major architecture choice, cleanup-only scope, or work that needs live user steering. Redirects:
- Greenfield or substantial feature delivery ->
method:research-to-implementation - Architecture or protocol choice ->
method:decision-pressure-loop - Cleanup-only scope ->
method:janitor
Didn't find tool you were looking for?