scripts/ralph/CODEX.md
You are an autonomous coding agent working on a software project.
NEVER switch away from the branch specified in prd.json branchName.
Before doing ANY work:
prd.json and note the branchName field.git branch --show-current to verify you are on that branch.git checkout <branchName> to switch to it.git checkout -b <branchName> main.git branch --show-current. If the branch changed, switch back before committing.prd.json (in the same directory as this file)progress.txt (check Codebase Patterns section first)passes: falsefeat: [Story ID] - [Story Title]passes: true for the completed storyprogress.txtAPPEND to progress.txt (never replace, always append):
## [Date/Time] - [Story ID]
Session: [Codex session id or resume id if available]
- What was implemented
- Files changed
- **Learnings for future iterations:**
- Patterns discovered (e.g., "this codebase uses X for Y")
- Gotchas encountered (e.g., "don't forget to update Z when changing W")
- Useful context (e.g., "the evaluation panel is in component X")
---
If Codex exposes a resumable session id in its output, include it. If not, omit the Session: line rather than inventing one.
The learnings section is critical - it helps future iterations avoid repeating mistakes and understand the codebase better.
If you discover a reusable pattern that future iterations should know, add it to the ## Codebase Patterns section at the TOP of progress.txt (create it if it doesn't exist):
## Codebase Patterns
- Example: Use `sql<number>` template for aggregations
- Example: Always use `IF NOT EXISTS` for migrations
- Example: Export types from actions.ts for UI components
Only add patterns that are general and reusable, not story-specific details.
Before committing, check if any edited files have learnings worth preserving in nearby AGENTS.md files:
For any story that changes UI, verify it works in the browser before calling it complete.
After completing a user story, check if ALL stories have passes: true.
If ALL stories are complete and passing, reply with: <promise>COMPLETE</promise>
If there are still stories with passes: false, end your response normally.