Audit–Fix Loop
Purpose
Audit the task → fix its findings → audit the same task again until the
audit rubric shows A for Architecture, Correctness risk, and
Complexity debt within that task scope, then make one final
git-commit containing only the loop's changes.
This is not a license to repair the whole repository. A narrow user task stays
narrow even when repo-wide checks expose unrelated debt.
Use When
- The user explicitly invokes
audit-fix-loop, $audit-fix-loop,
or clearly asks to use audit-fix-loop (same intent boundary as
execute-plan-hardcore—no implicit routing).
Do Not Use When
- The user only asked for a read-only audit—use
audit.
- The user is executing a checked-in plan and wants the hardcore gate after
plan work—prefer
execute-plan-hardcore.
- A single phase needs plan rubric review—use
phase-audit.
- Git writes are forbidden and nothing overrides that.
Authority Model
Explicit invocation of audit-fix-loop authorizes:
- Running the full
audit procedure as part of this skill even if the
current message does not contain the substring audit—this skill is
the explicit request for audit and implementation fixes until grades reach
A (overrides audit's default "surface only unless asked" rule for
this workflow only).
- Multiple audit cycles with multi-agent depth per
audit (parallel
Task charters when the harness supports it; sequential charters when not).
git-commit once after A / A / A is achieved, following
git-commit message rules but overriding its whole-tree staging default:
stage only files created or changed by this audit-fix loop for the authorized
task.
If audit-fix-loop was only inferred from vague wording—stop before
fixes or commit and confirm intent.
Procedure
Freeze the task scope before auditing:
- Translate the user's task into concrete flows, paths, or a git-defined
diff. Whole-repo scope is allowed only when the user explicitly requested
a whole-repo audit-fix loop.
- Record the starting
git status and diff so pre-existing user/agent
changes are distinguishable from loop-owned changes.
- Name relevant tests, contracts, guides, and notes that constrain the task.
- State the frozen scope in every audit report header.
- If investigation reveals a separate defect outside that scope, report it
as an out-of-scope finding; do not fix it or silently expand the task.
Audit pass (read + grade): Follow audit end-to-end:
- Mechanical signals from repo root:
pytest (or python -m pytest);
lint only when the repo defines a standard lint command—otherwise skip and
note “no configured lint.” When the audited surface includes kokoro.js/,
add targeted checks there (e.g. npm test). Repo-wide failures outside the
frozen task are baseline/out-of-scope evidence, not authorization to repair
unrelated files.
- Delegate multiple readonly charters when depth warrants it (when in
doubt, parallelize per
audit).
- Merge, dedupe, assign P0–P3 severities, and Architecture /
Correctness risk / Complexity debt grades (A–F).
- Grade the task and its changed surface—not unrelated pre-existing repo
debt.
Pass condition: all three grades are A. If mechanical checks fail,
treat failures as P0 and fix before accepting any A.
If any grade is below A: fix every in-scope issue that blocks A
(prioritize P0/P1 and task-related mechanical failures). Re-run
targeted checks; iterate only on task-owned code until ready for a fresh
audit. Record unrelated findings without changing them.
Loop: Return to step 2 with a complete audit of the same frozen
task scope (not only a spot-check) until A / A / A. Include any
additional files the loop itself changed to implement the task, but do not
absorb unrelated defects merely because they were discovered.
Stuck loop: If A / A / A requires an out-of-scope change, a product
or architecture tradeoff, or modifying pre-existing user/agent work, stop,
report grades and the exact boundary, and ask the user whether to expand
scope—do not spin or expand it yourself.
Final commit: When step 5 passes, run git-commit once for the
files produced by this loop. Use git-commit for subject/body quality,
but explicitly override whole-tree staging. Never include unrelated dirty
files, pre-existing user edits, or another agent's work merely because they
are present.
Boundaries
- Do not grade-inflate;
audit rubric applies.
- Do not lower thresholds to reach A—raise quality.
- Do not audit or fix the whole repository when the user authorized a
narrower task.
- Do not treat unrelated repo-wide check failures as task failures. Report
them separately with their pre-existing/out-of-scope status.
- Do not revert, rewrite, stage, or commit pre-existing user/agent changes
outside the frozen task scope.
git-commit runs after grades are A / A / A, not after the first
audit pass unless the first pass already meets A (still follow
git-commit for recording).
Relation to Other Skills
audit: Defines the audit procedure, charters, mechanical checks, and
grading; audit-fix-loop adds mandatory fix iterations and a final
commit.
execute-plan-hardcore: Plan execution plus audit-to-A gate;
audit-fix-loop is only the audit–fix–commit loop (no plan phases).
git-commit: Final step; post-commit behavior in git-commit is
not a substitute for step 2 above.
1---2name: audit-fix-loop3description: Runs the full multi-agent audit workflow on the user's exact task scope, fixes every in-scope issue that blocks Architecture, Correctness risk, or Complexity debt from grade A, re-audits that same scope until all three are A, then commits only loop-owned changes via git-commit. Use ONLY when the user explicitly invokes audit-fix-loop, $audit-fix-loop, or "use audit-fix-loop"—not for standalone audits, plan execution, whole-repo cleanup inferred from a narrow task, or implicit routing. Does not replace phase-audit or deploy gates.4---56# Audit–Fix Loop78## Purpose910**Audit the task → fix its findings → audit the same task again** until the11**`audit`** rubric shows **A** for **Architecture**, **Correctness risk**, and12**Complexity debt** within that task scope, then make **one final13`git-commit`** containing only the loop's changes.1415This is not a license to repair the whole repository. A narrow user task stays16narrow even when repo-wide checks expose unrelated debt.1718## Use When1920- The user **explicitly** invokes **`audit-fix-loop`**, **`$audit-fix-loop`**,21 or clearly asks to **use audit-fix-loop** (same intent boundary as22 **`execute-plan-hardcore`**—no implicit routing).2324## Do Not Use When2526- The user only asked for a **read-only audit**—use **`audit`**.27- The user is **executing a checked-in plan** and wants the hardcore gate after28 plan work—prefer **`execute-plan-hardcore`**.29- A **single phase** needs plan rubric review—use **`phase-audit`**.30- Git writes are forbidden and nothing overrides that.3132## Authority Model3334Explicit invocation of **`audit-fix-loop`** authorizes:3536- Running the full **`audit`** procedure **as part of this skill** even if the37 current message does **not** contain the substring **`audit`**—this skill is38 the explicit request for **audit and implementation fixes** until grades reach39 **A** (overrides **`audit`**'s default "surface only unless asked" rule for40 this workflow only).41- **Multiple** audit cycles with **multi-agent** depth per **`audit`** (parallel42 `Task` charters when the harness supports it; sequential charters when not).43- **`git-commit`** once **after** **A / A / A** is achieved, following44 **`git-commit`** message rules but overriding its whole-tree staging default:45 stage only files created or changed by this audit-fix loop for the authorized46 task.4748If **`audit-fix-loop`** was only inferred from vague wording—**stop** before49fixes or commit and confirm intent.5051## Procedure52531. **Freeze the task scope before auditing:**54 - Translate the user's task into concrete flows, paths, or a git-defined55 diff. Whole-repo scope is allowed only when the user explicitly requested56 a whole-repo audit-fix loop.57 - Record the starting `git status` and diff so pre-existing user/agent58 changes are distinguishable from loop-owned changes.59 - Name relevant tests, contracts, guides, and notes that constrain the task.60 - State the frozen scope in every audit report header.61 - If investigation reveals a separate defect outside that scope, report it62 as an out-of-scope finding; do not fix it or silently expand the task.63642. **Audit pass (read + grade):** Follow **`audit`** end-to-end:65 - Mechanical signals from repo root: **`pytest`** (or `python -m pytest`);66 lint only when the repo defines a standard lint command—otherwise skip and67 note “no configured lint.” When the audited surface includes `kokoro.js/`,68 add targeted checks there (e.g. `npm test`). Repo-wide failures outside the69 frozen task are baseline/out-of-scope evidence, not authorization to repair70 unrelated files.71 - Delegate **multiple readonly** charters when depth warrants it (**when in72 doubt, parallelize** per **`audit`**).73 - Merge, dedupe, assign **P0–P3** severities, and **Architecture** /74 **Correctness risk** / **Complexity debt** grades (**A–F**).75 - Grade the task and its changed surface—not unrelated pre-existing repo76 debt.77783. **Pass condition:** all three grades are **A**. If mechanical checks fail,79 treat failures as **P0** and fix before accepting any **A**.80814. **If any grade is below A:** fix every **in-scope** issue that blocks **A**82 (prioritize **P0**/**P1** and task-related mechanical failures). Re-run83 targeted checks; iterate only on task-owned code until ready for a fresh84 audit. Record unrelated findings without changing them.85865. **Loop:** Return to step **2** with a complete audit of the **same frozen87 task scope** (not only a spot-check) until **A / A / A**. Include any88 additional files the loop itself changed to implement the task, but do not89 absorb unrelated defects merely because they were discovered.90916. **Stuck loop:** If **A / A / A** requires an out-of-scope change, a product92 or architecture tradeoff, or modifying pre-existing user/agent work, stop,93 report grades and the exact boundary, and ask the user whether to expand94 scope—do not spin or expand it yourself.95967. **Final commit:** When step **5** passes, run **`git-commit`** once for the97 files produced by this loop. Use **`git-commit`** for subject/body quality,98 but explicitly override whole-tree staging. Never include unrelated dirty99 files, pre-existing user edits, or another agent's work merely because they100 are present.101102## Boundaries103104- Do **not** grade-inflate; **`audit`** rubric applies.105- Do **not** lower thresholds to reach **A**—raise quality.106- Do **not** audit or fix the whole repository when the user authorized a107 narrower task.108- Do **not** treat unrelated repo-wide check failures as task failures. Report109 them separately with their pre-existing/out-of-scope status.110- Do **not** revert, rewrite, stage, or commit pre-existing user/agent changes111 outside the frozen task scope.112- **`git-commit`** runs **after** grades are **A / A / A**, not after the first113 audit pass unless the first pass already meets **A** (still follow114 **`git-commit`** for recording).115116## Relation to Other Skills117118- **`audit`:** Defines the audit procedure, charters, mechanical checks, and119 grading; **`audit-fix-loop`** adds **mandatory fix iterations** and a **final120 commit**.121- **`execute-plan-hardcore`:** Plan execution **plus** audit-to-**A** gate;122 **`audit-fix-loop`** is **only** the audit–fix–commit loop (no plan phases).123- **`git-commit`:** Final step; post-commit behavior in **`git-commit`** is124 **not** a substitute for step **2** above.