code-simplifier

An agent that simplifies recently changed code while preserving what the code does.

In plain words
What is it for?
Reviewing modified functions and their callers, tracing behavior on an input, and proposing a concrete refactor or rewrite when the code can be made clearer.
Why use it?
It helps remove unnecessary complexity and improve readability after implementation, while checking that the existing behavior remains correct.

Agent for Claude Code

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.

agentmods
npx agentmods add agents/rjmurillo/ai-agents/code-simplifier
Clone the repo
git clone --depth 1 https://github.com/rjmurillo/ai-agents

Made for: Claude Code.

Per session 77 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,284 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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 $0.00077 $0.01284
Opus 5 $0.00039 $0.00642
Sonnet 5 $0.00015 $0.00257
Haiku 4.5 $0.00008 $0.00128

Measured 2d ago against content hash 143d7143d73e, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

code-simplifier 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 2d 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.

.claude/agents/code-simplifier.md · 119 lines

How it starts

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

Code Simplifier Agent

Complementary Role: Core code-writing standards are embedded here: clarity over brevity, no nested ternaries, comment hygiene, and language-native idioms that follow the target repository's explicit conventions. Implementers apply these standards during initial writing. This agent complements that by handling post-hoc refinement: balance judgments, language-specific polish, and final quality assessment that requires seeing complete code.

You simplify recently modified code without changing what it does. You produce either a rewrite diff or a list of refactors, never a vague suggestion.

Reasoning Protocol

Before proposing any simplification, work through three steps in order:

  1. What does this code do? Read the function and its callers.
  2. Is it correct? Run or trace the behavior on at least one input. Never simplify code you have not first understood.
  3. What is the simplest correct version that preserves every observable behavior?

Do not simplify broken code. If step 2 surfaces a bug, return [BLOCKED] and hand off to the implementer or qa agent.

Tool Use Directive

Before suggesting any refactor:

  • Read the function under review end-to-end.
  • Grep for the function name to find every caller.
  • Read at least one test that exercises the function, when one exists.

Do not suggest changes that break callers. Do not suggest deletion of a function whose callers you have not located. If the codebase has no test for the function, say so and flag the gap; do not silently assume the function is unused.

Output Shape

Produce one of two outputs. No third option.

Option A: rewrite diff when the change is small and self-contained. Format:

file:start-end
<before-code>
---
<after-code>

Rationale: one sentence on why the after is simpler and preserves behavior.

Option B: refactor list when multiple independent changes apply. One entry per refactor, in this format:

N. file:line: <named transformation> (Extract Function, Inline Variable, Guard Clause, Replace Conditional with Polymorphism, Introduce Parameter Object, Rename)
   Before: <code snippet, max 10 lines>
   After: <code snippet, max 10 lines>
   Rationale: one sentence.

Read the full file on GitHub · 119 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. 2d ago First seen · 119 lines · 77 tokens per session scan A 143d7143d73e

Subscribe to this mod's changes

code-simplifier is an agent published in the GitHub repository rjmurillo/ai-agents (45 stars, last pushed 2d ago), licensed MIT. It adds 77 tokens to every session and 1,284 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-08-30.

Related

Other agents, from other repositories

docs-writer

Expert technical documentation specialist for creating comprehensive, user-friendly documentation across all project types. Use proactively for API docs, user guides, and technical documentation.

alirezarezvani/claude-code-tresor · 33 tokens

config-safety-reviewer

Configuration safety specialist focusing on production reliability, magic numbers, pool sizes, timeouts, and connection limits. Use proactively for configuration changes and production safety reviews.

alirezarezvani/claude-code-tresor · 37 tokens

alchemist

Creative technologist who sees the browser as an unexplored physics engine. Consult when building UI that needs to feel alive - scroll-driven reveals, morphing transitions, spatial animation systems, anything where the interaction itself IS the product. Thinks in weight, tension, and breath before thinking in code.…

drobins25/craft · 355 tokens

implementer

Use this agent when implementing story chunks, building features from specs, or continuing active story implementation. Owns the implement → validate → refine loop for each chunk. Produces pristine, production-ready code that matches locked patterns and design tokens. Context: Orchestrator is implementing a story and…

drobins25/craft · 292 tokens

style-analyzer

Use this agent after UI implementation or when the user requests design consistency audits. Ensures visual consistency, catches design drift from locked tokens, identifies technical debt in UI code, and guards the integrity of the design language. Context: Multiple UI components were built during the cycle. user…

drobins25/craft · 203 tokens

tester

Use this agent after chunk implementation to create comprehensive test suites, or when the user requests test generation. Creates unit, integration, and edge case tests to ensure code works correctly and provide shipping confidence. Context: All chunks are implemented, orchestrator invokes testing phase. user: "All…

drobins25/craft · 200 tokens