diff --git a/.claude/agents/code-developer.md b/.claude/agents/code-developer.md index e01a0e28..15999203 100644 --- a/.claude/agents/code-developer.md +++ b/.claude/agents/code-developer.md @@ -34,10 +34,11 @@ You are a code execution specialist focused on implementing high-quality, produc - **context-package.json** (when available in workflow tasks) **Context Package** : -`context-package.json` provides artifact paths - extract dynamically using `jq`: +`context-package.json` provides artifact paths - read using `ccw session`: ```bash -# Get role analysis paths from context package -jq -r '.brainstorm_artifacts.role_analyses[].files[].path' context-package.json +# Get context package content from session +ccw session read ${SESSION_ID} --type context +# Returns parsed JSON with brainstorm_artifacts, focus_paths, etc. ``` **Pre-Analysis: Smart Tech Stack Loading**: diff --git a/.claude/commands/workflow/execute.md b/.claude/commands/workflow/execute.md index 228b771a..97465596 100644 --- a/.claude/commands/workflow/execute.md +++ b/.claude/commands/workflow/execute.md @@ -68,8 +68,8 @@ Phase 4: Execution Strategy & Task Execution ├─ Lazy load task JSON ├─ Launch agent with task context ├─ Mark task completed (update IMPL-*.json status) - │ # Quick fix: Update task status for ccw dashboard - │ # 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 + │ # Update task status with ccw session (auto-tracks status_history): + │ # ccw session task ${sessionId} IMPL-X completed └─ Advance to next task Phase 5: Completion @@ -92,37 +92,32 @@ Resume Mode (--resume-session): **Process**: -#### Step 1.1: Count Active Sessions +#### Step 1.1: List Active Sessions ```bash -bash(find .workflow/active/ -name "WFS-*" -type d 2>/dev/null | wc -l) +ccw session list --location active +# Returns: {"success":true,"result":{"active":[...],"total":N}} ``` #### Step 1.2: Handle Session Selection -**Case A: No Sessions** (count = 0) +**Case A: No Sessions** (total = 0) ``` ERROR: No active workflow sessions found Run /workflow:plan "task description" to create a session ``` -**Case B: Single Session** (count = 1) -```bash -bash(find .workflow/active/ -name "WFS-*" -type d 2>/dev/null | head -1 | xargs basename) -``` -Auto-select and continue to Phase 2. +**Case B: Single Session** (total = 1) +Auto-select the single session from result.active[0].session_id and continue to Phase 2. -**Case C: Multiple Sessions** (count > 1) +**Case C: Multiple Sessions** (total > 1) -List sessions with metadata and prompt user selection: +List sessions with metadata using ccw session: ```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) +# Get session list with metadata +ccw session list --location active + +# For each session, get stats +ccw session stats WFS-session-name ``` Use AskUserQuestion to present formatted options (max 4 options shown): @@ -154,7 +149,7 @@ Parse user input (supports: number "1", full ID "WFS-auth-system", or partial "a #### Step 1.3: Load Session Metadata ```bash -bash(cat .workflow/active/${sessionId}/workflow-session.json) +ccw session read ${sessionId} --type session ``` **Output**: Store session metadata in memory @@ -164,8 +159,8 @@ bash(cat .workflow/active/${sessionId}/workflow-session.json) **Purpose**: Update workflow-session.json status from "planning" to "active" for dashboard monitoring. ```bash -# Update status atomically using jq -bash(jq '.status = "active"' .workflow/active/${sessionId}/workflow-session.json > /tmp/ws.json && mv /tmp/ws.json .workflow/active/${sessionId}/workflow-session.json) +# 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. diff --git a/.claude/commands/workflow/session/complete.md b/.claude/commands/workflow/session/complete.md index de7a998f..f7337586 100644 --- a/.claude/commands/workflow/session/complete.md +++ b/.claude/commands/workflow/session/complete.md @@ -25,17 +25,15 @@ Mark the currently active workflow session as complete, analyze it for lessons l #### Step 1.1: Find Active Session and Get Name ```bash -# Find active session directory -bash(find .workflow/active/ -name "WFS-*" -type d | head -1) - -# Extract session name from directory path -bash(basename .workflow/active/WFS-session-name) +# Find active session +ccw session list --location active +# Extract first session_id from result.active array ``` **Output**: Session name `WFS-session-name` #### Step 1.2: Check for Existing Archiving Marker (Resume Detection) ```bash -# Check if session is already being archived +# Check if session is already being archived (marker file exists) bash(test -f .workflow/active/WFS-session-name/.archiving && echo "RESUMING" || echo "NEW") ``` @@ -161,26 +159,17 @@ Analyze workflow session for archival preparation. Session is STILL in active lo **Purpose**: Atomically commit all changes. Only execute if Phase 2 succeeds. -#### Step 3.1: Create Archive Directory +#### Step 3.1: Update Session Status and Archive ```bash -bash(mkdir -p .workflow/archives/) -``` - -#### Step 3.2: Update Session Status to Completed -**Purpose**: Update workflow-session.json status to "completed" for dashboard display. - -```bash -# Update status atomically using jq -bash(jq '.status = "completed"' .workflow/active/WFS-session-name/workflow-session.json > /tmp/ws.json && mv /tmp/ws.json .workflow/active/WFS-session-name/workflow-session.json) -``` - -#### Step 3.3: Move Session to Archive -```bash -bash(mv .workflow/active/WFS-session-name .workflow/archives/WFS-session-name) +# Archive session (updates status to "completed" and moves to archives) +ccw session archive WFS-session-name +# This operation atomically: +# 1. Updates workflow-session.json status to "completed" +# 2. Moves session from .workflow/active/ to .workflow/archives/ ``` **Result**: Session now at `.workflow/archives/WFS-session-name/` -#### Step 3.4: Update Manifest +#### Step 3.2: Update Manifest ```bash # Read current manifest (or create empty array if not exists) bash(test -f .workflow/archives/manifest.json && cat .workflow/archives/manifest.json || echo "[]") diff --git a/.claude/commands/workflow/session/list.md b/.claude/commands/workflow/session/list.md index 78c16d82..630b4b0a 100644 --- a/.claude/commands/workflow/session/list.md +++ b/.claude/commands/workflow/session/list.md @@ -17,41 +17,30 @@ Display all workflow sessions with their current status, progress, and metadata. ## Implementation Flow -### Step 1: Find All Sessions +### Step 1: List All Sessions ```bash -ls .workflow/active/WFS-* 2>/dev/null +ccw session list --location both ``` -### Step 2: Check Active Session +### Step 2: Get Session Statistics ```bash -find .workflow/active/ -name "WFS-*" -type d 2>/dev/null | head -1 +ccw session stats WFS-session +# Returns: tasks count by status, summaries count, has_plan ``` ### Step 3: Read Session Metadata ```bash -jq -r '.session_id, .status, .project' .workflow/active/WFS-session/workflow-session.json +ccw session read WFS-session --type session +# Returns: session_id, status, project, created_at, etc. ``` -### 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 +## Simple 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` +- **List all sessions**: `ccw session list` +- **List active only**: `ccw session list --location active` +- **Read session data**: `ccw session read WFS-xxx --type session` +- **Get task stats**: `ccw session stats WFS-xxx` ## Simple Output Format diff --git a/.claude/commands/workflow/session/resume.md b/.claude/commands/workflow/session/resume.md index 05527ca3..11f4b6ec 100644 --- a/.claude/commands/workflow/session/resume.md +++ b/.claude/commands/workflow/session/resume.md @@ -17,39 +17,35 @@ Resume the most recently paused workflow session, restoring all context and stat ### Step 1: Find Paused Sessions ```bash -ls .workflow/active/WFS-* 2>/dev/null +ccw session list --location active +# Filter for sessions with status="paused" ``` ### Step 2: Check Session Status ```bash -jq -r '.status' .workflow/active/WFS-session/workflow-session.json +ccw session read WFS-session --type session +# Check .status field in response ``` ### Step 3: Find Most Recent Paused ```bash -ls -t .workflow/active/WFS-*/workflow-session.json | head -1 +ccw session list --location active +# Sort by created_at, filter for paused status ``` -### Step 4: Update Session Status +### Step 4: Update Session Status to Active ```bash -jq '.status = "active"' .workflow/active/WFS-session/workflow-session.json > temp.json -mv temp.json .workflow/active/WFS-session/workflow-session.json +ccw session status WFS-session active +# Or with full update: +ccw session update WFS-session --type session --content '{"status":"active","resumed_at":"2025-12-10T08:00:00Z"}' ``` -### 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 +## Simple Commands ### Basic Operations -- **List sessions**: `ls .workflow/active/WFS-*` -- **Check status**: `jq -r '.status' session.json` -- **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)'"'` +- **List sessions**: `ccw session list --location active` +- **Check status**: `ccw session read WFS-xxx --type session` +- **Update status**: `ccw session status WFS-xxx active` ### Resume Result ``` diff --git a/.claude/commands/workflow/session/start.md b/.claude/commands/workflow/session/start.md index b40f1358..f848b21a 100644 --- a/.claude/commands/workflow/session/start.md +++ b/.claude/commands/workflow/session/start.md @@ -70,12 +70,12 @@ SlashCommand({command: "/workflow:init"}); ### Step 1: List Active Sessions ```bash -bash(ls -1 .workflow/active/ 2>/dev/null | head -5) +ccw session list --location active ``` ### Step 2: Display Session Metadata ```bash -bash(cat .workflow/active/WFS-promptmaster-platform/workflow-session.json) +ccw session read WFS-promptmaster-platform --type session ``` ### Step 4: User Decision @@ -92,34 +92,29 @@ Present session information and wait for user to select or create session. ### Step 1: Check Active Sessions Count ```bash -bash(find .workflow/active/ -name "WFS-*" -type d 2>/dev/null | wc -l) +ccw session list --location active +# Check result.total in response ``` ### Step 2a: No Active Sessions → Create New ```bash -# Generate session slug -bash(echo "implement OAuth2 auth" | sed 's/[^a-zA-Z0-9]/-/g' | tr '[:upper:]' '[:lower:]' | cut -c1-50) +# Generate session slug from description +# Pattern: WFS-{lowercase-slug-from-description} -# Create directory structure -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) +# Create session with ccw (creates directories + metadata atomically) +ccw session init WFS-implement-oauth2-auth --type workflow --content '{"project":"implement OAuth2 auth","status":"planning"}' ``` **Output**: `SESSION_ID: WFS-implement-oauth2-auth` ### Step 2b: Single Active Session → Check Relevance ```bash -# Extract session ID -bash(find .workflow/active/ -name "WFS-*" -type d 2>/dev/null | head -1 | xargs basename) +# Get session list with metadata +ccw session list --location active -# Read project name from metadata -bash(cat .workflow/active/WFS-promptmaster-platform/workflow-session.json | grep -o '"project":"[^"]*"' | cut -d'"' -f4) +# Read session metadata for relevance check +ccw session read WFS-promptmaster-platform --type session -# Check keyword match (manual comparison) # If task contains project keywords → Reuse session # If task unrelated → Create new session (use Step 2a) ``` @@ -129,8 +124,9 @@ bash(cat .workflow/active/WFS-promptmaster-platform/workflow-session.json | grep ### Step 2c: Multiple Active Sessions → Use First ```bash -# Get first active session -bash(find .workflow/active/ -name "WFS-*" -type d 2>/dev/null | head -1 | xargs basename) +# Get first active session from list +ccw session list --location active +# Use first session_id from result.active array # Output warning and session ID # WARNING: Multiple active sessions detected @@ -146,24 +142,15 @@ bash(find .workflow/active/ -name "WFS-*" -type d 2>/dev/null | head -1 | xargs ### Step 1: Generate Unique Session Slug ```bash -# Convert to slug -bash(echo "fix login bug" | sed 's/[^a-zA-Z0-9]/-/g' | tr '[:upper:]' '[:lower:]' | cut -c1-50) - -# 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") +# Convert description to slug: lowercase, alphanumeric + hyphen, max 50 chars +# Check if exists via ccw session list, add counter if collision +ccw session list --location active ``` ### Step 2: Create Session Structure ```bash -bash(mkdir -p .workflow/active/WFS-fix-login-bug/.process) -bash(mkdir -p .workflow/active/WFS-fix-login-bug/.task) -bash(mkdir -p .workflow/active/WFS-fix-login-bug/.summaries) -``` - -### Step 3: Create Metadata -```bash -# Include type field from --type parameter (default: "workflow") -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) +# Single command creates directories (.process, .task, .summaries) + metadata +ccw session init WFS-fix-login-bug --type workflow --content '{"project":"fix login bug","status":"planning"}' ``` **Output**: `SESSION_ID: WFS-fix-login-bug`