---
description: Run an erabot LLM/agent cost audit on this repo and apply the recommended fixes
---

# erabot — cost audit + apply fixes

Run an erabot cost audit on the current repository and apply its recommended fixes.
Drop this file in your coding agent (Claude Code: `.claude/commands/erabot.md`;
Cursor: a rule/command) so you can trigger it directly.

## Steps

1. Make sure the erabot CLI is available: run `erabot --version`, and if it is
   missing, `pip install erabot`.
2. Run the audit in this repo:
   ```
   erabot audit . --out erabot-audit
   ```
   It analyses your LLM calls, agent loops, tool use, and skills, estimates the
   monthly cost, and writes apply-ready fixes. It runs under your own model keys
   and never sends your source to erabot.
3. Open `erabot-audit/agent-instructions.md`. Each finding lists the estimated
   monthly saving and an apply-ready patch. The raw diffs are in
   `erabot-audit/patches/`.
4. For each fix:
   - Apply the patch on a new branch.
   - Run the repository's own tests.
   - Keep the fix only if the tests still pass.
   - **Never** apply a model-downgrade that erabot marked `UNSAFE`.
5. Report back: total estimated monthly savings, which fixes you applied, and
   which you skipped and why.

## Rules

- Only touch code that erabot flagged — never edit unrelated files.
- Treat every patch as a suggestion to verify, not a merge-ready commit.
- If a fix would change model behavior, confirm erabot shadow-verified it as
  safe before applying.
