# RPI Formula - Research -> Plan -> Implement # # Universal workflow for feature development with human gates. formula = "rpi" description = """ Research -> Plan -> Implement workflow. Usage: bd pour rpi --var title="Add user preferences" bd pour rpi --var title="Auth" --var bead_id="project-abc" --var test_cmd="nix flake check" """ version = 1 type = "workflow" # ─── Variables ─── [vars.title] required = true description = "What are we building?" [vars.bead_id] description = "Existing bead ID (creates new if not provided)" [vars.test_cmd] default = "make test" description = "Command to run tests" [vars.lint_cmd] default = "make lint" description = "Command to run linting" # ─── Research Phase ─── [[steps]] id = "research" title = "Research: {{title}}" skill = "research-agents" description = """ Conduct comprehensive codebase research. Goals: - Understand current implementation - Identify patterns to follow - Find relevant files and dependencies - Document key discoveries Output: thoughts/beads-{{bead_id}}/research.md """ # ─── Planning Phase ─── [[steps]] id = "plan" title = "Plan: {{title}}" needs = ["research"] type = "human" skill = "planning" description = """ Create detailed implementation plan based on research. Goals: - Present understanding and clarify requirements - Propose design options with tradeoffs - Define phases with success criteria - Identify what we're NOT doing Output: thoughts/beads-{{bead_id}}/plan.md """ [steps.gate] type = "human" reason = "Plan approval before implementation" # ─── Implementation Phase ─── [[steps]] id = "implement" title = "Implement: {{title}}" needs = ["plan"] description = """ Execute the approved plan phase by phase. For each phase: 1. Make the changes 2. Run verification: {{test_cmd}}, {{lint_cmd}} 3. Update plan checkboxes for resumability Stop and ask if encountering unexpected issues. """ # ─── Verification Phase ─── [[steps]] id = "verify" title = "Manual verification" needs = ["implement"] type = "human" description = """ Human confirms implementation works correctly. Check: feature works, edge cases handled, no regressions. Tests: {{test_cmd}} | Lint: {{lint_cmd}} """ [steps.gate] type = "human" reason = "Confirm implementation is correct" # ─── Completion ─── [[steps]] id = "complete" title = "Close bead" needs = ["verify"] skill = "artifact-format" description = """ Mark work as complete. Actions: - bd update {{bead_id}} --notes="Implementation complete" - bd close {{bead_id}} --reason="Completed: {{title}}" - bd sync && git push """