ralph-implement
Skill6 starsChanged 27 days agoMITView on GitHub
Implement a task list with the ralph-loop pattern — run, score, fix, re-run. Generic code-implementation loop (separate from skill-validator which targets skills). Use when executing a plan from task-plan. Triggers — "implement the plan", "ralph the implementation", "work the task list", "iterate on [feature]", "run the implementation loop". Two-strike rule on retries; escalates to `debugger` and `five-whys` on repeated failure rather than masking with a third blind retry.
In this repository30 other files it gives its agents.
- adversarial-re-readSkill
- adversarial-reviewSkill
- build-estimateSkill
- build-evaluateSkill
- build-executeSkill
- build-planSkill
- build-polishSkill
- build-prdSkill
- build-probeSkill
- build-validateSkill
- excel-connector-governanceSkill
- five-whysSkill
- insight-builderSkill
- insight-crystallizerSkill
- insight-promotionSkill
- multi-sessionSkill
- notion-governanceSkill
- oodaSkill
- prd-writerSkill
- promote-to-toolingSkill
- quality-reviewSkill
- ralph-loopSkill
- search-governanceSkill
- session-outputSkill
- skill-validatorSkill
- task-planSkill
- verifySkill
- voice-profile-testSkill
- why-diagnosticSkill
- writing-qualitySkill
The file
We split this skill into the rules it gives an agent
6 rules. About 0 are common, 2 are distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 78
If debugger returns a root cause, apply the minimal fix and retry once.
- Distinctive: line 92
If a task fails twice with the same failure mode:
- Very specific: line 95
If debugger returns a root cause and minimal fix — apply and retry once
- Very specific: line 96
If debugger cannot reproduce or cannot find a root cause — invoke five-whys, surface to the user, halt the task
- Distinctive: line 126
Before starting the loop:
- Very specific: line 157
Hand-rolled parallel spawning: Use multi-agent-coordinator.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 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
Ralph Implement
Continuous-iteration implementation loop. For each task in a plan, implement the smallest change that addresses it, run the task-level checks, and iterate on failure. Stop cleanly when the budget is exhausted.
When to use
- Executing a task list produced by
task-plan - Migrating a refactor through a sequence of small changes
- Driving any code work where each step has a deterministic pass/fail check
When NOT to use
- Validating a skill against a target repo — use
skill-validator - Pure exploration where no task-level checks are defined
- Tasks already in a CI pipeline that handles iteration
Inputs
plan_path— path to the task plan (e.g.,docs/PRDs/<slug>-plan.md)task_checks— per-task command(s) that verify the task is done. Format:<task_id>: <command>.budget— max retries per task (default 3) and max minutes per task (default 30). Hard cap.
The loop (per task)
for task in plan.unchecked_tasks():
retries = 0
while retries < BUDGET.max_retries:
implement(task) # smallest change that addresses the task
result = run(task_checks[task.id])
if result.passed:
invoke `code-reviewer` against the changed files
if code-reviewer returns no Critical: mark_complete(task)
else: log and retry with code-reviewer findings as input
break
retries += 1
if same_failure_mode_as_last_retry(result):
invoke `debugger` for reproduction-first investigation
if debugger surfaces a root cause: apply the minimal fix and retry once
else: invoke `five-whys` and stop_task()
else:
stop_task() and escalate(task)The two agents the loop calls
The loop above names these at the two points that matter. Both are gates, not commentary.
code-reviewer — on every task whose check just passed, before it is marked done
A Critical finding sends the task back into the loop with the findings as input. The task check is a gate; it is not the only gate.
Agent(
subagent_type="code-reviewer",
description="Review task {N} before marking done",
prompt="Review the changed files at <paths> — diff scope only, not the whole repo. Task: <task title and its one-line scope>. Its check command already passed: <command>. Do NOT re-report what the check covers. Report correctness bugs, type-safety gaps, blast-radius misses beyond the changed files, and structural debt, each with file and line, marked Critical / High / Medium / Low. Read-only, no edits."
)debugger — on the FIRST same-failure-mode repeat, not after the third
Earlier than the two-strike halt on purpose: the point is to investigate before a blind retry, not after one.
Agent(
subagent_type="debugger",
description="Reproduce and narrow the repeated failure on task {N}",
prompt="Task: <task title>. Check command: <command>. It has now failed twice with the same failure mode. Attempt 1 output: <paste>. Attempt 2 output: <paste>. Changes made between them: <paste diff>. Reproduce the failure first, then narrow to a root cause with evidence — a log line, a code path, or a test output. Return the root cause and the SMALLEST fix, or state plainly that you cannot reproduce it. Do not implement the fix."
)If debugger returns a root cause, apply the minimal fix and retry once. If it cannot reproduce or cannot find a root cause, invoke five-whys and halt the task — a blind third retry is worse than a clean failure.
Also referenced by this skill
five-whys— the protocol path whendebuggercomes back empty. Halts the task.error-coordinator— when 2+ parallel tasks fail in the same run, correlates symptoms to a shared cause (upstream dependency, shared config, environment) before the group is stopped.multi-agent-coordinator— reads the plan's "Parallelizable groups" section and runs those tasks concurrently with partial-failure handling.
Parallel task groups
If the plan marks a group of tasks as parallelizable, multi-agent-coordinator spawns them concurrently. Each parallel task gets its own scope and own retry budget. A failure in one parallel task does NOT auto-stop the others — error-coordinator correlates failures to a shared cause before stopping the group.
Two-strike rule (mandatory)
If a task fails twice with the same failure mode:
- Invoke
debuggerfor reproduction-first investigation - If
debuggerreturns a root cause and minimal fix — apply and retry once - If
debuggercannot reproduce or cannot find a root cause — invokefive-whys, surface to the user, halt the task
A blind third retry without debugger intervention is worse than a clean failure.
Per-task logging
Each task run writes .ralph-implement/<feature_slug>/task-<N>.json:
{
"task_id": "<N>",
"title": "<task title>",
"started_at": "<iso8601>",
"ended_at": "<iso8601>",
"retries": <int>,
"passed": <bool>,
"final_check": "<command>",
"final_result": "<stdout/stderr summary>",
"failure_modes": ["<deduped error class>", ...],
"code_reviewer_findings": "<summary or path>",
"debugger_invoked": <bool>,
"five_whys_invoked": <bool>,
"escalated": <bool>
}The log file is the audit trail.
Pre-flight checklist
Before starting the loop:
- Does the plan exist and have unchecked tasks?
- Does every task have a corresponding check command in
task_checks? - Does the plan have a "Parallelizable groups" section (run
task-distributorfirst if not)? - Is the workspace clean?
- Have I read the PRD success criteria and confirmed the plan covers them?
- Is the budget set?
Pass / fail summary
The loop closes when every plan task is checked complete and every check returned pass on the final retry.
The loop stops without closing when any task exhausts its retry budget, two-strike triggers and debugger + five-whys halt the task, or the user explicitly stops.
Relationship to other skills
- task-plan — input
- debugger — invoked at the first same-failure-mode repeat
- five-whys — invoked if
debuggercannot surface a root cause - code-reviewer — invoked after every task check passes, before marking done
- multi-agent-coordinator — orchestrates parallel spawns
- error-coordinator — correlates failures across parallel tasks
- quality-review — runs at Stage 6 against the built implementation; not invoked inside this skill
- skill-validator — sibling skill, specialized for validating skills
Anti-patterns
- Patching past the first same-failure repeat without
debugger. The classic ralph failure. - Implementing past the task scope. Each task does one thing.
- Skipping the
code-reviewerpass. The task check is a gate, not the only gate. - Hand-rolled parallel spawning. Use
multi-agent-coordinator; the partial-failure handling matters. - Silent escalation. Escalations go to the user explicitly.
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.

