Skip to content
/

Smart Ralph

smart-ralph · tzachbon/smart-ralph · ★ 339 · last commit 2026-05-19

Turn a vague feature idea into structured specs and then execute them task-by-task with fresh subagent context, without losing state across sessions.

Best whenThe orchestrator must be banned from implementing anything — all substantive work delegated to named subagents is non-negotiable.
Skip ifCoordinator doing implementation work, Automatic phase advancement in normal mode
vs seeds
spec-driver(both implement the Ralph delta-first task-by-task loop with the same four spec artifacts), but Smart Ralph ships as a C…
Primitive shape 32 total
Commands 15 Skills 5 Subagents 9 Hooks 3
00

Summary

Smart Ralph — Summary

Smart Ralph is a Claude Code and Codex plugin that implements the Ralph agentic loop pattern — turning vague feature ideas into structured four-artifact specs (research.md, requirements.md, design.md, tasks.md), then executing them task-by-task with a fresh subagent context per task. The framework names itself after the ghuntley.com/ralph loop pattern and the Springfield character, signaling that its core philosophy is "do the next task, don't overthink." It ships as a native Claude Code plugin with 15 slash commands, 9 named subagent personas, 5 skills, and a 3-hook lifecycle that enforces quick-mode constraints, loads active spec context on session start, and drives an autonomous stop-watcher loop. A --quick mode bypasses all approval gates and runs research → requirements → design → tasks → execution in one autonomous sweep. The framework uniquely injects skill discovery at two points in the pipeline (pre-research and post-research) so that third-party Claude skills can be automatically woven into any spec lifecycle.

