When to Use Dynamic vs Hardcoded
| Approach | Best for | Example |
|---|---|---|
| Dynamic discovery | Large, evolving projects (more than 20 tasks) | Building a full application from a PRD |
| Hardcoded tasks | Focused features (fewer than 20 tasks) | Adding auth, fixing a bug, a specific refactor |
Dynamic Discovery Pattern
The workflow has three key parts:- Discover — An agent generates the next 3-5 tickets by analyzing the codebase.
- TicketPipeline — Each ticket goes through research, planning, implementation, review, and reporting.
- Re-render loop — When all tickets complete, Discover runs again to find the next batch.
How it works
- On first render,
discoverOutputisundefined, sounfinishedTicketsis empty. - The
Branchcondition is true, so<Discover />mounts and runs. - Discover generates tickets as structured JSON and persists them to the
discovertable. - The workflow re-renders. Now
unfinishedTicketshas entries, so the Branch is false (Discover is skipped). - Each ticket maps to a
<TicketPipeline>that runs research, planning, implementation, and review. - As each ticket completes, its
<Report>writes to thereporttable. - When all tickets have reports,
unfinishedTicketsis empty again, and Discover runs to find the next batch.
The Discover Component
Discover uses an agent to analyze the codebase and produce structured tickets:Ticket Schema
Tickets are structured with kebab-case IDs, descriptions, acceptance criteria, and dependency information:Ticket ID rules
- IDs must be lowercase kebab-case slugs derived from the title (e.g.
sqlite-wal-init,add-auth-middleware). - Never use numeric IDs like
T-001— they collide across discovery runs. - Keep slugs short but descriptive (2-5 words).
The TicketPipeline
Each ticket flows through a pipeline of steps. UseskipIf to skip completed tickets on resume:
Discover Prompt Tips
The Discover prompt should instruct the agent to:- Compare specs vs reality — Read the project’s requirements docs and compare to what actually exists in the codebase.
- Prioritize foundational work — Infrastructure and types before features that depend on them.
- Keep tickets small — Each ticket should be the smallest independently testable unit.
- Include previous context — Pass completed ticket IDs so the agent does not re-discover finished work.
- Limit batch size — Generate 3-5 tickets at a time, not the full project backlog. This lets each batch benefit from the context of what was just implemented.
Hardcoded Tasks (For Smaller Projects)
For projects with fewer than 20 well-defined tasks, hardcoding is simpler and more predictable:Sprint-Based Discovery
For very large projects, wrap the entire workflow in a Ralph loop with a sprint tracker. Each sprint discovers work, implements it, and advances a counter:Next Steps
- Implement-Review Loop — The recommended review loop pattern.
- Model Selection — Which models to use for discovery vs implementation.
- Best Practices — General workflow design guidelines.