sdd-run
Skill0 starsChanged 8 months agoMITView on GitHub
Orchestrates the full SPIIM lifecycle end-to-end. Auto-detects greenfield vs brownfield, runs Research → Spec → Design → Plan → Implement → Iterate → Monitor as a continuous cycle. The user kicks this off and walks away. Use to run the complete SDD process for a feature.
In this repository13 other files it gives its agents.
- AGENTS.mdAGENTS.md
- sdd-adrSkill
- sdd-implementSkill
- sdd-initSkill
- sdd-iterateSkill
- sdd-monitorSkill
- sdd-planSkill
- sdd-reviewSkill
- sdd-specSkill
- sdd-standupSkill
- sdd-statusSkill
- sdd-triageSkill
- sdd-ux-validateSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
25 rules. About 0 are common, 14 are distinctive, and 11 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈14
Distinctive · estimate
This author's own choices. Worth a look.
11
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 8
Run the entire Spec-Driven Development lifecycle for a feature.
- Very specific: line 76
If no spec/active/*.prd.json files exist: skip this sub-step (greenfield run, PRD not yet created).
- Very specific: line 80
Before loading the handoff and continuing, invoke scripts/resume-handler.sh to detect stale-handoff / pending-PRD mismatches (ASSERT-010 — …
- Very specific: line 127
Check if /sdd-init has been run.
- Distinctive: line 130
If found beyond config/boilerplate: brownfield (existing codebase)
- Distinctive: line 131
If empty or config-only: greenfield (fresh project)
- Very specific: line 134
Write initial .sdd/handoff.json with phase: "starting"
- Distinctive: line 157
If brownfield: include research findings as context
- Distinctive: line 162
Ask: "Does this spec look right?
- Distinctive: line 169
Read the spec. Generate a ~200-line design discussion that covers:
- Distinctive: line 180
Ask: "Does this architecture make sense?
- Distinctive: line 197
Before dispatching any agent (implementer or evaluator), invoke:
- Very specific: line 207
This field is mandatory on every agent invocation context: If the field is absent, the sdd-evaluator agent will refuse to issue a verdict …
- Distinctive: line 221
If any stories escalate (maxAttempts exceeded):
- Very specific: line 228
Update handoff: phase: "implement-complete" with story pass/fail counts
- Distinctive: line 236
If manual-fix candidates found:
- Very specific: line 248
If spec amendments were applied and --loop is active:
- Very specific: line 256
Run convergence check (sdd_convergence_check MCP tool):
- Very specific: line 268
If --loop and issues found (drift, uncovered requirements, non-convergent stories):
- Distinctive: line 270
If cycle < 3: loop back to Phase 5 (or Phase 2 if spec issues detected)
- Distinctive: line 271
If cycle >= 3: stop and report — non-convergence after 3 cycles needs human intervention
- Very specific: line 273
Update handoff: phase: "complete" (or phase: "looping-back")
- Distinctive: line 310
If approaching context limit: summarize prior phase results before starting next phase
- Very specific: line 316
All artifacts created (spec, design discussion, plan, prd.json)
- Distinctive: line 317
All stories attempted via Ralph loop
≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
SDD Run — Full SPIIM Orchestrator
Run the entire Spec-Driven Development lifecycle for a feature. One command, full autonomy.
Arguments
$ARGUMENTS — feature description + optional flags:
/sdd-run "user authentication with JWT"
/sdd-run "add rate limiting to existing API" --brownfield
/sdd-run "new CLI tool" --greenfield --auto
/sdd-run --resumeFlags:
--greenfield— skip research phase (no existing code)--brownfield— force research phase (existing codebase)--auto— skip human gates except escalations (overnight mode)--yolo— skip ALL human gates (prototyping only)--loop— after monitor, loop back if issues found (max 3 cycles)--resume— pick up from.sdd/handoff.json
Phase Flow
BROWNFIELD?
│
yes ──> RESEARCH (opinion-free codebase exploration)
│ │
no ─────────┘
│
v
SPEC (generate spec with traceability IDs)
│
v
DESIGN DISCUSSION (~200-line architecture sense-check)
│
v
PLAN (decompose into prd.json task DAG)
│
v
IMPLEMENT (Ralph loop — one story at a time, fresh context, TDD)
│
v
ITERATE (auto-scan for backprop candidates)
│
[human gate in standard mode — approve spec amendments]
│
v
MONITOR (convergence, gaps, drift)
│
┌───┴───┐
│ │
CLEAN ISSUES ──> loop back to IMPLEMENT (if --loop)
│
DONEProcess
Phase 0: Initialize
- PRD validation gate (runs before all other steps):
- Invoke
sdd_validate_prdagainst every file matchingspec/active/*.prd.json. - Evaluate the result:
- No issues (empty errors + empty warnings): proceed.
- Warnings only: proceed but log each warning to progress.txt with the
[WARN]prefix. - Errors present: HALT. Print each error. Operator must fix the PRD or re-run with
--yoloto bypass. --strictflag set: warnings are promoted to errors — halt on any unknown field.
- If no
spec/active/*.prd.jsonfiles exist: skip this sub-step (greenfield run, PRD not yet created).
- Invoke
--resumecross-check (only when--resumeflag is present):Before loading the handoff and continuing, invoke
scripts/resume-handler.shto detect stale-handoff / pending-PRD mismatches (ASSERT-010 — closes smoke #16):bash scripts/resume-handler.sh .sdd/handoff.json spec/active/ [--auto|--yolo]The handler loads
.sdd/handoff.json, extracts thefeaturename and target PRD path, then scans allspec/active/*.prd.jsonfiles. It determines:- Is the handoff feature's PRD all
passes:true? - Does any OTHER PRD in
spec/active/have actionable pending stories?
Decision matrix:
Handoff-PRD state Other PRDs have pending Flag Result Still active Any state (any) Exits 0 — safe to resume; no action needed All done None pending (any) Exits 0 — all done; clean state All done Yes (none) Exits 1 — ERROR citing feature name AND pending PRD filenames; operator must choose All done Yes --auto Exits 0 — auto-resolves to highest-priority pending story across all PRDs; prints dispatch info All done Yes --yolo Exits 0 — bypasses check; proceeds against named handoff regardless Error format (default mode, exit 1):
ERROR: Resume mismatch detected. Handoff feature '<feature-name>' is complete — all stories pass. But the following PRD(s) in spec/active/ still have pending work: - <pending-prd-filename.prd.json> ... To proceed, choose one of: --auto Auto-resolve to the highest-priority pending story across all PRDs --yolo Bypass this check and proceed against the named handoff (<feature-name>)If the handler exits non-zero and neither
--autonor--yolois set: HALT. Print the error verbatim and ask the operator which path to take.--autoresolution: The handler emits a dispatch message identifying the highest-priority pending story (lowest priority integer, tie-break: PRD filename alphabetical). Use that story as the next dispatch target — equivalent to the Ralph loop's normal dispatch logic.--yolobypass: The handler proceeds without cross-checking. Use only in prototyping or when the operator has explicitly confirmed stale-handoff is intentional.- Is the handoff feature's PRD all
- Check if
/sdd-inithas been run. If not, run it automatically. - Auto-detect project type:
- Scan for source code directories (
src/,lib/,app/,pkg/) and language-specific files (.ts,.py,.go,.rs,.java,.rb) - If found beyond config/boilerplate: brownfield (existing codebase)
- If empty or config-only: greenfield (fresh project)
- Override with
--greenfieldor--brownfieldflag
- Scan for source code directories (
- Initialize session log:
scripts/session-log.sh init - Write initial
.sdd/handoff.jsonwith phase: "starting" - Append to progress.txt:
[START] SDD run: "{feature}" (mode: {greenfield|brownfield}, tier: {standard|auto|yolo})
Phase 1: Research (brownfield only)
Skip this phase if greenfield.
- Derive 3-5 research questions from the feature description. These are WHAT questions about the existing codebase, NOT questions about what to build:
- "How does the current auth system work?"
- "What HTTP clients/frameworks are used?"
- "Where are API routes defined?"
- "What test patterns exist?"
- "What database/ORM is used?"
- Invoke
sdd-researcheragent via Task tool with these questions. The researcher gets NO knowledge of what we're building — this prevents implementation bias (QRISPY pattern). - Capture research findings. These will be passed to the spec phase.
- Update handoff:
phase: "research-complete"
Phase 2: Spec
- Invoke
/sdd-specwith the feature description.- If brownfield: include research findings as context
- The spec skill handles clarifying questions, template generation, traceability IDs
- Human gate (standard mode only):
- Present the generated spec summary
- Ask: "Does this spec look right? Proceed to design discussion?"
- In
--autoor--yolomode: skip this gate
- Update handoff:
phase: "spec-complete", spec_path: "context/specs/spec-{slug}.md"
Phase 3: Design Discussion
- Read the spec. Generate a ~200-line design discussion that covers:
- Architecture approach: How does this feature fit into the existing system?
- Key technical decisions: What patterns, libraries, or approaches to use?
- Risk assessment: What could go wrong? What's the hardest part?
- Integration points: How does this feature connect to existing code?
- Non-obvious constraints: What did the researcher find that affects design?
- Save to
context/design/design-discussion-{slug}.md - Human gate (standard mode only):
- Present the design discussion summary
- Ask: "Does this architecture make sense? Proceed to planning?"
- In
--autoor--yolomode: skip this gate
- Update handoff:
phase: "design-complete"
Phase 4: Plan
- Invoke
/sdd-planwhich reads the spec and generates:context/plans/plan-{slug}.md(human-readable)spec/active/{slug}.prd.json(machine-readable)- Traceability cross-check (every spec req covered)
- Update handoff:
phase: "plan-complete", prd_path: "spec/active/{slug}.prd.json"
Phase 5: Implement (Ralph Loop)
Compute
same_family_warningfor every agent invocation (ASSERT-009 — mandatory). Before dispatching any agent (implementer or evaluator), invoke:same_family_warning=$(bash scripts/dispatcher/family-detect.sh "<implementer-model-id>" "<evaluator-model-id>")This must happen BEFORE the agent is dispatched. The result — one of
true | false | unknown— is injected into the agent's input context under the keysame_family_warning.true— both agents are from the same model family (e.g., bothclaude-sonnet-*). Structural diversity is NOT active; evaluator will emit adiversity-warningannotation.false— different families. Structural diversity IS active; evaluator proceeds normally.unknown— dispatcher could not determine the relationship. Evaluator proceeds but emits anunknown-diversityannotation.
This field is mandatory on every agent invocation context. If the field is absent, the
sdd-evaluatoragent will refuse to issue a verdict (fail-closed). Do not dispatch the evaluator without this field.The model identifiers come from
.sdd/config.jsonviasdd_resolve_provider. If identifiers are unavailable, pass empty strings —family-detect.shwill returnunknown, which is the safe default.- Invoke
/sdd-implementwhich runs the Ralph loop:- Picks highest-priority incomplete story
- Loads fresh context (only this story's spec + plan sections)
- Invokes
sdd-implementeragent (TDD mandatory) - Runs quality gates
- Updates prd.json (passes/attempts)
- Commits with
Spec-Ref+Attempttrailers
- The stop hook keeps the loop running until all stories pass or escalate.
- If any stories escalate (maxAttempts exceeded):
- Generate decision-request.md for each escalated story.
- Tier behavior (per
state-machine.json approval_gates.escalated_stories):--automode (defer_and_continue): Park (defer) the escalated story — do NOT halt the loop. Continue draining independent stories from the runnable frontier. The loop is not interrupted mid-run. Collect all decision-request.md files. At end-of-run (Phase 8), batch all deferred decision-requests and present them once: "N stories escalated — review decision-request.md files and re-run." This is the walk-away-safe behavior — a single hard story does not stall the whole run.--standardmode (ask): Halt. Present escalated stories and decision requests. Ask: "How should we handle these? Fix spec / increase attempts / skip?"--yolomode (skip_and_mark): Mark as skipped, continue.
- Update handoff:
phase: "implement-complete"with story pass/fail counts
Phase 6: Iterate (Backpropagation Auto-Scan)
- Automatically run
sdd_backprop_analyzeMCP tool to scan commits since implementation started. - Classify commits: ralph-generated vs manual-fix vs infrastructure.
If manual-fix candidates found:
- For each: invoke
sdd-backpropagatoragent to trace to spec - Generate backpropagation report with suggested spec amendments
Human gate (standard mode):
- Present each amendment: "This spec is missing constraint X. Apply? [yes/modify/skip]"
- Apply approved amendments, commit with
Backprop-Fromtrailers - Update backprop-log.json
In
--automode: Skip backprop amendments (log candidates for later review) In--yolomode: Auto-apply all suggested amendments (dangerous but fast)- For each: invoke
- If spec amendments were applied and
--loopis active:- Reset affected stories in prd.json (passes=false, attempts=0)
- Go back to Phase 5 (Implement) for re-run verification
- Update handoff:
phase: "iterate-complete"
Phase 7: Monitor
- Run convergence check (
sdd_convergence_checkMCP tool):- Files changed per iteration trend (should be decreasing)
- Per-story attempt counts
- Estimated remaining iterations
- Run gap analysis:
- Spec coverage: every requirement covered by a passing story?
- Traceability: every commit has Spec-Ref trailer?
- Drift: any code changes not linked to specs?
- Generate health report.
- If
--loopand issues found (drift, uncovered requirements, non-convergent stories):- Increment cycle counter
- If cycle < 3: loop back to Phase 5 (or Phase 2 if spec issues detected)
- If cycle >= 3: stop and report — non-convergence after 3 cycles needs human intervention
- Update handoff:
phase: "complete"(orphase: "looping-back")
Phase 8: Completion
- Generate final summary:
## SDD Run Complete: {feature} ### Results - Stories: {passed}/{total} complete - Escalated: {N} (see decision-request.md) - Backpropagation: {N} spec amendments applied - Convergence: {trend} - Traceability: {N}/{total} commits traced ### Artifacts Created - Spec: context/specs/spec-{slug}.md ({N} requirements) - Plan: context/plans/plan-{slug}.md - Tasks: spec/active/{slug}.prd.json - Design: context/design/design-discussion-{slug}.md - ADRs: {list if any} ### Next Steps - Run /sdd-review before shipping - Run /sdd-iterate if bugs are found later - Run /sdd-monitor periodically - End session log:
scripts/session-log.sh end - Final handoff update:
phase: "complete" - Append to progress.txt:
[PASS] SDD run complete: "{feature}" — {passed}/{total} stories, {N} backprop amendments
Context Management
Between phase transitions:
- Evict tool outputs from prior phases (microcompaction)
- Carry forward only: spec path, prd.json path, progress.txt last 20 lines
- If approaching context limit: summarize prior phase results before starting next phase
- On crash: resume from
.sdd/handoff.jsonvia/sdd-run --resume
Output contract
- Full SPIIM lifecycle executed
- All artifacts created (spec, design discussion, plan, prd.json)
- All stories attempted via Ralph loop
- Backpropagation scan run automatically
- Human gates respected per approval tier
.sdd/handoff.jsonmaintained throughout for crash recovery- Session log captures all phase transitions
- progress.txt updated with typed symbols
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

