---
name: Harness Audit and Pruning
description: >-
  Use periodically (monthly or after a rough sprint) to run an L5 improvement
  audit: turn repeat mistakes into deterministic checks and flag stale skills or
  rules for owner approval before pruning.
---
# Harness Audit and Pruning (L5 Improvement Loop)

Run this audit periodically (monthly or after a heavy sprint) to tighten your agent harness, convert repeat failures into cheap deterministic checks, and prune stale rules or skills.

## 1. Collect recent failures and rework
- Review recent corrections, failed runs, rework loops, and user pushback since the last audit.
- Group mistakes by root cause: wrong files touched, flooded context, lost decisions, stale rules, missing permissions/guardrails, or weak verification.

## 2. Promote repeat failures down the cost stack
For any mistake that happened more than once, fix it at the cheapest durable layer:
1. **Deterministic check first** (lint rule, typecheck, automated test, permission deny rule) — stops the bug forever at zero ongoing token cost.
2. **State or contract file second** (add to the project's `decisions.md` Rejected list, path rules, or handoff template).
3. **Skill or agent instruction update third** — only when the fix requires judgment, and keep it to one concrete sentence.

Never add vague reminders like "be more careful."

## 3. Audit for rule and skill decay
- Scan installed skills, standing rules, and active project decision logs for:
  - **Stale rules:** conventions or tool choices the team has dropped or superseded.
  - **Conflicts:** two rules or skills giving opposite instructions.
  - **Duplicates:** overlapping skills that should be merged or retired.
  - **Unowned instructions:** rules with no clear project or owner.

## 4. Present a Keep / Tighten / Prune report
Return one concise summary with three short lists:
- **Tighten (promote to guardrail or rule):** concrete repeat failure -> exact proposed fix.
- **Prune (stale, conflicting, or duplicate):** exact skill, rule, or memory -> why it is stale.
- **No action needed:** brief note if everything looks clean.

**Hard stop:** Never delete, archive, or disable any skill or standing rule automatically. Wait for explicit owner approval on every proposed removal or rewrite.
