The Algorithm by Elon Musk

A decomposed set of agent skills (and Obsidian-compatible notes) implementing Elon Musk's 5-step engineering algorithm. The algorithm was articulated by Musk during the 2021 Starbase tour with Tim Dodd ("Everyday Astronaut") and curated in The Book of Elon by Eric Jorgenson (Simon & Schuster, 2026).
Compatible with Claude Code, Codex, Cursor, and any other agent that reads the AGENTS.md or Agent Skills (SKILL.md) open standard.
Inspired by multica-ai/andrej-karpathy-skills. The Karpathy guidelines target LLM coding behavior; this framework targets engineering decision-making at the feature and system level. The two are complementary and can be installed together.
The Algorithm
Five steps in strict order. The order is the framework: optimizing or automating a thing that should not exist is the most common engineering failure.
Plus an entry-point overview skill: musk-algorithm.
Why decomposed
Each step is its own skill with its own trigger conditions, its own Gate (which enforces prior steps are complete), and its own protocol. Three benefits:
- Specific triggers. A phrase like "let's optimize this query" triggers the step 3 skill, which then refuses to proceed until steps 1 and 2 have visibly run.
- Order enforcement via Gates. Each step skill includes a Gate section with backward wiki links. If the Gate cannot be satisfied, the skill stops and redirects.
- Obsidian-native. The wiki links between skills work in any Obsidian vault, so the same files serve as a knowledge graph.
Scope and Use Cases
This framework is primarily designed for review and cleanup of existing systems (brownfield work). The algorithm's natural verbs (delete, simplify, accelerate, automate) assume something already exists. Three of the five steps require existing state: step 2 needs an inventory, step 4 needs measured cycle time, step 5 needs a manual execution history.
Best fit
- Auditing accumulated complexity in existing systems
- Pruning feature backlogs, dashboards, services, dependencies
- Reviewing technical debt with structured cuts
- Evaluating whether to automate a process that has been running manually
Awkward fit (use with translation)
Building greenfield applications from scratch. Only steps 1, 2, and 3 are actively useful at the start; steps 4 and 5 wait until you have an operational system.
| Step | Greenfield meaning |
|---|
| 1. Question requirements | Where most of the value lives. Refuse every feature without a named owner. |
| 2. Delete parts | "Default to no". Reject speculative abstractions and unrequested features. |
| 3. Simplify | Build the simplest thing that solves the named requirement. |
| 4. Accelerate | Not applicable until v1 exists. |
| 5. Automate | Not applicable until the system has been operated manually. |
Wrong fit
Function-level coding decisions (variable naming, error handling style, refactoring patterns). The algorithm operates at the feature and system level, not the function level. For function-level guidance, pair with andrej-karpathy-skills.
Repository Layout