## Report Generation Strategy

> This file defines the orchestration flow for the fifth stage — dispatching sub-tasks to generate JSON report and Markdown report, with final reconciliation before output.

### Data Sources

| Draft File | Provides Data |
|----------|---------|
| `.draft-01-change-analysis.md` | Review scope, project environment, scanned file list |
| `.draft-02-detection/manifest.json` | Detection statistics (file count, detected defects, distribution by type/severity) |
| `.draft-03-validation/<defect_id>.md` | Validation details, confidence, and verdict reasoning for surviving defects |
| `.draft-04-management/manifest.json` | Final surviving defect list, clustering information, management statistics |

### Execution Flow

#### 1. Launch JSON Report Sub-task

Pass the **sub-task execution template** (see `json-report.md`) and fill in:
- `<output_dir>`: Output directory path
- `<skill-root>`: Skill root path

Wait for the sub-task to complete.

#### 2. Launch Markdown Report Sub-task

Pass the **sub-task execution template** (see `markdown-report.md`) and fill in:
- `<output_dir>`: Output directory path
- `<skill-root>`: Skill root path

Wait for the sub-task to complete.

#### 3. Reconciliation

1. Read `<output_dir>/review-report.json` and `<output_dir>/review-report.md`
2. Verify that both reports have consistent defect counts and defect ID lists
3. Verify that all defects' location, severity, and type fields are consistent
4. Correct any inconsistencies (using the JSON report as the source of truth)

#### 4. Output JSON to Conversation

Output only the full content of `review-report.json` in the conversation.

#### 5. Clean Up Drafts

Delete all `.draft-*` directories and files under the output directory. The final output directory should only retain `review-report.json` and `review-report.md`.
