src/bmm-skills/1-analysis/bmad-document-project/instructions.md
<critical>Communicate all responses in {communication_language}</critical>
<workflow><critical>This router determines workflow mode and delegates to specialized sub-workflows</critical>
<step n="1" goal="Check for ability to resume and determine workflow mode"> <action>Check for existing state file at: {project_knowledge}/project-scan-report.json</action> <check if="project-scan-report.json exists"> <action>Read state file and extract: timestamps, mode, scan_level, current_step, completed_steps, project_classification</action> <action>Extract cached project_type_id(s) from state file if present</action> <action>Calculate age of state file (current time - last_updated)</action><ask>I found an in-progress workflow state from {{last_updated}}.
**Current Progress:**
- Mode: {{mode}}
- Scan Level: {{scan_level}}
- Completed Steps: {{completed_steps_count}}/{{total_steps}}
- Last Step: {{current_step}}
- Project Type(s): {{cached_project_types}}
Would you like to:
1. **Resume from where we left off** - Continue from step {{current_step}}
2. **Start fresh** - Archive old state and begin new scan
3. **Cancel** - Exit without changes
Your choice [1/2/3]:
<critical>CONDITIONAL CSV LOADING FOR RESUME:</critical>
<action>For each cached project_type_id, load ONLY the corresponding row from: ./documentation-requirements.csv</action>
<action>Skip loading project-types.csv and architecture_registry.csv (not needed on resume)</action>
<action>Store loaded doc requirements for use in remaining steps</action>
<action>Display: "Resuming {{workflow_mode}} from {{current_step}} with cached project type(s): {{cached_project_types}}"</action>
<check if="workflow_mode == deep_dive">
<action>Read fully and follow: ./workflows/deep-dive-workflow.md with resume context</action>
</check>
<check if="workflow_mode == initial_scan OR workflow_mode == full_rescan">
<action>Read fully and follow: ./workflows/full-scan-workflow.md with resume context</action>
</check>
<ask>I found existing documentation generated on {{existing_doc_date}}.
What would you like to do?
Your choice [1/2/3]: </ask>
<check if="user selects 1"> <action>Set workflow_mode = "full_rescan"</action> <action>Display: "Starting full project rescan..."</action> <action>Read fully and follow: ./workflows/full-scan-workflow.md</action> <action>After sub-workflow completes, continue to Step 4</action> </check> <check if="user selects 2"> <action>Set workflow_mode = "deep_dive"</action> <action>Set scan_level = "exhaustive"</action> <action>Display: "Starting deep-dive documentation mode..."</action> <action>Read fully and follow: ./workflows/deep-dive-workflow.md</action> <action>After sub-workflow completes, continue to Step 4</action> </check> <check if="user selects 3"> <action>Display message: "Keeping existing documentation. Exiting workflow."</action> <action>Exit workflow</action> </check> </check> <check if="index.md does not exist"> <action>Set workflow_mode = "initial_scan"</action> <action>Display: "No existing documentation found. Starting initial project scan..."</action> <action>Read fully and follow: ./workflows/full-scan-workflow.md</action> <action>After sub-workflow completes, continue to Step 4</action> </check> </step> </workflow>