project-standalo-sonic-cloud/.claude/commands/workflow/resume.md

160 lines
5.6 KiB
Markdown

---
description: Resume an interrupted workflow from saved state
allowed-tools: Read, Write, Edit, Bash, AskUserQuestion, TodoWrite
---
# 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: <id> ║
║ Feature: <feature> ║
║ Started: <started_at> ║
║ Last Updated: <updated_at> ║
╠══════════════════════════════════════════════════════════════╣
║ CURRENT STATE ║
║ Phase: <current_phase> ║
║ Resume Point: <resume_point.action> ║
╠══════════════════════════════════════════════════════════════╣
║ PROGRESS ║
║ Entities Designed: <progress.entities_designed> ║
║ Tasks Created: <progress.tasks_created> ║
║ Tasks Implemented: <progress.tasks_implemented> ║
║ Tasks Reviewed: <progress.tasks_reviewed> ║
║ Tasks Completed: <progress.tasks_completed> ║
╠══════════════════════════════════════════════════════════════╣
║ LAST ERROR (if any): <last_error> ║
╚══════════════════════════════════════════════════════════════╝
```
### 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**:
→ Continue to IMPLEMENTING phase
**DESIGN_REJECTED**:
→ Show rejection reason
→ Return to DESIGNING with feedback
**IMPLEMENTING**:
→ Find incomplete tasks
→ Continue implementation from next pending task
**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. **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]
```
2. **Skip completed work**:
- Don't recreate files that exist and are valid
- Don't re-run validations that passed
3. **Continue from failure point**:
- If task failed mid-implementation, restart that task
- If validation failed, show error and retry
## 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/<id>_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