claude/ai-resources-plugin/skills/analyze-ralph-logs/SKILL.md
This skill should be used when analyzing Ralph Loop workflow executions to diagnose failures, understand execution flow, or review what happened during the most recent run. Use when the user says "analyze ralph logs", "what happened with ralph", "ralph stopped", "ralph failed", "debug ralph", or wants to understand why a Ralph Loop execution ended unexpectedly.
npx skillsauth add amhuppert/my-ai-resources analyze-ralph-logsInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Diagnose Ralph Loop workflow executions by analyzing logs, state files, and error conditions. Provides failure analysis with concrete solutions.
The Ralph Loop is an autonomous development system that executes Claude Code in iterations. When execution stops unexpectedly or behaves incorrectly, this skill provides a systematic approach to diagnose the cause and propose solutions.
| File | Purpose | Format |
| --------------------------------------------------- | -------------------------------------------------- | ---------------- |
| .ralph/logs/ralph.log | Main loop activity log | Timestamped text |
| .ralph/logs/claude_output_YYYY-MM-DD_HH-MM-SS.log | Per-execution Claude output | JSON or text |
| .ralph/status.json | Current loop/API status | JSON |
| .ralph/.response_analysis | Latest response analysis | JSON |
| .ralph/.circuit_breaker_state | Circuit breaker state | JSON |
| .ralph/.exit_signals | Rolling exit signal tracking | JSON |
| .ralph/.ralph_session | Session lifecycle tracking | JSON |
| .ralph/live.log | Real-time streaming output (when --live enabled) | Text/JSON |
Find and read the most recent Claude output log:
ls -lt .ralph/logs/claude_output_*.log | head -1
Read this file to understand what Claude was doing in its last execution.
Read these files in parallel to understand the current state:
.ralph/status.json - Shows current loop count, API call usage, and last action.ralph/.response_analysis - Shows how the last response was analyzed.ralph/.circuit_breaker_state - Shows if stagnation was detected.ralph/.exit_signals - Shows recent completion/test-only/done signals.ralph/.ralph_session - Shows session lifecycle and any resetsRead the last 100 lines of the main loop log:
tail -100 .ralph/logs/ralph.log
Look for:
[ERROR])[WARN])Match observations against the failure modes in the "Failure Modes Reference" section below.
Based on the diagnosed failure mode, propose a concrete solution from the reference.
Diagnosis:
Check consecutive_no_progress and consecutive_same_error counts in circuit breaker state.
Root Causes:
Solutions:
.ralph/fix_plan.md - tasks may be too vague.ralph/PROMPT.md for unclear instructionsralph --reset-circuitDiagnosis:
Check denied_commands array in response analysis to see which tools were blocked.
Root Causes:
.ralphrc ALLOWED_TOOLS missing required tool patternsSolutions:
.ralph/.response_analysisALLOWED_TOOLS in .ralphrc to include needed patterns:
ALLOWED_TOOLS="Write,Read,Edit,Bash(git *),Bash(npm *),Bash(pytest)"
Bash(npm *) allows all npm commandsralph --reset-session
</failure-mode>Diagnosis: Check if execution consistently times out at same point.
Root Causes:
Solutions:
ralph --timeout 30 (minutes, max 120).ralphrc: CLAUDE_TIMEOUT_MINUTES=30.ralph/fix_plan.mdDiagnosis: This is an Anthropic API limit, not a Ralph configuration issue.
Solutions:
--calls flag to limit API calls per hour.ralph/.call_count to see current hour's usage
</failure-mode>Diagnosis: Claude is only running tests without implementing changes.
Root Causes:
Solutions:
.ralph/fix_plan.md for incomplete implementation tasksralph --reset-session
</failure-mode>Diagnosis: Claude signaled completion (EXIT_SIGNAL: true) with multiple completion indicators.
Root Causes:
Solutions:
.ralph/PROMPT.md.ralph/fix_plan.md has unchecked tasks for remaining workralph --reset-session
</failure-mode>Diagnosis: Check session file for reset reasons and last_used timestamps.
Root Causes:
Solutions:
SESSION_EXPIRY_HOURS=48 in .ralphrcDiagnosis: Read the Claude output log for error details.
Root Causes:
Solutions:
claude --versionclaude (should prompt or show ready)Diagnosis: Read the raw Claude output log - check if it's valid JSON.
Root Causes:
Solutions:
CLAUDE_OUTPUT_FORMAT=json in .ralphrc--output-format textDiagnosis: Check git status and compare to loop start SHA.
Root Causes:
Solutions:
git status for untracked files.gitignore is excluding changed files
</failure-mode>When reading .ralph/*.json files, extract these key fields:
{
"loop_count": 42, // Total iterations
"calls_made_this_hour": 15, // API usage
"status": "running", // running|stopped|complete
"exit_reason": "" // Why it stopped
}
{
"state": "CLOSED", // CLOSED|HALF_OPEN|OPEN
"consecutive_no_progress": 0, // Loops without changes
"consecutive_same_error": 0, // Repeated errors
"consecutive_permission_denials": 0, // Permission blocks
"reason": "" // Why state changed
}
{
"loop_number": 42,
"analysis": {
"has_completion_signal": false,
"is_test_only": false,
"has_progress": true,
"exit_signal": false, // Claude says done
"has_permission_denials": false,
"denied_commands": [] // Blocked tools
}
}
{
"test_only_loops": [], // Recent test-only iterations
"done_signals": [], // Recent completion signals
"completion_indicators": [] // Loops with EXIT_SIGNAL=true
}
Key .ralphrc settings that affect execution:
# Rate limiting
MAX_CALLS_PER_HOUR=100 # API calls per hour limit
CLAUDE_TIMEOUT_MINUTES=15 # Per-execution timeout
# Tool permissions
ALLOWED_TOOLS="Write,Read,Edit,Bash(git *),Bash(npm *)"
# Session management
SESSION_CONTINUITY=true # Maintain context across loops
SESSION_EXPIRY_HOURS=24 # Session lifetime
# Circuit breaker thresholds
CB_NO_PROGRESS_THRESHOLD=3 # Opens after N no-progress loops
CB_SAME_ERROR_THRESHOLD=5 # Opens after N repeated errors
CB_OUTPUT_DECLINE_THRESHOLD=70 # Opens if output declines >70%
Useful commands for recovery:
# Show current status
ralph --status
# Show circuit breaker state
ralph --circuit-status
# Reset circuit breaker only
ralph --reset-circuit
# Reset session only
ralph --reset-session
# Reset both and restart
ralph --reset-circuit --reset-session
# Start with increased timeout
ralph --timeout 30
# Start with verbose logging
ralph --verbose
# Start with live output
ralph --live
development
Debug a running web app via the web-debugger SDK: app logs, application state, runtime snapshots, React state, query cache.
development
Thoroughly understand a software development objective before implementation: research, identify ambiguities, ask clarifying questions. Use before starting implementation of a non-trivial or ambiguously specified feature, or when requirements leave open design decisions.
development
Locate the on-disk Claude Code transcript file (.jsonl under ~/.claude/projects/) for the current or a specified conversation.
development
Reflect on codebase navigation effectiveness at end of conversation. Surfaces dead ends, inefficiencies, missing context. Does not write files — pair with /kiro:steering-custom to persist.