Compared to the seeds, Smart Ralph is closest to spec-driver (both use a delta-first task-by-task Ralph loop and produce the same four spec artifacts), but differs in three important ways: it ships as a Claude plugin with 15 slash commands rather than a Python CLI, it adds a named subagent layer (9 persona-md agents vs. spec-driver's 0), and it injects two rounds of semantic skill discovery so external skills participate in every spec run automatically.

01

Overview

Smart Ralph — Overview

Origin

Created by Tzach Bon (tzachbon), published on GitHub under MIT license. The project is named after the Ralph agentic loop pattern described by Geoffrey Huntley, plus the Simpsons character Ralph Wiggum — the conceit being that Ralph "doesn't overthink, just does the next task."

The description on GitHub reads: "Spec-driven development with smart compaction. Claude Code plugin combining Ralph Wiggum loop with structured specification workflow."

Philosophy

The framework's philosophy is articulated in the README:

"Ralph doesn't overthink. Ralph just does the next task. Be like Ralph."

The core loop is:

  1. User provides a one-line feature idea
  2. Ralph creates four spec artifacts with subagents
  3. Ralph executes each task with a dedicated subagent, fresh context per task
  4. Smart compaction: state lives in .ralph-state.json on disk, not in the conversation window — crashes are recoverable

The framework is explicitly positioned as a "tiny product team in your terminal."

Key Manifesto Excerpts

From the README:

"You: 'Add user authentication'
Ralph: creates research.md, requirements.md, design.md, tasks.md
Ralph: executes each task with fresh context
Ralph: 'I'm helping!'"

From the start.md command (delegation mandate):

"YOU ARE A COORDINATOR, NOT AN IMPLEMENTER. You MUST delegate ALL substantive work to subagents. This is NON-NEGOTIABLE regardless of mode."

From the stop-watcher behavior:

"After ANY subagent returns in normal mode: [...] DO NOT invoke another subagent in the same response [...] The user must explicitly run the next command."

Target Users

Solo developers and small teams who want a structured spec→execute pipeline without managing external tools or services.

02

Architecture

Smart Ralph — Architecture

Distribution

  • Type: Claude Code plugin (also has a Codex variant)
  • Install (Claude Code): /plugin marketplace add tzachbon/smart-ralph then /plugin install ralph-specum@smart-ralph
  • Install (Codex): Manual clone and copy to ~/.codex/plugins/
  • License: MIT
  • Language: Shell (plugin scripts) + Markdown (prompts)

Directory Structure

plugins/
  ralph-specum/           ← Claude Code plugin
    .claude-plugin/       ← Plugin manifest
    commands/             ← 15 slash commands
      cancel.md, design.md, feedback.md, help.md, implement.md,
      index.md, new.md, refactor.md, requirements.md, research.md,
      start.md, status.md, switch.md, tasks.md, triage.md
    agents/               ← 9 persona-md subagents
    hooks/
      hooks.json          ← 3 lifecycle hooks
      scripts/            ← hook shell scripts
    skills/               ← 5 skills
    templates/            ← spec artifact templates
    schemas/              ← JSON schemas for state files
    references/           ← branch-management.md, goal-interview.md, etc.
  ralph-specum-codex/     ← Codex variant (parallel structure)
  ralph-speckit/          ← Lightweight variant

specs/                    ← Created per-project at runtime
  <spec-name>/
    .ralph-state.json     ← FSM state (phase, taskIndex, iterations)
    .progress.md          ← Human-readable progress log
    research.md
    requirements.md
    design.md
    tasks.md
  .current-spec           ← Pointer to active spec name
  .current-epic           ← Pointer to active epic (if any)
  _epics/                 ← Epic state files for multi-spec workflows

Required Runtime

  • Claude Code v1.0+ (or Codex CLI for the Codex variant)
  • No external package manager or language runtime required beyond the AI tools themselves

Target AI Tools

  • Claude Code (primary)
  • Codex CLI (secondary, via separate plugin variant)
  • Multi-directory specs support for monorepos
03

Components

Smart Ralph — Components

Commands (15)

All commands are slash commands prefixed /ralph-specum:.

Command Purpose
start Smart entry point — detects new vs resume, handles git branch, skill discovery, team research
new Create new spec and start research phase (explicit version of start)
research Run research phase on current spec
requirements Invoke product-manager agent to write requirements.md
design Invoke architect-reviewer agent to write design.md
tasks Invoke task-planner agent to write tasks.md
implement Invoke spec-executor for current task
status Show current spec phase and progress
switch Switch active spec via .current-spec pointer
triage Decompose a large feature into an epic (multi-spec orchestration)
refactor Refactoring-specific spec entry point
feedback Capture user feedback into .progress.md
cancel Cancel current spec execution
help Show available commands
index Rebuild spec index

Agents (9 persona-md subagents)

Agent Role
research-analyst Researches best practices, codebase patterns, feasibility; writes research.md
product-manager Writes user stories, acceptance criteria; produces requirements.md
architect-reviewer Writes architecture, component design; produces design.md
task-planner Decomposes requirements into POC-first tasks; writes tasks.md
spec-executor Implements individual tasks; creates commits
spec-reviewer Reviews generated spec artifacts; iterates up to 3x
qa-engineer Test generation and validation
refactor-specialist Handles refactoring-specific workflows
triage-analyst Decomposes epics into dependency-ordered individual specs

Skills (5)

Skill Purpose
spec-workflow Describes overall spec-driven workflow; triggers when user asks to build/spec/plan
smart-ralph Core Ralph loop description
interview-framework Goal interview techniques for brainstorming
communication-style Defines agent communication tone and format
reality-verification Checks that implementation matches spec acceptance criteria

Hooks (3)

Hook Event Script Purpose
PreToolUse (matcher: AskUserQuestion) quick-mode-guard.sh Blocks interactive questions in --quick mode
Stop stop-watcher.sh Autonomous loop: re-invokes next phase/task if awaitingApproval=false
SessionStart load-spec-context.sh Loads active spec context into the session on startup

Scripts

  • hooks/scripts/quick-mode-guard.sh — hook enforcement
  • hooks/scripts/stop-watcher.sh — autonomous loop driver
  • hooks/scripts/load-spec-context.sh — session context loader
  • hooks/scripts/update-spec-index.sh — spec index maintenance

Templates

Spec artifact templates in templates/: research.md, requirements.md, design.md, tasks.md

State Files (per-spec)

  • .ralph-state.json — FSM: {phase, taskIndex, totalTasks, taskIteration, maxTaskIterations, globalIteration, maxGlobalIterations, commitSpec, quickMode, discoveredSkills}
  • .progress.md — Human-readable log with Original Goal, Completed Tasks, Learnings, Blockers, Skill Discovery sections
  • specs/.current-spec — Active spec name pointer
  • specs/.current-epic — Active epic name pointer (multi-spec mode)
05

Prompts

Smart Ralph — Prompt Excerpts

Excerpt 1: start.md — Delegation Mandate (Iron Law pattern)

Source: plugins/ralph-specum/commands/start.md

## CRITICAL: Delegation Requirement

**YOU ARE A COORDINATOR, NOT AN IMPLEMENTER.**

You MUST delegate ALL substantive work to subagents. This is NON-NEGOTIABLE regardless of mode.

**NEVER do any of these yourself:**
- Write code or modify source files
- Perform research or analysis
- Generate spec artifacts (research.md, requirements.md, design.md, tasks.md)
- Execute task steps
- Run verification commands as part of task execution

**ALWAYS delegate to the appropriate subagent:**

| Work Type | Subagent |
|-----------|----------|
| Research | Research Team (multiple parallel teammates) |
| Requirements | `product-manager` |
| Design | `architect-reviewer` |
| Task Planning | `task-planner` |
| Artifact Review | `spec-reviewer` |
| Task Execution | `spec-executor` |

Prompting technique: Iron Law with explicit ban list and role table. Similar to superpowers' "Iron Law + rationalization table" pattern but applied to coordination roles rather than development behavior.


Excerpt 2: start.md — Ralph Loop Stop Enforcement

Source: plugins/ralph-specum/commands/start.md

## CRITICAL: Stop After Each Subagent (Normal Mode)

After ANY subagent returns in normal mode (no `--quick` flag):

1. Wait for subagent to return
2. Read `$basePath/.ralph-state.json`
3. If `awaitingApproval: true`: STOP IMMEDIATELY
4. Output a brief status message
5. **END YOUR RESPONSE**

**DO NOT:**
- Invoke another subagent in the same response
- Continue to the next phase automatically
- Ask if the user wants to continue

**The user must explicitly run the next command.** This gives them time to review artifacts.

Exception: `--quick` mode runs all phases without stopping.

Prompting technique: Explicit negative constraints (banned behaviors list) with machine-readable exception condition.


Excerpt 3: new.md — Goal Capture Mandate

Source: plugins/ralph-specum/commands/new.md

## Capture Goal

<mandatory>
The goal MUST be captured before proceeding:

1. If goal text was provided in arguments, use it
2. If NO goal text provided, use AskUserQuestion to ask:
   "What is the goal for this spec? Describe what you want to build or achieve."
3. Store the goal verbatim in .progress.md under "Original Goal"
</mandatory>

Prompting technique: <mandatory> XML tag wrapping a numbered conditional — makes the mandatory/optional distinction machine-parseable.


Excerpt 4: skills/spec-workflow/SKILL.md — Decision Tree Trigger

Source: plugins/ralph-specum/skills/spec-workflow/SKILL.md

---
name: spec-workflow
description: This skill should be used when the user asks to "build a feature", "create a spec",
"start spec-driven development", "run research phase", "generate requirements", "create design",
"plan tasks", "implement spec", "check spec status", "triage a feature", "create an epic",
"decompose a large feature", or needs guidance on spec-driven development workflow...
---

## Decision Tree: Where to Start

| Situation | Command |
|-----------|---------|
| New feature, want guidance | `/ralph-specum:start <name> <goal>` |
| New feature, skip interviews | `/ralph-specum:start <name> <goal> --quick` |
| Large feature needing decomposition | `/ralph-specum:triage <goal>` |
| Resume existing spec | `/ralph-specum:start` (auto-detects) |
| Jump to specific phase | `/ralph-specum:<phase>` |

Prompting technique: YAML frontmatter with trigger phrases list + decision table for routing. The frontmatter description is the skill's autonomous-activation trigger.

09

Uniqueness

Smart Ralph — Uniqueness

Differs From Seeds

Smart Ralph is most similar to spec-driver (both implement the Ralph loop, both produce research/requirements/design/tasks artifacts, both run task-by-task with fresh context), but Smart Ralph diverges in three concrete ways: (1) it ships as a Claude Code plugin with 15 slash commands instead of a Python CLI with hooks, making it zero-install for Claude Code users; (2) it adds a named subagent layer with 9 distinct persona-md agents where spec-driver has none, separating the coordinator from all implementation work by contract; and (3) it adds a two-pass semantic skill discovery mechanism that automatically invokes any installed Claude skills whose descriptions match the feature goal, creating a dynamic hook into third-party skill ecosystems that spec-driver lacks entirely.

Compared to superpowers (skills-only, no commands), Smart Ralph inverts the philosophy: commands are the primary entry point, skills are supplementary activations. Compared to BMAD-METHOD (persona-heavy, no Ralph loop), Smart Ralph uses agents only as task-scoped workers, not as persistent personas that the user addresses.

Positioning

  • "A tiny product team in your terminal"
  • Zero external dependencies beyond the AI tools
  • Explicit anti-pattern: the coordinator agent is banned from implementing anything
  • Appeals to developers who want structure without orchestration complexity

Observable Failure Modes

  1. Quick mode token exhaustion: With 100 global iterations and no context-window management, long specs in quick mode can hit context limits mid-execution. The stop-watcher loop provides no built-in compaction.
  2. Skill discovery false positives: The "err on the side of invoking" instruction for skill discovery may trigger expensive third-party skills unnecessarily.
  3. State desync: If the stop-watcher fires but .ralph-state.json is corrupted or missing, the loop can re-run already-completed phases.
  4. Single-branch execution: Unlike Forge, tasks run in the same worktree sequentially, so a failing task can leave the branch in a broken state.

Cross-References

04

Workflow

Smart Ralph — Workflow

Phases

Phase Command Agent Artifact Approval Gate
Research /ralph-specum:research research-analyst specs/<name>/research.md Yes — STOP, wait for user review
Requirements /ralph-specum:requirements product-manager specs/<name>/requirements.md Yes — STOP, wait for user review
Design /ralph-specum:design architect-reviewer specs/<name>/design.md Yes — STOP, wait for user review
Task Planning /ralph-specum:tasks task-planner specs/<name>/tasks.md Yes — STOP, wait for user review
Execution /ralph-specum:implement spec-executor commits (one per task) Per-task stop + resume (unless --quick)

Entry Points

  • /ralph-specum:start [name] [goal] [--quick] [--skip-research] [--commit-spec] [--tasks-size fine|coarse] [--specs-dir <path>] — Smart start
  • /ralph-specum:new <name> [goal] [--skip-research] — Explicit new spec
  • /ralph-specum:triage <goal> — Epic decomposition (multi-spec)

Quick Mode

When --quick is provided:

  1. All phases run sequentially with no approval gates
  2. PreToolUse hook blocks AskUserQuestion to enforce non-interactive execution
  3. After task completion, stop-watcher re-invokes the executor until ALL_TASKS_COMPLETE

Epic Workflow (Multi-Spec)

/ralph-specum:triage <goal>
  → triage-analyst creates epic with N dependency-ordered specs
  → .current-epic set, _epics/<name>/ created
  → Each spec runs through the normal single-spec flow
  → /ralph-specum:start auto-detects next unblocked spec from epic

Approval Gates

  1. After research phase — user must run /ralph-specum:requirements
  2. After requirements phase — user must run /ralph-specum:design
  3. After design phase — user must run /ralph-specum:tasks
  4. After tasks phase — user must run /ralph-specum:implement
  5. Per-task in execution (unless --quick) — stop-watcher pauses at each task boundary

Branch Management

  • The start command always checks the current git branch first
  • If on main/master, prompts user to create new branch, use worktree, or continue
  • In --quick mode, auto-creates a branch

Commit Behavior

  • Controlled by commitSpec flag in state (default: true)
  • --commit-spec / --no-commit-spec flags override
  • spec-executor creates a commit per completed task
06

Memory Context

Smart Ralph — Memory & Context

State Storage

All state is file-based, per-spec, in specs/<name>/.

.ralph-state.json (JSON)

Primary FSM state file. Fields:

  • source, name, basePath — spec identity
  • phase — current phase (research | requirements | design | tasks | execution)
  • taskIndex, totalTasks — execution progress
  • taskIteration, maxTaskIterations (5) — per-task retry limit
  • globalIteration, maxGlobalIterations (100) — global iteration cap
  • commitSpec — whether to commit spec artifacts
  • quickMode — whether --quick mode is active
  • discoveredSkills — array of {name, source, matchedAt, invoked} from skill discovery
  • awaitingApproval — boolean gating the stop-watcher loop
  • epicName — set if spec was spawned from an epic

.progress.md (Markdown)

Human-readable log. Sections:

  • YAML frontmatter: spec, basePath, phase, task progress, timestamp
  • Original Goal (verbatim user text)
  • Completed Tasks
  • Current Task
  • Learnings
  • Blockers
  • Skill Discovery (with matched/not-matched/failed per skill)

Persistence

  • Scope: project-level (per-repo, per-spec)
  • Survives session crashes and context resets because state is read from disk at session start
  • SessionStart hook loads .current-spec and associated .ralph-state.json automatically

Compaction Handling

  • The stop-watcher hook re-reads .ralph-state.json after each agent stop to determine whether to continue, not conversation memory
  • This makes the framework compaction-resistant: the FSM state is external to the conversation

Handoffs Between Sessions

  • load-spec-context.sh (SessionStart hook) injects active spec context into new sessions
  • .current-spec pointer file identifies which spec to resume
  • Epic pointer .current-epic survives session boundaries too

Spec Index

  • update-spec-index.sh maintains a searchable index of all specs in all configured specs_dirs
  • Enables the start command's "Scan Existing Specs" step to find related prior specs by keyword

Multi-Directory Support

  • specs_dirs configuration allows multiple spec directories (e.g., for monorepos)
  • --specs-dir <path> flag on commands overrides the default directory
07

Orchestration

Smart Ralph — Orchestration

Multi-Agent Pattern

Yes — hierarchical orchestration. The start command acts as a coordinator that spawns named subagents via Claude's Task tool for each lifecycle phase.

  • Orchestration pattern: hierarchical (coordinator + workers)
  • Worker assignment: one agent per phase (research-analyst, product-manager, architect-reviewer, task-planner, spec-executor)
  • Spec reviewer: can iterate up to 3x on any generated artifact before proceeding

Parallel Research

The research phase uses a "team research" pattern (described in references/parallel-research.md): multiple research sub-teammates are dispatched in parallel, then their outputs are merged before writing research.md.

Subagent Spawn Mechanism

  • All agents are spawned via Claude's Task tool with subagent_type: <name>
  • Agent definitions are persona-md files in plugins/ralph-specum/agents/
  • The coordinator reads these at runtime and selects the appropriate agent per phase

Isolation Mechanism

  • No container or git-worktree isolation per task
  • Branch management is handled at the spec level (one branch per spec, optionally)
  • Tasks execute in-place within the spec's branch

Execution Mode

  • Normal mode: interactive-loop — stop after each phase, user advances
  • Quick mode: continuous-ralph — all phases run automatically; stop-watcher hook drives the loop without user interaction

Stop-Watcher Loop (Continuous Mode)

The Stop hook fires stop-watcher.sh after every agent completion. The script:

  1. Reads .ralph-state.json
  2. If awaitingApproval: false and phase != "done": re-invokes the next phase automatically
  3. If ALL_TASKS_COMPLETE is output: sets phase to "done" and exits

Multi-Model

No multi-model routing. The framework relies entirely on the model the user has configured in their Claude Code session.

Consensus Mechanism

None — single agent per phase, no adversarial review (except the spec-reviewer retry loop which is self-review, not adversarial).

Prompt Chaining

Yes — one phase's output artifact (e.g., requirements.md) is explicitly passed as context to the next phase's agent (design), making this a classic prompt chaining pipeline.

08

Ui Cli Surface

Smart Ralph — UI / CLI Surface

CLI Binary

No dedicated CLI binary. The framework is a Claude Code plugin — all interaction is through slash commands inside the Claude Code session.

Local UI

None. No web dashboard or TUI.

IDE Integration

  • Claude Code: Primary target. Plugin installable via /plugin marketplace add tzachbon/smart-ralph
  • Codex CLI: Secondary target. Manual plugin install via file copy.

Observability

  • .progress.md — real-time human-readable progress log per spec
  • .ralph-state.json — machine-readable FSM state (phase, taskIndex, iterations)
  • Status command: /ralph-specum:status shows current phase and progress

Spec Index

The update-spec-index.sh script builds a searchable list of all specs across all configured directories. The start command uses this to surface related prior work.

Quick Mode Output

In --quick mode, each phase is tracked as a native Claude task via TaskCreate/TaskUpdate, providing visible spinner progress in the Claude Code UI.

Error Recovery

  • State is external to conversation, so session crashes do not lose progress
  • The --specs-dir validation prevents path injection via argument manipulation
  • Kebab-case validation on epic names prevents directory traversal

Related frameworks

same archetype · same primary tool · same memory type

Claude-Flow / Ruflo ★ 55k

Eliminates single-agent context limits and sequential bottlenecks by orchestrating fault-tolerant swarms of specialized AI agents…

Hermes Agent (NousResearch) ★ 168k

Self-improving personal AI agent with closed learning loop, 7 terminal backends, and messaging gateway — not tied to any AI…

OpenCode ★ 165k

Terminal-first AI coding agent with multi-model routing, native desktop app, and a typed .opencode/ configuration system for…

OpenHands ★ 75k

Open-source AI software development platform (open-source Devin alternative) with Docker sandbox isolation, 77.6% SWE-bench…

DeerFlow ★ 70k

Long-horizon superagent that researches, codes, and creates by orchestrating parallel sub-agents with isolated contexts in Docker…

oh-my-openagent (omo) ★ 60k

Multi-provider AI agent orchestration for OpenCode: escape vendor lock-in by routing Sisyphus (Claude/Kimi/GLM) and Hephaestus…