Documentation Index
Fetch the complete documentation index at: https://mintlify.com/snarktank/ralph/llms.txt
Use this file to discover all available pages before exploring further.
Feedback Loops
Ralph is an autonomous agent that can run for hours or days without human intervention. This makes feedback loops absolutely critical. Without them, Ralph will accumulate broken code that compounds across iterations, eventually making the codebase unusable.Why Feedback Loops Matter
The Compounding Problem
Imagine Ralph completes 10 stories in a row:- Story 1 - Introduces a subtle bug (no tests catch it)
- Story 2 - Builds on Story 1, inherits the bug
- Story 3 - Bug causes a type error, ignored without typechecking
- Story 4 - Type error breaks the build
- Story 5 - Can’t even run due to broken build
- Stories 6-10 - Pile more broken code on top
The Feedback Loop Solution
With proper feedback loops:- Story 1 - Introduces a subtle bug
- Tests catch the bug - Agent fixes it before committing
- Story 2 - Builds on correct code
- Story 3 - Type error caught by typecheck
- Agent fixes type error - Commit only happens after checks pass
- Stories 4-10 - Continue on a solid foundation
Feedback loops catch problems immediately when they’re easiest to fix, not 10 iterations later when the cause is buried.
Required Feedback Loops
Ralph mandates quality checks before every commit:1. Type Checking
Why it matters:- Catches type errors before runtime
- Enforces contracts between modules
- Prevents undefined errors and null pointer exceptions
Type checking is non-negotiable. It’s the first line of defense against broken code.
2. Linting
Why it matters:- Catches common mistakes (unused variables, unreachable code)
- Enforces code style consistency
- Detects potential bugs (missing return statements, etc.)
3. Unit Tests
Why it matters:- Verifies individual functions and modules work correctly
- Catches regressions when changing existing code
- Documents expected behavior
4. Integration Tests
Why it matters:- Verifies components work together correctly
- Catches issues at system boundaries
- Tests database interactions, API calls, etc.
5. Build Verification
Why it matters:- Ensures the project actually builds
- Catches missing dependencies
- Verifies deployment artifacts can be created
Configuring Quality Checks
Edit the prompt template (prompt.md or CLAUDE.md) to specify your project’s quality checks:
Browser Verification for UI
For frontend stories, automated tests aren’t always enough. The UI might pass tests but look broken in the browser.Amp with dev-browser Skill
If using Amp, thedev-browser skill allows the agent to verify UI changes:
- Load the dev-browser skill
- Navigate to the relevant page
- Interact with the UI (click buttons, fill forms, etc.)
- Verify the changes work as expected
- Take screenshots for the progress report
Claude Code with MCP
Claude Code can use MCP (Model Context Protocol) servers for browser automation:Manual Verification
If no browser automation is available, the prompt can instruct the agent to note that manual verification is required:CI/CD Integration
For production use, integrate Ralph with your CI/CD pipeline:GitHub Actions Example
CI is the ultimate feedback loop. Even if the agent’s local checks pass, CI provides an independent verification.
Pre-commit Hooks
Use pre-commit hooks as a last line of defense:What Happens When Checks Fail?
The prompt template instructs the agent:- The agent sees the error output
- The agent fixes the issues
- The agent re-runs the checks
- Repeat until checks pass
- Only then commit
The agent should NEVER commit code that doesn’t pass quality checks. The prompt explicitly prohibits this.
Common Pitfalls
1. No Tests
❌ Bad:2. Flaky Tests
Flaky tests (tests that randomly fail) will block Ralph indefinitely:3. Slow Checks
If quality checks take 10 minutes to run, each iteration takes 10+ minutes:- Run unit tests in parallel
- Use incremental type checking
- Cache dependencies in CI
4. Accepting Failures
Never let Ralph commit failing code “temporarily”: ❌ Bad practice:Advanced Feedback Loops
Performance Benchmarks
Include performance requirements:Security Scans
Add security scanning to quality checks:Accessibility Checks
For UI work, verify accessibility:Debugging Feedback Loop Issues
If Ralph keeps failing quality checks:- Check the error output - What specific check is failing?
- Check progress.txt - Has the agent documented the issue?
- Run checks manually - Can you reproduce the failure?
- Check test flakiness - Does it fail consistently?
- Check test coverage - Are the tests actually testing the right thing?
Summary
Feedback loops are what make autonomous agents reliable:- Type checking catches type errors
- Linting catches code quality issues
- Unit tests verify functionality
- Integration tests verify system behavior
- Build verification ensures deployability
- Browser testing verifies UI correctness
- CI/CD provides independent verification

