agentleFS
Ormus-SolutionsOrmus-Solutions/ormus-agent-ops/skills/agent-clean/SKILL.md

agent-clean

Skill0 starsChanged 7 months agoMITView on GitHub

Purge tasks from an autonomous coding agent that failed due to infrastructure errors (rate limits, credit exhaustion, auth failures, network) — not code failures. Cleans the queue without losing legitimate failures that need triage.

  • Sends data out

1 other project uses a version of this.

Adopted by

Most recently taken up by

  • Other versions1 project uses a version of this.

    Word for word · 1

    1. HermeticOrmus/ormus-agent-ops★ 0100% same

    Edited · 0

    None found.

    Wrote their own version · 0

    None found.

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

  • In this repository6 other files it gives its agents.

The file

We split this skill into the rules it gives an agent

2 rules. About 0 are common, 1 is distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    After explicit user confirmation:

    line 88
  2. Very specific:

    When in doubt: dead-letter is safer (reversible — you can re-create the task).

    line 120

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

/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

VarPurpose
AGENT_API_URLBase URL of the agent's HTTP API
AGENT_API_TOKENBearer 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

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:

PatternClass
rate.?limit / 429 Too Many Requestsrate-limit
credit.?balance.?exhausted / insufficient.?(credits|balance) / quota.?exceededcredit-exhausted
401 Unauthorized / invalid.?api.?key / expired.?tokenauth-expired
ECONNRESET / ETIMEDOUT / getaddrinfo.?(ENOTFOUND|EAI_AGAIN) / socket hang upnetwork
500 Internal Server Error / 502 Bad Gateway / 503 Service Unavailable (from upstream APIs)upstream-5xx
worker.?(died|killed|crashed)worker-crash

Anything that doesn't match — leave alone. That's a real failure that needs /agent-triage.

Phase 3: Group + present

INFRA SWEEP — <window>
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Total failures:           <N>
Infra failures:           <N>  ←  this skill cleans these
Real failures:            <N>  ←  use /agent-triage

INFRA BREAKDOWN
  rate-limit:        <N>
  credit-exhausted:  <N>
  auth-expired:      <N>
  network:           <N>
  upstream-5xx:      <N>
  worker-crash:      <N>

PROPOSED ACTION
  default:           dead-letter all infra failures (with reason logged)
  --requeue mode:    requeue all infra failures

Real failures NOT touched:  <N>  (run /agent-triage to handle these)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Confirm? [y/N]

Phase 4: Execute

After explicit user confirmation:

# Default: dead-letter (cleaner — these were never the agent's fault, no need to retry)
for tid in $INFRA_TASK_IDS; do
  curl -s -X POST -H "Authorization: Bearer $AGENT_API_TOKEN" \
    -H "Content-Type: application/json" \
    -d "{\"reason\": \"infra: $CLASS\"}" \
    "$AGENT_API_URL/api/tasks/$tid/dead-letter"
done

Or with --requeue:

for tid in $INFRA_TASK_IDS; do
  curl -s -X POST -H "Authorization: Bearer $AGENT_API_TOKEN" \
    "$AGENT_API_URL/api/tasks/$tid/requeue"
done

When to requeue vs dead-letter

ScenarioAction
Rate limit hit, but you've upgraded the API tier--requeue
Credits exhausted, you've topped up--requeue
Auth expired, you've rotated tokens--requeue
Generic network blip 3 days ago, work is no longer neededdead-letter (default)
Worker crashed during a task that's no longer relevantdead-letter
Upstream API was down briefly, work IS still needed--requeue

When in doubt: dead-letter is safer (reversible — you can re-create the task). --requeue only when you've fixed the root cause.

Pairs with

  • /agent-triage — handles the real failures (code, prompt, env). Run /agent-clean first to remove noise, then /agent-triage on what remains.
  • /agent-status — verify the queue is clean afterward.

Notes

  • Don't auto-requeue rate-limit failures while still rate-limited. You'll create another wave of failures. Verify the underlying constraint is fixed first.
  • Log the reason on dead-letter. A future audit looking at "why was this dead-lettered" needs to see "infra: credit-exhausted" not just "dead-lettered."
  • This skill is intentionally scoped narrowly. Don't try to clean code/prompt/env failures here — that's /agent-triage's job. Keep the scope clean.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.