musk-algo

musk-algo is a command for Claude Code from blutrich/musk-algo-plugin. It costs 33 tokens per session (3,207 once invoked), scanned A, original, MIT.

A repository-analysis command that looks for unnecessary work and the main bottleneck slowing a software project. It combines Musk's five-step process for removing needless parts with Goldratt's Theory of Constraints, a method for finding the limiting step in a system.

In plain words
What is it for?
Use it to map a local repository, inspect files, dependencies, size, history, and activity, and produce a specific report with examples and a prioritized improvement plan.
Why use it?
It helps developers separate code that should be removed from code that merely needs improvement, then focus effort on the constraint with the biggest overall effect.

Command for Claude Code

Written for Claude Code: argument-hint in frontmatter. Also seen: mentions Claude Code.

Part of the musk-algo plugin — 1 command shipped together

Good fit Use it to map a local repository, inspect files, dependencies, size, history, and activity, and produce a specific report with examples and a prioritized improvement plan.

Compare 6 commands from other repositories ↓
Install with agentmods
npx agentmods add commands/blutrich/musk-algo-plugin/musk-algo
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/blutrich/musk-algo-plugin

Made for: Claude Code.

Or install musk-algo, the plugin that ships this one along with the rest of its 1 command.

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 musk-algo

README.md
[![agentmods](https://agentmods.dev/badge/commands/blutrich/musk-algo-plugin/musk-algo/github.svg)](https://agentmods.dev/commands/blutrich/musk-algo-plugin/musk-algo)
Your own site
<a href="https://agentmods.dev/commands/blutrich/musk-algo-plugin/musk-algo"><img src="https://agentmods.dev/badge/commands/blutrich/musk-algo-plugin/musk-algo/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 musk-algo

Your own site · 80×15
<a href="https://agentmods.dev/commands/blutrich/musk-algo-plugin/musk-algo"><img src="https://agentmods.dev/badge/commands/blutrich/musk-algo-plugin/musk-algo.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 33 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 3,207 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.00033 $0.03207
Opus 5 $0.00016 $0.01604
Sonnet 5 $0.00007 $0.00641
Haiku 4.5 $0.00003 $0.00321

Measured 11d ago against content hash f8f75704deab, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-11, from the pricing page.

Security

Grade A, and why

musk-algo 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 11d 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.

plugins/musk-algo/commands/musk-algo.md · 261 lines

How it starts

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

Musk Algo — Repo Flow Analyzer

Analyze the repo at $ARGUMENTS through two lenses:

  1. Musk's 5-Step Algorithm — find what shouldn't exist at all
  2. Theory of Constraints (Goldratt) — find what's slowing the entire system

Produce a deep, specific, actionable report with before/after examples and a prioritized roadmap. If $ARGUMENTS is empty, ask the user which repo path to analyze.


Phase 0: Repo Intake

Build a map of the repo before diving in:

# Structure
find <repo> -type f | grep -v node_modules | grep -v .git | grep -v dist | grep -v __pycache__ | head -100

# LOC by file
find <repo> -type f | grep -v node_modules | grep -v .git | xargs wc -l 2>/dev/null | sort -rn | head -30

# Dependency files
find <repo> -name "package.json" -o -name "requirements.txt" -o -name "Cargo.toml" -o -name "pom.xml" -o -name "go.mod" | grep -v node_modules

# Git depth
cd <repo> && git log --oneline | wc -l 2>/dev/null

# Largest files
find <repo> -type f -not -path "*/node_modules/*" -not -path "*/.git/*" | xargs ls -la 2>/dev/null | sort -k5 -rn | head -20

Build a mental model: project type, languages, scale (LOC, files, deps), activity (commits).

Detect repo type before choosing the scan depth

Some repos are 95% code. Others (Claude Code plugins, prompt libraries, documentation sites) are 95% markdown with a small code sidecar. The Musk/Goldratt lens still applies to prompt-heavy repos, but the scans in Phase 1 need to shift:

# What's the dominant file type?
find <repo> -type f -not -path "*/node_modules/*" -not -path "*/.git/*" -not -path "*/dist/*" \
  | sed 's/.*\.//' | sort | uniq -c | sort -rn | head -10

If .md dominates, treat prompts/skills as the "code" — scan them for stale references, half-finished renames, duplicated instructions, and sections that no longer match the current architecture. Tell the user explicitly: "This is a prompt-heavy repo, I'm shifting to a content-audit lens."

Tracked-artifact scan (things that shouldn't be in git at all)

Read the full file on GitHub · 261 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. 11d ago First seen · 261 lines · 33 tokens per session scan A f8f75704deab

Subscribe to this mod's changes

musk-algo is a command published in the GitHub repository blutrich/musk-algo-plugin (2 stars, last pushed 4mo ago), licensed MIT. It adds 33 tokens to every session and 3,207 once invoked, about $0.0002 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.