PRD to JSON Conversion
Hybrid approach: Python script parses, AI validates and corrects.
Workflow
- Dry-run parser (Bash tool) — catch parser issues before writing
python ralph/scripts/generate_prd_json.py --dry-run
Check output for: declared vs parsed story count mismatch, missing stories, empty acceptance/files. If issues found, fix PRD markdown or note for manual correction in step 3.
- Run parser (Bash tool)
python ralph/scripts/generate_prd_json.py
Script handles: PRD.md parsing, (depends: ...) extraction, content hashing, state preservation.
Validate (Read tool)
- Read
ralph/docs/prd.json(script output) - Read the sprint PRD (
docs/PRD.mdsymlink ordocs/sprints/source) - Check against Validation Checklist
- Read
Correct errors (Write tool, if needed)
- Fix issues found
- Recompute
content_hashif title/description/acceptance changed - Write corrected
ralph/docs/prd.json
Report
- Story count and status
- Corrections made
- Suggest:
make ralph_run
Validation Checklist
For each story, verify:
-
idfollows STORY-XXX format -
titleis 3-7 words, matches PRD.md feature -
descriptionis non-empty -
acceptancearray is non-empty -
filesarray contains valid paths (if specified in PRD.md) -
content_hashis 64-char hex string -
depends_onreferences valid STORY-XXX IDs (no circular deps, no self-refs)
Cross-reference with PRD.md:
- All
#### Feature N:headings have corresponding stories - Story order matches PRD.md feature order
-
(depends: STORY-XXX)syntax correctly parsed
Common Issues to Correct
| Issue | Correction |
|---|---|
| Empty acceptance | Extract from description or PRD.md feature |
| Invalid depends_on reference | Remove non-existent story IDs |
| Circular dependency | Remove one direction |
| Missing content_hash | Recompute from title+description+acceptance |
| Duplicate story IDs | Renumber sequentially |
prd.json Schema
See ralph/docs/templates/prd.json.template for structure and fields.
Usage
make ralph_prd_json
Next Steps
make ralph_init # Validate environment
make ralph_run # Start Ralph loop