codex/skills/resolve/SKILL.md
Resolve the current branch through a CAS-first, receipt-backed review loop with native review as recorded fallback only. Use for `$resolve`, branch resolution, review/fix/validate/commit/push loops, PR comment sweep, three consecutive clean reviews, CAS review lanes, deterministic base/HEAD pinning, full review-adjudication route consumption, review-closure abstraction ladder, surface-budgeted fixed-point fixes, and final pushed readiness. Do not use for one-shot review, PR creation only, merging/landing, isolated adjudication, or final closure proof without branch mutation.
npx skillsauth add tkersey/dotfiles resolveInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Resolve the current branch to a pinned-review-clean, validated, committed, pushed, and PR-comment-swept state.
$resolve is a root-owned state machine. It does not merely review the branch. It keeps reviewing, adjudicating, selecting the right abstraction route, fixing only when warranted, validating, committing, pushing, and sweeping visible PR comments until the branch reaches the completion bar or a precise blocker stops the run.
Use $resolve when the user wants the current branch driven to completion through review/fix/validate/push and PR-sweep closure.
Do not use $resolve when:
$ship.$land.$review-adjudication.$verification-closure.$fixed-point-driver / $accretive-implementer as appropriate.Default mode: full branch resolution, CAS-first.
Mutation authority: root-owned only. Specialist workers and sidecars may gather evidence but must not mutate, stage, commit, push, resolve threads, own the review streak, or declare completion.
Completion bar:
3 consecutive clean reviews
+ pinned backend/base/head/fingerprint
+ full validation pass
+ intended commit/push
+ complete post-push PR sweep
+ no unprocessed in-scope PR comments
+ no actionable PR comments remaining
Before any review command runs, prove this run has loaded enough of this skill to include:
## Backend selection## Review adjudication route consumption## Review-Closure Abstraction Ladder## Fixed-point and implementation handoff## Non-negotiablesA partial read of only the top of this file is not enough to operate $resolve.
Record one of these facts before the first review attempt:
The following facts are not native fallback conditions:
statusCheckRollup;gh pr view reports a clean merge state or no requested changes.If native review has already run before a CAS preflight/fallback fact was recorded, treat that review as invalid for $resolve streak accounting. Do not count it as clean, do not use it to justify backend choice, and restart from the CAS-first guard. If the invalidly ordered native run found a real issue, adjudicate and fix the issue on its merits, then restart the CAS-first loop.
Do not consider the branch resolved until all of the following are true, in this order:
do-not-address, resolve-thread-only, validate-only, or blocked.HEAD SHA remain pinned for the streak.$review-adjudication unless it is clearly irrelevant system noise, already resolved, authored by this agent as a status/reply, or previously adjudicated with the same content and current artifact context.$fixed-point-driver with a surface-budgeted handoff unless the selected ladder rung blocks, validates only, or explicitly returns no-change.native Codex review: the Codex CLI/repository-native review command, normally codex review, not a separate invented LLM review.review backend: the review execution class used for streak accounting: cas-lane by default, native-cli or cas-native-fallback only after recorded fallback.review driver: the deterministic wrapper that discovers base, invokes the selected backend, captures receipts, normalizes findings, and classifies whether a review was clean.clean review: a completed review result from the selected backend with zero findings/comments/requested changes, no unresolved review notes, and matching pinned state.review item: any substantive review item, inline comment, requested change, warning, issue, or note that asks for or implies a code, test, behavior, safety, reliability, performance, accessibility, maintainability, API, release, or documentation change.mutation-capable route: an adjudication route that could change production code, validation code, fixtures, generated artifacts, config, behavior docs, dependencies, or lockfiles.HEAD changed: the current commit SHA changed because of a fix, generated update, validation fix, rebase, merge, amend, cherry-pick, or branch synchronization.base changed: the resolved base ref or merge-base SHA changed since the current clean streak began.Maintain this state during the run:
resolve_state:
resolve_run_id: "<timestamp/branch/short-head>"
clean_review_streak: 0
streak_review_backend: null
streak_target_fingerprint: null
streak_base_ref: null
streak_base_sha: null
streak_head_sha: null
last_review_invocations: []
adjudication_ledger: {}
abstraction_route_ledger: []
implementation_handoff_ledger: []
validation_commands: []
pr_comment_ledger: {}
pr_sweep_inventory_status: unknown
language_skill_packet: {}
parallel_task_ledger: []
durable_run_dir: null
Reset clean_review_streak = 0 whenever:
$fixed-point-driver or downstream implementation changes code, config, dependencies, lockfiles, generated artifacts, behavior docs, or tests;HEAD changes;Do not reset the streak merely because another clean review was run. Increment only for completed clean reviews from the pinned backend class against the pinned base and current HEAD.
For long or mutating runs, create or maintain a local operational ledger outside committed source, for example:
~/.codex/resolve/runs/<repo-name>/<timestamp-or-branch>/
resolve-state.json
review-*.json
adjudication-ledger.jsonl
abstraction-route-ledger.jsonl
implementation-handoff-ledger.jsonl
pr-comment-ledger.jsonl
validation-ledger.jsonl
parallel-task-ledger.jsonl
Do not commit this ledger. Use it to survive context loss, CAS waits, retries, and PR sweep restarts. If no durable ledger is used, state why in the final report.
$resolve owns discovery and routing, not language-specific proof mechanics.
Before the first review run, and again whenever the changed file set materially changes, inspect repository and diff signals:
build.zig, Cargo.toml, package.json, pyproject.toml, go.mod, mix.exs, lakefile.lean, or equivalent project roots;For every applicable language/tool skill available, load that skill before selecting proof commands or invoking review. Keep a concise language_skill_packet:
language_skill_packet:
skill_name:
trigger_evidence:
loaded: true|false
review_guidance_summary:
validation_guidance_summary:
Pass relevant guidance into review context and validation planning. For Zig projects, $resolve should route to $zig; $zig owns writable cache paths, Zig version/proof lanes, lint/test command shape, and cache-environment failure classification. $resolve must not hardcode Zig-specific environment variables or cache paths except as a direct quote from loaded $zig guidance.
If a clearly applicable skill cannot be loaded, record that as a limitation and proceed only when repository-native proof commands are already reliable enough. Block when missing guidance is required to distinguish tool transport failure from code failure.
$resolve is CAS-first.
After base discovery and language-skill routing, attempt the persistent CAS lane preflight before any native codex review invocation.
Use native Codex review only when one of these fallback conditions is true:
cas / cas review_session surface is too old or incompatible.Do not choose native review merely because it is simpler, faster to type, historically common, or the run seems one-shot. $resolve is a multi-cycle remediation workflow; its normal review primitive is CAS lane review with fallback disabled unless explicitly degraded.
Load $cas review backend guidance before CAS preflight. $resolve owns review streak state; $cas owns lane command shape, version gates, receipt field meanings, timeout recovery semantics, and fallback classification.
See references/cas-review-backend.md.
All native review invocations must go through the fallback driver. Do not nakedly call codex review --base main except as a documented last-resort fallback when no remote default branch, PR base, or usable remote ref can be discovered.
The driver must:
origin/HEAD.origin/main or origin/master if present.main or master only as last resort.HEAD.language_skill_packet guidance.HEAD SHA, language packet, raw output, exit status, and parsed findings/comments.See references/native-review-driver.md.
Normalize every review run into:
review_result:
clean: true|false
backend_class: cas-lane | native-cli | cas-native-fallback
target_fingerprint: string|null
tool_completed: true|false
exit_status: integer|null
base_ref: string
base_sha: string
head_sha: string
invocation: string
sandbox_mode: string|null
raw_output_ref: string
findings: []
A review run is clean only when all are true:
HEAD SHA match the pinned streak state, or this is the first clean review in a new streak.Treat CLI failure, missing/ambiguous output, partial output, transport failure, parser failure, unexpected base, or wrong HEAD as not clean.
See references/review-result-contract.md.
$resolve owns the state machine. Do not delegate the full review/fix/validate/commit/push/PR-sweep loop to a specialist worker.
Workers or sidecars may be used only for bounded, side-effect-light tasks that return structured evidence:
$review-adjudication;.reviewVerdict.Workers and sidecars must not:
clean_review_streak;Use parallelism when it reduces wall time without increasing state ambiguity. Do not launch sidecars merely because work is technically independent; each sidecar must have a named decision it can improve.
See references/parallelism-contract.md.
Before making changes:
Repeat until clean_review_streak == 3:
HEAD, base ref, base SHA, backend, or fingerprint, reset/pin streak only after a successful clean review.clean_review_streak;clean_review_streak = 0;$review-adjudication;$fixed-point-driver;Do not use an arbitrary maximum iteration count. Stop early only for an unrecoverable blocker such as unavailable review backend, impossible base discovery, required validation blocked by missing external credentials/services, persistent false-positive review loop that cannot be resolved without making the branch worse, or incomplete PR sweep inventory that prevents a completion claim.
When invoking $review-adjudication, provide:
HEAD SHA;Consume the full Claim Decision Kernel and Resolution Warrants. Do not collapse routes to only address / do-not-address.
Route handling:
address with mutate-code: run Review-Closure Abstraction Ladder, then route surviving mutation to $fixed-point-driver.delete-collapse-canonicalize with mutate-code: run Review-Closure Abstraction Ladder, with isomorphic simplification or fixed-point ablation preferred.validate-only with add-validation-only: run/add validation-only proof. If files change, reset review streak after proof change.resolve-thread-only with resolve-thread: resolve/reply only when provider policy permits and proof is current.do-not-address with draft-reply, defer, or none: record rationale; the review run still does not count as clean.blocked with none: stop before commit/push.See references/adjudication-route-contract.md.
Before any review-driven production mutation, consume the $review-adjudication route and select the earliest applicable abstraction route from this ladder.
The ladder is an anti-accretion spine:
2. complexity-mitigator
3. simplify-and-refactor-code-isomorphically
4. reduce
5. universalist
6. fixed-point-driver
7. accretive-implementer
Earliest owner wins. Do not run every rung by default. Select the earliest rung that owns the dominant pathology, and record why later rungs were not selected.
No review-driven production mutation may proceed directly from address. address only means the review item is potentially actionable. The ladder decides the route.
Use when the finding touches branchy, nested, flag-heavy, hard-to-follow, cross-file, mutable-state, or specification-risky code.
Expected output: Micro Preflight and smallest clarity cut.
This rung blocks patching code the agent does not understand.
Use when the proposed fix would add or preserve helper/wrapper/adapter/branch/test-case accumulation, duplicate/pass-through/shadow surface, near-clones, parameter-sprawl, local defensive code, or obvious behavior-preserving collapse opportunities.
Expected output: isomorphic refactor preflight, equivalence proof route, or behavior-preserving collapse route.
This rung blocks adding code when behavior-preserving collapse is available.
Use when the finding adds, preserves, or works around layer/tooling/framework/generated/config abstraction tax: adapters, registries, dependency injection, plugin surfaces, generated clients, codegen, ORMs, GraphQL, task runners, workflow engines, queues, infra wrappers, or config indirection.
Expected output: descend | hold | split | ask-universalist.
This rung blocks adding another layer to compensate for layer tax.
Use when repeated findings indicate a missing boundary artifact, protocol/state-machine artifact, explicit IR, effect signature, context certificate, canonical composition seam, or wrong shape of truth.
Expected output: one-seam boundary/construction call, obstruction report, or proof signal.
This rung blocks local patches when the boundary artifact is missing.
Use when findings are coupled, repeated, invariant-linked, deletion-sensitive, likely to reopen, or involve duplicate truth owners, additive scaffolds, or unresolved ablation pressure.
Expected output: normal-form route, ablation status, surface budget, and implementation handoff.
This rung blocks repeated local fixes that should become normal-form repair.
Use only after route selection as the single-writer executor.
Expected output: right_sized_route, surface_delta_call, and proof receipt.
This rung blocks direct mutation before route selection.
Every mutation-capable review item must leave this compact receipt in the durable ledger or final report:
review_closure_abstraction_receipt:
review_item_id: "..."
adjudication_route: "address | delete-collapse-canonicalize | validate-only | resolve-thread-only | do-not-address | blocked"
primary_smell:
hard_to_understand_or_spec_risk: yes|no
duplicate_or_pass_through_surface: yes|no
layer_or_tooling_tax: yes|no
missing_boundary_artifact: yes|no
coupled_or_repeated_findings: yes|no
implementation_only_after_route_selection: yes|no
earliest_applicable_rung: "complexity-mitigator | simplify-isomorphic | reduce | universalist | fixed-point-driver | accretive-implementer"
selected_skill: "..."
reason_selected: "..."
rejected_later_rungs:
- skill: "..."
reason: "earlier rung owned the pathology"
selected_route: "no-change | validate-only | delete-collapse-canonicalize | refactor-existing-owner | mutate-existing-owner | add-new-surface | blocked"
proof_required: []
If the receipt cannot be filled for a mutation-capable review item, do not mutate. Route to validation-only, fixed-point blocked, or ask for missing owner/context.
See references/review-closure-abstraction-ladder.md.
Track review items by subsystem, file, protocol, state machine, parser/validator, lifecycle, retry/idempotency path, cache/index, impossible-state family, and truth owner.
If three review findings in the same cluster appear in one $resolve run, stop point-fix mutation for that cluster.
Required next artifact:
cluster_refactor_moratorium:
cluster_id:
review_item_ids:
suspected_owner:
invariant_or_protocol:
local_patches_already_attempted:
duplicate_or_shadow_surfaces:
selected_route:
no-change | validate-only | delete-collapse-canonicalize | refactor-existing-owner | mutate-existing-owner | add-new-surface | blocked
required_skill:
complexity-mitigator | simplify-and-refactor-code-isomorphically | reduce | universalist | fixed-point-driver
proof_required:
The moratorium may lift only after the selected skill produces a route and proof plan, or the root records a blocker.
See references/cluster-refactor-moratorium.md.
When invoking $fixed-point-driver, pass:
$review-adjudication decision, route, warrant, and rationale;HEAD SHA;The handoff must be surface-budgeted. Do not simply say "fix minimally."
Minimum handoff shape:
implementation_handoff:
source_skill: resolve
target_skill: fixed-point-driver
artifact_state_id: "..."
review_item_id: "..."
abstraction_ladder_rung: "complexity-mitigator | simplify-isomorphic | reduce | universalist | fixed-point-driver | accretive-implementer"
selected_adjudication_route: address | delete-collapse-canonicalize | validate-only | resolve-thread-only | do-not-address | blocked
selected_route: no-change | validate-only | delete-collapse-canonicalize | refactor-existing-owner | mutate-existing-owner | add-new-surface | blocked
permitted_action: mutate-code | add-validation-only | resolve-thread | draft-reply | defer | none
permitted_scope: []
forbidden_actions: []
surface_budget:
production_surface: zero_or_negative | bounded_positive | explicit_expansion
added_helpers_allowed: yes | no
added_wrappers_adapters_allowed: yes | no
added_flags_or_fallbacks_allowed: yes | no
public_symbols_allowed: yes | no
compatibility_paths_allowed: yes | no
ablation_status: not-required | local-preflight | external-clearance-required | blocked
proof_required: []
stale_if: []
After $fixed-point-driver changes the branch:
clean_review_streak = 0;See references/implementation-handoff.md.
After clean_review_streak == 3, run the full project validation suite.
Prefer repository-native commands from CI, package scripts, Makefiles, task runners, project docs, or applicable language/tool skills.
If a validation command fails:
$review-adjudication only if actionability is contested; otherwise process the validation failure through the Review-Closure Abstraction Ladder when production mutation may result.$fixed-point-driver.clean_review_streak = 0.Do not skip builds, lints, tests, or type checks merely because the branch has three clean reviews.
If no validation command exists, do not silently treat validation as passed. Report validation as blocked, or route a validation-only proof addition/discovery if mutation authority permits. Commit/push is blocked unless the user explicitly accepts manual-only proof for this branch and the final report says validation was manual-only.
See references/validation-policy.md.
Only after the final three-review clean streak and full validation pass:
git status and final diff.If there are no intended changes after validation, do not create an empty commit. Push only if the branch needs remote update, then run the PR sweep.
Do not commit or push when:
After each successful push, inspect the PR associated with the current branch.
If no associated PR exists, report pr_sweep_inventory_status: no_pr and complete only if local review, validation, commit, and push gates passed.
If multiple PRs are associated and ambiguous, block instead of guessing.
For GitHub repositories, prefer a complete paginated review-thread inventory before claiming PR sweep complete.
Process:
headRefOid matches the latest pushed commit.totalCount;pageInfo.hasNextPage / endCursor;id;isResolved;isOutdated;totalCount is missing, or collected thread count is less than totalCount, mark sweep incomplete.$review-adjudication and consume full routes.$fixed-point-driver with surface-budgeted handoff.In-scope PR items:
Out-of-scope PR items:
See references/pr-sweep-contract.md.
When comments are adjudicated as no-change/do-not-address/defer:
If the same actionable PR comment persists after a fix/push, re-check latest code and adjudicate again. If it is now fixed/obsolete, classify accordingly. If it still identifies a real issue, route again.
A persistent loop is not success. Treat these as blockers unless a minimal correct fix can break the loop:
When blocked:
HEAD SHA, relevant output, unresolved comments/findings, abstraction route ledger, PR inventory status, and parallel ledger entries when relevant;When complete or blocked, report:
Resolve:
- status: resolved | blocked | partial
- resolve_run_id:
- branch:
- final_commit:
- pushed_to:
- PR:
Review closure:
- backend_class:
- base_ref:
- base_sha:
- head_sha:
- target_fingerprint:
- clean_review_streak:
- review_receipts:
Validation:
- commands_passed:
- commands_blocked_or_not_available:
- validation_mode: full | partial | manual-only | blocked
Adjudication:
- review_items: address=N, delete-collapse-canonicalize=N, validate-only=N, resolve-thread-only=N, do-not-address=N, blocked=N
- pr_items: address=N, delete-collapse-canonicalize=N, validate-only=N, resolve-thread-only=N, do-not-address=N, blocked=N
Review-Closure Abstraction Ladder:
- rungs_selected: complexity-mitigator=N, simplify-isomorphic=N, reduce=N, universalist=N, fixed-point-driver=N, accretive-implementer=N
- no_direct_address_to_patch: yes|no
- clusters_moratorium_triggered:
- selected_routes:
- blocked_by_route_selector:
Implementation:
- fixed_point_runs:
- implementation_handoffs:
- accretive_implementer_routes:
- surface_delta_calls:
- ablation_statuses:
PR sweep:
- inventory_status: complete | incomplete | no_pr | blocked
- unresolved_actionable_comments:
Parallelism:
- sidecars_used:
- stale_or_rejected_results:
Resolve Bottom Line:
- status:
- strongest proof:
- open blocker:
- exact next action:
Resolve Bottom Line must be final.
$resolve must attempt CAS lane review first; native review is fallback-only.codex review --base main.main is last resort only.$review-adjudication, Review-Closure Abstraction Ladder, and $fixed-point-driver route/warrant flow as local review comments.$resolve owns the state machine; workers/sidecars may assist but must not own mutable state or completion.$cas is the default review backend and must pass preflight before use; failed CAS preflight falls back to native review only when available and recorded.$review-adjudication routes into address/do-not-address.address to apply_patch.$fixed-point-driver without the abstraction receipt, surface budget, ablation status, forbidden actions, and proof required.testing
Use before local patching when bugs, regressions, malformed state, crashes, parser failures, migrations, cache drift, protocol problems, compatibility requests, tolerant readers, fallbacks, coercions, retries, catch-and-continue logic, or local workarounds may broaden accepted invalid state.
testing
Use for bug reports, PR/issue prose, reviewer comments, user diagnoses, generated summaries, memories, retrieved context, public tracker context, claimed root causes, proposed fixes, fake-minimal repro risk, or any investigation where natural-language context could anchor the implementation scope.
development
Use when non-trivial work needs Challenge Escalation, latent-intelligence activation, frame-market selection, doctrine operators, dominant-move selection, ablation/surface-tax judgment, reification, review comment law, negative capability, route receipts, or proof-bearing refusal to mutate.
development
Apply Algebra-Driven Design. Use for ADD, denotational design, combinator models, law-driven architecture, domain algebra, property tests, codebase modeling, event sourcing, workflow design, or agentic skill design. If the canonical bundle is unavailable, use this wrapper as the minimal ADD kernel and report the missing bundle path.