prune

A cleanup command that searches a codebase and its `CLAUDE.md` instruction files for dead code and unnecessary content, then verifies the approved changes. Dead code is code that is no longer used.

In plain words
What is it for?
Use it to analyze the whole project or a selected directory, review proposed removals, apply approved changes, and run the test suite.
Why use it?
It helps find removable code and oversized instructions while checking that cleanup did not cause test regressions.

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/kesteva/soloflow/prune
Clone the repo
git clone --depth 1 https://github.com/kesteva/soloflow
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 2,000 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.02000
Opus 5 $0.00011 $0.01000
Sonnet 5 $0.00004 $0.00400
Haiku 4.5 $0.00002 $0.00200

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

Security

Grade A, and why

prune 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.

commands/prune.md · 174 lines

How it starts

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

/soloflow:prune

Performs a comprehensive pruning pass across the codebase and all CLAUDE.md files. Spins up parallel analysis agents, presents findings for approval, applies approved changes, and runs the test suite to confirm no regressions.

Scope: $ARGUMENTS (optional — limit analysis to a specific directory; defaults to entire project)


Model resolution

Run once:

node "${CLAUDE_PLUGIN_ROOT}/scripts/config/resolve.js" \
    --key models.codebase_pruner --key models.claudemd_pruner \
    --fallback opus --fallback opus

Line 1 is the codebase-pruner model; line 2 is the claudemd-pruner model.

Step 0: Check initialization

If .soloflow/ does not exist, report: "SoloFlow not initialized. Run /soloflow:init first." and stop.

Step 1: Create prune branch

  1. Verify working tree is clean: git status --porcelain. If dirty, tell the user to commit or stash first and stop.
  2. Capture current branch: git rev-parse --abbrev-ref HEAD.
  3. Create and checkout a new branch: git checkout -b soloflow/prune-$(date +%Y%m%d-%H%M%S).
  4. Print: Prune branch: {branch_name} (base: {base_branch}).

Step 2: Parallel analysis

Spawn two agents in parallel using the Agent tool:

Agent A: Codebase Pruner

  • Agent definition: codebase-pruner
  • Task: "Audit the codebase at {project_root} for dead code, redundancy, inefficiency, and orphaned assets. {If $ARGUMENTS specifies a scope, add: Focus on {scope}.} Produce a structured pruning report."
  • Model: resolved models.codebase_pruner (see Model resolution above)

Agent B: CLAUDE.md Pruner

  • Agent definition: claudemd-pruner
  • Task: "Audit all CLAUDE.md files in {project_root} for redundancy, staleness, scope misplacement, and content that should move to specialized reference files. Produce a structured pruning report."
  • Model: resolved models.claudemd_pruner (see Model resolution above)

Wait for both agents to complete.

Step 3: Present findings for approval

Combine the two reports into a unified presentation. For each category, present items grouped by type:

Read the full file on GitHub · 174 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 · 174 lines · 22 tokens per session scan A 8949f4e14d55

Subscribe to this mod's changes

prune is a command published in the GitHub repository kesteva/soloflow (40 stars, last pushed 3mo ago), licensed MIT. It adds 22 tokens to every session and 2,000 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-30.