---
description: Generates a high-level plan and granular todo-checklist for a given requirement, following the Ralph Loop methodology.
---

# Ralph Loop: Autonomous Planning Workflow

Use this workflow to break down complex requirements into structured, verifiable plans and task lists without modifying the source code. This ensures a clean "Ralph Loop" iteration where the planning is decoupled from implementation.

## 🚀 Execution Steps

1. **Verify Baseline Stability**
   - Run the existing test suite to ensure the application is in a stable state before planning.
   ```bash
   docker compose exec bukidbountyapp composer test
   ```

2. **Define the Requirement**
   - Read the user's input requirement and search the codebase to identify affected models, controllers, views, and routes.
   - Refer to `ai-docs/dictionary.md` for existing definitions and standard fields.

3. **Generate High-Level Plan**
   - Create a new plan file in `docs/tasks/prompt-[timestamp].md`.
   - The timestamp format should be `YYYYMMDD-HHMMSS`.
   - The plan should define the technical approach, architecture, and any new dependencies.

4. **Generate Detailed Checklist (Ralph Task)**
   - Create a task checklist in `docs/tasks/prd-[timestamp same as timestamp of plan file].md`.
   - Use a short hash of the requirement or content for the filename.
   - Format:
     ```markdown
     # Checklist: [Requirement Name]
     - [ ] **[Component]**: Specific instruction (e.g., "Add 'status' column in 'shipments' table")
     - [ ] **[File Path]**: Precise line-level instructions if possible
     ```
   - Ensure the instructions are specific enough for a "simpler AI" to execute.

5. **Final Review**
   - Summarize the generated documents for the user.
   - **CRITICAL**: Do NOT modify any existing `.php`, `.vue`, or logic files during this step. Only write to `ai-docs/` and `docs/tasks/`.