{# ============================================================================ #}
{# Template: planning.txt                                                       #}
{# Version: 1.0                                                                  #}
{# ============================================================================ #}
{#                                                                             #}
{# PURPOSE:                                                                    #}
{#   Prompt for planning phase to create detailed implementation plans.         #}
{#   Follows Claude Code's 5-phase planning workflow pattern.                   #}
{#                                                                             #}
{# WHEN USED:                                                                  #}
{#   During planning phase (before implementation begins).                       #}
{#                                                                             #}
{# TRIGGER:                                                                    #}
{#   Pipeline runtime: planning phase at start of workflow.                     #}
{#                                                                             #}
{# VARIABLES:                                                                  #}
{#   PROMPT - User requirements from PROMPT.md (required)                        #}
{#                                                                             #}
{# OUTPUT:                                                                     #}
{#   Structured plan with: Summary, Implementation Steps, Critical Files,       #}
{#   Risks & Mitigations, Verification Strategy.                                #}
{#                                                                             #}
{# NOTES:                                                                      #}
{#   - Agent is strictly READ-ONLY during planning (no file modifications)      #}
{#   - Agent receives PROMPT.md content directly (not file path)                 #}
{#   - Plan is returned as structured output, not written to file               #}
{#   - Reference: https://github.com/Piebald-AI/claude-code-system-prompts      #}
{# ============================================================================ #}

You are in PLANNING MODE. Create a detailed implementation plan.

CRITICAL: This is a READ-ONLY planning task. You are STRICTLY PROHIBITED from:
- Creating, modifying, or deleting any files
- Running any commands that modify system state
- Installing dependencies or packages

You MAY use read-only operations: reading files, searching code, listing directories.

═══════════════════════════════════════════════════════════════════════════════
PHASE 1: UNDERSTANDING
═══════════════════════════════════════════════════════════════════════════════

{# USER REQUIREMENTS #}
USER REQUIREMENTS:
{{PROMPT}}
{# END USER REQUIREMENTS #}

Understand:
- The Goal: What is the desired end state?
- Acceptance Checks: What specific conditions must be satisfied?
- Constraints: Any requirements, limitations, or quality standards mentioned?

If requirements are ambiguous, note them for clarification in the plan.

═══════════════════════════════════════════════════════════════════════════════
PHASE 2: EXPLORATION
═══════════════════════════════════════════════════════════════════════════════
Explore the codebase using read-only tools to understand:
- Current architecture and patterns used
- Relevant existing code that will need changes
- Dependencies and potential impacts
- Similar implementations that can serve as reference
- Test patterns and coverage expectations

Be thorough. Quality exploration leads to better plans.

═══════════════════════════════════════════════════════════════════════════════
PHASE 3: DESIGN
═══════════════════════════════════════════════════════════════════════════════
Design your implementation approach:
- What changes need to be made and in what order?
- Are there multiple valid approaches? Evaluate trade-offs.
- What are the potential risks or challenges?
- How does this integrate with existing code patterns?

═══════════════════════════════════════════════════════════════════════════════
PHASE 4: REVIEW
═══════════════════════════════════════════════════════════════════════════════
Validate your plan against the requirements:
- Does the approach satisfy ALL acceptance checks?
- Are there edge cases or error scenarios to handle?
- Is the plan specific enough to implement without ambiguity?
- Have you identified the correct files to modify?

═══════════════════════════════════════════════════════════════════════════════
PHASE 5: WRITE PLAN
═══════════════════════════════════════════════════════════════════════════════
OUTPUT your plan with this exact structure:

## Summary
One paragraph explaining what will be done and why.

## Implementation Steps
Numbered, actionable steps. Be specific about:
- What each step accomplishes
- Which files are affected
- Dependencies between steps

## Critical Files for Implementation
List 3-5 key files that will be created or modified:
- `path/to/file.rs` - Brief justification for why this file needs changes

## Risks & Mitigations
Challenges identified during exploration and how to handle them.

## Verification Strategy
How to verify acceptance checks are met:
- Specific tests to run
- Manual verification steps
- Success criteria

CRITICAL OUTPUT INSTRUCTIONS:
- Output your COMPLETE plan above as a single response
- Ensure ALL sections (Summary, Implementation Steps, Critical Files, Risks & Mitigations, Verification Strategy) are included
- Do NOT truncate or shorten your plan
- Do NOT write to any files
