Files
Claude-Code-Workflow/.claude/commands/workflow/session/list.md
catlog22 598bea9b21 feat(ccw): add session manager tool with auto workspace detection
- Add session_manager tool for workflow session lifecycle management
- Add ccw session CLI command with subcommands:
  - list, init, status, task, stats, delete, read, write, update, archive, mkdir
- Implement auto workspace detection (traverse up to find .workflow)
- Implement auto session location detection (active, archived, lite-plan, lite-fix)
- Add dashboard notifications for tool executions via WebSocket
- Add granular event types (SESSION_CREATED, TASK_UPDATED, etc.)
- Add status_history auto-tracking for task status changes
- Update workflow session commands to document ccw session usage

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-10 19:26:53 +08:00

3.5 KiB

name, description, examples
name description examples
list List all workflow sessions with status filtering, shows session metadata and progress information
/workflow:session:list

List Workflow Sessions (/workflow:session:list)

Overview

Display all workflow sessions with their current status, progress, and metadata.

Usage

/workflow:session:list       # Show all sessions with status

Implementation Flow

Step 1: Find All Sessions

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

Step 2: Check Active Session

find .workflow/active/ -name "WFS-*" -type d 2>/dev/null | head -1

Step 3: Read Session Metadata

jq -r '.session_id, .status, .project' .workflow/active/WFS-session/workflow-session.json

Step 4: Count Task Progress

find .workflow/active/WFS-session/.task/ -name "*.json" -type f 2>/dev/null | wc -l
find .workflow/active/WFS-session/.summaries/ -name "*.md" -type f 2>/dev/null | wc -l

Step 5: Get Creation Time

jq -r '.created_at // "unknown"' .workflow/active/WFS-session/workflow-session.json

Simple Bash Commands

Basic Operations

  • List sessions: find .workflow/active/ -name "WFS-*" -type d
  • Find active: find .workflow/active/ -name "WFS-*" -type d
  • Read session data: jq -r '.session_id, .status' session.json
  • Count tasks: find .task/ -name "*.json" -type f | wc -l
  • Count completed: find .summaries/ -name "*.md" -type f 2>/dev/null | wc -l
  • Get timestamp: jq -r '.created_at' session.json

Simple Output Format

Session List Display

Workflow Sessions:

[ACTIVE] WFS-oauth-integration
   Project: OAuth2 authentication system
   Status: active
   Progress: 3/8 tasks completed
   Created: 2025-09-15T10:30:00Z

[PAUSED] WFS-user-profile
   Project: User profile management
   Status: paused
   Progress: 1/5 tasks completed
   Created: 2025-09-14T14:15:00Z

[COMPLETED] WFS-database-migration
   Project: Database schema migration
   Status: completed
   Progress: 4/4 tasks completed
   Created: 2025-09-13T09:00:00Z

Total: 3 sessions (1 active, 1 paused, 1 completed)

Status Indicators

  • [ACTIVE]: Active session
  • [PAUSED]: Paused session
  • [COMPLETED]: Completed session
  • [ERROR]: Error/corrupted session

Quick Commands

# Count all sessions
ls .workflow/active/WFS-* | wc -l

# Show recent sessions
ls -t .workflow/active/WFS-*/workflow-session.json | head -3

session_manager Tool Alternative

Use ccw tool exec session_manager for simplified session listing:

List All Sessions (Active + Archived)

ccw tool exec session_manager '{"operation":"list","location":"both","include_metadata":true}'

# Response:
# {
#   "success": true,
#   "result": {
#     "active": [{"session_id":"WFS-xxx","metadata":{...}}],
#     "archived": [{"session_id":"WFS-yyy","metadata":{...}}],
#     "total": 2
#   }
# }

List Active Sessions Only

ccw tool exec session_manager '{"operation":"list","location":"active","include_metadata":true}'

Read Specific Session

ccw tool exec session_manager '{"operation":"read","session_id":"WFS-xxx","content_type":"session"}'

Operation Reference

Old Pattern session_manager
ls .workflow/active/WFS-* {"operation":"list","location":"active"}
find ... -type d {"operation":"list"} returns session_id list
jq -r '.status' session.json {"operation":"read","content_type":"session"}
cat workflow-session.json {"operation":"read","content_type":"session"}