Summary
The loop starts executing immediately without verifying that the PRD, app_spec, and feature_list are well-formed and consistent. A malformed spec can burn through expensive AI iterations before anyone notices.
Current Behavior
ralph.sh passes the coding prompt to Claude without validating inputs
- If
feature_list.json has invalid JSON, missing fields, or no features, the loop may error mid-execution or produce nonsensical results
- No check that
app_spec.txt exists or has the expected sections
- No check that referenced tech stack components are compatible
Proposal
Add a validation step to ralph.sh (or as a standalone validate.sh / CLI command) that runs before the loop:
Checks to implement:
-
feature_list.json
- Valid JSON
- All required fields present (
id, priority, category, description, steps, passes)
- No duplicate feature IDs
- No gaps in priority ordering
depends_on references exist (if dependency resolution is implemented)
-
app_spec.txt
- File exists and is non-empty
- Contains expected sections (Tech Stack, Data Models, API Routes, etc.)
-
PRD.md
- File exists
- Contains expected sections
-
Cross-file consistency
- Features in feature_list reference concepts described in app_spec
- Tech stack in app_spec matches PRD requirements
Output:
Validating specs...
✓ feature_list.json: 10 features, valid schema
✓ app_spec.txt: all sections present
✓ PRD.md: exists, 2,400 words
⚠ Warning: feature API-003 references "Redis" but app_spec tech stack does not include it
✓ Validation passed with 1 warning
Considerations
- Validation should be non-blocking by default (warnings) with a
--strict flag for hard failures
- Could be integrated into
init.sh as well, running after spec generation
- Keep validation fast — it should add seconds, not minutes
Summary
The loop starts executing immediately without verifying that the PRD, app_spec, and feature_list are well-formed and consistent. A malformed spec can burn through expensive AI iterations before anyone notices.
Current Behavior
ralph.shpasses the coding prompt to Claude without validating inputsfeature_list.jsonhas invalid JSON, missing fields, or no features, the loop may error mid-execution or produce nonsensical resultsapp_spec.txtexists or has the expected sectionsProposal
Add a validation step to
ralph.sh(or as a standalonevalidate.sh/ CLI command) that runs before the loop:Checks to implement:
feature_list.json
id,priority,category,description,steps,passes)depends_onreferences exist (if dependency resolution is implemented)app_spec.txt
PRD.md
Cross-file consistency
Output:
Considerations
--strictflag for hard failuresinit.shas well, running after spec generation