debloat

debloat is a command for Claude Code from randomittin/heimdall. It costs 62 tokens per session (1,211 once invoked), scanned A, original, MIT.

A read-only report and proposed-refactoring workflow for measuring unnecessary complexity in an existing code repository. It checks dead exports, duplicated code, complexity hotspots, unused dependencies, and possible deletion size before suggesting changes.

In plain words
What is it for?
Use it to assess repository bloat, write a BLOAT-REPORT.md scorecard, and—when the test suite passes—propose cleanup work as a pull request.
Why use it?
Large or inherited repositories can contain excess code that is difficult to judge by inspection. The scorecard turns that concern into a measured report, while tests act as a safety check before changes are proposed.

Command for Claude Code

Written for Claude Code: disable-model-invocation in frontmatter.

Part of the hmd plugin — 7 skills, 19 commands, 16 agents, 8 hooks, 1 MCP server shipped together

Good fit Use it to assess repository bloat, write a BLOAT-REPORT.md scorecard, and—when the test suite passes—propose cleanup work as a pull request.

Compare 6 commands from other repositories ↓
Install with agentmods
npx agentmods add commands/randomittin/heimdall/debloat
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/randomittin/heimdall

Made for: Claude Code.

Or install hmd, the plugin that ships this one along with the rest of its 7 skills, 19 commands, 16 agents, 8 hooks, 1 MCP server.

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 debloat

README.md
[![agentmods](https://agentmods.dev/badge/commands/randomittin/heimdall/debloat/github.svg)](https://agentmods.dev/commands/randomittin/heimdall/debloat)
Your own site
<a href="https://agentmods.dev/commands/randomittin/heimdall/debloat"><img src="https://agentmods.dev/badge/commands/randomittin/heimdall/debloat/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for debloat

Your own site · 80×15
<a href="https://agentmods.dev/commands/randomittin/heimdall/debloat"><img src="https://agentmods.dev/badge/commands/randomittin/heimdall/debloat.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 62 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,211 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.00062 $0.01211
Opus 5.5 $0.00025 $0.00484
Sonnet 5.5 $0.00012 $0.00242
Haiku 4.5 $0.00006 $0.00121

Measured 1mo ago against content hash 3e87e49a8e84, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

debloat 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 1mo 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/debloat.md · 97 lines

How it starts

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

Debloat — Retroactive Whole-Repo Bloat Removal

Turn the H-2 bloat engine (bin/bloat-gate) on an ENTIRE existing repo. This is the adoption hook: a cold-repo, no-setup command that produces a real bloat scorecard, and — only when it can prove safety — proposes removals as a PR.

When to use

  • Someone wants a bloat read on a repo Heimdall did not build (the reply-guy reply).
  • Before adopting the per-wave bloat gate, to clear the existing debt.
  • To turn "this codebase feels bloated" into a measured, prioritized PR.

Instructions

  1. Always start read-only. Run the one-word scorecard on any repo:

    bin/heimdall-debloat report [<path>]      # <path> defaults to cwd
    

    report is the friendly, screenshot-worthy entrypoint (a back-compatible alias of --report-only). It runs ONLY the read-only scorecard pass, writes BLOAT-REPORT.md (dead exports, duplication clusters, complexity hotspots, unused deps, candidate-deletion LOC estimate), makes NO changes, and prints a truecolor BLOAT SCORECARD card to the terminal. The equivalent legacy form still works and is unchanged:

    bin/heimdall-debloat --report-only --repo <path>
    

    Present the report. Skipped axes mean the analysis tool is absent — say so honestly; an absent tool is a gap, never a pass.

    The BLOAT SCORECARD card. report (and --report-only when run interactively on a tty) prints a one-frame scorecard: the 5 axes — dead exports, duplication %, cyclomatic complexity, dependency creep, LOC budget — each with its real value from the bloat-gate run and a ✓ / ⚠ / ✗ glyph, plus an overall verdict (LEAN / NEEDS TRIMMING / BLOATED, or INCONCLUSIVE when every axis was skipped) and the repo name. Numbers come straight from the same data as BLOAT-REPORT.md; an axis whose tool is absent reads skipped: needs <tool> — never a fabricated number. Piped / CI output is clean plain text (zero ANSI), so it is safe to redirect or capture.

Read the full file on GitHub · 97 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. 1mo ago First seen · 97 lines · 62 tokens per session scan A 3e87e49a8e84

Subscribe to this mod's changes

debloat is a command published in the GitHub repository randomittin/heimdall (5 stars, last pushed 5d ago), licensed MIT. It adds 62 tokens to every session and 1,211 once invoked, about $0.0002 per session on Opus 5.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.

Related

Other commands, from other repositories

subagent-diagnose

Multi-agent failure-investigation orchestrator. Parallel to /subagent-implementation — same scratchpad + investigator + builder/surgeon + reviewer + FOLLOWUPS pattern — but starts from a failure, not a spec. Two modes share one loop: ci (failed CI run is the brief seed) and bug (freeform symptom paragraph is the brief…

damusix/atomic-claude · 0 tokens

quick-fix

Implement→review subagent loop with no planning phase, for a fix whose cause is known and whose shape is obvious, however many files it touches. No spec, no worktree, no docs or signals at the end; one audit. Routes to /subagent-diagnose on an unknown cause and to /atomic-plan on an open approach or contract choice.

damusix/atomic-claude · 73 tokens

atomic-help

Route a lost user to the right atomic verb, skill, agent, or binary subcommand. Bare invocation reads git state and recommends one next step. Topic keyword or freeform intent → focused pointer. tour → guided walkthrough of the system. Help router, not duplicated docs.

damusix/atomic-claude · 57 tokens

follow-up

Review and act on pending reminders. Bare invocation shows all reminders as an indexed list; cron-fired invocation (/follow-up due ) surfaces the specific reminder and waits for a response; /follow-up review lists stale project follow-up entries for per-item disposition (extend/close/promote/skip). Transport-aware…

damusix/atomic-claude · 0 tokens

review-branch

Review the current branch's diff against base by dispatching atomic-reviewer. No orchestration loop, no spec required — pre-flight before /commit pr or /commit merge.

damusix/atomic-claude · 35 tokens

report-issue

Open a atomic GitHub issue via gh. Bug report or feature request — auto-detect from user's description.

damusix/atomic-claude · 22 tokens