Files
Claude-Code-Workflow/.claude/commands/workflow/session/resume.md
catlog22 19ebb2dc82 fix(workflow): complete path migration and enhance session:complete
Comprehensive update to eliminate all old path references and implement transactional archival in session:complete.

## Part 1: Complete Path Migration (43 files)

### Files Updated
- action-plan-verify.md
- session/list.md, session/resume.md
- tdd-verify.md, tdd-plan.md, test-*.md
- All brainstorm/*.md files (13 files)
- All tools/*.md files (10 files)
- All ui-design/*.md files (10 files)
- lite-plan.md, lite-execute.md, plan.md

### Path Changes
- `.workflow/.active-*` → `find .workflow/sessions/ -name "WFS-*" -type d`
- `.workflow/WFS-{session}` → `.workflow/sessions/WFS-{session}`
- `.workflow/.archives/` → `.workflow/archives/`
- Removed all marker file operations (touch/rm .active-*)

### Verification
-  0 references to .active-* markers remain
-  0 references to direct .workflow/WFS-* paths
-  0 references to .workflow/.archives/ (dot prefix)

## Part 2: Transactional Archival Enhancement

### session/complete.md - Complete Rewrite

**New Four-Phase Architecture**:

1. **Phase 1: Pre-Archival Preparation**
   - Find active session in .workflow/sessions/
   - Check for existing .archiving marker (resume detection)
   - Create .archiving marker to prevent concurrent operations

2. **Phase 2: Agent Analysis (In-Place)**
   - Agent processes session WHILE STILL in sessions/ directory
   - Pure analysis - no file moves or manifest updates
   - Returns complete metadata package for atomic commit
   - Failure here → session remains active, safe to retry

3. **Phase 3: Atomic Commit**
   - Only executes if Phase 2 succeeds
   - Move session to archives/
   - Update manifest.json
   - Remove .archiving marker
   - All-or-nothing guarantee

4. **Phase 4: Project Registry Update**
   - Extract feature metadata and update project.json

**Key Improvements**:
- **Agent-first, move-second**: Prevents inconsistent states
- **Transactional guarantees**: All-or-nothing file operations
- **Resume capability**: .archiving marker enables safe retry
- **Error recovery**: Comprehensive failure handling documented

**Old Design Flaw (Fixed)**:
- Old: Move first → Agent processes → If agent fails, session moved but metadata incomplete
- New: Agent processes → If success, atomic commit → Guaranteed consistency

## Benefits

1. **Consistency**: All commands use identical path patterns
2. **Robustness**: Transactional archival prevents data loss
3. **Maintainability**: Single source of truth for directory structure
4. **Recoverability**: Failed operations can be safely retried
5. **Alignment**: Closer to OpenSpec's clean three-layer model

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-18 12:39:23 +08:00

1.7 KiB

name, description
name description
resume Resume the most recently paused workflow session with automatic session discovery and status update

Resume Workflow Session (/workflow:session:resume)

Overview

Resume the most recently paused workflow session, restoring all context and state.

Usage

/workflow:session:resume     # Resume most recent paused session

Implementation Flow

Step 1: Find Paused Sessions

ls .workflow/sessions/WFS-* 2>/dev/null

Step 2: Check Session Status

jq -r '.status' .workflow/sessions/WFS-session/workflow-session.json

Step 3: Find Most Recent Paused

ls -t .workflow/sessions/WFS-*/workflow-session.json | head -1

Step 4: Update Session Status

jq '.status = "active"' .workflow/sessions/WFS-session/workflow-session.json > temp.json
mv temp.json .workflow/sessions/WFS-session/workflow-session.json

Step 5: Add Resume Timestamp

jq '.resumed_at = "'$(date -u +%Y-%m-%dT%H:%M:%SZ)'"' .workflow/sessions/WFS-session/workflow-session.json > temp.json
mv temp.json .workflow/sessions/WFS-session/workflow-session.json

Simple Bash Commands

Basic Operations

  • List sessions: ls .workflow/sessions/WFS-*
  • Check status: jq -r '.status' session.json
  • Find recent: ls -t .workflow/sessions/*/workflow-session.json | head -1
  • Update status: jq '.status = "active"' session.json > temp.json
  • Add timestamp: jq '.resumed_at = "'$(date -u +%Y-%m-%dT%H:%M:%SZ)'"'

Resume Result

Session WFS-user-auth resumed
- Status: active
- Paused at: 2025-09-15T14:30:00Z
- Resumed at: 2025-09-15T15:45:00Z
- Ready for: /workflow:execute