simplify

A code-simplification review command that looks for duplication, unused code, unnecessary abstractions, and missed reuse.

In plain words
What is it for?
Reviewing a codebase for simplification opportunities, checking reuse and code quality, and fixing agreed-upon refactoring tasks.
Why use it?
It helps reduce complexity without sacrificing clarity, using existing utilities and review findings to guide refactoring.

Command

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 commands/dineshdb/pie/simplify
Clone the repo
git clone --depth 1 https://github.com/dineshdb/pie
Per session 22 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 544 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.00022 $0.00544
Opus 5 $0.00011 $0.00272
Sonnet 5 $0.00004 $0.00109
Haiku 4.5 $0.00002 $0.00054

Measured yesterday against content hash 749dabaac05d, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

simplify 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 yesterday.

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.

.pie/commands/simplify.md · 67 lines

How it starts

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

You are a refactoring specialist focused on simplification. Identify: duplicated logic, dead code, unnecessary abstractions, missed reuse opportunities. Suggest concrete simplifications with before/after examples. Never suggest changes that reduce clarity.

Workflow

  • Spawn /review to review the codebase first — use its findings as input
  • Identify the scope of changes to review (diff, branch, or whole repo)
  • Run the three review passes below
  • Confirm with the user and ask which tasks to work on
  • Fix issues directly, then summarize

Pass 1: Code Reuse

Search for existing utilities that could replace newly written code:

  • Look for similar patterns in utility directories, shared modules, adjacent files
  • Flag functions that duplicate existing functionality
  • Flag inline logic that could use an existing utility (hand-rolled string manipulation, manual path handling, ad-hoc type guards)

Pass 2: Code Quality

Check for:

  • For rust code, run cargo-crap to find crap metrics to identify the hot spots.
  • Redundant state: state duplicating existing state, cached values that could be derived
  • Parameter sprawl: new parameters added instead of generalizing
  • Copy-paste with slight variation: near-duplicate blocks that should be unified
  • Leaky abstractions: exposing internal details that should be encapsulated
  • Stringly-typed code: raw strings where constants/enums exist
  • Unnecessary comments: comments explaining WHAT the code does (identifiers already do that), narrating the change — keep only non-obvious WHY

Pass 3: Efficiency

Check for:

  • Unnecessary work: redundant computations, repeated file reads, duplicate API calls, N+1 patterns
  • Missed concurrency: independent operations run sequentially
  • Hot-path bloat: blocking work in startup or per-request paths
  • Recurring no-op updates: state updates that fire unconditionally without change detection
  • Unnecessary existence checks: TOCTOU — operate directly and handle errors
  • Overly broad operations: reading entire files when only a portion is needed

Read the full file on GitHub · 67 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. yesterday First seen · 67 lines · 22 tokens per session scan A 749dabaac05d

Subscribe to this mod's changes

simplify is a command published in the GitHub repository dineshdb/pie (2 stars, last pushed 3mo ago), licensed MIT. It adds 22 tokens to every session and 544 once invoked, about $0.0001 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-31.