mit einem Klick
phase-4-heal
// Systematic error recovery using root cause investigation before fixes
// Systematic error recovery using root cause investigation before fixes
Break down PRD into atomic, testable tasks using CLI for modular storage
Autonomous implementation loop with TDD, fresh agents per task, and self-healing
Interactive requirement clarification through structured questions and PRD generation
Autonomous language and framework detection for any programming language. Use when user asks to "detect language", "what language is this project", or when initializing ralph-dev for a new project.
Autonomous end-to-end development from requirement to delivery. Use when user wants complete automation, "build X for me", or full feature implementation without manual steps.
Two-stage code review, quality gates, and automated delivery (commit + PR)
| name | phase-4-heal |
| description | Systematic error recovery using root cause investigation before fixes |
| allowed-tools | ["Read","Write","Bash","WebSearch","Grep","Glob"] |
| user-invocable | false |
Systematically investigate and fix implementation errors using root cause analysis. NO FIXES WITHOUT INVESTIGATION FIRST.
NO FIXES WITHOUT ROOT CAUSE INVESTIGATION FIRST
If you haven't completed Phase 1 (Root Cause Investigation), you CANNOT propose fixes.
{task_id}{error_msg}IMPORTANT: This skill requires the Ralph-dev CLI. It will build automatically on first use.
# Bootstrap CLI - runs automatically, builds if needed
source ${CLAUDE_PLUGIN_ROOT}/shared/bootstrap-cli.sh
# Verify CLI is ready
ralph-dev --version
# Context-compression resilience: Verify current phase
CURRENT_PHASE=$(ralph-dev state get --json 2>/dev/null | jq -r '.phase // "none"')
echo "Current phase: $CURRENT_PHASE"
# Expected: implement or heal (invoked by phase-3)
# Get task details (context-compression safe)
TASK_JSON=$(ralph-dev tasks get "$TASK_ID" --json)
TASK_DESC=$(echo "$TASK_JSON" | jq -r '.data.description // "No description"')
# Get test command from language config
TEST_CMD=$(ralph-dev detect --json | jq -r '.verifyCommands[] | select(contains("test"))' | head -1)
echo "Task: $TASK_ID"
echo "Description: $TASK_DESC"
echo "Test command: $TEST_CMD"
MANDATORY: Complete each phase before proceeding to the next.
CI=true {test_command} to confirmgit log -5, git diff HEAD~1Error Classification:
| Error Type | Indicators | Fix Type |
|---|---|---|
| Missing dependency | "Module not found", "Cannot find module" | npm install |
| Type error | "TypeError", type mismatch | Code fix |
| Undefined reference | "is not defined", "ReferenceError" | Import/declaration |
| Test failure | "Expected X but got Y" | Implementation logic |
| Build error | "compilation error", "build failed" | Config fix |
Max 3 attempts. After 3 failures → mark task as failed.
MAX_ATTEMPTS=3
ATTEMPT=1
while [ $ATTEMPT -le $MAX_ATTEMPTS ]; do
# Apply single fix based on hypothesis
# Run tests: CI=true {test_command}
if [ $? -eq 0 ]; then
# SUCCESS - return result
break
fi
ATTEMPT=$((ATTEMPT + 1))
# If still failing, refine hypothesis and retry
done
CRITICAL: Always show full test output as verification evidence.
REQUIRED Output Format:
---HEALING RESULT---
task_id: {task_id}
status: success | failed
verification_passed: true | false
attempts: {N}
fix_type: dependency | code | implementation | config
hypothesis: {what was wrong}
notes: {brief summary}
---END HEALING RESULT---
| Limit | Value | Purpose |
|---|---|---|
| Max attempts | 3 | Prevent infinite retry loops |
| Timeout | 1 hour | Prevent stuck healing |
| Single fix per attempt | 1 | Isolate variables |
CI=true when running tests| Error | Action |
|---|---|
| Cannot reproduce | Gather more data, check environment |
| No working examples | Use WebSearch for reference implementations |
| All 3 attempts fail | Mark task failed, require manual intervention |
| Hypothesis unclear | Return to Phase 1 with more investigation |