tzachbon/smart-ralph: Spec-Driven Development for Claude Code
Developers using AI coding assistants often hit a familiar wall: you describe a feature in plain language, and the AI generates code that misses requirements, skips edge cases, or drifts from your intent. The loop of clarification and correction burns context window and patience. tzachbon/smart-ralph addresses this by forcing structure before execution—turning vague ideas into research documents, requirements, designs, and discrete tasks before any code is written. Named after the Ralph agentic loop pattern and The Simpsons' earnest but simple-minded student, this MIT-licensed plugin (426 GitHub stars, 35 forks) brings spec-driven development directly into Claude Code and OpenAI Codex.
What is tzachbon/smart-ralph?
tzachbon/smart-ralph is a plugin for Claude Code and Codex that implements a structured, phase-based workflow for AI-assisted software development. Created by Tzach Bonfil and released under the MIT License, it is written primarily in Shell and was last updated July 11, 2026.
The tool sits at the intersection of two emerging practices: spec-driven development (defining what to build before building it) and agentic AI workflows (letting AI systems autonomously execute multi-step processes). Rather than treating the AI as a code generator that responds to prompts, Smart Ralph treats it as a member of a product team with defined roles and deliverables.
The core insight comes from the Ralph pattern: don't overthink, just do the next task. But critically, the "next task" is always well-defined because it was produced by a preceding structured phase. This prevents the common failure mode where AI assistants lose coherence across long sessions or generate solutions that don't match the original goal.
Smart Ralph is self-contained as of v3.0.0—it requires no external dependencies or companion plugins to manage its execution loop. This addresses earlier architectural complexity where task execution required a separate "ralph-loop" component.
Key Features
Phase-Based Spec Workflow
Smart Ralph enforces a five-phase progression: Research → Requirements → Design → Tasks → Implementation. Each phase produces a markdown↗ Smart Converter artifact stored in ./specs/<name>/. You cannot skip phases accidentally; the command structure makes the sequence explicit.
Specialized Sub-Agents
Each phase invokes a purpose-built agent persona: research-analyst for web search and codebase analysis, product-manager for user stories, architect-reviewer for technical decisions, task-planner for sequencing, and spec-executor for implementation. This separation of concerns prevents a single prompt context from becoming overloaded.
Fresh Context Per Task The execution loop resets context for each individual task rather than accumulating an ever-growing conversation. This combats context window exhaustion and reduces the likelihood that late tasks are contaminated by early, potentially obsolete decisions.
Approval-Gated Execution Outside of explicit quick mode, Ralph stops after each spec artifact and requests human approval, changes, or continuation. This keeps developers in control while automating the mechanical work of document generation.
Codebase Indexing (v2.12.0+)
The /ralph-specum:index command scans existing codebases for controllers, services, models, helpers, and migrations, generating searchable component specs. This makes legacy code discoverable during research for new features.
Dual Platform Support
Full parity plugins exist for both Claude Code (/ralph-specum:* commands) and OpenAI Codex ($ralph-specum-* skills), with identical workflow semantics.
Alternative Methodology: Ralph Speckit
For teams needing stricter governance, ralph-speckit implements GitHub's spec-kit methodology with constitution-first project memory, numbered feature directories, and full requirement-to-acceptance-criteria traceability.
Use Cases
Greenfield Feature Development When adding substantial new capabilities—such as user authentication, payment processing, or data pipelines—Smart Ralph prevents the "build first, discover requirements later" anti-pattern. The research phase analyzes existing code and external resources; requirements capture user stories; design documents architectural decisions. This is particularly valuable for [INTERNAL_LINK: backend architecture planning] where early structural choices constrain later flexibility.
Legacy Codebase Maintenance
The indexing feature addresses a genuine pain point: understanding what's already built before modifying it. Running /ralph-specum:index on an unfamiliar repository generates a searchable map of components, reducing the risk of duplicating functionality or breaking undocumented dependencies.
Cross-Cutting Epic Decomposition
Large initiatives that span multiple domains—like migrating authentication systems or implementing real-time collaboration—exceed the scope of single specs. The /ralph-specum:triage phase decomposes these into dependent specifications with interface contracts, enabling parallel workstreams where possible (marked with [P] for low-conflict parallel tasks).
Team Onboarding and Knowledge Transfer
The generated spec artifacts (research.md, requirements.md, design.md, tasks.md) serve as persistent documentation. New team members can read the spec directory to understand why code was built a certain way, not just what it does.
Solo Developer Focus Management For individual developers using Claude Code or Codex, Smart Ralph provides externalized structure. The tool manages what to do next, freeing cognitive resources for the actual implementation decisions within each bounded task.
Installation & Setup
Claude Code Installation
# Install from marketplace
/plugin marketplace add tzachbon/smart-ralph
/plugin install ralph-specum@smart-ralph
# Restart Claude Code
The /plugin commands register Smart Ralph with Claude Code's plugin system. ralph-specum is the plugin identifier; smart-ralph is the repository namespace. Restart is required for command registration.
Codex Installation (Personal)
# 1. Clone the Smart Ralph repo
git clone https://github.com/tzachbon/smart-ralph.git /tmp/smart-ralph
# 2. Copy the Codex plugin into your personal plugins directory
mkdir -p ~/.codex/plugins
cp -R /tmp/smart-ralph/plugins/ralph-specum-codex ~/.codex/plugins/ralph-specum-codex
# 3. Create a marketplace entry so Codex can discover the plugin
mkdir -p ~/.agents/plugins
cat > ~/.agents/plugins/marketplace.json << 'EOF'
{
"name": "smart-ralph",
"plugins": [{
"name": "ralph-specum",
"source": {"source": "local", "path": "~/.codex/plugins/ralph-specum-codex"},
"policy": {"installation": "AVAILABLE"},
"category": "Productivity"
}]
}
EOF
# 4. Clean up
rm -rf /tmp/smart-ralph
This installs the plugin globally for all Codex sessions. The ~/.codex/plugins/ directory is Codex's plugin search path; ~/.agents/plugins/marketplace.json registers it in the local marketplace.
Codex Installation (Per-Project)
# Run from your project root directory
git clone https://github.com/tzachbon/smart-ralph.git /tmp/smart-ralph
mkdir -p ./plugins
cp -R /tmp/smart-ralph/plugins/ralph-specum-codex ./plugins/ralph-specum-codex
mkdir -p ./.agents/plugins
cat > ./.agents/plugins/marketplace.json << 'EOF'
{
"name": "smart-ralph",
"plugins": [{
"name": "ralph-specum",
"source": {"source": "local", "path": "./plugins/ralph-specum-codex"},
"policy": {"installation": "AVAILABLE"},
"category": "Productivity"
}]
}
EOF
rm -rf /tmp/smart-ralph
Use per-project installation when you need version pinning or team-shared plugin configuration committed to repository.
Optional: Enable Stop Hook for Autonomous Execution
# ~/.codex/config.toml
[features]
codex_hooks = true
The stop hook enables automatic task execution without manual approval between each task. Without this, Codex stops after each task completion.
Real Code Examples
Starting a New Spec (Claude Code)
# Smart entry: auto-detects whether to resume or create new
/ralph-specum:start user-auth Add JWT authentication
This creates ./specs/user-auth/ and begins the research phase. The first argument is the spec identifier (used for directory naming and state tracking); remaining text is the goal description. If ./specs/user-auth/ already exists, it resumes from the last completed phase.
Quick Mode Execution
# Skip spec phases, auto-generate everything and execute
/ralph-specum:start "Add user auth" --quick
Quick mode bypasses approval checkpoints, generating research, requirements, design, and tasks automatically before executing. Use when you have high confidence in the goal's clarity and low risk of misinterpretation.
Step-by-Step Explicit Control
/ralph-specum:new user-auth Add JWT authentication
/ralph-specum:requirements
/ralph-specum:design
/ralph-specum:tasks
/ralph-specum:implement
This demonstrates the full manual progression. Each command generates its respective artifact and stops for approval (unless in quick mode). The :new command creates the spec directory and runs research; subsequent commands advance through the pipeline.
Codex Surface Commands
$ralph-specum
$ralph-specum-start
$ralph-specum-triage
$ralph-specum-research
$ralph-specum-requirements
$ralph-specum-design
$ralph-specum-tasks
$ralph-specum-implement
$ralph-specum-status
Codex uses $-prefixed skill invocations rather than /-prefixed slash commands. The base $ralph-specum skill provides the full workflow; suffixed variants provide direct phase entrypoints. Additional helpers include $ralph-specum-switch, $ralph-specum-cancel, $ralph-specum-index, $ralph-specum-refactor, $ralph-specum-feedback, and $ralph-specum-help.
Codebase Indexing
# Full interactive indexing (recommended first-time)
/ralph-specum:index
# Quick mode - skip interviews, batch scan only
/ralph-specum:index --quick
# Dry run - preview without writing files
/ralph-specum:index --dry-run
# Index specific directory
/ralph-specum:index --path=src/api/
# Force regenerate all specs
/ralph-specum:index --force
The indexing command interviews you about external resources, scans for recognized component patterns, validates findings, and writes to ./specs/.index/. Options control scope, verbosity, and overwrite behavior.
Advanced Usage & Best Practices
Index Before You Spec: The README explicitly recommends running /ralph-specum:index before starting features on existing codebases. Without indexing, the research agent lacks visibility into existing components, leading to redundant or conflicting implementations.
Use Triage for Epics: When your goal description contains multiple deliverables or cross-domain concerns, start with /ralph-specum:triage (or $ralph-specum-triage). This produces an epic plan with multiple spec names and dependency ordering, preventing a single bloated spec.
Control Task Granularity: The --tasks-size fine|coarse option adjusts task breakdown detail. Fine granularity provides more checkpointing and easier debugging; coarse reduces overhead for straightforward implementations.
Leverage Parallel Markers: Tasks marked [P] in the task list are identified as low-conflict and safe for parallel execution. Review these for opportunities to reduce wall-clock time.
Preserve Spec Artifacts: The ./specs/ directory contains valuable design rationale. Commit it to version control (excluding .ralph-state.json and .progress.md, which are ephemeral) to maintain institutional knowledge.
Choose Your Methodology: For personal projects or rapid iteration, ralph-specum with its ./specs/ structure is sufficient. For enterprise contexts requiring audit trails and formal traceability, evaluate ralph-speckit with its .specify/ directory and constitution-based governance.
Comparison with Alternatives
| Tool | Approach | Platform | Key Difference |
|---|---|---|---|
| tzachbon/smart-ralph | Structured phase workflow with spec artifacts | Claude Code, Codex | Enforces research→requirements→design→tasks→implement sequence; codebase indexing |
| Aider | Pair programming with git integration | CLI, multiple editors | Deep git integration for commit granularity; less structured spec phase separation |
| Devin (Cognition) | Fully autonomous AI engineer | Web platform | End-to-end autonomy with browser and shell access; requires external service, not plugin-based |
| GitHub Copilot Workspace | Task decomposition with plan verification | GitHub, VS Code | Tight GitHub ecosystem integration; plan review before implementation but less explicit phase artifacts |
Smart Ralph's distinguishing characteristic is its artifact-centric workflow: each phase produces a persistent, human-readable document that serves as both checkpoint and documentation. Aider optimizes for tight edit-commit loops; Devin for full autonomy; Copilot Workspace for GitHub-native integration. Smart Ralph fits developers who want structured guardrails without surrendering control to a fully autonomous agent.
FAQ
Is tzachbon/smart-ralph free to use? Yes, released under the MIT License. No pricing or paid tiers are mentioned in the repository.
Does it work with editors other than Claude Code? Full plugins exist for Claude Code and OpenAI Codex. No VS Code, JetBrains, or other editor extensions are documented.
What happens if a task fails repeatedly?
The loop stops after max iterations. Check .progress.md for error details, fix manually, then resume with /ralph-specum:implement.
Can I use this without internet access? The research phase uses web search when available. Offline operation would limit research capabilities but not prevent local codebase analysis or spec generation.
How do I update the plugin? Re-clone the repository and copy the plugin directory over your existing installation. See the README's updating section for exact commands per install method.
Is my code sent to external services? The plugin operates within Claude Code or Codex, which have their own data handling policies. The plugin itself has no external dependencies or telemetry as of v3.0.0.
What's the difference between ralph-specum and ralph-speckit?
ralph-specum is the default quick-iteration workflow. ralph-speckit implements stricter spec-kit methodology with project constitutions and full traceability for team/enterprise use.
Conclusion
tzachbon/smart-ralph solves a concrete problem: AI coding assistants generate code faster than humans can specify requirements, leading to misaligned implementations and wasted context window. By enforcing structured spec phases before execution, it trades a small upfront time investment for significantly higher implementation accuracy and persistent documentation.
The tool is best suited for developers already using Claude Code or Codex who find themselves repeatedly clarifying AI-generated code, working with complex or unfamiliar codebases, or needing to justify technical decisions to stakeholders. The 426-star community suggests genuine utility, though as with any plugin-dependent workflow, adoption requires comfort with the host platform's ecosystem.
If spec-driven development with AI assistance matches your workflow needs, explore the repository at https://github.com/tzachbon/smart-ralph and evaluate whether the default ralph-specum or governance-oriented ralph-speckit better fits your project context.