From mercury
Orchestrates the fixer→judge loop after a Mercury audit. Spawns the mercury-fixer agent to implement fixes, then the code-auditor agent acts as judge to approve or reject each one. A finding is only closed when the judge explicitly signs off with no regressions. Updates NAMS throughout. Use after mercury-audit produces findings, or call directly with a report path.
How this skill is triggered — by the user, by Claude, or both
Slash command
/mercury:mercury-fix-loopThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Runs the fixer→judge cycle until all targeted findings are resolved or max iterations reached.
Runs the fixer→judge cycle until all targeted findings are resolved or max iterations reached.
project_dir — absolute path to the projectbranch — git branch created by mercury-audit (or create one now if missing)findings — list of finding objects to fix (JSON array, subset of the full report)manifest_path — path to mercury_<label>_manifest.jsongoal — user's stated goal if this was a specialized audit (may be null)Call NAMS to create/update the audit entity:
memory_add_entity({
name: "<project_label> Mercury Audit <YYYY-MM-DD>",
type: "AuditSession",
properties: {
project_dir, branch, goal, finding_count, timestamp
}
})
Also add an opening message to NAMS:
memory_add_messages([{
role: "system",
content: "Mercury audit started on <project> branch <branch>. <N> findings targeted. Goal: <goal or 'standard'>."
}])
Sort findings by priority:
blocks_goal: true + critical/high firstAssign each finding an ID: F-001, F-002, etc.
Track state: open | in_progress | fixed_pending_review | approved | rejected
Print the queue:
Fix queue (<N> findings):
F-001 [critical] SECURITY src/trader.py::execute_order — <issue> 🎯 blocks goal
F-002 [high] CORRECTNESS src/risk.py::check_limits — <issue>
...
For each finding in the queue (work through them in order):
2a. Set finding to in_progress.
2b. Spawn the mercury-fixer agent with:
Finding ID: <F-xxx>
Severity: <sev>
Category: <category>
File: <file>
Symbol: <symbol>
Issue: <issue>
Why: <why>
Suggested fix: <fix from report>
Goal context: <goal or null>
Project dir: <project_dir>
2c. Fixer agent returns: { fixed: bool, files_changed: [...], diff_summary: str, notes: str }
2d. If fixed: false, mark as rejected with fixer's notes and move on.
For each finding the fixer reports as fixed:
3a. Spawn the code-auditor agent in JUDGE mode with:
MODE: JUDGE
Finding ID: <F-xxx>
Original finding: <full finding JSON>
Files changed: <list>
Diff summary: <fixer's diff summary>
Goal context: <goal or null>
Project dir: <project_dir>
Branch: <branch>
Your job: Determine if this fix is CORRECT, COMPLETE, and introduces NO regressions.
Read the changed files. Check the fix addresses the root cause, not just the symptom.
If the goal is specified, confirm the fix moves closer to the goal.
3b. Judge returns one of:
APPROVED — finding closed ✅REJECTED: <specific reason> — finding goes back to fixer for another passPARTIAL: <what's good, what's missing> — fixer gets targeted follow-up3c. On REJECTED/PARTIAL: increment retry count. If retry >= 3, escalate to user.
Repeat Steps 2–3 until:
approved → successAfter each judge APPROVED:
cd "<project_dir>"
git add -p # stage only changed files
git commit -m "fix(mercury): <F-xxx> <category> — <issue one-liner>
Finding: <F-xxx>
Severity: <sev>
Approved-by: code-auditor (judge)
Audit-branch: <branch>"
When the loop completes, print:
## Fix Loop Complete — <project> | <branch>
| ID | Sev | 🎯 | Status | File | Fix summary |
|-------|----------|----|----------|------|-------------|
| F-001 | critical | ✅ | APPROVED | ... | ... |
| F-002 | high | | APPROVED | ... | ... |
| F-003 | high | | ESCALATED| ... | max retries |
Approved: N | Escalated: N | Skipped: N
Next suggested audit: run /mercury-audit again on <branch> to verify clean slate.
memory_add_messages([{
role: "assistant",
content: "Mercury fix loop complete on <project>. <N> findings approved, <N> escalated. Branch: <branch>. Goal: <goal>. Key fixes: <summary>."
}])
memory_add_entity({
name: "<project_label> Mercury Audit <date>",
type: "AuditSession",
properties: { status: "complete", approved_count, escalated_count, branch }
})
If a finding hits max retries, surface it to the user with:
npx claudepluginhub mli-corp/mercury-audit --plugin mercuryCreates, edits, and optimizes skills for Claude Code, including drafting, evaluating with test prompts, iterating on performance, and improving skill descriptions for better triggering accuracy.