{
  "_template_description": "Template for fix planning output. Planning agent reads this template and generates actual fix-plan.json",
  "_usage": "Planning agent should follow this structure when analyzing findings and creating fix plan",

  "plan_id": "<string: plan-{timestamp}>",
  "created_at": "<string: ISO8601 timestamp>",
  "total_findings": "<number: total findings to fix>",

  "execution_strategy": {
    "approach": "<string: hybrid|parallel|serial>",
    "parallel_limit": "<number: max concurrent agents, default 3>",
    "total_stages": "<number: how many stages in timeline>",
    "rationale": "<string: explain why this strategy was chosen>"
  },

  "groups": [
    {
      "group_id": "<string: unique group identifier like G1, G2, ...>",
      "group_name": "<string: descriptive name for this group>",
      "findings": ["<array of finding IDs>"],

      "fix_strategy": {
        "approach": "<string: high-level fix approach>",
        "rationale": "<string: why these findings were grouped together>",
        "complexity": "<string: low|medium|high>",
        "estimated_duration_minutes": "<number: estimated time>",
        "test_pattern": "<string: test file glob pattern like tests/auth/**/*.test.*>",
        "rollback_plan": "<string: what to do if fix fails>"
      },

      "risk_assessment": {
        "level": "<string: low|medium|high|critical>",
        "concerns": ["<array of strings: potential risks>"],
        "mitigation": "<string: how to mitigate risks>"
      }
    }
  ],

  "timeline": [
    {
      "stage": "<number: stage number 1-indexed>",
      "groups": ["<array of group IDs to execute in this stage>"],
      "execution_mode": "<string: parallel|serial>",
      "depends_on": ["<optional: array of group IDs this stage depends on>"],
      "rationale": "<string: why these groups are in this stage with this mode>"
    }
  ],

  "_instructions": {
    "grouping_principles": [
      "Group findings in the same file with same dimension",
      "Group findings with similar root causes (high semantic similarity)",
      "Consider file dependencies and execution order",
      "Balance group sizes for efficient parallel execution"
    ],
    "execution_strategy_guidelines": [
      "Use parallel for independent groups in different files",
      "Use serial for dependent changes (e.g., shared utilities)",
      "Limit parallelism to 3 concurrent agents to avoid resource contention",
      "High-risk groups should be isolated for careful monitoring"
    ],
    "test_strategy_guidelines": [
      "Identify test files related to changed code",
      "Use specific patterns for faster test execution",
      "Ensure test coverage captures all fix impacts",
      "Define clear pass criteria (usually 100% pass rate)"
    ],
    "risk_assessment_guidelines": [
      "Low: Simple fixes with comprehensive test coverage",
      "Medium: Moderate changes affecting multiple components",
      "High: Core logic changes or security-critical fixes",
      "Critical: Database schema changes or breaking API changes"
    ]
  }
}
