error-cleanup

error-cleanup is an agent for Claude Code from alphabravo-oss/guild. It costs 79 tokens per session (2,054 once invoked), scanned A, original, MIT.

A code-cleanup agent that finds error handlers which hide failures, such as empty catch blocks or ignored errors, and removes only the clearly unsafe ones.

In plain words
What is it for?
It reviews try/catch blocks, Go error checks, Python exceptions, Rust results, and promise catch handlers, then applies high-confidence changes and runs checks.
Why use it?
It helps prevent real problems from being silently ignored or replaced with misleading default results. It keeps handling that is needed for recovery, logging, cleanup, or system boundaries.

Agent for Claude Code

Written for Claude Code: effort in frontmatter. Also seen: model in frontmatter.

Part of the tidy plugin — 2 commands, 8 agents shipped together

Good fit It reviews try/catch blocks, Go error checks, Python exceptions, Rust results, and promise catch handlers, then applies high-confidence changes and runs checks.

Compare 6 agents from other repositories ↓
Install with agentmods
npx agentmods add agents/alphabravo-oss/guild/error-cleanup
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Clone the repo
git clone --depth 1 https://github.com/alphabravo-oss/guild

Made for: Claude Code.

Or install tidy, the plugin that ships this one along with the rest of its 2 commands, 8 agents.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for error-cleanup

README.md
[![agentmods](https://agentmods.dev/badge/agents/alphabravo-oss/guild/error-cleanup.svg)](https://agentmods.dev/agents/alphabravo-oss/guild/error-cleanup)
Your own site
<a href="https://agentmods.dev/agents/alphabravo-oss/guild/error-cleanup"><img src="https://agentmods.dev/badge/agents/alphabravo-oss/guild/error-cleanup.svg" alt="Measured on agentmods" height="20"></a>
Per session 79 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 2,054 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00079 $0.02054
Opus 5 $0.00039 $0.01027
Sonnet 5 $0.00016 $0.00411
Haiku 4.5 $0.00008 $0.00205

Measured 3d ago against content hash 0feaaf7df70b, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-07, from the pricing page.

Security

Grade A, and why

error-cleanup scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

plugins/tidy/agents/error-cleanup.md · 196 lines

How it starts

The opening of the file, as written. The whole thing — 196 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Tidy Track 6 — Error-handling Cleanup

You are the error-handling specialist. Your job is to find error handling that hides failures and remove it. The default position for an error is: it propagates. Catching it must serve a real purpose.

YOUR JOB

  1. Find all error-handling sites: try/catch, if err != nil patterns, except blocks, Result type matches, recover() calls, .catch() on promises.
  2. Classify each one: serves a real purpose, OR silently swallows.
  3. Rank removals by confidence.
  4. Apply ONLY HIGH-confidence removals (replace with propagation).
  5. Run all checks after each batch.

INSPECTION PROTOCOL

JavaScript / TypeScript

# try/catch blocks
grep -rn -B1 -A5 'try \?{' --include='*.ts' --include='*.tsx' | head -200

# Promise .catch
grep -rn '\.catch(' --include='*.ts' --include='*.tsx' | head -100

# Async error handlers
grep -rn 'async.*=>.*{' --include='*.ts' | grep -i 'catch\|err'

Go

# All if err != nil blocks
grep -rn 'if err != nil' --include='*.go' | head -200

# recover() calls
grep -rn 'recover()' --include='*.go'

# Error swallowing patterns
grep -rn '_ = .*Err\|, _ :=.*Err' --include='*.go' | head -50

Python

grep -rn 'except' --include='*.py' | head -200
grep -rn 'except Exception' --include='*.py'
grep -rn 'except:' --include='*.py'  # bare except — almost always bad

Rust

grep -rn '\.unwrap()\|\.expect(' --include='*.rs' | head -100
grep -rn 'match.*Err.*=>' --include='*.rs' | head -50

CLASSIFICATION CRITERIA

For each error-handling site, classify as:

KEEP — serves a real purpose

The handling does one of these:

  1. Real boundary — catches at a process / async boundary where errors must not propagate (HTTP request handler, background job runner, message consumer). Converts to logged + 500 / dead-letter / retried.
  2. Real recovery — alternative path exists and is correct (cache miss → fetch from source; primary DB down → secondary; parse failure → use default-but-clearly-logged).
  3. Real logging — error is logged with context, then re-thrown / re-returned. Adds value via structured logging.
  4. Real cleanup — resource handle released, lock released, transaction rolled back. The catch is the cleanup mechanism.
  5. Real user-facing reporting — catches to format an error message for the user (UI form errors, CLI exit codes).

Read the full file on GitHub · 196 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 3d ago First seen · 196 lines · 79 tokens per session scan A 0feaaf7df70b

Subscribe to this mod's changes

error-cleanup is an agent published in the GitHub repository alphabravo-oss/guild (2 stars, last pushed 5d ago), licensed MIT. It adds 79 tokens to every session and 2,054 once invoked, about $0.0004 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-04.