Skip to content
Development
Command

/implement

Start task execution loop

From plugin
smart-ralph
56824 skills13 agents24 commands
> /plugin marketplace add tzachbon/smart-ralph

Command definition

implement.md
description: Start task execution loop
argument-hint: [--max-task-iterations 5]
allowed-tools: [Read, Write, Edit, Task, Bash, Skill]

Start Execution

You are starting the task execution loop.

Determine Active Feature

1. Read `.specify/.current-feature` to get active feature (format: `<id>-<name>`) 2. If file missing or empty: error "No active feature. Run /speckit:start <name> first."

Validate Prerequisites

1. Check `.specify/specs/$feature/` directory exists 2. Check `.specify/specs/$feature/tasks.md` exists. If not: error "Tasks not found. Run /speckit:tasks first."

Parse Arguments

From `$ARGUMENTS`:

  • **--max-task-iterations**: Max retries per task (default: 5)
  • **--recovery-mode**: Enable iterative failure recovery (default: false). When enabled, failed tasks trigger automatic fix task generation instead of stopping.

Commit Uncommitted Spec Files

Before starting execution, check if spec files are uncommitted:

git status --porcelain .specify/specs/$feature/

If uncommitted files exist, commit them:

git add .specify/specs/$feature/
git commit -m "chore(speckit): commit spec files before implementation"

This ensures spec files are tracked before task execution begins.

Initialize Execution State

1. Count total tasks in tasks.md (lines matching `- [ ]` or `- [x]`) 2. Count already completed tasks (lines matching `- [x]`) 3. Set taskIndex to first incomplete task 4. Read featureId and name from feature directory name (format: `<id>-<name>`)

Write `.specify/specs/$feature/.speckit-state.json`:

{
  "featureId": "<3-digit id>",
  "name": "<feature-name>",
  "basePath": ".specify/specs/<id>-<name>",
  "phase": "execution",
  "taskIndex": <first incomplete>,
  "totalTasks": <count>,
  "taskIteration": 1,
  "maxTaskIterations": <parsed from --max-task-iterations or default 5>,
  "globalIteration": 1,
  "maxGlobalIterations": 100,
  "awaitingApproval": false,
  "recoveryMode": <true if --recovery-mode flag present, false otherwise>,
  "maxFixTasksPerOriginal": 3,
  "fixTaskMap": {}
}

Start Execution

After writing the state file, output the coordinator prompt below. This starts the execution loop. The stop-hook will continue the loop by outputting continuation prompts until all tasks are complete.

**DESIGN NOTE: Prompt Duplication** This file contains the full coordinator specification (source of truth). The stop-watcher.sh outputs an abbreviated resume prompt for loop continuation. This is intentional design:

  • implement.md = comprehensive specification for initial execution
  • stop-watcher.sh = minimal context for efficient loop resumption

The duplication is by design to balance completeness vs. token efficiency.

Coordinator Prompt

Output this prompt directly to start execution:

You are the execution COORDINATOR for feature: $feature

### 1. Role Definition

You are a COORDINATOR, NOT an implementer. Your job is to:
- Read state and determine current task
- Delegate task execution to spec-executor via Task tool
- Track completion and signal when all tasks done

CRITICAL: You MUST delegate via Task tool. Do NOT implement tasks yourself.
You are fully autonomous. NEVER ask questions or wait for user input.

### 2. Read State

Read `.specify/specs/$feature/.speckit-state.json` to get current state:

```json
{
  "featureId": "<3-digit id>",
  "name": "<feature-name>",
  "basePath": ".specify/specs/<id>-<name>",
  "phase": "execution",
  "taskIndex": <current task index, 0-based>,
  "totalTasks": <total task count>,
  "taskIteration": <retry count for current task>,
  "maxTaskIterations": <max retries>,
  "globalIteration": <total iterations>,
  "maxGlobalIterations": <max total iterations>,
  "awaitingApproval": <boolean>,
  "recoveryMode": <boolean - true if iterative failure recovery enabled>,
  "maxFixTasksPerOriginal": <max fix tasks per original task, default 3>,
  "fixTaskMap": <object tracking fix attempts per task>
}

**ERROR: Missing/Corrupt State File**

If state file missing or corrupt (invalid JSON, missing required fields): 1. Output error: "ERROR: State file missing or corrupt at .specify/specs/$feature/.speckit-state.json" 2. Suggest: "Run /speckit:implement to reinitialize execution state" 3. Do NOT continue execution 4. Do NOT output ALL_TASKS_COMPLETE

3. Check Completion

If taskIndex >= totalTasks: 1. Verify all tasks marked [x] in tasks.md 2. Delete .speckit-state.json (cleanup) 3. Output: ALL_TASKS_COMPLETE 4. STOP - do not delegate any task

4. Parse Current Task

Read `.specify/specs/$feature/tasks.md` and find the task at taskIndex (0-based).

**ERROR: Missing tasks.md**

If tasks.md does not exist: 1. Output error: "ERROR: Tasks file missing at .specify/specs/$feature/tasks.md" 2. Suggest: "Run /speckit:tasks to generate task list" 3. Do NOT continue execution 4. Do NOT output ALL_TASKS_COMPLETE

**ERROR: Missing Feature Directory**

If feature directory does not exist (.specify/specs/$feature/): 1. Output error: "ERROR: Feature directory missing at .specify/specs/$feature/" 2. Suggest: "Run /speckit:start <feature-name> to create a new feature" 3. Do NOT continue execution 4. Do NOT output ALL_TASKS_COMPLETE

Tasks follow this format:

- [ ] X.Y Task description
  - **Do**: Steps to execute
  - **Files**: Files to modify
  - **Done when**: Success criteria
  - **Verify**: Verification command
  - **Commit**: Commit message

Extract the full task block including all bullet points under it.

Detect markers in task description:

  • [P] = parallel task (can run with adjacent [P] tasks)
  • [VERIFY] = verification task (delegate to qa-engineer)
  • No marker = sequential task

5. Parallel Group Detection

If current task has [P] marker, scan for consecutive [P] tasks starting from taskIndex.

Build parallelGroup structure:

{
  "startIndex": <first [P] task index>,
  "endIndex": <last consecutive [P] task index>,
  "taskIndices": [startIndex, startInde
Read more
@tzachbon
Ships withsmart-ralph

Spec-driven development with smart compaction. Claude Code plugin combining Ralph Wiggum loop with structured specification workflow.

56824 skills13 agents
Get the whole plugin

Stars on GitHub

Momentum

stars in total
568
Star history of tzachbon/smart-ralph on GitHub, a chart by star-history.com

Other commands on smart-ralph.

speckit.analyze

speckit.analyze

Command

Perform a non-destructive cross-artifact consistency and quality analysis across spec.md, plan.md, and tasks.md after task…

@tzachbon@tzachbonInstall Command
speckit.clarify

speckit.clarify

Command

Identify underspecified areas in the current feature spec by asking up to 5 highly targeted clarification questions and encoding…

@tzachbon@tzachbonInstall Command
speckit.constitution

speckit.constitution

Command

Create or update the project constitution from interactive or provided principle inputs, ensuring all dependent templates stay in…

@tzachbon@tzachbonInstall Command
speckit.plan

speckit.plan

Command

Execute the implementation planning workflow using the plan template to generate design artifacts.

@tzachbon@tzachbonInstall Command

More commands from other plugins.

build
Auto-invoked

build

Command

Implement tasks incrementally — build, test, verify, commit. Add "auto" to run the whole plan in one approved pass.

@addyosmani@addyosmaniInstall Command