--- description: Resume an interrupted workflow from saved state allowed-tools: Read, Write, Edit, Bash, AskUserQuestion, TodoWrite agents: workflow-orchestrator, workflow-validator --- # Workflow Orchestrator - Resume Resume a previously interrupted or paused workflow. ## EXECUTION PROTOCOL ### Step 1: Load Workflow State Read `.workflow/current.yml`: - If not found: Report "No workflow to resume" and exit - If found: Load state and continue ### Step 2: Display Resume Summary ``` ╔══════════════════════════════════════════════════════════════╗ ║ 🔄 RESUMING WORKFLOW ║ ╠══════════════════════════════════════════════════════════════╣ ║ Workflow ID: ║ ║ Feature: ║ ║ Started: ║ ║ Last Updated: ║ ╠══════════════════════════════════════════════════════════════╣ ║ CURRENT STATE ║ ║ Phase: ║ ║ Resume Point: ║ ╠══════════════════════════════════════════════════════════════╣ ║ PROGRESS ║ ║ Entities Designed: ║ ║ Tasks Created: ║ ║ Tasks Implemented: ║ ║ Tasks Reviewed: ║ ║ Tasks Completed: ║ ╠══════════════════════════════════════════════════════════════╣ ║ LAST ERROR (if any): ║ ╚══════════════════════════════════════════════════════════════╝ ``` ### Step 3: Confirm Resume **Ask user**: - Option 1: "Continue - Resume from current point" - Option 2: "Restart Phase - Redo current phase from beginning" - Option 3: "Abort - Cancel workflow entirely" ### Step 4: Resume Based on Phase **INITIALIZING**: → Continue to DESIGNING phase **DESIGNING**: → Continue architect work → Resume creating entities/tasks **AWAITING_DESIGN_APPROVAL**: → Present design summary again → Ask for approval **DESIGN_APPROVED**: → **CRITICAL**: Generate types before implementing → Run: `python3 skills/guardrail-orchestrator/scripts/generate_types.py .workflow/versions/$VERSION_ID/design/design_document.yml --output-dir types` → Verify types exist: `ls types/types.ts types/component-props.ts types/api-types.ts` → Transition to IMPLEMENTING **DESIGN_REJECTED**: → Show rejection reason → Return to DESIGNING with feedback **IMPLEMENTING**: → **Step 1**: Verify generated types exist ```bash ls types/types.ts types/component-props.ts types/api-types.ts ``` If missing → Run type generation first → **Step 2**: Display type compliance reminder ``` ╔══════════════════════════════════════════════════════════════╗ ║ ⚠️ TYPE COMPLIANCE REQUIRED ║ ╠══════════════════════════════════════════════════════════════╣ ║ ALL implementations MUST: ║ ║ 1. Import types from @/types ║ ║ 2. Import component props from @/types/component-props ║ ║ 3. Use object props (not flat props) ║ ║ 4. Implement ALL events from design ║ ╚══════════════════════════════════════════════════════════════╝ ``` → **Step 3**: Find incomplete tasks → **Step 4**: Continue implementation from next pending task → **Step 5**: Run validation after completing tasks: ```bash python3 skills/guardrail-orchestrator/scripts/workflow_manager.py validate --checklist ``` **REVIEWING**: → Find tasks awaiting review → Continue review process **SECURITY_REVIEW**: → Continue security scanning → Run: `python3 skills/guardrail-orchestrator/scripts/security_scan.py --project-dir . --severity HIGH` → Run: `python3 skills/guardrail-orchestrator/scripts/validate_api_contract.py --project-dir .` → If passed: Transition to AWAITING_IMPL_APPROVAL → If critical issues: Return to IMPLEMENTING with security feedback **AWAITING_IMPL_APPROVAL**: → Present implementation summary again → Ask for approval **IMPL_APPROVED**: → Continue to COMPLETING phase **IMPL_REJECTED**: → Show rejection reason → Return to IMPLEMENTING with feedback **COMPLETING**: → Continue marking tasks complete **PAUSED**: → Resume from `resume_point.phase` **FAILED**: → Show error details → Ask user how to proceed: - Retry failed operation - Skip and continue - Abort workflow ### Step 5: Continue Workflow Execute remaining phases following `/workflow:spawn` protocol. ## TASK-LEVEL RESUME If resuming during IMPLEMENTING phase: 1. **Verify types exist**: ```bash ls types/types.ts types/component-props.ts types/api-types.ts types/index.ts ``` If missing → Generate types first: ```bash python3 skills/guardrail-orchestrator/scripts/generate_types.py \ .workflow/versions/$VERSION_ID/design/design_document.yml \ --output-dir types ``` 2. **Verify IMPLEMENTATION_CONTEXT.md exists**: ```bash ls .workflow/versions/$VERSION_ID/IMPLEMENTATION_CONTEXT.md ``` If missing → Regenerate (see spawn.md Step 3.5.4) 3. **Display context reminder to agent**: ``` ╔══════════════════════════════════════════════════════════════╗ ║ 🔴 MANDATORY CONTEXT READING ║ ╠══════════════════════════════════════════════════════════════╣ ║ BEFORE implementing ANY task, you MUST read: ║ ║ ║ ║ 1. .workflow/versions/$VERSION_ID/IMPLEMENTATION_CONTEXT.md ║ ║ Contains: All rules, types, import patterns ║ ║ ║ ║ 2. .workflow/versions/$VERSION_ID/tasks/task_.yml ║ ║ Contains: Task definition, acceptance criteria ║ ║ ║ ║ 3. .workflow/versions/$VERSION_ID/contexts/.yml ║ ║ Contains: Entity context, props, events, schemas ║ ║ ║ ║ 4. types/component-props.ts OR types/api-types.ts ║ ║ Contains: Generated types - SOURCE OF TRUTH ║ ╚══════════════════════════════════════════════════════════════╝ ``` 4. **Identify incomplete tasks**: ```yaml # Resume from first task not in 'completed' or 'approved' resume_task: tasks.pending[0] || tasks.in_progress[0] || tasks.review[0] ``` 5. **Skip completed work**: - Don't recreate files that exist and are valid - Don't re-run validations that passed 6. **Continue from failure point**: - If task failed mid-implementation, restart that task - If validation failed, show error and retry 7. **For each task, remind agent of type requirements**: ``` ⚠️ IMPLEMENTATION RULES: - READ .workflow/versions/$VERSION_ID/IMPLEMENTATION_CONTEXT.md FIRST - Import types from @/types (NOT define your own) - Import props from @/types/component-props - Use object props: { song: Song } NOT { id, title, ... } - Implement ALL events from design ``` 8. **Run validation after completing tasks**: ```bash python3 skills/guardrail-orchestrator/scripts/workflow_manager.py validate --checklist ``` - If errors found → Fix before proceeding - If warnings only → Continue with caution ## STATE RECOVERY If `.workflow/current.yml` is corrupted: 1. **Check for backup**: `.workflow/current.yml.bak` 2. **Attempt recovery from manifest**: - Read `project_manifest.json` for entity status - Scan version-specific tasks directory for task status - Reconstruct workflow state 3. **If unrecoverable**: - Report error - Suggest starting fresh with `/workflow:spawn` ## ABORT WORKFLOW If user chooses to abort: 1. **Confirm abort**: "This will cancel the workflow. Files already created will remain. Continue?" 2. **If confirmed**: - Archive state to `.workflow/history/_aborted.yml` - Clear `.workflow/current.yml` - Report: "Workflow aborted. Created files remain in place." 3. **Cleanup options**: - Offer to rollback created files (if git available) - Offer to keep partial implementation