agent-cleanlisted
Install: claude install-skill HermeticOrmus/ormus-agent-ops
# /agent-clean — Infrastructure-Failure Purge
> Don't conflate "the agent didn't try because we ran out of credits" with "the agent tried and the code is broken."
## The signal
Failed tasks in an autonomous agent fall into two completely different categories:
1. **Infra failures** — agent never got a chance: rate limit, credit exhausted, network timeout, auth expired
2. **Real failures** — agent tried, code is broken, prompt was wrong, env was missing
Bulk-requeuing all failures conflates these. Bulk-dead-lettering all failures throws away real work. `/agent-clean` separates them: it purges (or requeues) only the infra failures and leaves the real failures for `/agent-triage`.
## Prerequisites
| Var | Purpose |
|---|---|
| `AGENT_API_URL` | Base URL of the agent's HTTP API |
| `AGENT_API_TOKEN` | Bearer token |
## Usage
```
/agent-clean — sweep last 24h
/agent-clean 7d — sweep last 7 days
/agent-clean --requeue — requeue infra failures instead of dead-lettering
/agent-clean --dry-run — show what would be done, don't act
```
## Workflow
### Phase 1: Pull failures
```bash
curl -s -H "Authorization: Bearer $AGENT_API_TOKEN" \
"$AGENT_API_URL/api/tasks?status=failed&since=24h"
```
### Phase 2: Match each failure against infra patterns
For each failed task, fetch a tail of its log and match against these patterns:
| Pattern | Class |
|---|---|
| `rate.?limit` / `429 Too Many Requests` | `rate-limit` |
| `credit.