Files
Claude-Code-Workflow/.claude/commands/workflow/session/switch.md
catlog22 754f9b8da0 修复所有命令文件的usage格式:斜杠改为冒号
统一命令调用格式从 /workflow/session/list 改为 /workflow:session:list

## 修复范围
- workflow/session/: 6个子命令 (start, pause, resume, list, status, switch)
- workflow/issue/: 4个子命令 (create, list, update, close)
- workflow/: 3个主命令 (plan, execute, review)
- task/: 4个命令 (create, execute, breakdown, replan)
- gemini/: 3个命令 (chat, execute, analyze)

## 格式统一
- usage行: /workflow:session:list
- examples: /workflow:session:start "任务"
- 标题: # Command (/workflow:session:start)
- 内容引用: 所有命令路径统一使用冒号格式

## 验证完成
 24个命令文件全部采用统一格式
 所有examples和内容引用保持一致
 parent字段同步更新

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-08 16:32:41 +08:00

85 lines
2.1 KiB
Markdown

---
name: workflow-session-switch
description: Switch to a different workflow session
usage: /workflow:session:switch <session-id>
parent: /workflow:session
examples:
- /workflow:session:switch WFS-oauth-integration
- /workflow:session:switch WFS-user-profile
---
# Switch Workflow Session (/workflow:session:switch)
## Purpose
Switch the active session to a different workflow session.
## Usage
```bash
/workflow:session:switch <session-id>
```
## Session Switching Process
### Validation
- Verifies target session exists
- Checks session directory integrity
- Validates session state
### Active Session Handling
- Automatically pauses currently active session
- Saves current session state
- Removes current `.active-*` marker file
### Target Session Activation
- Creates `.active-[target-session]` marker file
- Updates session status to "active"
- Loads session context and state
### State Transition
```
Current Active → Paused (auto-saved)
Target Session → Active (context loaded)
```
## Context Loading
After switching:
- Loads target session's phase and progress
- Restores appropriate agent context
- Makes session's documents available
- Updates TodoWrite to target session's tasks
## Output
Displays:
- Previous active session (now paused)
- New active session details
- Current phase and progress
- Available next actions
## Session ID Formats
Accepts various formats:
- Full ID: `WFS-oauth-integration`
- Partial match: `oauth` (if unique)
- Index from list: `1` (from session list order)
## Error Handling
- **Session not found**: Lists available sessions
- **Invalid session**: Shows session validation errors
- **Already active**: No-op with confirmation message
- **Switch failure**: Maintains current session, shows error
## Quick Reference
After switching, shows:
- Session description and phase
- Recent activity and progress
- Suggested next commands
- Directory location
## Integration
Commands executed after switch will:
- Use new active session context
- Save artifacts to new session directory
- Update new session's state and progress
---
**Result**: Different session is now active and ready for work