{"id":42752064,"url":"https://github.com/sliday/slag","last_synced_at":"2026-04-02T16:47:13.415Z","repository":{"id":334915791,"uuid":"1143216970","full_name":"sliday/slag","owner":"sliday","description":"Smelt ideas, skim the bugs, forge the product.","archived":false,"fork":false,"pushed_at":"2026-02-18T23:15:51.000Z","size":4905,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-02-19T04:41:05.848Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sliday.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-01-27T10:01:18.000Z","updated_at":"2026-02-18T23:15:53.000Z","dependencies_parsed_at":null,"dependency_job_id":"79375db5-bd40-4d1e-87f9-cedc0c2fe20b","html_url":"https://github.com/sliday/slag","commit_stats":null,"previous_names":["sliday/slag"],"tags_count":28,"template":false,"template_full_name":null,"purl":"pkg:github/sliday/slag","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sliday%2Fslag","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sliday%2Fslag/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sliday%2Fslag/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sliday%2Fslag/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sliday","download_url":"https://codeload.github.com/sliday/slag/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sliday%2Fslag/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29955885,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-28T22:53:01.873Z","status":"ssl_error","status_checked_at":"2026-02-28T22:52:50.699Z","response_time":90,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-01-29T20:00:25.682Z","updated_at":"2026-04-02T16:47:13.399Z","avatar_url":"https://github.com/sliday.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# slag\n\n[slag.dev](https://slag.dev)\n\n**Smelt ideas, skim the bugs, forge the product.**\n\nA task orchestrator for AI-powered development. Give it a product requirement, and it breaks it into verifiable tasks, executes them via a configured smith CLI, and proves each one passed before moving on.\n\n![slag-promo](https://github.com/user-attachments/assets/d12def06-6eab-4236-9634-bbbd09be6683)\n\n## What's new in v1.5.0\n\n- **Default parallel anvils raised from 3 to 6.** Better utilization for Claude Max and high-rate-limit API tiers. Override with `--anvils N`.\n- **Stall detection with proactive cancellation.** If an anvil exceeds 2x the average sibling completion time (floor 10 min), it is aborted and the ingot requeued as ore. Configurable via `SLAG_STALL_MULTIPLIER` (default 2.0) and `SLAG_STALL_FLOOR_SECS` (default 600). Works in all modes, not just verbose.\n- **Parallel proof re-evaluation.** Post-forge proof checks for cracked ingots now run concurrently via JoinSet instead of sequentially. With 6 cracked ingots this reduces re-eval from ~12 min worst case to ~2 min.\n\n## What's new in v1.4.1\n\n- **Fix: `truncate_output` byte cap for short-but-huge output.** When output had few lines but exceeded 4KB, the early return path skipped the byte cap and duplicated lines. Now applies byte cap directly.\n- **Fix: `git_revert_last` now creates proper revert commits.** Removed `--no-commit` flag that was leaving dirty tree state, bleeding staged changes into the next heat's experiment commit.\n- **Fix: `parse_test_output` accumulates across crates.** Multi-crate `cargo test --all` output now sums pass/fail counts instead of only keeping the last crate's numbers.\n\n## What's new in v1.4.0\n\n- **`slag self-improve` — slag can improve its own codebase and submit PRs.** Clones from GitHub, forges improvements in `/tmp/` sandbox, measures before/after metrics (tests, clippy), and creates a PR via `gh` if improved. Anyone can contribute improvements without touching the source repo directly.\n- **Freeform targets:** `slag self-improve quality` (predefined) or `slag self-improve \"Add streaming support to smith output\"` (any freeform text becomes a commission).\n- **Existing PR detection:** before starting, queries GitHub for open self-improve PRs. Shows a TUI picker to continue an existing PR or start fresh.\n- **Predefined targets:** `quality` (clippy), `tests` (coverage), `performance` (allocations), `tokens` (prompt sizes).\n- **First verified self-improvement:** slag fixed its own pre-existing clippy warning at `config.rs:345` (needless borrow) that persisted across 5+ releases.\n\n## What's new in v1.3.39\n\n- **TOON tabular experiment ledger**: experiment log switched from JSONL to [TOON](https://github.com/toon-format/toon) (Token-Oriented Object Notation) tabular format. Field names written once in header, rows are compact comma-separated values. ~21% smaller on disk, larger savings when injected into smith prompts. Legacy JSONL files still readable (automatic fallback).\n- **Compact crucible in prompts**: forge prompts now include a summary + current ingot + cracked ingots only, instead of the full PLAN.md. 57% reduction for small projects, 95%+ for large ones (50+ ingots).\n- **TOON history injection**: retry prompts use compact tabular format (`HISTORY(id)[N]{h,status,dur,err,hash}:`) instead of verbose prose blocks.\n- **Shorter section headers**: `=== BLUEPRINT ===` → `[BLUEPRINT]` across all flux prompts. Small per-prompt savings that compound over hundreds of invocations.\n\n## What's new in v1.3.38\n\n- **Experiment-driven forge loop** (inspired by [autoresearch](https://github.com/karpathy/autoresearch)): every heat is now a tracked experiment. Smith work is git-committed BEFORE verification; failures are git-reverted but preserved in history. Enable with `SLAG_GIT_EXPERIMENTS=1` or `--worktree` (always active).\n- **Structured experiment ledger**: every heat (success and failure) recorded as JSONL in `logs/experiments.jsonl` with timing, commit hash, status, and description.\n- **History-informed retries**: on retry, the smith receives structured experiment history (heat #, status, duration, error) instead of raw \"CRACKED\" messages.\n- **Per-ingot time budget**: new `:budget N` field caps smith invocation wall-clock time per heat. Configurable via `SLAG_INGOT_BUDGET_SECS` env or per-ingot field.\n- **Crash recovery protocol**: infrastructure failures (smith timeout, rate limit, missing CMD) no longer consume heats. Only real experiments count. Up to 6 free infra retries before chain failover.\n- **Smart output truncation** (inspired by [pi coding-agent](https://github.com/badlogic/pi-mono/tree/main/packages/coding-agent)): slag messages keep first 5 + last 30 lines, capped at 4KB. Full output in logs.\n- **Structured failure context**: retry messages use typed fields (Type, Exit, CMD, Files changed) instead of raw output dumps.\n- **Flux caching**: blueprint and alloy files read once per ingot, reused across heats instead of re-reading from disk every heat.\n\n## What's new in v1.3.37\n\n- **Claude auto-detect guardrail:** if `ANTHROPIC_API_KEY` is present, auto-detection skips Claude while other supported smith CLIs are available, avoiding accidental API-key billing.\n- **Claude subscription fallback:** if Claude is selected and fails with an API-key or billing-style error, slag now checks for subscription auth and retries once without `ANTHROPIC_API_KEY` when available.\n- **Runtime detection tested locally:** end-to-end shim-based tests now confirm the actual selected smith matches the intended policy, not just the unit-level chain ordering.\n\n## What's new in v1.3.36\n\n- **Explicit smith selection:** `slag` now supports `--smith` and `--smith-chain`, so users can pick an agent without exporting env vars.\n- **Claude-first preference restored:** auto-detection now prefers `claude`, then `codex`, then `gemini`, then the remaining supported smith CLIs.\n- **`claude-plan` / `kimi-plan` selectors:** high-grade routing for the built-in Claude-compatible wrappers now resolves cleanly to plan mode.\n\n## What's new in v1.3.33\n\n- **Fix: `--dangerously-skip-permissions` no longer conflicts with `--permission-mode plan`:** The surveyor and other high-grade smith invocations were appending `--permission-mode plan` even when the base command already had `--dangerously-skip-permissions` (which implies `bypassPermissions`). Claude CLI rejects conflicting permission flags with exit 1. Slag now skips adding plan mode when bypass mode is already active.\n- **Better error diagnostics:** When the smith process exits non-zero with empty stderr, slag now falls back to capturing stdout in the error message. Previously, errors reported to stdout (common in Claude CLI) were silently lost, producing unhelpful `exit 1:` messages.\n\n## What's new in v1.3.32\n\n- **Bare `slag` resumes quarried phases:** Previously, running `slag` (no args) mid-project with PHASES.md would only forge the current phase and never advance to remaining phases. Now PHASES.md presence always loads the multi-phase pipeline, so bare `slag` picks up exactly where it left off.\n\n## What's new in v1.3.31\n\n- **Effort control (`--effort`):** Smith invocations now support `--effort \u003clevel\u003e` (low/medium/high) to control extended thinking budget, preventing surveyor timeouts. Surveyor defaults to `low` effort. Configure globally via `SLAG_EFFORT` or surveyor-specific via `SLAG_SURVEYOR_EFFORT`.\n\n## What's new in v1.3.29\n\n- **Commission chunking (quarrier phase):** Large commissions (\u003e500 chars) are automatically decomposed into 2-5 ordered build phases before survey. Each phase runs the full survey → found → forge pipeline independently. Small commissions skip the quarrier entirely.\n- **Resume support:** Quarried phases are persisted to `PHASES.md`. If a run is interrupted mid-phase, `slag resume` picks up from where it stopped.\n- **`--no-quarry` flag:** Disable commission chunking to force single-pass behavior (old behavior).\n\n## What's new in v1.3.28\n\n- **Sanitized synthetic repair proofs:** outcome validator no longer assigns `echo \"STATUS:PASS\"` as proof commands — these validator output markers are stripped before creating synthetic repair ingots.\n- **Extension exclusion from browser tests:** Chrome/Firefox/Safari extensions and Manifest V3 projects are no longer flagged as browser-testable, preventing impossible Playwright/screenshot requirements.\n- **Subagent timeout guard:** when the primary outcome validator times out, slag no longer escalates to a 90s subagent call — total dead time reduced from 270s to 180s.\n- **Identical-failure early bail:** after 3 consecutive identical failures in the heat loop, slag bails to resmelt instead of burning remaining heats on the same error.\n- **Cycle-aware repair IDs:** synthetic repair ingots now use `v_auto_c{cycle}` IDs to avoid naming confusion across outcome cycles.\n- **Softer confidence penalties:** browser test mismatch penalty reduced from -0.20 to -0.10, preventing impossible-to-reach confidence thresholds for non-Playwright-testable outcomes.\n\n## What's new in v1.3.27\n\n- **Claude became the default smith in v1.3.27:** auto-detection priority was reordered to `claude` first in that release.\n- **Usage-limit failover:** when any smith hits a usage or rate limit, slag automatically fails over to the next smith in the chain instead of crashing.\n\n## What's new in v1.3.26\n\n- **Post-forge proof re-evaluation:** after each forge cycle, slag re-runs the `:proof` command for every cracked ingot. If the proof passes (because an earlier forged ingot already made the needed change), the cracked ingot is promoted to forged without invoking a smith. This eliminates entire retry cycles when overlapping ingots target the same files.\n\n## What's new in v1.3.25\n\n- **Sandbox failure detection:** analysis now recognizes read-only sandbox errors (`READ_ONLY_SANDBOX`, `filesystem writes are blocked`, `operation not permitted`) and immediately skips instead of retrying indefinitely.\n- **Smelt history preserved:** retry cycles no longer reset the `:smelt` counter, so ingots that have been through re-smelt and reconsider reach the skip threshold naturally instead of spiraling.\n- **Prompt repetition activated:** raised max-chars threshold from 12K to 40K so real forge prompts get repeated. Prompts exceeding the limit now get partial tail repetition (last ~2000 chars) instead of being skipped entirely.\n\n## Install\n\n**Binary** (recommended):\n```bash\ncurl -sSf https://slag.dev/install.sh | sh\n```\n\n**Bash version** (no build required):\n```bash\ncurl -fsSL https://slag.dev/slag.sh -o /usr/local/bin/slag \u0026\u0026 chmod +x /usr/local/bin/slag\n```\n\n**From source**:\n```bash\ncargo install --git https://github.com/sliday/slag\n```\n\n## Quick start\n\n```bash\n# Write your requirements\ncat \u003e PRD.md \u003c\u003c 'EOF'\nBuild a REST API with user authentication, rate limiting,\nand PostgreSQL storage. Include health check endpoint.\nEOF\n\n# Forge it\nslag \"Build the REST API from PRD.md\"\n```\n\nslag reads `PRD.md`, analyzes it, designs tasks, executes them, and proves each one works.\n\n## Usage\n\n```\nslag [OPTIONS] [COMMISSION]... [COMMAND]\n```\n\n**Commands:**\n\n| Command | Description |\n|---------|-------------|\n| `slag \"Build X from PRD.md\"` | Start a new forge from a commission |\n| `slag status` | Show crucible state (ingot counts and progress) |\n| `slag resume` | Resume an existing forge |\n| `slag update` | Self-update to latest release |\n| `slag self-improve [target]` | Self-improve slag's code via GitHub clone + PR (freeform or predefined target) |\n\n**Options:**\n\n| Flag | Default | Description |\n|------|---------|-------------|\n| `--worktree` | off | Enable branch-per-ingot worktree isolation with master review |\n| `--anvils N` | 3 | Max parallel anvil workers |\n| `--skip-review` | off | Skip the master review phase (legacy behavior) |\n| `--keep-branches` | off | Don't delete branches after review |\n| `--ci-only` | off | Run CI checks but skip AI review |\n| `--review-all` | off | Review even if CI fails |\n| `--retry N` | 3 | Max retry cycles when ingots crack (0 = no retry) |\n| `--verbose` (`--debug`) | off | Show detailed forge output (commands, retries, extended previews, and stall heartbeats) |\n| `--no-outcome` | off | Disable independent outcome-validation closing loop |\n| `--no-quarry` | off | Disable commission chunking (quarrier phase) |\n| `--prompt-policy MODE` | `ask` | Operator prompt behavior: `ask`, `auto-requeue`, `auto-crack`, `auto-abort` |\n| `--prompt-timeout-secs N` | 45 | Prompt timeout before default action |\n| `--log-format FORMAT` | `text` | Output renderer format: `text` or `json` |\n| `--effort LEVEL` | unset | Smith effort level: `low`, `medium`, `high` (controls extended thinking) |\n| `--smith VALUE` | unset | Base smith selector or full command, e.g. `claude`, `claude-plan`, `codex` |\n| `--smith-chain VALUE` | unset | Comma-separated fallback smith selectors or full commands |\n\n**Model routing (env):**\n\n| Variable | Default | Purpose |\n|----------|---------|---------|\n| `SLAG_SMITH` | auto-detected (`claude` / `codex` / `gemini` / `opencode` / `kimi`; native `kimi` fallback) | Main smith for survey/founder/forge |\n| `SLAG_SMITH_CHAIN` | auto-generated from detected smiths | Comma-separated fallback chain for forge smith failover (aliases: `kimi`, `codex`, `gemini`, `opencode`, `claude`) |\n| `SLAG_SMITH_SURVEYOR` | routed high-grade planning variant of `SLAG_SMITH` | Override model/flags for Surveyor phase |\n| `SLAG_SMITH_FOUNDER` | `SLAG_SMITH` | Override model/flags for Founder phase |\n| `SLAG_SMITH_REVIEW` | `SLAG_SMITH` | Override model/flags for Review phase |\n| `SLAG_SMITH_RECOVERY` | `SLAG_SMITH` | Override model/flags for analysis/re-smelt/reconsider phases |\n| `SLAG_SMITH_OUTCOME` | same routed planning variant used by Surveyor | Independent outcome validator (non-interactive by default; override to use a specific model/profile) |\n| `SLAG_SMITH_INDEPENDENT` | unset (disabled) | Optional independent fallback smith for recovery escalation after rejected re-smelt/reconsider output |\n| `SLAG_SMITH_SUBAGENT` | auto-detected (`claude` / `codex` / `gemini` / `opencode` / `kimi`; native `kimi` fallback) | Optional uncertainty fallback smith (used only on low-confidence founder/outcome cases) |\n| `SLAG_CONFIDENCE_THRESHOLD` | `0.65` | Global default threshold for uncertainty escalation |\n| `SLAG_FOUNDER_CONFIDENCE_THRESHOLD` | inherits `SLAG_CONFIDENCE_THRESHOLD` | Founder-specific escalation threshold |\n| `SLAG_OUTCOME_CONFIDENCE_THRESHOLD` | inherits `SLAG_CONFIDENCE_THRESHOLD` | Outcome-specific escalation threshold |\n| `SLAG_OUTCOME_TIMEOUT_SECS` | `180` | Max seconds for each validator/recast response before fallback fail path |\n| `SLAG_SUBAGENT_TIMEOUT_SECS` | `90` | Max seconds for each subagent fallback invocation |\n| `SLAG_PROOF_TIMEOUT_SECS` | `120` | Max seconds for proof/test shell commands before timeout failure |\n| `SLAG_PROMPT_POLICY` | `ask` | Default operator prompt behavior (`ask`, `auto-requeue`, `auto-crack`, `auto-abort`) |\n| `SLAG_PROMPT_TIMEOUT_SECS` | `45` | Default prompt timeout when flag is not provided |\n| `SLAG_LOG_FORMAT` | `text` | Default log format (`text` or `json`) |\n| `SLAG_EFFORT` | unset | Global smith effort level (`low`, `medium`, `high`) |\n| `SLAG_SURVEYOR_EFFORT` | `low` | Surveyor-specific effort level (controls extended thinking budget) |\n| `SLAG_PROMPT_REPEAT_MODE` | `non-plan` | Prompt repetition mode (`off`, `non-plan`, `always`) |\n| `SLAG_PROMPT_REPEAT_COUNT` | `2` | Prompt repetitions when enabled (clamped `1..4`) |\n| `SLAG_PROMPT_REPEAT_MAX_CHARS` | `40000` | Full repetition up to this size; partial tail repetition above |\n| `SLAG_GIT_EXPERIMENTS` | unset | Enable git commit-before-verify / revert-on-fail experiment tracking (`1` or `true`) |\n| `SLAG_INGOT_BUDGET_SECS` | unset | Default per-ingot wall-clock time budget in seconds (0 = disabled) |\n\nWhen `SLAG_SMITH` is unset, slag picks the first compatible smith in this order:\n`claude`, `codex`, `gemini`, `opencode`, `kimi` (Claude-compatible), then native `kimi` as last fallback.\nIf `ANTHROPIC_API_KEY` is present, auto-detection skips Claude while other supported smiths are available, to avoid accidental API-key billing. Explicit `--smith claude` or `SLAG_SMITH=claude` still overrides that policy.\n\nCommon selectors for `--smith` and `SLAG_SMITH`: `claude`, `claude-plan`, `codex`, `gemini`, `opencode`, `kimi`, `kimi-plan`.\n\nForge now uses a runtime failover chain: if the active smith hard-fails protocol/invocation for an ingot, slag retries that ingot on the next smith in `SLAG_SMITH_CHAIN` automatically.\nFor Claude CLI specifically, slag keeps the current auth mode first, but if `ANTHROPIC_API_KEY` is set and the run fails with an API-key or billing-style error, it checks whether Claude subscription auth is already available and retries once with `ANTHROPIC_API_KEY` removed.\n\n## Progress display\n\nslag shows emoji progress in the terminal:\n\n```\n[ ✅3  🔥1  🧱5 ] 37%\n```\n\n| Emoji | Status | Meaning |\n|-------|--------|---------|\n| 🧱 | queued | Ingot is ore, waiting to be forged |\n| 🔥 | forging | Ingot is molten, currently being worked |\n| ✅ | done | Ingot is forged, proof passed |\n| ❌ | failed | Ingot cracked after exhausting all heats |\n\nThe percentage shows overall progress: forged ingots / total ingots.\n\nBy default, forge output is compact and optimized for readability. Use `--verbose` for full per-heat details and longer previews during Surveyor/Founder phases.\nSet `SLAG_VERBOSE_HEARTBEAT_SECS` (default `15`) to control verbose heartbeat cadence for long-running anvils.\nIf a previous run crashed and left ingots in `molten` state, forge now prompts with options to `requeue` (default), `crack`, or `abort`; in non-interactive runs it defaults to `requeue`. The prompt includes a best-effort re-forge time estimate from recent logs.\nOperator prompts are now policy-driven (`--prompt-policy`) and timeout-bounded (`--prompt-timeout-secs`) to prevent stalled loops.\nBased on prompt repetition results (arXiv:2512.14982), smith calls now repeat prompts by default for non-plan invocations with configurable guardrails via `SLAG_PROMPT_REPEAT_*`.\n\n## Language\n\nslag uses metallurgical vocabulary. Here's the dictionary.\n\n### Nouns\n\n| Term | What it is | File/location |\n|------|-----------|---------------|\n| **Ore** | Raw requirements; the starting material | `PRD.md` |\n| **Ingot** | A single task encoded as an S-expression | One line in `PLAN.md` |\n| **Crucible** | The file holding all ingots | `PLAN.md` |\n| **Blueprint** | Architecture analysis and forging plan | `BLUEPRINT.md` |\n| **Quarrier** | Pre-survey decomposer that splits large commissions into phases | `PHASES.md` |\n| **Anvil** | A parallel execution slot (background process) | In-memory |\n| **Smith** | The AI agent that does the work (configured smith CLI) | CLI invocation |\n| **Slag heap** | Debug logs dumped during forging | `logs/` directory |\n| **Heat** | One attempt at forging an ingot (retry count) | `:heat` field |\n| **Grade** | Complexity rating (1-5); high grade = plan mode | `:grade` field |\n| **Proof** | Shell command that verifies the work (exit 0 = pass) | `:proof` field |\n| **Skill** | Tool configuration for the smith (web, default) | `:skill` field |\n| **Temper bar** | Progress visualization in the terminal | TUI output |\n| **Sparks** | Animated spinner shown during work | TUI output |\n\n### Verbs\n\n| Term | What it does | Phase |\n|------|-------------|-------|\n| **Quarry** | Decompose large commissions into ordered build phases | Phase 0 |\n| **Survey** | Analyze requirements, produce blueprint | Phase 1 |\n| **Found** | Design and cast ingots from blueprint | Phase 2 |\n| **Forge** | Execute an ingot: strike, run commands, verify | Phase 3 |\n| **Strike** | Send work to the smith and get output | Phase 3 |\n| **Smelt** | Process raw ore into workable material | Phase 3 |\n| **Re-smelt** | Analyze a cracked ingot and rewrite/split it | Phase 3 (recovery) |\n| **Reconsider** | Rethink a twice-cracked ingot's fundamental approach | Phase 3 (recovery) |\n| **Temper** | Track and display forging progress | Phase 3 |\n| **Review** | Master agent CI checks and code review before merge | Phase 3.5 (--worktree) |\n| **Assay** | Final quality check, produce report | Phase 4 |\n| **Crack** | Fail permanently after exhausting all heats | Terminal state |\n\n### Ingot lifecycle\n\n```\nore --\u003e molten --\u003e forged\n                   \\--\u003e cracked --\u003e [re-smelt] --\u003e ore (retry)\n                                                    \\--\u003e cracked --\u003e [reconsider] --\u003e ore (rethought)\n                                                                                  --\u003e ore + ore (decomposed)\n                                                                                  --\u003e cracked (truly impossible)\n```\n\n## How it works\n\nslag runs a 5-phase pipeline (6 phases with `--worktree`). Large commissions add a Phase 0 quarrier that splits into 2-5 build phases:\n\n```\nPRD.md --\u003e [QUARRIER] --\u003e SURVEYOR --\u003e BLUEPRINT.md --\u003e FOUNDER --\u003e PLAN.md --\u003e FORGE --\u003e OUTCOME --\u003e PROGRESS.md\n (ore)    (decompose)    (analyze)    (blueprint)     (design)   (crucible)  (strike)   (validate)   (ledger)\n\nWith --worktree (master review enabled):\nPRD.md --\u003e SURVEYOR --\u003e FOUNDER --\u003e FORGE (branches) --\u003e REVIEW --\u003e OUTCOME --\u003e ASSAY\n                                         |                  |          |\n                                    git worktrees      CI + AI     independent\n                                    per ingot          review      validator\n```\n\n### Phase 1: Surveyor\n\nReads `PRD.md` and produces `BLUEPRINT.md` -- architecture decisions, dependency graph, risk assessment, and forging sequence. Uses smith plan mode.\n\n### Phase 2: Founder\n\nReads the blueprint and casts S-expression ingots into `PLAN.md`:\n\n```\n(ingot :id \"i1\" :status ore :solo t :grade 1 :skill default :heat 0 :max 5\n       :proof \"test -f package.json\" :work \"Initialize project with package.json\")\n```\n\nFounder now includes a format-recovery pass: if the model returns wrappers/prose instead of ingot lines, slag automatically re-casts with stricter output constraints.\nThe parser also extracts multiline/wrapped `(ingot ...)` expressions from mixed output, so benign formatting noise does not dead-stop the pipeline.\n\n### Phase 3: Forge\n\nThe main loop. For each ingot:\n\n1. **Pick** the next ore-status ingot\n2. **Strike** -- invoke the smith with the task, context, and skill tools\n3. **Run** -- extract and execute shell commands from smith output\n4. **Proof** -- run the `:proof` command; exit 0 = forged, non-zero = retry\n\nIndependent ingots (`:solo t`) run on parallel anvils. Sequential ingots (`:solo nil`) run one at a time.\n\n### Phase 3.5: Review (with `--worktree`)\n\nWhen `--worktree` is enabled, each ingot is forged in an isolated git worktree branch (`forge/iN`). After forging completes, the Review phase:\n\n1. **CI Checks** -- runs `cargo fmt --check`, `cargo clippy -- -D warnings`, `cargo test --all` on each branch\n2. **Master Review** -- AI agent reviews the diff, code quality, and integration safety\n3. **Merge Decision** -- approved branches merge to main; rejected branches are marked cracked for retry/recovery\n\nUse `--ci-only` to skip AI review and auto-merge on CI pass. Use `--skip-review` for legacy behavior (merge forged worktree branches without master review). Use `--keep-branches` to preserve branches for debugging.\n\n### Phase 3.6: Analysis \u0026 Retry\n\nWhen ingots crack, slag analyzes failures and can retry automatically (up to `--retry N` cycles):\n\n1. **Proof re-evaluation** -- re-runs `:proof` for every cracked ingot; promotes to forged if proof now passes (zero-cost check that eliminates overlapping work)\n2. **Failure detection** -- identifies patterns: missing dependencies, protocol failures, proof mismatches, JSON errors, sandbox/permission blocks\n3. **Fix application** -- converts parallel ingots to sequential if they have dependencies\n4. **Strict retry contract** -- repaired ingots must change approach, keep concrete proofs, and avoid failed proof signatures\n5. **Independent fallback lane** -- optional escalation to `SLAG_SMITH_INDEPENDENT` if primary repair output is rejected\n6. **Regeneration** -- uses founder to regenerate ingots that can't be fixed simply\n7. **Retry** -- re-runs forge with fixed/regenerated ingots\n8. **Force retry prompt** -- when no recoverable ingots found, asks user to confirm force retry\n\nThis loop continues until all ingots forge, max retries exhausted, or user declines force retry.\n\n### Phase 3.7: Outcome Validation (closing loop)\n\nEven when all ingots are forged, slag runs an **independent validator pass** to verify user-visible outcomes (not just file existence).\n\n1. **Independent check** -- separate tester/commenter prompt evaluates commission vs delivered behavior\n2. **PASS/FAIL decision** -- `PASS` finishes pipeline, `FAIL` must include repair ingots\n3. **Auto-repair loop** -- repair ingots are appended to `PLAN.md` and forged in the next cycle\n4. **Behavior-first proofs** -- validator requires runtime-focused checks (browser/runtime assertions for web/sim apps)\n5. **Screenshot requirement for web outcomes** -- browser/simulation TEST commands must write a non-empty screenshot artifact to `logs/outcome-smoke.png` (or `$SLAG_OUTCOME_SCREENSHOT`)\n6. **Deterministic web smoke fallback** -- for uncertain web outcomes, slag can run `scripts/outcome_web_smoke.js` to verify page load, runtime metric \u003e 0, console errors = 0, and screenshot output\n7. **Confidence scoring + escalation** -- founder/outcome compute confidence scores and escalate once via `SLAG_SMITH_SUBAGENT` when below threshold\n8. **Format recovery** -- if validator output is malformed (missing `STATUS:`/`TEST:`), slag re-runs validation with a strict recast prompt and fallback TEST inference\n9. **Never dead-stop on validator drift/timeouts** -- if validator fails/times out/omits repair ingots, slag falls back to fail-path + synthetic repair ingot so the cycle continues\n\nDisable this closing loop with `--no-outcome`.\n\n### Phase 4: Assay\n\nFinal report. Counts forged vs cracked, writes results to `PROGRESS.md`.\n\n## Ingot fields\n\n```\n(ingot :id \"i3\" :status ore :solo t :grade 2 :skill web :heat 0 :max 5\n       :proof \"curl -s localhost:3000/health | grep -q ok\"\n       :work \"Add health check endpoint returning JSON {status: ok}\")\n```\n\n| Field | Values | Meaning |\n|-------|--------|---------|\n| `:id` | string | Unique identifier |\n| `:status` | ore / molten / forged / cracked | Lifecycle state |\n| `:solo` | t / nil | Can run in parallel (t) or must be sequential (nil) |\n| `:grade` | 1-5 | Complexity; grade \u003e= 3 uses plan mode |\n| `:skill` | default / web / ... | Tool configuration for the smith |\n| `:heat` | 0-N | Current retry attempt |\n| `:max` | 5-8+ | Max retries before cracking |\n| `:smelt` | 0-2+ | Re-smelt/reconsider count (0 = never, 1 = re-smelted, 2 = reconsidered) |\n| `:budget` | seconds (optional) | Per-ingot wall-clock time limit for smith invocation |\n| `:proof` | shell command | Acceptance test (exit 0 = pass) |\n| `:work` | string | Task description for the AI |\n\n## Project files\n\n| File | Role |\n|------|------|\n| `PRD.md` | Requirements input (ore) |\n| `BLUEPRINT.md` | Surveyor analysis |\n| `PLAN.md` | Ingot crucible (task list) |\n| `PROGRESS.md` | Work history ledger |\n| `PHASES.md` | Quarried build phases (multi-phase runs) |\n| `AGENTS.md` | Agent recipe docs |\n| `logs/` | Debug logs (slag heap) |\n| `logs/experiments.toon` | Structured experiment ledger (TOON tabular) |\n\n## Development\n\n```bash\n# Rust binary\ncargo test --all\ncargo clippy -- -D warnings\ncargo run -- \"Your commission\"\n\n# Website (slag.dev)\ncd website\nnpm install\nnpm run dev       # Dev server at localhost:5173\nnpm run build     # Production build\nnpx wrangler pages deploy dist --project-name=slag-dev\n\n# Bash tests\nbash tests/test_slag.sh\n```\n\n### Repository structure\n\n```\nCargo.toml              # Rust project\nsrc/                    # Rust source (24 files)\nslag.sh                 # Bash orchestrator (legacy)\ninstall.sh              # curl | sh installer\nwebsite/                # slag.dev (Vite + Cloudflare Pages)\ntests/                  # Bash test suite\nexample/                # Real slag run outputs\n.github/workflows/      # CI + release automation\n```\n\n## Requirements\n\n- **Rust binary**: one supported smith CLI in PATH (`claude`, `kimi`, `codex`, `gemini`, or `opencode`)\n- **Bash version**: bash 4+, Claude CLI, curl, sed, awk\n- **Optional**: Playwright (for `:skill web` ingots)\n\n## License\n\nMIT\n\n## Warning\n\nslag gives the configured smith autonomous shell access. It will create files, install packages, and run commands without asking. Use in a dedicated directory or container.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsliday%2Fslag","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsliday%2Fslag","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsliday%2Fslag/lists"}