Audit-with-plans
Run an audit-fix loop for projects using the planning-with-files skill. Repeatedly launch independent, fresh-context audit workers that compare the code to .planning/<active>/{task_plan, findings, progress}.md, then fix whichever side is wrong. Exit only when a fresh audit returns zero findings.
Prerequisite
Require a planning-with-files plan at .planning/<plan-id>/{task_plan, findings, progress}.md. If none exists, explain that the audit needs this baseline and suggest creating a plan first.
Adapt to the host agent
- Use the host's fresh-context delegation capability for each audit pass. In Codex, use a new subagent or delegated agent task; in Claude Code, use a new
Agent invocation. Use an equivalent isolated worker on other hosts.
- Start a new worker for every pass. Never continue a prior audit worker or include earlier audit findings or fix history.
- Use the host's normal file-reading, searching, editing, and shell-execution tools. Do not depend on product-specific tool names.
- Keep the audit worker read-only with respect to project files. Run output-producing commands in a temporary copy or temporary output directory. Apply fixes only in the coordinating agent, then launch another cold-start worker.
- Inspect entry points for external or destructive side effects before execution. Never submit jobs, deploy, publish, SSH, or modify external systems; report the check as blocked when safe local execution is impossible.
- If the host cannot create an isolated worker, do not claim independent convergence. Ask the user to run the supplied prompt in a clean session, then continue the loop from its report.
The loop
audit → fix → audit (fresh, no memory of prior pass) → fix → … → no findings → exit
Exit condition: an independent fresh-context audit worker returns 0 CRITICAL / 0 HIGH / 0 MEDIUM / 0 LOW.
NOT exit conditions:
- "I think I fixed everything."
- "An audit worker that I told my fix history to confirmed my fixes landed."
- "All HIGH/MEDIUM closed; LOW items remain."
Audit-worker prompt template
Read templates/audit_subagent_prompt.md before launching the first audit worker. Fill its placeholders from the active planning files and pass the resulting prompt to a new isolated worker. The required structure is:
- Role: "You are a code reviewer auditing
<PROJECT_PATH>."
- Project goal: one paragraph stating what the project is trying to achieve (auditor cross-checks against this).
- Primary baseline: "Start from
.planning/<active-plan>/{task_plan, findings, progress}.md. Treat other Markdown files as secondary evidence. Planning files may themselves be stale, so determine the correct side from executable behavior, project intent, and current artifacts."
- Section-level audit hooks (see below).
- Two failure modes: (a) code does X but
.planning says Y; (b) .planning describes a workflow / artifact / value that the code is missing / broken / out of sync. Either side can be wrong.
- Execution requirement: "For every documented entry point, execute with the documented invocation, check exit code, compare stdout/stderr/file outputs to the
.planning description."
- Artifact verification: "For every on-disk artifact
.planning/*.md cites, verify the file exists; if a specific number is cited, grep for it in the file; if script-generated, regenerate + diff against the on-disk version where practical."
- Safety bounds: "Do not modify project files or external systems. Run output-producing checks in temporary locations. Do not submit SLURM/batch jobs, deploy, publish, or SSH. Report checks that cannot run safely."
- Independence: "You have no prior context on this project. Do not assume any audit has run before. Do not look for 'things prior passes might have missed'. Start cold from the three planning files and work outward."
Never include in the audit-worker prompt
- A list of prior findings.
- A list of what was just fixed.
- "Pass-N closed X; verify each landed."
- "Don't re-flag closed items."
- Any narrative from your prior fix history.
These turn the auditor into a verifier of your fixes. The verifier confirms what you told it is fixed and misses what you introduced, rationalized away, or never noticed. Each pass must be cold-start.
Section-level audit hooks (planning-with-files structure)
Anchor the audit worker's checks to the canonical sections of the three planning files:
| File |
Section |
What to verify |
task_plan.md |
Goal |
Code does what the goal says |
task_plan.md |
Current Phase |
Code state matches the named current phase |
task_plan.md |
Phases (status complete) |
Artifacts the phase claims to produce exist |
task_plan.md |
Decisions Made (table) |
Every decision reflected in code |
task_plan.md |
Open Blockers |
Every row in the described state |
task_plan.md |
Errors Encountered |
Every row's resolution applied (or explicitly still open) |
findings.md |
Technical Decisions + Resources |
Every cited file path exists; every cited numeric value (RMSE, density, monopole, ε, R_min, etc.) appears in the referenced artifact at the cited precision |
progress.md |
Files created/modified lists |
Every cited path exists |
progress.md |
5-Question Reboot Check |
Answers reflect CURRENT state, not a snapshot from an earlier session |
progress.md |
Test Results |
Every row's "Actual" reproduces on a fresh run |
| meta / tooling |
.planning/.active_plan + self-audit script |
The project's self-audit script (audit_planning.py) reads .active_plan and dispatches the matching check set — NOT hard-coded to a stale plan. Confirm which plan's checks actually fire. |
.md ↔ .md |
across task_plan / findings / progress |
Internal consistency: Current-Phase vs phase statuses; "decision pending" vs "made"; every shared numeric value identical across all three files |
Bidirectional fix policy
For each discrepancy:
- If the code does X and
.planning says Y, and .planning is RIGHT → fix the code.
- If the code does X and
.planning says Y, and the code has legitimately evolved (algorithm changed, cutoff tightened, path renamed) → fix the .planning file.
Stale documentation is as broken as stale code. Either direction is valid; the goal is convergence between code and .md, not one-way fixing of code.
Fix every reported issue
When an audit returns findings:
- Fix all of them (CRITICAL through LOW).
- The audit worker may explicitly mark some as "no fix required" / "informational" / "open by design pending user decision" — those don't count against the severity counts but should be acknowledged in the exit report.
- Do NOT punt items to "next session" without explicit user approval.
- Do NOT batch fixes across multiple audit passes; close each pass's findings before launching the next.
Anti-patterns
| Anti-pattern |
Symptom |
Correction |
| Verification bias |
Audit prompt includes "Pass-N closed X; verify each + don't re-flag" |
Launch each audit with no prior context — role + goal + baseline + execution requirement only |
| Static reading |
Audit workers grep text but never execute scripts |
Mandate execution of every documented entry point with trivial inputs |
| Confidence over-calibration |
Declaring "converged" on a worker's "0 findings" without independent verification |
Treat worker results as hypotheses; cross-check the most critical entry point yourself |
| Cookie-cutter "no action" deferrals |
LOW/MEDIUM punted to "next session" |
Fix every reported issue (LOW too) and re-audit until clean |
| Reading-vs-behavior gap |
Caught text drift; missed CWD bugs, silent failures, validator false-OKs |
Prompt phases for: (a) library docstring vs production workflow, (b) silent-failure grep for except Exception + missing exit codes, (c) audit-script positive/negative path inspection |
| One-direction fixing |
Always changing code to match .md |
Recognize when code is right and .md is stale; fix the .md side |
| Iteration short-circuit |
Launching a single audit worker and declaring done |
The loop runs until a FRESH audit returns 0/0/0/0 — typically 5-15 passes for a non-trivial project |
| Assembled-path blindness |
Path-update sweep only greps for literal old prefixes; scripts that assemble paths from variables (e.g. OTF / "01_qm_opt/sp.fchk" where OTF is a Path constant) silently break |
Audit-worker prompt must require: (a) bash -n / python3 -m py_compile parse-check, (b) actual execution with trivial input, (c) running any test suite (pytest/unittest) found in the project |
| Template-vs-instance drift |
An on-disk template is upgraded with new safety checks; pre-existing copies of that template in working dirs still have the OLD version |
Audit must diff every dynamic.sh / minimization.sh / build.sh in working dirs against the canonical template; flag any divergence |
| READMEs overstating completion |
A README says "Phase N complete" but the cited observable (e.g. ΔH^vap = X kJ/mol) is missing from any artifact |
Audit must verify every "complete" claim has a non-empty, current-code-produced artifact backing it. .CRASHED_* archives DO NOT count as a successful run; a dynamics.log without Performance: marker DOES NOT count as a complete trajectory |
audit_planning.py false confidence |
Project's own self-audit script checks file existence only; entry-point breakage invisible to it |
The project's audit_planning.py must include _audit_entry_points_runnable (parse-check every documented script) + _audit_phase_completion (verify observables exist, not just files) |
| Self-audit script targets the WRONG plan |
The project's self-audit script (audit_planning.py) is hard-coded to one plan id; .planning/.active_plan has since switched to a different plan. The script keeps printing "27 OK" — but it is auditing the stale plan's artifacts, not the active one. Audit workers read those OKs as evidence the active plan is consistent. This is the most dangerous failure mode: false confidence at the tooling layer. |
EVERY pass must (1) read .planning/.active_plan, (2) confirm the self-audit script resolves and dispatches on that same id — open audit_planning.py and check it reads .active_plan rather than a hard-coded constant. If the script audits a different plan than the active one, that is an automatic HIGH finding. The fix is to make the script resolve_active_plan() + dispatch per-plan check sets, gating each plan's checks behind its id. |
.md ↔ .md internal contradiction |
Audit checks only code↔.md and misses contradictions between the three planning files: task_plan.md "Current Phase" disagrees with the phase-status checkboxes; findings.md says a decision is "pending" while task_plan.md Decisions Made records it as made; a numeric value (production λ, monopole, density) differs between task_plan / findings / progress |
Add an explicit .md↔.md hook: cross-check Current-Phase vs phase statuses; every "decision pending/made" claim across the three files; every shared numeric value (grep the value across all three). Planning-file self-consistency is part of convergence. |
| Auditor's own fixes leave dangling cross-refs |
The agent fixes a value in task_plan.md but the old value still lives in findings.md/progress.md. The next homogeneous pass shares the agent's blind spot and "converges" without catching it. |
After changing ANY value in a planning file, grep the old value across all three planning files (and READMEs / code comments) and update every hit. Treat your own edits as a new source of drift to re-audit. |
| Homogeneous-prompt fixed point |
Every pass uses the same prompt template anchored on the same hooks, so the loop converges to a fixed point that still contains a systematic blind spot the template never looks at |
Vary the lens across passes (or always include a "meta/tooling" hook: does the self-audit tool target the active plan? are the three planning files mutually consistent?). A clean 0/0/0/0 from a homogeneous prompt is weaker evidence than one finding from a differently-framed pass. |
After a plan switch (.planning/.active_plan changed)
Switching the active plan is a major event on par with a restructure — it silently invalidates all plan-scoped tooling. When .active_plan changes (or when you start an audit and find the project has multiple plans):
- Verify the self-audit script (
audit_planning.py or equivalent) resolves .active_plan and dispatches the matching check set. A script hard-coded to the previous plan will print OKs about the wrong artifacts. This is an automatic HIGH finding until fixed.
- Verify every plan-scoped tool / path constant points at the active plan, not the old one.
- Re-run the self-audit and read WHICH plan's checks fired — not just the OK/FAIL counts. If you see checks naming the inactive plan's artifacts, the dispatch is broken.
- The exit condition (0/0/0/0) is only meaningful once the self-audit is confirmed to be auditing the active plan.
After a major restructure (paths moved, files relocated)
Path-update sweeps with grep+sed are necessary but NOT sufficient. They catch literal-string references. They miss:
- Assembled paths —
OTF / "01_qm_opt/sp.fchk" where OTF is a Path variable; the prefix is in the variable, the suffix in the assembled string.
- Test expectations — tests usually use
Path(__file__).parent.parent / "templates"; restructure breaks them silently until pytest runs.
- Template inheritance gap — the canonical template was updated; existing on-disk copies of that template (in working dirs, T-folders, etc.) were not re-templated.
- README claims — "Phase complete" was true before the move but now references files at stale paths or observables that haven't been measured.
Mandatory post-restructure audit pass:
bash -n on every shell script under the new tree.
python3 -m py_compile on every Python script.
- Run every documented entry-point script with a trivial invocation; check exit code.
- Run the project's test suite (
pytest etc.).
- Regenerate every cited analysis output; diff against on-disk version.
- Diff every working-dir copy of
dynamic.sh / minimization.sh / build.sh against the canonical templates.
- For every
phase N complete claim, verify the artifact exists, is non-empty, and was produced by the current code.
Termination report template
When the loop converges, report:
## Loop converged.
Fresh independent audit returned 0 CRITICAL / 0 HIGH / 0 MEDIUM / 0 LOW.
| Check | Status |
|---|---|
| Every cited file path in planning | ✓ exists |
| Every cited numeric value | ✓ matches artifact to documented precision |
| Every documented entry point | ✓ exit 0 |
| <add another project-specific category> | ✓ <status> |
One explicitly open item (documented, not an audit failure): <if any>
The remaining work is purely <physics / business logic / etc.>.
If items remain documented-but-unresolved (e.g. an explicit Open Blocker awaiting user decision), name them in the termination report so the user can see what's deferred by intent vs what's deferred by oversight.
Related skill
planning-with-files — prerequisite. audit-with-plans audits the artifacts that planning-with-files produces.
1---2name: audit-with-plans3description: Audit and repair planning-with-files projects by comparing code with `.planning/*/{task_plan,findings,progress}.md` in both directions, executing documented entry points, and repeating independent cold-start reviews until a fresh pass reports 0/0/0/0. Use for project audits, code reviews, plan-versus-implementation checks, or consistency checks when a `.planning` baseline exists.4---56# Audit-with-plans78Run an audit-fix loop for projects using the `planning-with-files` skill. Repeatedly launch independent, fresh-context audit workers that compare the code to `.planning/<active>/{task_plan, findings, progress}.md`, then fix whichever side is wrong. Exit only when a fresh audit returns zero findings.910## Prerequisite1112Require a `planning-with-files` plan at `.planning/<plan-id>/{task_plan, findings, progress}.md`. If none exists, explain that the audit needs this baseline and suggest creating a plan first.1314## Adapt to the host agent1516- Use the host's fresh-context delegation capability for each audit pass. In Codex, use a new subagent or delegated agent task; in Claude Code, use a new `Agent` invocation. Use an equivalent isolated worker on other hosts.17- Start a new worker for every pass. Never continue a prior audit worker or include earlier audit findings or fix history.18- Use the host's normal file-reading, searching, editing, and shell-execution tools. Do not depend on product-specific tool names.19- Keep the audit worker read-only with respect to project files. Run output-producing commands in a temporary copy or temporary output directory. Apply fixes only in the coordinating agent, then launch another cold-start worker.20- Inspect entry points for external or destructive side effects before execution. Never submit jobs, deploy, publish, SSH, or modify external systems; report the check as blocked when safe local execution is impossible.21- If the host cannot create an isolated worker, do not claim independent convergence. Ask the user to run the supplied prompt in a clean session, then continue the loop from its report.2223## The loop2425```26audit → fix → audit (fresh, no memory of prior pass) → fix → … → no findings → exit27```2829**Exit condition:** an independent fresh-context audit worker returns 0 CRITICAL / 0 HIGH / 0 MEDIUM / 0 LOW.3031NOT exit conditions:3233- "I think I fixed everything."34- "An audit worker that I told my fix history to confirmed my fixes landed."35- "All HIGH/MEDIUM closed; LOW items remain."3637## Audit-worker prompt template3839Read `templates/audit_subagent_prompt.md` before launching the first audit worker. Fill its placeholders from the active planning files and pass the resulting prompt to a new isolated worker. The required structure is:40411. **Role:** "You are a code reviewer auditing `<PROJECT_PATH>`."422. **Project goal:** one paragraph stating what the project is trying to achieve (auditor cross-checks against this).433. **Primary baseline:** "Start from `.planning/<active-plan>/{task_plan, findings, progress}.md`. Treat other Markdown files as secondary evidence. Planning files may themselves be stale, so determine the correct side from executable behavior, project intent, and current artifacts."444. **Section-level audit hooks** (see below).455. **Two failure modes:** (a) code does X but `.planning` says Y; (b) `.planning` describes a workflow / artifact / value that the code is missing / broken / out of sync. Either side can be wrong.466. **Execution requirement:** "For every documented entry point, execute with the documented invocation, check exit code, compare stdout/stderr/file outputs to the `.planning` description."477. **Artifact verification:** "For every on-disk artifact `.planning/*.md` cites, verify the file exists; if a specific number is cited, grep for it in the file; if script-generated, regenerate + diff against the on-disk version where practical."488. **Safety bounds:** "Do not modify project files or external systems. Run output-producing checks in temporary locations. Do not submit SLURM/batch jobs, deploy, publish, or SSH. Report checks that cannot run safely."499. **Independence:** "You have no prior context on this project. Do not assume any audit has run before. Do not look for 'things prior passes might have missed'. Start cold from the three planning files and work outward."5051## Never include in the audit-worker prompt5253- A list of prior findings.54- A list of what was just fixed.55- "Pass-N closed X; verify each landed."56- "Don't re-flag closed items."57- Any narrative from your prior fix history.5859These turn the auditor into a verifier of your fixes. The verifier confirms what you told it is fixed and misses what you introduced, rationalized away, or never noticed. **Each pass must be cold-start.**6061## Section-level audit hooks (planning-with-files structure)6263Anchor the audit worker's checks to the canonical sections of the three planning files:6465| File | Section | What to verify |66|---|---|---|67| `task_plan.md` | **Goal** | Code does what the goal says |68| `task_plan.md` | **Current Phase** | Code state matches the named current phase |69| `task_plan.md` | **Phases (status `complete`)** | Artifacts the phase claims to produce exist |70| `task_plan.md` | **Decisions Made** (table) | Every decision reflected in code |71| `task_plan.md` | **Open Blockers** | Every row in the described state |72| `task_plan.md` | **Errors Encountered** | Every row's resolution applied (or explicitly still open) |73| `findings.md` | **Technical Decisions + Resources** | Every cited file path exists; every cited numeric value (RMSE, density, monopole, ε, R_min, etc.) appears in the referenced artifact at the cited precision |74| `progress.md` | **Files created/modified lists** | Every cited path exists |75| `progress.md` | **5-Question Reboot Check** | Answers reflect CURRENT state, not a snapshot from an earlier session |76| `progress.md` | **Test Results** | Every row's "Actual" reproduces on a fresh run |77| **meta / tooling** | `.planning/.active_plan` + self-audit script | The project's self-audit script (`audit_planning.py`) reads `.active_plan` and dispatches the matching check set — NOT hard-coded to a stale plan. Confirm which plan's checks actually fire. |78| **`.md ↔ .md`** | across task_plan / findings / progress | Internal consistency: Current-Phase vs phase statuses; "decision pending" vs "made"; every shared numeric value identical across all three files |7980## Bidirectional fix policy8182For each discrepancy:8384- If the code does X and `.planning` says Y, and `.planning` is RIGHT → fix the code.85- If the code does X and `.planning` says Y, and the code has legitimately evolved (algorithm changed, cutoff tightened, path renamed) → fix the `.planning` file.8687Stale documentation is as broken as stale code. Either direction is valid; the goal is convergence between code and `.md`, not one-way fixing of code.8889## Fix every reported issue9091When an audit returns findings:9293- Fix all of them (CRITICAL through LOW).94- The audit worker may explicitly mark some as "no fix required" / "informational" / "open by design pending user decision" — those don't count against the severity counts but should be acknowledged in the exit report.95- Do NOT punt items to "next session" without explicit user approval.96- Do NOT batch fixes across multiple audit passes; close each pass's findings before launching the next.9798## Anti-patterns99100| Anti-pattern | Symptom | Correction |101|---|---|---|102| **Verification bias** | Audit prompt includes "Pass-N closed X; verify each + don't re-flag" | Launch each audit with no prior context — role + goal + baseline + execution requirement only |103| **Static reading** | Audit workers grep text but never execute scripts | Mandate execution of every documented entry point with trivial inputs |104| **Confidence over-calibration** | Declaring "converged" on a worker's "0 findings" without independent verification | Treat worker results as hypotheses; cross-check the most critical entry point yourself |105| **Cookie-cutter "no action" deferrals** | LOW/MEDIUM punted to "next session" | Fix every reported issue (LOW too) and re-audit until clean |106| **Reading-vs-behavior gap** | Caught text drift; missed CWD bugs, silent failures, validator false-OKs | Prompt phases for: (a) library docstring vs production workflow, (b) silent-failure grep for `except Exception` + missing exit codes, (c) audit-script positive/negative path inspection |107| **One-direction fixing** | Always changing code to match `.md` | Recognize when code is right and `.md` is stale; fix the `.md` side |108| **Iteration short-circuit** | Launching a single audit worker and declaring done | The loop runs until a FRESH audit returns 0/0/0/0 — typically 5-15 passes for a non-trivial project |109| **Assembled-path blindness** | Path-update sweep only greps for literal old prefixes; scripts that assemble paths from variables (e.g. `OTF / "01_qm_opt/sp.fchk"` where `OTF` is a `Path` constant) silently break | Audit-worker prompt must require: (a) `bash -n` / `python3 -m py_compile` parse-check, (b) actual execution with trivial input, (c) running any test suite (pytest/unittest) found in the project |110| **Template-vs-instance drift** | An on-disk template is upgraded with new safety checks; pre-existing copies of that template in working dirs still have the OLD version | Audit must diff every `dynamic.sh` / `minimization.sh` / `build.sh` in working dirs against the canonical template; flag any divergence |111| **READMEs overstating completion** | A README says "Phase N complete" but the cited observable (e.g. ΔH^vap = X kJ/mol) is missing from any artifact | Audit must verify every "complete" claim has a non-empty, current-code-produced artifact backing it. `.CRASHED_*` archives DO NOT count as a successful run; a `dynamics.log` without `Performance:` marker DOES NOT count as a complete trajectory |112| **`audit_planning.py` false confidence** | Project's own self-audit script checks file existence only; entry-point breakage invisible to it | The project's `audit_planning.py` must include `_audit_entry_points_runnable` (parse-check every documented script) + `_audit_phase_completion` (verify observables exist, not just files) |113| **Self-audit script targets the WRONG plan** | The project's self-audit script (`audit_planning.py`) is hard-coded to one plan id; `.planning/.active_plan` has since switched to a different plan. The script keeps printing "27 OK" — but it is auditing the *stale* plan's artifacts, not the active one. Audit workers read those OKs as evidence the active plan is consistent. **This is the most dangerous failure mode: false confidence at the tooling layer.** | EVERY pass must (1) read `.planning/.active_plan`, (2) confirm the self-audit script resolves and dispatches on that same id — open `audit_planning.py` and check it reads `.active_plan` rather than a hard-coded constant. If the script audits a different plan than the active one, that is an automatic **HIGH** finding. The fix is to make the script `resolve_active_plan()` + dispatch per-plan check sets, gating each plan's checks behind its id. |114| **`.md ↔ .md` internal contradiction** | Audit checks only code↔.md and misses contradictions *between* the three planning files: `task_plan.md` "Current Phase" disagrees with the phase-status checkboxes; `findings.md` says a decision is "pending" while `task_plan.md` Decisions Made records it as made; a numeric value (production λ, monopole, density) differs between task_plan / findings / progress | Add an explicit `.md↔.md` hook: cross-check Current-Phase vs phase statuses; every "decision pending/made" claim across the three files; every shared numeric value (grep the value across all three). Planning-file self-consistency is part of convergence. |115| **Auditor's own fixes leave dangling cross-refs** | The agent fixes a value in `task_plan.md` but the old value still lives in `findings.md`/`progress.md`. The next homogeneous pass shares the agent's blind spot and "converges" without catching it. | After changing ANY value in a planning file, `grep` the old value across all three planning files (and READMEs / code comments) and update every hit. Treat your own edits as a new source of drift to re-audit. |116| **Homogeneous-prompt fixed point** | Every pass uses the same prompt template anchored on the same hooks, so the loop converges to a fixed point that still contains a systematic blind spot the template never looks at | Vary the lens across passes (or always include a "meta/tooling" hook: does the self-audit tool target the active plan? are the three planning files mutually consistent?). A clean 0/0/0/0 from a homogeneous prompt is weaker evidence than one finding from a differently-framed pass. |117118## After a plan switch (`.planning/.active_plan` changed)119120Switching the active plan is a **major event** on par with a restructure — it silently invalidates all plan-scoped tooling. When `.active_plan` changes (or when you start an audit and find the project has multiple plans):1211221. **Verify the self-audit script (`audit_planning.py` or equivalent) resolves `.active_plan`** and dispatches the matching check set. A script hard-coded to the previous plan will print OKs about the wrong artifacts. This is an automatic HIGH finding until fixed.1232. **Verify every plan-scoped tool / path constant** points at the active plan, not the old one.1243. **Re-run the self-audit and read WHICH plan's checks fired** — not just the OK/FAIL counts. If you see checks naming the inactive plan's artifacts, the dispatch is broken.1254. The exit condition (0/0/0/0) is only meaningful once the self-audit is confirmed to be auditing the active plan.126127## After a major restructure (paths moved, files relocated)128129Path-update sweeps with grep+sed are necessary but NOT sufficient. They catch literal-string references. They miss:1301311. **Assembled paths** — `OTF / "01_qm_opt/sp.fchk"` where `OTF` is a `Path` variable; the prefix is in the variable, the suffix in the assembled string.1322. **Test expectations** — tests usually use `Path(__file__).parent.parent / "templates"`; restructure breaks them silently until pytest runs.1333. **Template inheritance gap** — the canonical template was updated; existing on-disk copies of that template (in working dirs, T-folders, etc.) were not re-templated.1344. **README claims** — "Phase complete" was true before the move but now references files at stale paths or observables that haven't been measured.135136Mandatory post-restructure audit pass:137138- `bash -n` on every shell script under the new tree.139- `python3 -m py_compile` on every Python script.140- Run every documented entry-point script with a trivial invocation; check exit code.141- Run the project's test suite (`pytest` etc.).142- Regenerate every cited analysis output; diff against on-disk version.143- Diff every working-dir copy of `dynamic.sh` / `minimization.sh` / `build.sh` against the canonical templates.144- For every `phase N complete` claim, verify the artifact exists, is non-empty, and was produced by the current code.145146## Termination report template147148When the loop converges, report:149150```151## Loop converged.152153Fresh independent audit returned 0 CRITICAL / 0 HIGH / 0 MEDIUM / 0 LOW.154155| Check | Status |156|---|---|157| Every cited file path in planning | ✓ exists |158| Every cited numeric value | ✓ matches artifact to documented precision |159| Every documented entry point | ✓ exit 0 |160| <add another project-specific category> | ✓ <status> |161162One explicitly open item (documented, not an audit failure): <if any>163164The remaining work is purely <physics / business logic / etc.>.165```166167If items remain documented-but-unresolved (e.g. an explicit Open Blocker awaiting user decision), name them in the termination report so the user can see what's deferred by intent vs what's deferred by oversight.168169## Related skill170171- `planning-with-files` — prerequisite. `audit-with-plans` audits the artifacts that `planning-with-files` produces.