Skip to content

Commit bf5ee80

Browse files
duyetclaudeduyetbot
committed
docs(ralph-wiggum): improve documentation with troubleshooting and examples
- Updated architecture section to reflect actual file structure - Added comprehensive troubleshooting section - Improved prompt guidelines with practical examples - Updated monitoring section with correct /tmp file paths - Fixed outdated file paths in help.md command 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> Co-Authored-By: duyetbot <duyetbot@users.noreply.github.com>
1 parent 6a60b93 commit bf5ee80

2 files changed

Lines changed: 131 additions & 30 deletions

File tree

ralph-wiggum/README.md

Lines changed: 127 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -85,37 +85,83 @@ Gracefully handles rate limits:
8585

8686
## Prompt Guidelines
8787

88-
Write prompts with clear completion criteria:
88+
Write prompts with clear, verifiable completion criteria:
8989

90+
### Structure
91+
92+
1. **Goal**: What you want to build/fix
93+
2. **Requirements**: Specific, testable criteria
94+
3. **Completion signal**: How to know when done
95+
96+
### Examples
97+
98+
**Bug fix with tests:**
99+
```markdown
100+
Fix the token refresh bug in auth.ts.
101+
102+
Requirements:
103+
- Token refresh returns valid JWT
104+
- Expired tokens trigger refresh flow
105+
- All auth tests pass
106+
107+
Output <promise>FIXED</promise> when tests pass.
108+
```
109+
110+
**Feature implementation:**
111+
```markdown
112+
Add rate limiting to the API.
113+
114+
Requirements:
115+
- 100 requests per minute per IP
116+
- Return 429 status when exceeded
117+
- Include retry-after header
118+
- Add rate limit tests
119+
120+
Output <promise>DONE</promise> when feature works.
121+
```
122+
123+
**Refactoring task:**
90124
```markdown
91-
Build a user authentication system.
125+
Refactor user service to use repository pattern.
92126

93127
Requirements:
94-
- JWT token generation and validation
95-
- Password hashing with bcrypt
96-
- Login and register endpoints
97-
- Input validation
98-
- Unit tests with >80% coverage
128+
- Extract database calls to UserRepository
129+
- Service depends on repository interface
130+
- Existing tests still pass
131+
- No TypeScript errors
99132

100-
Output <promise>COMPLETE</promise> when all requirements pass.
133+
Output <promise>REFACTORED</promise> when complete.
101134
```
102135

136+
### Tips
137+
138+
- Use measurable criteria ("tests pass", "no errors", "build succeeds")
139+
- Include the `<promise>` tag in your prompt so Claude knows how to exit
140+
- Keep requirements focused—fewer is better for iterative tasks
141+
103142
## Monitoring
104143

144+
Use the status command or inspect files directly:
145+
105146
```bash
106-
# Loop state
107-
cat .claude/ralph-loop.local.md
147+
# Quick status check
148+
/status
149+
150+
# Loop state file
151+
cat /tmp/ralph_loop.txt
108152

109-
# Circuit breaker
110-
cat .claude/ralph-circuit.json
153+
# Circuit breaker state
154+
cat /tmp/ralph_circuit.json
111155

112156
# Response analysis
113-
cat .claude/ralph-analysis.json
157+
cat /tmp/ralph_analysis.json
114158

115-
# API limits
116-
cat .claude/ralph-limits.json
159+
# API limit state
160+
cat /tmp/ralph_limits.json
117161
```
118162

163+
State files are stored in `/tmp/ralph_*` for the current session.
164+
119165
## Configuration
120166

121167
Environment variables:
@@ -132,21 +178,24 @@ Environment variables:
132178
```
133179
ralph-wiggum/
134180
├── .claude-plugin/
135-
│ └── plugin.json
181+
│ └── plugin.json # Plugin manifest
136182
├── commands/
137-
│ ├── ralph-loop.md
138-
│ ├── cancel-ralph.md
139-
│ └── help.md
183+
│ ├── ralph-loop.md # Start loop command
184+
│ ├── status.md # Check loop status
185+
│ ├── cancel-ralph.md # Cancel active loop
186+
│ └── help.md # Plugin documentation
140187
├── hooks/
141-
│ ├── hooks.json
142-
│ └── stop-hook.sh
188+
│ ├── hooks.json # Hook configuration
189+
│ └── stop-hook.sh # Main loop interceptor
143190
├── lib/
144-
│ ├── circuit_breaker.sh
145-
│ ├── response_analyzer.sh
146-
│ ├── api_limit_handler.sh
147-
│ └── task_manager.sh
191+
│ ├── circuit_breaker.sh # Stagnation detection
192+
│ ├── response_analyzer.sh # Completion analysis
193+
│ ├── api_limit_handler.sh # Rate limit handling
194+
│ └── task_manager.sh # Task state management
148195
└── scripts/
149-
└── setup-ralph-loop.sh
196+
├── setup-ralph-loop.sh # Loop initialization
197+
├── status.sh # Status display
198+
└── cancel-ralph.sh # Cancellation handler
150199
```
151200

152201
## When to Use
@@ -161,6 +210,58 @@ ralph-wiggum/
161210
- One-shot operations
162211
- Production debugging
163212

213+
## Troubleshooting
214+
215+
### Loop won't start
216+
217+
1. Check if another loop is active: `/status`
218+
2. Cancel any existing loop: `/cancel-ralph`
219+
3. Try again with your prompt
220+
221+
### Loop exits too early
222+
223+
The smart exit feature may trigger on completion keywords. Options:
224+
- Use `--no-smart-exit` to disable completion detection
225+
- Add more specific requirements to your prompt
226+
- Check `/tmp/ralph_analysis.json` to see what triggered the exit
227+
228+
### Loop runs forever
229+
230+
Ensure your prompt includes:
231+
- Clear, testable completion criteria
232+
- A `<promise>` tag if using `--completion-promise`
233+
- Measurable success conditions (tests pass, build succeeds)
234+
235+
### Circuit breaker keeps triggering
236+
237+
The circuit breaker stops loops that aren't making progress:
238+
- Ensure each iteration changes files
239+
- Check `/tmp/ralph_circuit.json` for details
240+
- Use `--reset-circuit` to reset state if needed
241+
242+
### Rate limits
243+
244+
If you hit Claude's API limits:
245+
- The loop pauses automatically
246+
- Wait for the recommended duration
247+
- Resume with `/ralph-loop` using the same prompt
248+
249+
### Debugging
250+
251+
```bash
252+
# Check all state files
253+
ls -la /tmp/ralph_*
254+
255+
# View loop configuration
256+
cat /tmp/ralph_loop.txt
257+
258+
# Check circuit breaker state
259+
cat /tmp/ralph_circuit.json
260+
261+
# Review completion analysis
262+
cat /tmp/ralph_analysis.json
263+
```
264+
164265
## References
165266

166267
- [ghuntley.com/ralph](https://ghuntley.com/ralph/)

ralph-wiggum/commands/help.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,10 +105,10 @@ The text must exactly match `--completion-promise`.
105105
## Monitoring
106106

107107
```bash
108-
/status # Show status
109-
cat .claude/ralph-loop.local.md # Loop state
110-
cat .claude/ralph-circuit.json # Circuit breaker
111-
cat .claude/ralph-analysis.json # Response analysis
108+
/status # Show status
109+
cat /tmp/ralph_loop.txt # Loop state
110+
cat /tmp/ralph_circuit.json # Circuit breaker
111+
cat /tmp/ralph_analysis.json # Response analysis
112112
```
113113

114114
## Example

0 commit comments

Comments
 (0)