Smelt ideas, skim the bugs, forge the product.
Task orchestrator for AI-powered development. Breaks requirements into S-expression ingots and forges them via configurable smith CLIs with strict retry contracts, independent fallback lanes, and proof-based verification.
curl -sSf https://slag.dev/install.sh | sh
One-liner that downloads the binary and adds to PATH
curl -fsSL https://slag.dev/slag.sh -o /usr/local/bin/slag && chmod +x /usr/local/bin/slag
cargo install --git https://github.com/sliday/slag
cat > PRD.md << 'EOF'
Build a REST API with auth and rate limiting
EOF
slag "Build the REST API from PRD.md"
⚠ slag gives the configured smith autonomous shell access. Use in a dedicated directory or container.
PRD.md PROGRESS.md (ore) (ledger) | ^ v | +-----------+ +-----------+ +--------+ +--------+ +-------+ | SURVEYOR |--->| FOUNDER |--->| FORGE |--->| REVIEW |--->| ASSAY | | analyze | | cast | | strike | | CI+AI | | report| +-----------+ +-----------+ +--------+ +--------+ +-------+ | | | | v v v v BLUEPRINT.md PLAN.md branches merge to main (analysis) (s-expr) (worktree) (--worktree)
PICK ORE PARALLEL ANVILS | +---------+---------+ v | | | :solo t? ----yes-----> ANVIL 1 ANVIL 2 ANVIL 3 | | | | no v v v | (each anvil is independent subshell) v SELECT SMITH by :skill + :grade | | web/frontend --> +Playwright | grade >= 3 --> plan mode | default --> base tools v STRIKE (smith invocation) | v CMD (extract & run shell command) | v PROOF (run :proof shell command) | +----- pass ----> :forged + git commit | +----- fail ----> :heat++ retry with slag feedback | +----- max -----> RE-SMELT (analyze failure, :smelt 0→1) | +----- rewrite --> new ore (retry) +----- split ----> sub-ingots (2-4) | +----- crack again? | v RECONSIDER (rethink approach, :smelt 1→2) | +----- rethought --> new ore +----- decomposed -> sub-ingots +----- impossible -> :cracked
Deep analysis with plan mode. Reads PRD.md (ore), produces BLUEPRINT.md with architecture, dependency graph, risk assessment, and forging sequence. Self-iterates to resolve any ambiguity.
Casts S-expression ingots from the blueprint. Each ingot has an ID, complexity grade, skill tag, proof command, and work description. Outputs PLAN.md as the crucible.
Strikes each ingot via the configured smith. Solo ingots run on parallel anvils (up to 3). Selects smith by skill and grade. Retries with slag feedback on failure. Commits on success.
Master agent quality gate. With --worktree, each ingot forges in an isolated branch. Review runs CI checks (fmt, clippy, test), then AI reviews the diff. Approved branches merge; rejected ones are marked cracked for retry/recovery.
Final quality report. Shows forged/cracked counts, temperature bar, and identifies any cracked ingots. Exits 0 on full forge, 1 if any ingot cracked.
S-expressions are single-line, grep/sed parseable, require zero dependencies, and survive bash string handling. Every ingot is one line in PLAN.md. The entire orchestrator can manipulate state with sed_i without any JSON/YAML parser. Fields are keyword-prefixed (:id, :status) making them unambiguous to extract with pattern matching.
Independent ingots (:solo t) run concurrently in background subshells, up to MAX_ANVILS=3. This gives 3x throughput for foundation tasks that have no dependencies. Each anvil gets its own smith process. Sequential ingots (:solo nil) run one at a time after parallel work completes.
Every ingot carries a :proof field containing a shell command. Exit code 0 means pass, anything else means fail. No human review needed. Proofs are concrete: "test -f file", "npm test", "grep -q pattern file". This enables fully autonomous forging with machine-verifiable quality gates.
When a surveyor or founder output contains questions, slag detects them and feeds the output back with instructions to resolve autonomously. Up to 3 rounds. This prevents the forge from stalling on ambiguity. The AI is instructed to make expert decisions rather than ask for clarification.
When an ingot cracks after exhausting all heats, re-smelting analyzes failure logs, blueprint, and git history to diagnose the root cause. Retry outputs now pass a strict contract: change approach, avoid known failed proof signatures, and provide concrete proof commands. If the primary recovery output is rejected, slag can escalate to an independent fallback smith. If a re-smelted ingot cracks again, a reconsider step triggers — a surveyor-level re-analysis that questions the fundamental approach rather than tweaking details. This gives each ingot two chances to self-correct before permanently cracking: re-smelt (fix) then reconsider (rethink). Only the specific ingot is affected; other anvils continue undisturbed. Analysis now detects sandbox/permission failures (read-only environments where the smith cannot write files) and skips immediately instead of spiraling through futile retries.
Unambiguous vocabulary that maps naturally to the pipeline. Ore (raw input) is surveyed, cast into ingots, heated in a forge, and either becomes forged steel or cracked waste. Every term has exactly one meaning. The temperature gradient (cold → hot → pure) maps to progress from unstarted to complete.
The installer adds ~/.slag/bin to your shell profile automatically. Open a new terminal or run:
source ~/.zshrc # or ~/.bashrc
If that doesn't work, manually add to your profile: export PATH="$HOME/.slag/bin:$PATH"
Run slag update to self-update to the latest release. This downloads the new binary from GitHub and replaces the current one.
The Rust binary is faster, has better error handling, and includes self-update. The bash script is a single file with no build step — useful if you can't install Rust or want to inspect/modify the orchestrator directly.
Not for the Rust binary. It auto-detects the first compatible smith CLI (kimi Claude-compatible, then codex, gemini, opencode, claude, with native kimi as fallback) unless you set SLAG_SMITH explicitly. The legacy bash script still expects Claude CLI.
| Field | Values | Meaning |
|---|---|---|
:id |
"i1", "i2", ... | Unique ingot identifier |
:status |
ore | molten | forged | cracked | Lifecycle state |
:solo |
t | nil | Can run in parallel (t) or must be sequential (nil) |
:grade |
1-5 | Complexity level; grade ≥ 3 uses plan mode |
:skill |
web | api | cli | default | Selects smith tools/plugins |
:heat |
0-N | Current retry attempt |
:max |
5-8+ | Max retries before cracking |
:smelt |
0-2+ | Re-smelt/reconsider count (0 = never, 1 = re-smelted, 2 = reconsidered) |
:proof |
shell command | Acceptance test (exit 0 = pass) |
:work |
string | Task description for the smith |
slag uses emoji indicators to show ingot status at a glance:
[ ✅3 🔥1 🧱5 ] 37%
| Emoji | Status | Meaning |
|---|---|---|
| 🧱 | queued | Ingot is ore, waiting to be forged |
| 🔥 | forging | Ingot is molten, currently being worked |
| ✅ | done | Ingot is forged, proof passed |
| ❌ | failed | Ingot cracked after exhausting all heats |
The percentage shows overall progress: forged ingots ÷ total ingots.