---
name: audit-plan
description: Audits a codebase to verify that an implementation matches a plan file. Use when you want to check if code changes made by any tool (Gemini, another AI, a developer) correctly implement a plan from ~/.claude/plans/. Reads each file specified in the plan, compares actual state to expected state, and reports PASS / FAIL / PARTIAL per item with a list of missing logic, bugs, or forgotten files.
argument-hint: [plan-file-path]
---

## Audit Plan Implementation

Your job is to verify that the codebase correctly implements a plan file.

### Step 1 — Locate the plan

- If the user provided a path or filename as an argument, use that.
- Otherwise, list files in `~/.claude/plans/` and ask the user which plan to audit (or use the most recently modified one if context makes it obvious).

### Step 2 — Parse the plan

Read the plan file and extract:
1. Every file listed under "Files to Modify" (or equivalent section)
2. The specific change each file is supposed to receive
3. Any new files that should have been created

### Step 3 — Launch a single Explore agent

Launch **one** Explore subagent with the following instructions:

> Read the plan file at [path]. Then read every file listed in the plan's "Files to Modify" table. For each file, compare what the plan requires against what is actually in the file. Also search the codebase for any references to old constants, class names, or patterns that the plan said to remove (e.g. grep for old constant names, old factory traits, old enum values). Report back with:
> - Per-file status: PASS / FAIL / PARTIAL
> - For FAIL/PARTIAL: exact lines that are wrong or missing
> - A list of any stale references found anywhere in the codebase

### Step 4 — Present results

Format the output as:

```
## Audit Results — <plan name>

### ✅ Passing (<N> files)
- file/path.rb
- ...

### ❌ Failing (<N> files)
**file/path.rb**
- Missing: <what was expected>
- Found: <what is actually there>

### ⚠️ Partial (<N> files)
**file/path.rb**
- Implemented: <what's correct>
- Missing: <what's still needed>

### 🔍 Stale References
- `OLD_CONSTANT` still referenced in spec/some_spec.rb:42
- ...

### Verdict
FULLY COMPLIANT / PARTIALLY COMPLIANT / INCOMPLETE
```

If everything passes and no stale references are found, say so clearly and confirm the implementation is complete.
