Revert: Remove ccw session management while keeping ccw cli exec

Selectively revert ccw session management commands back to commit 5114a94,
while preserving ccw cli exec improvements.

Changes:
- Session management commands (start, list, resume, complete): Full revert to bash commands
- execute.md: Full revert (only had ccw session changes)
- review.md: Reverted ccw session read, kept ccw cli exec
- docs.md: Reverted ccw session read/write, kept ccw cli exec
- lite-fix.md: Reverted ccw session init/read, kept other changes
- lite-plan.md: Reverted ccw session init/read, kept other changes
- lite-execute.md: No changes (kept ccw cli exec intact)
- code-developer.md: No changes (kept ccw cli exec intact)

All ccw session management operations replaced with bash commands.
All ccw cli exec commands preserved for unified CLI execution.

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
catlog22
2025-12-17 22:52:12 +08:00
parent 474a1ce027
commit 44d84116c3
9 changed files with 147 additions and 373 deletions

View File

@@ -74,7 +74,7 @@ SlashCommand(command="/workflow:session:start --type docs --new \"{project_name}
```bash ```bash
# Update workflow-session.json with docs-specific fields # Update workflow-session.json with docs-specific fields
ccw session {sessionId} write workflow-session.json '{"target_path":"{target_path}","project_root":"{project_root}","project_name":"{project_name}","mode":"full","tool":"gemini","cli_execute":false}' bash(jq '. + {"target_path":"{target_path}","project_root":"{project_root}","project_name":"{project_name}","mode":"full","tool":"gemini","cli_execute":false}' .workflow/active/{sessionId}/workflow-session.json > tmp.json && mv tmp.json .workflow/active/{sessionId}/workflow-session.json)
``` ```
### Phase 2: Analyze Structure ### Phase 2: Analyze Structure
@@ -136,8 +136,7 @@ bash(if [ -d .workflow/docs/\${project_name} ]; then find .workflow/docs/\${proj
```bash ```bash
# Count existing docs from doc-planning-data.json # Count existing docs from doc-planning-data.json
ccw session WFS-docs-{timestamp} read .process/doc-planning-data.json --raw | jq '.existing_docs.file_list | length' bash(cat .workflow/active/WFS-docs-{timestamp}/.process/doc-planning-data.json | jq '.existing_docs.file_list | length')
# Or read entire process file and parse
``` ```
**Data Processing**: Use count result, then use **Edit tool** to update `workflow-session.json`: **Data Processing**: Use count result, then use **Edit tool** to update `workflow-session.json`:
@@ -191,10 +190,10 @@ Large Projects (single dir >10 docs):
```bash ```bash
# 1. Get top-level directories from doc-planning-data.json # 1. Get top-level directories from doc-planning-data.json
ccw session WFS-docs-{timestamp} read .process/doc-planning-data.json --raw | jq -r '.top_level_dirs[]' bash(cat .workflow/active/WFS-docs-{timestamp}/.process/doc-planning-data.json | jq -r '.top_level_dirs[]')
# 2. Get mode from workflow-session.json # 2. Get mode from workflow-session.json
ccw session WFS-docs-{timestamp} read workflow-session.json --raw | jq -r '.mode // "full"' bash(cat .workflow/active/WFS-docs-{timestamp}/workflow-session.json | jq -r '.mode // "full"')
# 3. Check for HTTP API # 3. Check for HTTP API
bash(grep -r "router\.|@Get\|@Post" src/ 2>/dev/null && echo "API_FOUND" || echo "NO_API") bash(grep -r "router\.|@Get\|@Post" src/ 2>/dev/null && echo "API_FOUND" || echo "NO_API")
@@ -223,7 +222,7 @@ bash(grep -r "router\.|@Get\|@Post" src/ 2>/dev/null && echo "API_FOUND" || echo
**Task ID Calculation**: **Task ID Calculation**:
```bash ```bash
group_count=$(ccw session WFS-docs-{timestamp} read .process/doc-planning-data.json --raw | jq '.groups.count') group_count=$(jq '.groups.count' .workflow/active/WFS-docs-{timestamp}/.process/doc-planning-data.json)
readme_id=$((group_count + 1)) # Next ID after groups readme_id=$((group_count + 1)) # Next ID after groups
arch_id=$((group_count + 2)) arch_id=$((group_count + 2))
api_id=$((group_count + 3)) api_id=$((group_count + 3))
@@ -286,8 +285,8 @@ api_id=$((group_count + 3))
"step": "load_precomputed_data", "step": "load_precomputed_data",
"action": "Load Phase 2 analysis and extract group directories", "action": "Load Phase 2 analysis and extract group directories",
"commands": [ "commands": [
"ccw session ${session_id} read .process/doc-planning-data.json", "bash(cat ${session_dir}/.process/doc-planning-data.json)",
"ccw session ${session_id} read .process/doc-planning-data.json --raw | jq '.groups.assignments[] | select(.group_id == \"${group_number}\") | .directories'" "bash(jq '.groups.assignments[] | select(.group_id == \"${group_number}\") | .directories' ${session_dir}/.process/doc-planning-data.json)"
], ],
"output_to": "phase2_context", "output_to": "phase2_context",
"note": "Single JSON file contains all Phase 2 analysis results" "note": "Single JSON file contains all Phase 2 analysis results"

View File

@@ -68,8 +68,8 @@ Phase 4: Execution Strategy & Task Execution
├─ Lazy load task JSON ├─ Lazy load task JSON
├─ Launch agent with task context ├─ Launch agent with task context
├─ Mark task completed (update IMPL-*.json status) ├─ Mark task completed (update IMPL-*.json status)
│ # Update task status with ccw session (auto-tracks status_history): │ # Quick fix: Update task status for ccw dashboard
│ # ccw session task ${sessionId} IMPL-X completed │ # TS=$(date -Iseconds) && jq --arg ts "$TS" '.status="completed" | .status_history=(.status_history // [])+[{"from":"in_progress","to":"completed","changed_at":$ts}]' IMPL-X.json > tmp.json && mv tmp.json IMPL-X.json
└─ Advance to next task └─ Advance to next task
Phase 5: Completion Phase 5: Completion
@@ -92,32 +92,37 @@ Resume Mode (--resume-session):
**Process**: **Process**:
#### Step 1.1: List Active Sessions #### Step 1.1: Count Active Sessions
```bash ```bash
ccw session list --location active bash(find .workflow/active/ -name "WFS-*" -type d 2>/dev/null | wc -l)
# Returns: {"success":true,"result":{"active":[...],"total":N}}
``` ```
#### Step 1.2: Handle Session Selection #### Step 1.2: Handle Session Selection
**Case A: No Sessions** (total = 0) **Case A: No Sessions** (count = 0)
``` ```
ERROR: No active workflow sessions found ERROR: No active workflow sessions found
Run /workflow:plan "task description" to create a session Run /workflow:plan "task description" to create a session
``` ```
**Case B: Single Session** (total = 1) **Case B: Single Session** (count = 1)
Auto-select the single session from result.active[0].session_id and continue to Phase 2.
**Case C: Multiple Sessions** (total > 1)
List sessions with metadata using ccw session:
```bash ```bash
# Get session list with metadata bash(find .workflow/active/ -name "WFS-*" -type d 2>/dev/null | head -1 | xargs basename)
ccw session list --location active ```
Auto-select and continue to Phase 2.
# For each session, get stats **Case C: Multiple Sessions** (count > 1)
ccw session stats WFS-session-name
List sessions with metadata and prompt user selection:
```bash
bash(for dir in .workflow/active/WFS-*/; do
session=$(basename "$dir")
project=$(jq -r '.project // "Unknown"' "$dir/workflow-session.json" 2>/dev/null)
total=$(grep -c "^- \[" "$dir/TODO_LIST.md" 2>/dev/null || echo "0")
completed=$(grep -c "^- \[x\]" "$dir/TODO_LIST.md" 2>/dev/null || echo "0")
[ "$total" -gt 0 ] && progress=$((completed * 100 / total)) || progress=0
echo "${session} | ${project} | ${completed}/${total} tasks (${progress}%)"
done)
``` ```
Use AskUserQuestion to present formatted options (max 4 options shown): Use AskUserQuestion to present formatted options (max 4 options shown):
@@ -149,20 +154,12 @@ Parse user input (supports: number "1", full ID "WFS-auth-system", or partial "a
#### Step 1.3: Load Session Metadata #### Step 1.3: Load Session Metadata
```bash ```bash
ccw session ${sessionId} read workflow-session.json bash(cat .workflow/active/${sessionId}/workflow-session.json)
``` ```
**Output**: Store session metadata in memory **Output**: Store session metadata in memory
**DO NOT read task JSONs yet** - defer until execution phase (lazy loading) **DO NOT read task JSONs yet** - defer until execution phase (lazy loading)
#### Step 1.4: Update Session Status to Active
**Purpose**: Update workflow-session.json status from "planning" to "active" for dashboard monitoring.
```bash
# Update status atomically using ccw session
ccw session status ${sessionId} active
```
**Resume Mode**: This entire phase is skipped when `--resume-session="session-id"` flag is provided. **Resume Mode**: This entire phase is skipped when `--resume-session="session-id"` flag is provided.
### Phase 2: Planning Document Validation ### Phase 2: Planning Document Validation

View File

@@ -72,60 +72,17 @@ Phase 5: Dispatch
### Phase 1: Intelligent Multi-Angle Diagnosis ### Phase 1: Intelligent Multi-Angle Diagnosis
**Session Setup** (MANDATORY - follow exactly): **Session Setup** (MANDATORY - follow exactly):
**Option 1: Using CLI Command** (Recommended for simplicity):
```bash
# Generate session ID
bug_slug=$(echo "${bug_description}" | tr '[:upper:]' '[:lower:]' | tr -cs '[:alnum:]' '-' | cut -c1-40)
date_str=$(date -u '+%Y-%m-%d')
session_id="${bug_slug}-${date_str}"
# Initialize lite-fix session (location auto-inferred from type)
ccw session init "${session_id}" \
--type lite-fix \
--content "{\"description\":\"${bug_description}\",\"severity\":\"${severity}\"}"
# Get session folder
session_folder=".workflow/.lite-fix/${session_id}"
echo "Session initialized: ${session_id} at ${session_folder}"
```
**Option 2: Using session_manager Tool** (For programmatic access):
```javascript ```javascript
// Helper: Get UTC+8 (China Standard Time) ISO string // Helper: Get UTC+8 (China Standard Time) ISO string
const getUtc8ISOString = () => new Date(Date.now() + 8 * 60 * 60 * 1000).toISOString() const getUtc8ISOString = () => new Date(Date.now() + 8 * 60 * 60 * 1000).toISOString()
const bugSlug = bug_description.toLowerCase().replace(/[^a-z0-9]+/g, '-').substring(0, 40) const bugSlug = bug_description.toLowerCase().replace(/[^a-z0-9]+/g, '-').substring(0, 40)
const dateStr = getUtc8ISOString().substring(0, 10) // Format: 2025-12-17 const dateStr = getUtc8ISOString().substring(0, 10) // Format: 2025-11-29
const sessionId = `${bugSlug}-${dateStr}` // e.g., "user-avatar-upload-fails-2025-12-17" const sessionId = `${bugSlug}-${dateStr}` // e.g., "user-avatar-upload-fails-2025-11-29"
const sessionFolder = `.workflow/.lite-fix/${sessionId}`
bash(`mkdir -p ${sessionFolder} && test -d ${sessionFolder} && echo "SUCCESS: ${sessionFolder}" || echo "FAILED: ${sessionFolder}"`)
const sessionFolder = initResult.result.path
console.log(`Session initialized: ${sessionId} at ${sessionFolder}`)
```
**Session File Structure**:
- `session-metadata.json` - Session metadata (created at init, contains description, severity, status)
- `fix-plan.json` - Actual fix planning content (created later in Phase 3, contains fix tasks, diagnosis results)
**Metadata Field Usage**:
- `description`: Displayed in dashboard session list (replaces session ID as title)
- `severity`: Used for fix planning strategy selection (Low/Medium → Direct Claude, High/Critical → Agent)
- `created_at`: Displayed in dashboard timeline
- `status`: Updated through workflow (diagnosing → fixing → completed)
- Custom fields: Any additional fields in metadata are saved and accessible programmatically
**Accessing Session Data**:
```bash
# Read session metadata
ccw session ${session_id} read session-metadata.json
# Read fix plan content (after Phase 3 completion)
ccw session ${session_id} read fix-plan.json
``` ```
**Diagnosis Decision Logic**: **Diagnosis Decision Logic**:

View File

@@ -72,57 +72,17 @@ Phase 5: Dispatch
### Phase 1: Intelligent Multi-Angle Exploration ### Phase 1: Intelligent Multi-Angle Exploration
**Session Setup** (MANDATORY - follow exactly): **Session Setup** (MANDATORY - follow exactly):
**Option 1: Using CLI Command** (Recommended for simplicity):
```bash
# Generate session ID
task_slug=$(echo "${task_description}" | tr '[:upper:]' '[:lower:]' | tr -cs '[:alnum:]' '-' | cut -c1-40)
date_str=$(date -u '+%Y-%m-%d')
session_id="${task_slug}-${date_str}"
# Initialize lite-plan session (location auto-inferred from type)
ccw session init "${session_id}" \
--type lite-plan \
--content "{\"description\":\"${task_description}\",\"complexity\":\"${complexity}\"}"
# Get session folder
session_folder=".workflow/.lite-plan/${session_id}"
echo "Session initialized: ${session_id} at ${session_folder}"
```
**Option 2: Using session_manager Tool** (For programmatic access):
```javascript ```javascript
// Helper: Get UTC+8 (China Standard Time) ISO string // Helper: Get UTC+8 (China Standard Time) ISO string
const getUtc8ISOString = () => new Date(Date.now() + 8 * 60 * 60 * 1000).toISOString() const getUtc8ISOString = () => new Date(Date.now() + 8 * 60 * 60 * 1000).toISOString()
const taskSlug = task_description.toLowerCase().replace(/[^a-z0-9]+/g, '-').substring(0, 40) const taskSlug = task_description.toLowerCase().replace(/[^a-z0-9]+/g, '-').substring(0, 40)
const dateStr = getUtc8ISOString().substring(0, 10) // Format: 2025-12-17 const dateStr = getUtc8ISOString().substring(0, 10) // Format: 2025-11-29
const sessionId = `${taskSlug}-${dateStr}` // e.g., "implement-jwt-refresh-2025-12-17" const sessionId = `${taskSlug}-${dateStr}` // e.g., "implement-jwt-refresh-2025-11-29"
const sessionFolder = `.workflow/.lite-plan/${sessionId}`
bash(`mkdir -p ${sessionFolder} && test -d ${sessionFolder} && echo "SUCCESS: ${sessionFolder}" || echo "FAILED: ${sessionFolder}"`)
const sessionFolder = initResult.result.path
console.log(`Session initialized: ${sessionId} at ${sessionFolder}`)
```
**Session File Structure**:
- `session-metadata.json` - Session metadata (created at init, contains description, complexity, status)
- `plan.json` - Actual planning content (created later in Phase 3, contains tasks, steps, dependencies)
**Metadata Field Usage**:
- `description`: Displayed in dashboard session list (replaces session ID as title)
- `complexity`: Used for planning strategy selection (Low → Direct Claude, Medium/High → Agent)
- `created_at`: Displayed in dashboard timeline
- Custom fields: Any additional fields in metadata are saved and accessible programmatically
**Accessing Session Data**:
```bash
# Read session metadata
ccw session ${session_id} read session-metadata.json
# Read plan content (after Phase 3 completion)
ccw session ${session_id} read plan.json
``` ```
**Exploration Decision Logic**: **Exploration Decision Logic**:

View File

@@ -122,9 +122,8 @@ After bash validation, the model takes control to:
cat "$test_summary" cat "$test_summary"
done done
# Get session created_at for git log filter # Get changed files
created_at=$(ccw session ${sessionId} read workflow-session.json | jq -r .created_at) git log --since="$(cat .workflow/active/${sessionId}/workflow-session.json | jq -r .created_at)" --name-only --pretty=format: | sort -u
git log --since="$created_at" --name-only --pretty=format: | sort -u
``` ```
2. **Perform Specialized Review**: Based on `review_type` 2. **Perform Specialized Review**: Based on `review_type`

View File

@@ -25,16 +25,18 @@ Mark the currently active workflow session as complete, analyze it for lessons l
#### Step 1.1: Find Active Session and Get Name #### Step 1.1: Find Active Session and Get Name
```bash ```bash
# Find active session # Find active session directory
ccw session list --location active bash(find .workflow/active/ -name "WFS-*" -type d | head -1)
# Extract first session_id from result.active array
# Extract session name from directory path
bash(basename .workflow/active/WFS-session-name)
``` ```
**Output**: Session name `WFS-session-name` **Output**: Session name `WFS-session-name`
#### Step 1.2: Check for Existing Archiving Marker (Resume Detection) #### Step 1.2: Check for Existing Archiving Marker (Resume Detection)
```bash ```bash
# Check if session is already being archived (marker file exists) # Check if session is already being archived
ccw session WFS-session-name read .process/.archiving 2>/dev/null && echo "RESUMING" || echo "NEW" bash(test -f .workflow/active/WFS-session-name/.archiving && echo "RESUMING" || echo "NEW")
``` ```
**If RESUMING**: **If RESUMING**:
@@ -47,7 +49,7 @@ ccw session WFS-session-name read .process/.archiving 2>/dev/null && echo "RESUM
#### Step 1.3: Create Archiving Marker #### Step 1.3: Create Archiving Marker
```bash ```bash
# Mark session as "archiving in progress" # Mark session as "archiving in progress"
ccw session WFS-session-name write .process/.archiving '' bash(touch .workflow/active/WFS-session-name/.archiving)
``` ```
**Purpose**: **Purpose**:
- Prevents concurrent operations on this session - Prevents concurrent operations on this session
@@ -159,20 +161,21 @@ Analyze workflow session for archival preparation. Session is STILL in active lo
**Purpose**: Atomically commit all changes. Only execute if Phase 2 succeeds. **Purpose**: Atomically commit all changes. Only execute if Phase 2 succeeds.
#### Step 3.1: Update Session Status and Archive #### Step 3.1: Create Archive Directory
```bash ```bash
# Archive session (updates status to "completed" and moves to archives) bash(mkdir -p .workflow/archives/)
ccw session archive WFS-session-name ```
# This operation atomically:
# 1. Updates workflow-session.json status to "completed" #### Step 3.2: Move Session to Archive
# 2. Moves session from .workflow/active/ to .workflow/archives/ ```bash
bash(mv .workflow/active/WFS-session-name .workflow/archives/WFS-session-name)
``` ```
**Result**: Session now at `.workflow/archives/WFS-session-name/` **Result**: Session now at `.workflow/archives/WFS-session-name/`
#### Step 3.2: Update Manifest #### Step 3.3: Update Manifest
```bash ```bash
# Check if manifest exists # Read current manifest (or create empty array if not exists)
test -f .workflow/archives/manifest.json && echo "EXISTS" || echo "NOT_FOUND" bash(test -f .workflow/archives/manifest.json && cat .workflow/archives/manifest.json || echo "[]")
``` ```
**JSON Update Logic**: **JSON Update Logic**:
@@ -197,10 +200,9 @@ manifest.push(archiveEntry);
Write('.workflow/archives/manifest.json', JSON.stringify(manifest, null, 2)); Write('.workflow/archives/manifest.json', JSON.stringify(manifest, null, 2));
``` ```
#### Step 3.5: Remove Archiving Marker #### Step 3.4: Remove Archiving Marker
```bash ```bash
# Remove archiving marker from archived session (use bash rm as ccw has no delete) bash(rm .workflow/archives/WFS-session-name/.archiving)
rm .workflow/archives/WFS-session-name/.process/.archiving 2>/dev/null || true
``` ```
**Result**: Clean archived session without temporary markers **Result**: Clean archived session without temporary markers
@@ -221,8 +223,7 @@ rm .workflow/archives/WFS-session-name/.process/.archiving 2>/dev/null || true
#### Step 4.1: Check Project State Exists #### Step 4.1: Check Project State Exists
```bash ```bash
# Check if project.json exists bash(test -f .workflow/project.json && echo "EXISTS" || echo "SKIP")
test -f .workflow/project.json && echo "EXISTS" || echo "SKIP"
``` ```
**If SKIP**: Output warning and skip Phase 4 **If SKIP**: Output warning and skip Phase 4
@@ -249,6 +250,11 @@ const featureId = title.toLowerCase().replace(/[^a-z0-9]+/g, '-').substring(0, 5
#### Step 4.3: Update project.json #### Step 4.3: Update project.json
```bash
# Read current project state
bash(cat .workflow/project.json)
```
**JSON Update Logic**: **JSON Update Logic**:
```javascript ```javascript
// Read existing project.json (created by /workflow:init) // Read existing project.json (created by /workflow:init)
@@ -360,8 +366,8 @@ function getLatestCommitHash() {
**Recovery Steps**: **Recovery Steps**:
```bash ```bash
# Session still in .workflow/active/WFS-session-name # Session still in .workflow/active/WFS-session-name
# Remove archiving marker using bash # Remove archiving marker
rm .workflow/active/WFS-session-name/.process/.archiving 2>/dev/null || true bash(rm .workflow/active/WFS-session-name/.archiving)
``` ```
**User Notification**: **User Notification**:
@@ -458,12 +464,11 @@ Session state: PARTIALLY COMPLETE (session archived, manifest needs update)
**Phase 3: Atomic Commit** (Transactional file operations) **Phase 3: Atomic Commit** (Transactional file operations)
- Create archive directory - Create archive directory
- Update session status to "completed"
- Move session to archive location - Move session to archive location
- Update manifest.json with archive entry - Update manifest.json with archive entry
- Remove `.archiving` marker - Remove `.archiving` marker
- **All-or-nothing**: Either all succeed or session remains in safe state - **All-or-nothing**: Either all succeed or session remains in safe state
- **Total**: 5 bash commands + JSON manipulation - **Total**: 4 bash commands + JSON manipulation
**Phase 4: Project Registry Update** (Optional feature tracking) **Phase 4: Project Registry Update** (Optional feature tracking)
- Check project.json exists - Check project.json exists
@@ -493,55 +498,3 @@ Session state: PARTIALLY COMPLETE (session archived, manifest needs update)
- Idempotent operations (safe to retry) - Idempotent operations (safe to retry)
## session_manager Tool Alternative
Use `ccw tool exec session_manager` for session completion operations:
### List Active Sessions
```bash
ccw tool exec session_manager '{"operation":"list","location":"active"}'
```
### Update Session Status to Completed
```bash
ccw tool exec session_manager '{
"operation": "update",
"session_id": "WFS-xxx",
"content_type": "session",
"content": {
"status": "completed",
"archived_at": "2025-12-10T08:00:00Z"
}
}'
```
### Archive Session
```bash
ccw tool exec session_manager '{"operation":"archive","session_id":"WFS-xxx"}'
# This operation:
# 1. Updates status to "completed" if update_status=true (default)
# 2. Moves session from .workflow/active/ to .workflow/archives/
```
### Read Session Data
```bash
# Read workflow-session.json
ccw tool exec session_manager '{"operation":"read","session_id":"WFS-xxx","content_type":"session"}'
# Read IMPL_PLAN.md
ccw tool exec session_manager '{"operation":"read","session_id":"WFS-xxx","content_type":"plan"}'
```
### Write Archiving Marker
```bash
ccw tool exec session_manager '{
"operation": "write",
"session_id": "WFS-xxx",
"content_type": "process",
"path_params": {"filename": ".archiving"},
"content": ""
}'
```

View File

@@ -17,30 +17,41 @@ Display all workflow sessions with their current status, progress, and metadata.
## Implementation Flow ## Implementation Flow
### Step 1: List All Sessions ### Step 1: Find All Sessions
```bash ```bash
ccw session list --location both ls .workflow/active/WFS-* 2>/dev/null
``` ```
### Step 2: Get Session Statistics ### Step 2: Check Active Session
```bash ```bash
ccw session stats WFS-session find .workflow/active/ -name "WFS-*" -type d 2>/dev/null | head -1
# Returns: tasks count by status, summaries count, has_plan
``` ```
### Step 3: Read Session Metadata ### Step 3: Read Session Metadata
```bash ```bash
ccw session WFS-session read workflow-session.json jq -r '.session_id, .status, .project' .workflow/active/WFS-session/workflow-session.json
# Returns: session_id, status, project, created_at, etc.
``` ```
## Simple Commands ### Step 4: Count Task Progress
```bash
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
```bash
jq -r '.created_at // "unknown"' .workflow/active/WFS-session/workflow-session.json
```
## Simple Bash Commands
### Basic Operations ### Basic Operations
- **List all sessions**: `ccw session list` - **List sessions**: `find .workflow/active/ -name "WFS-*" -type d`
- **List active only**: `ccw session list --location active` - **Find active**: `find .workflow/active/ -name "WFS-*" -type d`
- **Read session data**: `ccw session WFS-xxx read workflow-session.json` - **Read session data**: `jq -r '.session_id, .status' session.json`
- **Get task stats**: `ccw session WFS-xxx stats` - **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 ## Simple Output Format
@@ -77,38 +88,9 @@ Total: 3 sessions (1 active, 1 paused, 1 completed)
### Quick Commands ### Quick Commands
```bash ```bash
# Count active sessions using ccw # Count all sessions
ccw session list --location active --no-metadata ls .workflow/active/WFS-* | wc -l
# Returns session count in result.total
# Show recent sessions # Show recent sessions
ccw session list --location active 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)
```bash
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
```bash
ccw tool exec session_manager '{"operation":"list","location":"active","include_metadata":true}'
```
### Read Specific Session
```bash
ccw tool exec session_manager '{"operation":"read","session_id":"WFS-xxx","content_type":"session"}'
```

View File

@@ -17,33 +17,39 @@ Resume the most recently paused workflow session, restoring all context and stat
### Step 1: Find Paused Sessions ### Step 1: Find Paused Sessions
```bash ```bash
ccw session list --location active ls .workflow/active/WFS-* 2>/dev/null
# Filter for sessions with status="paused"
``` ```
### Step 2: Check Session Status ### Step 2: Check Session Status
```bash ```bash
ccw session WFS-session read workflow-session.json jq -r '.status' .workflow/active/WFS-session/workflow-session.json
# Check .status field in response
``` ```
### Step 3: Find Most Recent Paused ### Step 3: Find Most Recent Paused
```bash ```bash
ccw session list --location active ls -t .workflow/active/WFS-*/workflow-session.json | head -1
# Sort by created_at, filter for paused status
``` ```
### Step 4: Update Session Status to Active ### Step 4: Update Session Status
```bash ```bash
ccw session WFS-session status active jq '.status = "active"' .workflow/active/WFS-session/workflow-session.json > temp.json
mv temp.json .workflow/active/WFS-session/workflow-session.json
``` ```
## Simple Commands ### Step 5: Add Resume Timestamp
```bash
jq '.resumed_at = "'$(date -u +%Y-%m-%dT%H:%M:%SZ)'"' .workflow/active/WFS-session/workflow-session.json > temp.json
mv temp.json .workflow/active/WFS-session/workflow-session.json
```
## Simple Bash Commands
### Basic Operations ### Basic Operations
- **List sessions**: `ccw session list --location active` - **List sessions**: `ls .workflow/active/WFS-*`
- **Check status**: `ccw session WFS-xxx read workflow-session.json` - **Check status**: `jq -r '.status' session.json`
- **Update status**: `ccw session WFS-xxx status active` - **Find recent**: `ls -t .workflow/active/*/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 ### Resume Result
``` ```
@@ -52,26 +58,4 @@ Session WFS-user-auth resumed
- Paused at: 2025-09-15T14:30:00Z - Paused at: 2025-09-15T14:30:00Z
- Resumed at: 2025-09-15T15:45:00Z - Resumed at: 2025-09-15T15:45:00Z
- Ready for: /workflow:execute - Ready for: /workflow:execute
``` ```
## session_manager Tool Alternative
Use `ccw tool exec session_manager` for session resume:
### Update Session Status
```bash
# Update status to active
ccw tool exec session_manager '{
"operation": "update",
"session_id": "WFS-xxx",
"content_type": "session",
"content": {
"status": "active",
"resumed_at": "2025-12-10T08:00:00Z"
}
}'
```
### Read Session Status
```bash
ccw tool exec session_manager '{"operation":"read","session_id":"WFS-xxx","content_type":"session"}'
```

View File

@@ -30,17 +30,10 @@ The `--type` parameter classifies sessions for CCW dashboard organization:
| `tdd` | TDD-based development | `/workflow:tdd-plan` | | `tdd` | TDD-based development | `/workflow:tdd-plan` |
| `test` | Test generation/fix sessions | `/workflow:test-fix-gen` | | `test` | Test generation/fix sessions | `/workflow:test-fix-gen` |
| `docs` | Documentation sessions | `/memory:docs` | | `docs` | Documentation sessions | `/memory:docs` |
| `lite-plan` | Lightweight planning workflow | `/workflow:lite-plan` |
| `lite-fix` | Lightweight bug fix workflow | `/workflow:lite-fix` |
**Special Behavior for `lite-plan` and `lite-fix`**:
- These types automatically infer the storage location (`.workflow/.lite-plan/` or `.workflow/.lite-fix/`)
- No need to specify `--location` parameter when using these types
- Alternative: Use `--location lite-plan` or `--location lite-fix` directly
**Validation**: If `--type` is provided with invalid value, return error: **Validation**: If `--type` is provided with invalid value, return error:
``` ```
ERROR: Invalid session type. Valid types: workflow, review, tdd, test, docs, lite-plan, lite-fix ERROR: Invalid session type. Valid types: workflow, review, tdd, test, docs
``` ```
## Step 0: Initialize Project State (First-time Only) ## Step 0: Initialize Project State (First-time Only)
@@ -77,12 +70,12 @@ SlashCommand({command: "/workflow:init"});
### Step 1: List Active Sessions ### Step 1: List Active Sessions
```bash ```bash
ccw session list --location active bash(ls -1 .workflow/active/ 2>/dev/null | head -5)
``` ```
### Step 2: Display Session Metadata ### Step 2: Display Session Metadata
```bash ```bash
ccw session WFS-promptmaster-platform read workflow-session.json bash(cat .workflow/active/WFS-promptmaster-platform/workflow-session.json)
``` ```
### Step 4: User Decision ### Step 4: User Decision
@@ -99,29 +92,34 @@ Present session information and wait for user to select or create session.
### Step 1: Check Active Sessions Count ### Step 1: Check Active Sessions Count
```bash ```bash
ccw session list --location active bash(find .workflow/active/ -name "WFS-*" -type d 2>/dev/null | wc -l)
# Check result.total in response
``` ```
### Step 2a: No Active Sessions → Create New ### Step 2a: No Active Sessions → Create New
```bash ```bash
# Generate session slug from description # Generate session slug
# Pattern: WFS-{lowercase-slug-from-description} bash(echo "implement OAuth2 auth" | sed 's/[^a-zA-Z0-9]/-/g' | tr '[:upper:]' '[:lower:]' | cut -c1-50)
# Create session with ccw (creates directories + metadata atomically) # Create directory structure
ccw session init WFS-implement-oauth2-auth --type workflow bash(mkdir -p .workflow/active/WFS-implement-oauth2-auth/.process)
bash(mkdir -p .workflow/active/WFS-implement-oauth2-auth/.task)
bash(mkdir -p .workflow/active/WFS-implement-oauth2-auth/.summaries)
# Create metadata (include type field, default to "workflow" if not specified)
bash(echo '{"session_id":"WFS-implement-oauth2-auth","project":"implement OAuth2 auth","status":"planning","type":"workflow","created_at":"2024-12-04T08:00:00Z"}' > .workflow/active/WFS-implement-oauth2-auth/workflow-session.json)
``` ```
**Output**: `SESSION_ID: WFS-implement-oauth2-auth` **Output**: `SESSION_ID: WFS-implement-oauth2-auth`
### Step 2b: Single Active Session → Check Relevance ### Step 2b: Single Active Session → Check Relevance
```bash ```bash
# Get session list with metadata # Extract session ID
ccw session list --location active bash(find .workflow/active/ -name "WFS-*" -type d 2>/dev/null | head -1 | xargs basename)
# Read session metadata for relevance check # Read project name from metadata
ccw session WFS-promptmaster-platform read workflow-session.json bash(cat .workflow/active/WFS-promptmaster-platform/workflow-session.json | grep -o '"project":"[^"]*"' | cut -d'"' -f4)
# Check keyword match (manual comparison)
# If task contains project keywords → Reuse session # If task contains project keywords → Reuse session
# If task unrelated → Create new session (use Step 2a) # If task unrelated → Create new session (use Step 2a)
``` ```
@@ -131,9 +129,8 @@ ccw session WFS-promptmaster-platform read workflow-session.json
### Step 2c: Multiple Active Sessions → Use First ### Step 2c: Multiple Active Sessions → Use First
```bash ```bash
# Get first active session from list # Get first active session
ccw session list --location active bash(find .workflow/active/ -name "WFS-*" -type d 2>/dev/null | head -1 | xargs basename)
# Use first session_id from result.active array
# Output warning and session ID # Output warning and session ID
# WARNING: Multiple active sessions detected # WARNING: Multiple active sessions detected
@@ -149,48 +146,26 @@ ccw session list --location active
### Step 1: Generate Unique Session Slug ### Step 1: Generate Unique Session Slug
```bash ```bash
# Convert description to slug: lowercase, alphanumeric + hyphen, max 50 chars # Convert to slug
# Check if exists via ccw session list, add counter if collision bash(echo "fix login bug" | sed 's/[^a-zA-Z0-9]/-/g' | tr '[:upper:]' '[:lower:]' | cut -c1-50)
ccw session list --location active
# Check if exists, add counter if needed
bash(ls .workflow/active/WFS-fix-login-bug 2>/dev/null && echo "WFS-fix-login-bug-2" || echo "WFS-fix-login-bug")
``` ```
### Step 2: Create Session Structure ### Step 2: Create Session Structure
```bash ```bash
# Basic init - creates directories + default metadata bash(mkdir -p .workflow/active/WFS-fix-login-bug/.process)
ccw session init WFS-fix-login-bug --type workflow bash(mkdir -p .workflow/active/WFS-fix-login-bug/.task)
bash(mkdir -p .workflow/active/WFS-fix-login-bug/.summaries)
# Advanced init - with custom metadata
ccw session init WFS-oauth-implementation --type workflow --content '{"description":"OAuth2 authentication system","priority":"high","complexity":"medium"}'
``` ```
**Default Metadata** (auto-generated): ### Step 3: Create Metadata
```json ```bash
{ # Include type field from --type parameter (default: "workflow")
"session_id": "WFS-fix-login-bug", bash(echo '{"session_id":"WFS-fix-login-bug","project":"fix login bug","status":"planning","type":"workflow","created_at":"2024-12-04T08:00:00Z"}' > .workflow/active/WFS-fix-login-bug/workflow-session.json)
"type": "workflow",
"status": "planning",
"created_at": "2025-12-17T..."
}
``` ```
**Custom Metadata** (merged with defaults):
```json
{
"session_id": "WFS-oauth-implementation",
"type": "workflow",
"status": "planning",
"created_at": "2025-12-17T...",
"description": "OAuth2 authentication system",
"priority": "high",
"complexity": "medium"
}
```
**Field Usage**:
- `description`: Displayed in dashboard (replaces session_id as title)
- `status`: Can override default "planning" (e.g., "active", "implementing")
- Custom fields: Any additional fields are saved and accessible programmatically
**Output**: `SESSION_ID: WFS-fix-login-bug` **Output**: `SESSION_ID: WFS-fix-login-bug`
## Execution Guideline ## Execution Guideline
@@ -222,36 +197,4 @@ SESSION_ID: WFS-promptmaster-platform
- Pattern: `WFS-[lowercase-slug]` - Pattern: `WFS-[lowercase-slug]`
- Characters: `a-z`, `0-9`, `-` only - Characters: `a-z`, `0-9`, `-` only
- Max length: 50 characters - Max length: 50 characters
- Uniqueness: Add numeric suffix if collision (`WFS-auth-2`, `WFS-auth-3`) - Uniqueness: Add numeric suffix if collision (`WFS-auth-2`, `WFS-auth-3`)
## session_manager Tool Alternative
The above bash commands can be replaced with `ccw tool exec session_manager`:
### List Sessions
```bash
# List active sessions with metadata
ccw tool exec session_manager '{"operation":"list","location":"active","include_metadata":true}'
# Response: {"success":true,"result":{"active":[{"session_id":"WFS-xxx","metadata":{...}}],"total":1}}
```
### Create Session (replaces mkdir + echo)
```bash
# Single command creates directories + metadata
ccw tool exec session_manager '{
"operation": "init",
"session_id": "WFS-my-session",
"metadata": {
"project": "my project description",
"status": "planning",
"type": "workflow",
"created_at": "2025-12-10T08:00:00Z"
}
}'
```
### Read Session Metadata
```bash
ccw tool exec session_manager '{"operation":"read","session_id":"WFS-xxx","content_type":"session"}'
```