This commit addresses multiple issues in session management and command documentation: Session Management Fixes: - Add auto-inference of location from type parameter in session.ts - When --type lite-plan/lite-fix is specified, automatically set location accordingly - Preserve explicit --location parameter when provided - Update session-manager.ts to support type-based location inference - Fix metadata filename selection (session-metadata.json vs workflow-session.json) Command Documentation Fixes: - Add missing --mode analysis parameter (3 locations): * commands/memory/docs.md * commands/workflow/lite-execute.md (2 instances) - Add missing --mode write parameter (4 locations): * commands/workflow/tools/task-generate-agent.md - Remove non-existent subcommands (3 locations): * commands/workflow/session/complete.md (manifest, project) - Update session command syntax to use simplified format: * Changed from 'ccw session manifest read' to 'test -f' checks * Changed from 'ccw session project read' to 'test -f' checks Documentation Updates: - Update lite-plan.md and lite-fix.md to use --type parameter - Update session/start.md to document lite-plan and lite-fix types - Sync all fixes to skills/command-guide/reference directory (84 files) All ccw command usage across the codebase is now consistent and correct. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
7.6 KiB
Start Workflow Session (/workflow:session:start)
Overview
Manages workflow sessions with three operation modes: discovery (manual), auto (intelligent), and force-new.
Dual Responsibility:
- Project-level initialization (first-time only): Creates
.workflow/project.jsonfor feature registry - Session-level initialization (always): Creates session directory structure
Session Types
The --type parameter classifies sessions for CCW dashboard organization:
| Type | Description | Default For |
|---|---|---|
workflow |
Standard implementation (default) | /workflow:plan |
review |
Code review sessions | /workflow:review-module-cycle |
tdd |
TDD-based development | /workflow:tdd-plan |
test |
Test generation/fix sessions | /workflow:test-fix-gen |
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
--locationparameter when using these types - Alternative: Use
--location lite-planor--location lite-fixdirectly
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
Step 0: Initialize Project State (First-time Only)
Executed before all modes - Ensures project-level state file exists by calling /workflow:init.
Check and Initialize
# Check if project state exists
bash(test -f .workflow/project.json && echo "EXISTS" || echo "NOT_FOUND")
If NOT_FOUND, delegate to /workflow:init:
// Call workflow:init for intelligent project analysis
SlashCommand({command: "/workflow:init"});
// Wait for init completion
// project.json will be created with comprehensive project overview
Output:
- If EXISTS:
PROJECT_STATE: initialized - If NOT_FOUND: Calls
/workflow:init→ creates.workflow/project.jsonwith full project analysis
Note: /workflow:init uses cli-explore-agent to build comprehensive project understanding (technology stack, architecture, key components). This step runs once per project. Subsequent executions skip initialization.
Mode 1: Discovery Mode (Default)
Usage
/workflow:session:start
Step 1: List Active Sessions
ccw session list --location active
Step 2: Display Session Metadata
ccw session WFS-promptmaster-platform read workflow-session.json
Step 4: User Decision
Present session information and wait for user to select or create session.
Output: SESSION_ID: WFS-[user-selected-id]
Mode 2: Auto Mode (Intelligent)
Usage
/workflow:session:start --auto "task description"
Step 1: Check Active Sessions Count
ccw session list --location active
# Check result.total in response
Step 2a: No Active Sessions → Create New
# Generate session slug from description
# Pattern: WFS-{lowercase-slug-from-description}
# Create session with ccw (creates directories + metadata atomically)
ccw session init WFS-implement-oauth2-auth --type workflow
Output: SESSION_ID: WFS-implement-oauth2-auth
Step 2b: Single Active Session → Check Relevance
# Get session list with metadata
ccw session list --location active
# Read session metadata for relevance check
ccw session WFS-promptmaster-platform read workflow-session.json
# If task contains project keywords → Reuse session
# If task unrelated → Create new session (use Step 2a)
Output (reuse): SESSION_ID: WFS-promptmaster-platform
Output (new): SESSION_ID: WFS-[new-slug]
Step 2c: Multiple Active Sessions → Use First
# 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
# SESSION_ID: WFS-first-session
Mode 3: Force New Mode
Usage
/workflow:session:start --new "task description"
Step 1: Generate Unique Session Slug
# 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
# Basic init - creates directories + default metadata
ccw session init WFS-fix-login-bug --type workflow
# 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):
{
"session_id": "WFS-fix-login-bug",
"type": "workflow",
"status": "planning",
"created_at": "2025-12-17T..."
}
Custom Metadata (merged with defaults):
{
"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
Execution Guideline
- Non-interrupting: When called from other commands, this command completes and returns control to the caller without interrupting subsequent tasks.
Output Format Specification
Success
SESSION_ID: WFS-session-slug
Error
ERROR: --auto mode requires task description
ERROR: Failed to create session directory
Analysis (Auto Mode)
ANALYSIS: Task relevance = high
DECISION: Reusing existing session
SESSION_ID: WFS-promptmaster-platform
Session ID Format
- Pattern:
WFS-[lowercase-slug] - Characters:
a-z,0-9,-only - Max length: 50 characters
- 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
# 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)
# 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
ccw tool exec session_manager '{"operation":"read","session_id":"WFS-xxx","content_type":"session"}'