autonomous-loop
Use when running Ralph-style iterative autonomous development. Triggers on /ralph or /loop commands, when autonomous iterative development is needed, when a project has specs and an implementation plan ready for iterative execution, or when deterministic context loading with subagent delegation and dual-condition exit gates is required. Orchestrates PLANNING, BUILDING, and STATUS cycles.
What this skill does
# Autonomous Loop ## Overview The autonomous loop implements Ralph's iterative development methodology. Each iteration loads identical context (PROMPT + AGENTS files), executes one focused task, reports structured status, and persists state to disk for the next iteration. The loop continues until the dual-condition exit gate is satisfied. The core innovation is that deterministic conditions allow Claude to autonomously plan, build, and iterate toward quality without human intervention in the loop. **Announce at start:** "I'm starting the autonomous loop. Loading context and beginning PLANNING mode." ## Trigger Conditions - `/ralph` or `/loop` command invoked - Project has specs and is ready for iterative autonomous development - Multi-task implementation that benefits from autonomous iteration - User requests autonomous execution without per-task approval --- ## Architecture ``` +--------------------------------------------------+ | AUTONOMOUS LOOP | | | | +----------+ +----------+ +-----------+ | | | PLANNING |---→| BUILDING |---→| STATUS | | | | MODE | | MODE | | CHECK | | | +----------+ +----------+ +-----+-----+ | | ^ | | | | +-----------+ | | | +------------| EXIT GATE|←-----+ | | | (dual) | | | +-----+-----+ | | | | | PASS: EXIT | | FAIL: LOOP | +--------------------------------------------------+ ``` --- ## Phase 1: PLANNING MODE (Gap Analysis) **Goal:** Analyze specs against implementation to identify and prioritize remaining work. <HARD-GATE> Planning mode produces NO implementation code. It is analysis and planning ONLY. </HARD-GATE> ### Steps 1. **Knowledge Gathering** — Deploy up to 250 parallel subagents via the `Agent` tool (with `subagent_type="Explore"` and `model="sonnet"`) to study specs, existing implementation plans, and utility libraries 2. **Code Analysis** — Deploy up to 500 parallel subagents via the `Agent` tool (with `subagent_type="Explore"`) to study `src/*` against `specs/*`, identifying gaps between specification and implementation 3. **Synthesis** — Deploy a synthesis subagent via the `Agent` tool (with `model="opus"`) to synthesize findings and prioritize incomplete work 4. **Plan Refresh** — Update `IMPLEMENTATION_PLAN.md` as organized, prioritized bullet list ### Planning Mode Constraints | Constraint | Rationale | |-----------|-----------| | Verify ALL assumptions through code search | Never assume something is absent | | Treat `src/lib` as authoritative standard library | Consolidate, do not duplicate | | Output is a prioritized task list | Not code, not designs — tasks only | | Identify missing specs | Specs gaps are blockers, not things to guess about | ### Planning Mode Output ``` IMPLEMENTATION_PLAN.md updated: - [x] Completed tasks (checked off) - [ ] Remaining task 1 (highest priority) - [ ] Remaining task 2 - [ ] Remaining task 3 ... Missing specs identified: [list or "none"] ``` **STOP — Do NOT proceed to Phase 2 until:** - [ ] All specs have been read and analyzed - [ ] Code has been compared against specs - [ ] IMPLEMENTATION_PLAN.md is updated with prioritized tasks - [ ] Missing specs are identified (if any) --- ## Phase 2: BUILDING MODE (Implementation) **Goal:** Select and complete exactly ONE task per iteration. ### "ONE Task Per Loop" Principle Each iteration selects and completes exactly one task from IMPLEMENTATION_PLAN.md. This reduces context switching, enables clear progress measurement, and makes debugging easier. ### Steps 1. **Study** — Read specs and current IMPLEMENTATION_PLAN.md 2. **Select** — Choose the most important remaining task 3. **Search** — Find existing code patterns (do NOT assume implementations are missing) 4. **Implement** — Write complete, production-quality code (no placeholders, no stubs) 5. **Test** — Run tests immediately after implementation 6. **Update** — Refresh IMPLEMENTATION_PLAN.md with findings and progress 7. **Commit** — Descriptive conventional commit message with rationale ### Task Selection Decision Table | Condition | Which Task to Select | |-----------|---------------------| | Blocker exists for other tasks | Select the blocker task | | Test failures exist | Select task that fixes the failure | | All tasks independent | Select highest priority task | | Multiple tasks at same priority | Select the one with clearest spec | | Spec is missing for top task | Run PLANNING mode to identify gap | ### Subagent Rules During Building | Resource | Budget | Rationale | |----------|--------|-----------| | Read/search subagents | Up to 500 parallel Sonnet | Fast context gathering | | Build subagent | Only 1 Sonnet at a time | Serialize builds to detect failures | | Main context | 40-60% utilization | The "smart zone" — enough room to think | ### Building Mode Constraints | Constraint | Rationale | |-----------|-----------| | No placeholders or stubs | Every line of code is production-quality | | Search before implementing | Code may already exist elsewhere | | Run tests immediately | Backpressure catches errors early | | Update plan after every task | Keep plan current with reality | | Commit after every task | Small atomic commits, easy to revert | **STOP — Do NOT proceed to Phase 3 until:** - [ ] Task is fully implemented (no stubs) - [ ] Tests have been run - [ ] IMPLEMENTATION_PLAN.md is updated - [ ] Changes are committed --- ## Phase 3: STATUS CHECK **Goal:** Produce a RALPH_STATUS block and evaluate exit conditions. After each BUILD iteration, invoke the `ralph-status` skill to produce a structured status block. ### Exit Evaluation | Check | Condition | Result | |-------|-----------|--------| | Tasks remaining? | IMPLEMENTATION_PLAN.md has unchecked items | Continue loop | | Tests passing? | Full test suite passes | Required for exit | | Errors in iteration? | Clean execution, no unresolved exceptions | Required for exit | | Meaningful work remains? | No TODOs, no incomplete features | Required for exit | ### Loop Decision | Status | Tasks Remaining | Tests | Action | |--------|----------------|-------|--------| | IN_PROGRESS | Yes | Any | Loop back to Phase 1 or 2 | | IN_PROGRESS | No | FAILING | Loop — fix failures first | | BLOCKED | Any | Any | Report blocker, wait for input | | COMPLETE | No | PASSING | Evaluate exit gate | --- ## Exit Conditions — Dual-Condition Gate <HARD-GATE> Both conditions must be true simultaneously to exit the loop: </HARD-GATE> | Condition | Threshold | Verification | |-----------|-----------|-------------| | Completion indicators | >= 2 recent occurrences of "done" language | Heuristic detection in output | | Explicit EXIT_SIGNAL | `EXIT_SIGNAL: true` in status block | Intentional declaration | ### EXIT_SIGNAL May Only Be `true` When ALL Of: - IMPLEMENTATION_PLAN.md has no remaining tasks - All tests pass - No errors in latest iteration - No meaningful work remains This prevents false positives where completion language appears while productive work continues. ### Exit Decision Table | Completion Language | EXIT_SIGNAL | Action | |--------------------|-------------|--------| | < 2 occurrences | false | Continue loop | | >= 2 occurrences | false | Continue — may be casual language | | < 2 occurrences | true | Continue — signal without evidence | | >= 2 occurrences | true | EXIT the loop | --- ## Context Efficiency | Resource | Budget | Strategy | |----------|--------|----------| | Main context | 40-60% of window | Keep focused; delegate heavy lifting | | Read subagents | Up to 500 parallel | Searching, file reading, pattern matching | | Build subage
Related in General
modeling-omnistudio-epc-catalog
IncludedSalesforce Industries CME EPC product-modeling skill for Product2-based catalog creation. Use when creating EPC products, configuring product attributes, building offer bundles with Product Child Items, or reviewing EPC DataPack JSON metadata for product catalog changes. TRIGGER when: user creates or updates Product2 EPC records, AttributeAssignment payloads, AttributeMetadata/AttributeDefaultValues, Offer bundles, or ProductChildItem relationships. DO NOT TRIGGER when: designing OmniScripts/FlexCards/Integration Procedures (use building-omnistudio-omniscript, building-omnistudio-flexcard, or building-omnistudio-integration-procedure), implementing Apex business logic (use generating-apex), or troubleshooting deployment pipelines (use deploying-metadata).
relationship-science-coach
IncludedUse this skill for direct, practical adult relationship coaching: couples conflict, repair, trust, marriage, dating, flirting, attachment patterns, emotional connection, sex, desire differences, eroticism, kink negotiation, affection, love languages, breakups, and long-term passion. Draw on Gottman, EFT and Hold Me Tight, attachment science, modern sex research, Perel, Nagoski, Kerner, Schnarch, Love and Stosny, and flexible love-language tools. Be concrete and low-hedge. Redirect only for imminent danger, abuse, coercive control, minors, non-consent, self-harm, stalking, or medical/legal/psychiatric decisions.
building-sf-integrations
IncludedSalesforce integration architecture and runtime plumbing with 120-point scoring. Use this skill to set up Named Credentials, External Credentials, External Services, REST/SOAP callout patterns, Platform Events, and Change Data Capture. TRIGGER when: user sets up Named Credentials, External Services, REST/SOAP callouts, Platform Events, CDC, or touches .namedCredential-meta.xml files. DO NOT TRIGGER when: Connected App/OAuth config (use configuring-connected-apps), Apex-only logic (use generating-apex), or data import/export (use handling-sf-data).
venue-templates
IncludedAccess comprehensive LaTeX templates, formatting requirements, and submission guidelines for major scientific publication venues (Nature, Science, PLOS, IEEE, ACM), academic conferences (NeurIPS, ICML, CVPR, CHI), research posters, and grant proposals (NSF, NIH, DOE, DARPA). This skill should be used when preparing manuscripts for journal submission, conference papers, research posters, or grant proposals and need venue-specific formatting requirements and templates.
let-fate-decide
IncludedDraws the 12 Houses of the Zodiac Tarot spread to inject entropy into planning when prompts are vague, ambiguous, or casually delegated. Interprets the spread to guide next steps. Use when the user says 'let fate decide', 'YOLO', 'whatever', 'idk', or other nonchalant phrases, makes Yu-Gi-Oh references, or when you are about to arbitrarily pick between multiple reasonable approaches. Prefer over ask-questions-if-underspecified when the user's tone is casual or playful rather than precision-seeking.
net-ops
IncludedCross-platform network troubleshooting (Windows, macOS, Linux) via local or remote shell. Use for: DNS broken, can't resolve hostnames, nslookup/dig works but apps fail, NRPT, WFP, scutil, /etc/resolver, systemd-resolved, /etc/resolv.conf, NetworkManager, VPN DNS leak residue (ProtonVPN/Mullvad/WireGuard/AnyConnect), AV/firewall blocking DNS or DoH, Tailscale DNS interaction, intermittent connectivity, remote diagnostics over SSH.