# Pre-Execution Report - Run {{run-id}}

[[LLM: Default path: .bmad-workspace/ck-parallel-dev/runs/{{run-id}}/pre-execution-report.md]]

[[LLM: This report documents what parallel-dev is about to execute, providing full transparency and an audit trail. Generate unique run-id as YYYYMMDD-HHMMSS-RANDOM (e.g., 20250703-151230-abc123)]]

## Executive Summary

**Generated**: {{current timestamp via MCP time tool}}  
**Run ID**: {{run-id}}  
**Go/No-Go Recommendation**: {{PROCEED|ABORT|REVIEW}}  
**Risk Level**: {{LOW|MEDIUM|HIGH}}  
**Estimated Duration**: {{time estimate based on work complexity}}  
**Total Work Items**: {{count}}  
**Execution Waves**: {{wave count}}

### Quick Decision Matrix

| Criteria                   | Status | Impact |
| -------------------------- | ------ | ------ | ---- | ---------- | ------- | ------ |
| All validations passed     | {{✅   | ⚠️     | ❌}} | {{Critical | Warning | Info}} |
| No file conflicts detected | {{✅   | ⚠️     | ❌}} | {{Critical | Warning | Info}} |
| Clean working tree         | {{✅   | ⚠️     | ❌}} | {{Critical | Warning | Info}} |
| All tests passing          | {{✅   | ⚠️     | ❌}} | {{Warning  | Info}}  |
| Team availability          | {{✅   | ⚠️     | ❌}} | {{Info}}   |

## Work Items Analysis

[[LLM: For each work item, provide detailed analysis]]

### Work Item 1: {{description}}

- **Worktree**: `{{worktree-name}}`
- **Branch**: `{{branch-name}}`
- **Validation Status**: {{✅ Passed|⚠️ Warnings|❌ Critical Issues}}
  - {{List specific validation results}}
- **Estimated Complexity**: {{Low|Medium|High}}
- **Files to Modify**:
  ```
  {{file1.js}}
  {{file2.test.js}}
  {{directory/file3.md}}
  ```
- **Potential Conflicts**: {{None|List conflicts with other work items}}
- **Dependencies**: {{None|List dependencies}}

### Work Item 2: {{description}}

{{Repeat structure for each work item}}

## Wave Planning

[[LLM: Group work items into waves based on conflict analysis]]

### 🌊 Wave 1 - Parallel Execution (No Conflicts)

**Start Time**: Immediate  
**Work Items**: {{count}}

| Worktree | Description | Agent Focus    | Risk     |
| -------- | ----------- | -------------- | -------- | ----- | ----- | ----- | ------ | ------ |
| {{wt1}}  | {{desc1}}   | {{Performance  | Security | UX    | etc}} | {{Low | Med    | High}} |
| {{wt2}}  | {{desc2}}   | {{Architecture | Testing  | etc}} | {{Low | Med   | High}} |

### 🌊 Wave 2 - Sequential Execution (Conflict Resolution)

**Start Time**: After Wave 1 completion  
**Work Items**: {{count}}  
**Reason**: File conflicts detected in {{conflicting files}}

| Worktree | Description | Conflicts With | Resolution Strategy |
| -------- | ----------- | -------------- | ------------------- |
| {{wt3}}  | {{desc3}}   | {{wt1}}        | {{strategy}}        |

## Risk Assessment

{{#llm-assess overall_risk="{{riskLevel}}" wave_count="{{waveCount}}" conflict_count="{{conflictCount}}"}}
Perform comprehensive risk assessment:

- If HIGH overall risk: Generate detailed risk matrix with probability/impact scores
- If >3 waves: Analyze cascade failure potential and provide circuit breakers
- If >5 conflicts: Recommend alternative execution strategies
- Always include: Rollback procedures for each risk level
  {{/llm-assess}}

### 🔴 High Risks

{{#llm-analyze high_risks}}
For each high risk item:

- Provide specific failure scenarios with business impact
- Include detection mechanisms and early warning signs
- Detail immediate response procedures
- Estimate recovery time if risk materializes
  {{/llm-analyze}}
  {{List any high-risk items that could impact success}}

### 🟡 Medium Risks

{{#llm-mitigate medium_risks}}
For each medium risk:

- Suggest preventive measures that can be implemented now
- Provide monitoring commands or checks
- Include escalation criteria to high risk
  {{/llm-mitigate}}
  {{List medium risks with mitigation strategies}}

### 🟢 Low Risks

{{#llm-monitor low_risks}}
For low risks:

- Confirm they remain low risk given the specific context
- Suggest simple monitoring approaches
- Identify any cumulative effects if multiple low risks occur
  {{/llm-monitor}}
  {{List low risks for awareness}}

### Rollback Complexity Assessment

- **Overall Complexity**: {{LOW|MEDIUM|HIGH}}
- **Automated Rollback Safe**: {{Yes|Partial|No}}
- **Manual Steps Required**: {{None|List specific manual steps}}

## Resource Requirements

### System Resources

- **Git Worktrees**: {{count}} new worktrees ({{size estimate}} disk space)
- **Concurrent Processes**: {{count}} Task agents
- **Estimated Memory**: {{estimate based on work complexity}}

### Human Resources

- **Primary Developer**: Current user
- **Reviewers Needed**: {{count and roles}}
- **Stakeholder Notifications**: {{list who should be notified}}

## Pre-Flight Checklist

[[LLM: Verify these conditions before execution]]

### Critical Checks (Blocking)

- [ ] Main branch is clean (no uncommitted changes)
- [ ] All work items have clear descriptions
- [ ] No critical validation failures
- [ ] Sufficient disk space for worktrees

### Important Checks (Warning)

- [ ] All tests passing on main branch
- [ ] Recent backup exists
- [ ] Team calendar checked for availability
- [ ] Related JIRA tickets updated

### Recommended Checks (Info)

- [ ] Documentation up to date
- [ ] CI/CD pipeline healthy
- [ ] Performance benchmarks recorded

## Execution Plan

### Pre-Execution Actions

1. Create run directory: `.bmad-workspace/ck-parallel-dev/runs/{{run-id}}/`
2. Save this report and execution plan
3. Create git worktrees for each work item
4. Verify all pre-flight checks

### Execution Sequence

1. **Wave 1**: Launch {{count}} parallel Task agents
   - Monitor progress via execution.log
   - Handle any failures gracefully
2. **Wave 2**: Sequential execution for conflict resolution
   - Wait for Wave 1 completion
   - Execute with conflict awareness
3. **Post-Execution**: Merge and cleanup

### Success Criteria

- All work items completed successfully
- No merge conflicts during integration
- All tests passing after merge
- Clean worktree removal

## Approval

**⚠️ IMPORTANT**: This report documents what will be executed. Review carefully before proceeding.

### Approval Decision

- **Recommended Action**: {{PROCEED|ABORT|REVIEW}}
- **Reason**: {{explanation based on analysis}}

### Override Options

If you choose to proceed despite warnings:

- Document override reason for audit trail
- Accept responsibility for potential issues
- Ensure rollback plan is understood

---

**To proceed with execution**: Confirm explicitly when prompted  
**To abort**: Exit without confirmation  
**Report Location**: `.bmad-workspace/ck-parallel-dev/runs/{{run-id}}/pre-execution-report.md`

## Appendix: Detailed Validation Results

[[LLM: Include detailed validation results from 3-tier system if relevant]]

### Critical Issues (Blocking)

{{List any critical issues that must be resolved}}

### Warnings (Require Justification)

{{List warnings that need override justification}}

### Suggestions (Informational)

{{List suggestions for improvement}}
