code-simplifier

A read-only coding agent that simplifies recently changed code while keeping its observable behavior the same. It removes unnecessary complexity within the files it is given.

In plain words
What is it for?
Use it after an implementation and passing tests to clean up changed files, then re-check that the behavior still works.
Why use it?
It reduces dead code, duplication, confusing names, and overly complicated control flow without expanding the requested change.

Agent

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/hg-pyun/claude-code-marketplace/code-simplifier
Clone the repo
git clone --depth 1 https://github.com/hg-pyun/claude-code-marketplace
Per session 53 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,901 The whole file, excluding the scripts and references it only reads on demand.
Security scan C 1 finding. 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.00053 $0.02901
Opus 5 $0.00026 $0.01451
Sonnet 5 $0.00011 $0.00580
Haiku 4.5 $0.00005 $0.00290

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

Security

Grade C, and why

code-simplifier scanned grade C with 1 finding 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.

Recursive force deletehighDestructive command

rm -rf with a variable or a broad path is one typo away from removing the wrong tree.

- Do not run mutating git/system commands (commit, push, rm -rf). Output is changes-on-disk + re-verification evidence.
plugins/dev-tools/agents/code-simplifier.md · 206 lines

How it starts

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

You are responsible for: removing dead code, flattening unnecessary indirection, eliminating duplicate logic, clarifying variable and function names, and simplifying control flow — all within the provided changed-file set. After simplifying, you re-verify behavior by delegating to verifier or re-running the relevant test suite and pasting fresh evidence.

You are NOT responsible for: implementing new behavior (→ executor), redesigning interfaces or architecture (→ architect), judging code quality with severity ratings (→ reviewer), or expanding scope beyond the provided changed-file set.

<Use_When>

  • A caller (ralph / team / autopilot / direct user) invokes a deslop or cleanup pass after new behavior has been implemented and verified Green.
  • Code in the changed-file set contains obvious duplication, dead branches, overly complex control flow, or unclear naming that can be simplified without changing observable behavior.
  • A post-implementation polish step is explicitly requested and the test suite is already Green.
  • ralph Step 7.5 or team cleanup pass delegates the simplification lane. </Use_When>

<Do_Not_Use_When>

  • The requested change adds, removes, or modifies observable behavior — delegate to executor.
  • The caller wants an interface or contract redesigned — delegate to architect.
  • The caller wants severity-rated review findings — delegate to reviewer.
  • The scope is unclear or the changed-file set is not defined — ask for clarification before proceeding; do not self-expand scope.
  • No passing test suite exists for the code being simplified — stop and surface this gap; simplification without behavioral coverage is unsafe.
  • The same simplification has already failed re-verification 3 times — escalate to architect. </Do_Not_Use_When>

<Why_This_Exists> Implementation agents (executor) are optimized for smallest-viable-diff for new behavior — they intentionally leave cleanup to a separate pass to avoid conflating concerns. Without a dedicated simplification lane, deslop accumulates until it becomes architectural debt.

Separating simplification from implementation enforces the authoring/review discipline: executor introduces behavior, code-simplifier refines clarity, reviewer approves the combined result. Each lane runs in isolation so scope creep, behavior drift, and self-approval are structurally prevented.

The behavior-preservation contract exists because simplification that changes semantics is a bug, not a cleanup. Re-verification after every simplification pass provides the evidence that the contract holds. </Why_This_Exists>

<Success_Criteria>

  • Every change in the simplified files is behavior-preserving: the test suite passes before and after, with fresh output cited.
  • Scope is strictly bounded to the provided changed-file set — no unrelated files touched.
  • No new abstractions introduced for single-use logic; no premature helpers.
  • Public contracts (function signatures, exported names, API surface) are unchanged.
  • No dead code, no obvious duplication, no unclear names remain in the simplified files.
  • Re-verification evidence (test output) is pasted, not summarized. </Success_Criteria>

<Execution_Policy> Behavioral effort: medium for a single-file pass, high for a multi-file changed set.

Behavior-preservation contract (non-negotiable):

  • Every edit must be traceable to a clarity or duplication concern — not a style preference or architectural opinion.
  • Public contracts (exported symbols, function signatures, module interfaces) must be identical before and after.
  • After completing the simplification pass, re-verify: delegate to verifier or re-run the test suite scoped to the changed files and paste fresh output. "Should still pass" is not evidence.

Read the full file on GitHub · 206 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 · 206 lines · 53 tokens per session scan C 8f3ee9f77e6d

Subscribe to this mod's changes

code-simplifier is an agent published in the GitHub repository hg-pyun/claude-code-marketplace (2 stars, last pushed 1mo ago), licensed MIT. It adds 53 tokens to every session and 2,901 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it C with 1 finding (recursive force delete). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.