From 292dc113e3ad75d920afeb1765b13f83cc30045e Mon Sep 17 00:00:00 2001 From: catlog22 Date: Thu, 20 Nov 2025 10:25:28 +0800 Subject: [PATCH] refactor(workflow): complete migration from .workflow/sessions/ to .workflow/active/ directory structure MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Update all command files to use the new standardized directory structure: - Active sessions: .workflow/active/WFS-{session}/ - Archived sessions: .workflow/archives/WFS-{session}/ Changes: - Updated workflow-architecture.md with new directory structure (active/ not sessions/) - Fixed 31 path references across 12 command files - Verified compliance across all 73 command files using parallel agent checks - Confirmed directory naming: active/ (adjective, no plural) + archives/ (noun plural) Files modified: - .claude/workflows/workflow-architecture.md (directory structure definition) - .claude/commands/cli/*.md (8 files: analyze, chat, codex-execute, discuss-plan, execute, mode/*) - .claude/commands/memory/docs.md (4 path fixes) - .claude/commands/task/*.md (execute, replan) πŸ€– Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- .claude/commands/cli/analyze.md | 4 ++-- .claude/commands/cli/chat.md | 4 ++-- .claude/commands/cli/codex-execute.md | 14 +++++++------- .claude/commands/cli/discuss-plan.md | 4 ++-- .claude/commands/cli/execute.md | 6 +++--- .claude/commands/cli/mode/bug-diagnosis.md | 4 ++-- .claude/commands/cli/mode/code-analysis.md | 4 ++-- .claude/commands/cli/mode/plan.md | 4 ++-- .claude/commands/memory/docs.md | 8 ++++---- .claude/commands/task/execute.md | 8 ++++---- .claude/commands/task/replan.md | 2 +- .claude/workflows/workflow-architecture.md | 14 +++++++------- 12 files changed, 38 insertions(+), 38 deletions(-) diff --git a/.claude/commands/cli/analyze.md b/.claude/commands/cli/analyze.md index c6f85f58..2c792540 100644 --- a/.claude/commands/cli/analyze.md +++ b/.claude/commands/cli/analyze.md @@ -75,7 +75,7 @@ Task( 4. Execution & Output: - Execute CLI tool with assembled context - Generate comprehensive analysis report - - Save to .workflow/WFS-[id]/.chat/analyze-[timestamp].md (or .scratchpad/) + - Save to .workflow/active/WFS-[id]/.chat/analyze-[timestamp].md (or .scratchpad/) ` ) ``` @@ -84,4 +84,4 @@ Task( - **Read-only**: Analyzes code, does NOT modify files - **Auto-pattern**: Detects file patterns from keywords (authβ†’auth files, componentβ†’components, APIβ†’api/routes, testβ†’test files) -- **Output**: `.workflow/WFS-[id]/.chat/analyze-[timestamp].md` (or `.scratchpad/` if no session) +- **Output**: `.workflow/active/WFS-[id]/.chat/analyze-[timestamp].md` (or `.scratchpad/` if no session) diff --git a/.claude/commands/cli/chat.md b/.claude/commands/cli/chat.md index f75752cf..cc212bae 100644 --- a/.claude/commands/cli/chat.md +++ b/.claude/commands/cli/chat.md @@ -70,7 +70,7 @@ Task( 3. Execution & Output: - Execute CLI tool with assembled context - Validate answer completeness - - Save to .workflow/WFS-[id]/.chat/chat-[timestamp].md (or .scratchpad/) + - Save to .workflow/active/WFS-[id]/.chat/chat-[timestamp].md (or .scratchpad/) ` ) ``` @@ -79,4 +79,4 @@ Task( - **Read-only**: Provides answers, does NOT modify code - **Context**: `@CLAUDE.md` + inferred or all files (`@**/*`) -- **Output**: `.workflow/WFS-[id]/.chat/chat-[timestamp].md` (or `.scratchpad/` if no session) +- **Output**: `.workflow/active/WFS-[id]/.chat/chat-[timestamp].md` (or `.scratchpad/` if no session) diff --git a/.claude/commands/cli/codex-execute.md b/.claude/commands/cli/codex-execute.md index def4ea5d..652a69d1 100644 --- a/.claude/commands/cli/codex-execute.md +++ b/.claude/commands/cli/codex-execute.md @@ -468,9 +468,9 @@ Summary: [file references, changes, next steps] **Execution Log Destination**: - **IF** active workflow session exists: - - Execution log: `.workflow/WFS-[id]/.chat/codex-execute-[timestamp].md` - - Task summaries: `.workflow/WFS-[id]/.summaries/[TASK-ID]-summary.md` (if task ID) - - Task updates: `.workflow/WFS-[id]/.task/[TASK-ID].json` status updates + - Execution log: `.workflow/active/WFS-[id]/.chat/codex-execute-[timestamp].md` + - Task summaries: `.workflow/active/WFS-[id]/.summaries/[TASK-ID]-summary.md` (if task ID) + - Task updates: `.workflow/active/WFS-[id]/.task/[TASK-ID].json` status updates - TodoWrite tracking: Embedded in execution log - **ELSE** (no active session): - **Recommended**: Create workflow session first (`/workflow:session:start`) @@ -478,7 +478,7 @@ Summary: [file references, changes, next steps] **Output Files** (during execution): ``` -.workflow/WFS-[session-id]/ +.workflow/active/WFS-[session-id]/ β”œβ”€β”€ .chat/ β”‚ └── codex-execute-20250105-143022.md # Full execution log with task flow β”œβ”€β”€ .summaries/ @@ -492,9 +492,9 @@ Summary: [file references, changes, next steps] **Examples**: - During session `WFS-auth-system`, executing multi-stage auth implementation: - - Log: `.workflow/WFS-auth-system/.chat/codex-execute-20250105-143022.md` - - Summaries: `.workflow/WFS-auth-system/.summaries/IMPL-001.{1,2,3}-summary.md` - - Task status: `.workflow/WFS-auth-system/.task/IMPL-001.json` (status: completed) + - Log: `.workflow/active/WFS-auth-system/.chat/codex-execute-20250105-143022.md` + - Summaries: `.workflow/active/WFS-auth-system/.summaries/IMPL-001.{1,2,3}-summary.md` + - Task status: `.workflow/active/WFS-auth-system/.task/IMPL-001.json` (status: completed) - No session, ad-hoc multi-stage task: - Log: `.workflow/.scratchpad/codex-execute-auth-refactor-20250105-143045.md` diff --git a/.claude/commands/cli/discuss-plan.md b/.claude/commands/cli/discuss-plan.md index 4872ab29..78019533 100644 --- a/.claude/commands/cli/discuss-plan.md +++ b/.claude/commands/cli/discuss-plan.md @@ -167,9 +167,9 @@ TodoWrite({ ## Output Routing - **Primary Log**: Entire multi-round discussion logged to single file: - - `.workflow/WFS-[id]/.chat/discuss-plan-[topic]-[timestamp].md` + - `.workflow/active/WFS-[id]/.chat/discuss-plan-[topic]-[timestamp].md` - **Final Plan**: Clean final version saved upon conclusion: - - `.workflow/WFS-[id]/.summaries/plan-[topic].md` + - `.workflow/active/WFS-[id]/.summaries/plan-[topic].md` - **Scratchpad**: If no session active: - `.workflow/.scratchpad/discuss-plan-[topic]-[timestamp].md` diff --git a/.claude/commands/cli/execute.md b/.claude/commands/cli/execute.md index 9f21c7d7..0314702d 100644 --- a/.claude/commands/cli/execute.md +++ b/.claude/commands/cli/execute.md @@ -127,8 +127,8 @@ Task( - Ensure working implementation with proper error handling 5. Output & Documentation: - - Save execution log: .workflow/WFS-[id]/.chat/execute-[timestamp].md - ${task_id ? '- Generate task summary: .workflow/WFS-[id]/.summaries/' + task_id + '-summary.md' : ''} + - Save execution log: .workflow/active/WFS-[id]/.chat/execute-[timestamp].md + ${task_id ? '- Generate task summary: .workflow/active/WFS-[id]/.summaries/' + task_id + '-summary.md' : ''} ${task_id ? '- Update task status in .task/' + task_id + '.json' : ''} - Document all code changes made @@ -137,7 +137,7 @@ Task( ) ``` -**Output**: `.workflow/WFS-[id]/.chat/execute-[timestamp].md` + `.summaries/[TASK-ID]-summary.md` (or `.scratchpad/` if no session) +**Output**: `.workflow/active/WFS-[id]/.chat/execute-[timestamp].md` + `.workflow/active/WFS-[id]/.summaries/[TASK-ID]-summary.md` (or `.scratchpad/` if no session) ## Examples diff --git a/.claude/commands/cli/mode/bug-diagnosis.md b/.claude/commands/cli/mode/bug-diagnosis.md index 33e02743..656d73c3 100644 --- a/.claude/commands/cli/mode/bug-diagnosis.md +++ b/.claude/commands/cli/mode/bug-diagnosis.md @@ -84,7 +84,7 @@ Task( - Root cause diagnosis with evidence - Fix suggestions and recommendations - Prevention strategies - - Save to .workflow/WFS-[id]/.chat/bug-diagnosis-[timestamp].md (or .scratchpad/) + - Save to .workflow/active/WFS-[id]/.chat/bug-diagnosis-[timestamp].md (or .scratchpad/) ` ) ``` @@ -93,4 +93,4 @@ Task( - **Read-only**: Diagnoses bugs, does NOT modify code - **Template**: `~/.claude/workflows/cli-templates/prompts/analysis/01-diagnose-bug-root-cause.txt` -- **Output**: `.workflow/WFS-[id]/.chat/bug-diagnosis-[timestamp].md` (or `.scratchpad/` if no session) +- **Output**: `.workflow/active/WFS-[id]/.chat/bug-diagnosis-[timestamp].md` (or `.scratchpad/` if no session) diff --git a/.claude/commands/cli/mode/code-analysis.md b/.claude/commands/cli/mode/code-analysis.md index d0862582..31baf30e 100644 --- a/.claude/commands/cli/mode/code-analysis.md +++ b/.claude/commands/cli/mode/code-analysis.md @@ -86,7 +86,7 @@ Task( - Execution trace documentation - Call flow analysis with diagrams - Performance and optimization insights - - Save to .workflow/WFS-[id]/.chat/code-analysis-[timestamp].md (or .scratchpad/) + - Save to .workflow/active/WFS-[id]/.chat/code-analysis-[timestamp].md (or .scratchpad/) ` ) ``` @@ -95,4 +95,4 @@ Task( - **Read-only**: Analyzes code, does NOT modify files - **Template**: `~/.claude/workflows/cli-templates/prompts/analysis/01-trace-code-execution.txt` -- **Output**: `.workflow/WFS-[id]/.chat/code-analysis-[timestamp].md` (or `.scratchpad/` if no session) +- **Output**: `.workflow/active/WFS-[id]/.chat/code-analysis-[timestamp].md` (or `.scratchpad/` if no session) diff --git a/.claude/commands/cli/mode/plan.md b/.claude/commands/cli/mode/plan.md index e9d7adf6..98d14c23 100644 --- a/.claude/commands/cli/mode/plan.md +++ b/.claude/commands/cli/mode/plan.md @@ -81,7 +81,7 @@ Task( - Strategic modification plan - Impact analysis and risk assessment - Implementation roadmap - - Save to .workflow/WFS-[id]/.chat/plan-[timestamp].md (or .scratchpad/) + - Save to .workflow/active/WFS-[id]/.chat/plan-[timestamp].md (or .scratchpad/) ` ) ``` @@ -90,4 +90,4 @@ Task( - **Read-only**: Creates modification plans, does NOT generate code - **Template**: `~/.claude/workflows/cli-templates/prompts/planning/01-plan-architecture-design.txt` -- **Output**: `.workflow/WFS-[id]/.chat/plan-[timestamp].md` (or `.scratchpad/` if no session) +- **Output**: `.workflow/active/WFS-[id]/.chat/plan-[timestamp].md` (or `.scratchpad/` if no session) diff --git a/.claude/commands/memory/docs.md b/.claude/commands/memory/docs.md index bc0d718e..52416c9a 100644 --- a/.claude/commands/memory/docs.md +++ b/.claude/commands/memory/docs.md @@ -128,7 +128,7 @@ bash(if [ -d .workflow/docs/\${project_name} ]; then find .workflow/docs/\${proj ```bash # Count existing docs from phase2-analysis.json -bash(cat .workflow/WFS-docs-{timestamp}/.process/phase2-analysis.json | jq '.existing_docs.file_list | length') +bash(cat .workflow/active/WFS-docs-{timestamp}/.process/phase2-analysis.json | jq '.existing_docs.file_list | length') ``` **Data Processing**: Use count result, then use **Edit tool** to update `workflow-session.json`: @@ -183,10 +183,10 @@ Large Projects (single dir >10 docs): ```bash # 1. Get top-level directories from phase2-analysis.json -bash(cat .workflow/WFS-docs-{timestamp}/.process/phase2-analysis.json | jq -r '.top_level_dirs[]') +bash(cat .workflow/active/WFS-docs-{timestamp}/.process/phase2-analysis.json | jq -r '.top_level_dirs[]') # 2. Get mode from workflow-session.json -bash(cat .workflow/WFS-docs-{timestamp}/workflow-session.json | jq -r '.mode // "full"') +bash(cat .workflow/active/WFS-docs-{timestamp}/workflow-session.json | jq -r '.mode // "full"') # 3. Check for HTTP API bash(grep -r "router\.|@Get\|@Post" src/ 2>/dev/null && echo "API_FOUND" || echo "NO_API") @@ -215,7 +215,7 @@ bash(grep -r "router\.|@Get\|@Post" src/ 2>/dev/null && echo "API_FOUND" || echo **Task ID Calculation**: ```bash -group_count=$(jq '.groups.count' .workflow/WFS-docs-{timestamp}/.process/phase2-analysis.json) +group_count=$(jq '.groups.count' .workflow/active/WFS-docs-{timestamp}/.process/phase2-analysis.json) readme_id=$((group_count + 1)) # Next ID after groups arch_id=$((group_count + 2)) api_id=$((group_count + 3)) diff --git a/.claude/commands/task/execute.md b/.claude/commands/task/execute.md index 20b2d255..607c556f 100644 --- a/.claude/commands/task/execute.md +++ b/.claude/commands/task/execute.md @@ -199,10 +199,10 @@ This is the simplified data structure loaded to provide context for task executi "session": "WFS-user-auth", "phase": "IMPLEMENT", "session_context": { - "workflow_directory": ".workflow/WFS-user-auth/", - "todo_list_location": ".workflow/WFS-user-auth/TODO_LIST.md", - "summaries_directory": ".workflow/WFS-user-auth/.summaries/", - "task_json_location": ".workflow/WFS-user-auth/.task/" + "workflow_directory": ".workflow/active/WFS-user-auth/", + "todo_list_location": ".workflow/active/WFS-user-auth/TODO_LIST.md", + "summaries_directory": ".workflow/active/WFS-user-auth/.summaries/", + "task_json_location": ".workflow/active/WFS-user-auth/.task/" } }, "execution": { diff --git a/.claude/commands/task/replan.md b/.claude/commands/task/replan.md index 3fb26830..28158fcb 100644 --- a/.claude/commands/task/replan.md +++ b/.claude/commands/task/replan.md @@ -274,7 +274,7 @@ Backup saved to .task/backup/IMPL-2-v1.0.json ### Batch Mode - From Verification Report ```bash -/task:replan --batch .workflow/WFS-{session}/.process/ACTION_PLAN_VERIFICATION.md +/task:replan --batch .workflow/active/WFS-{session}/.process/ACTION_PLAN_VERIFICATION.md Parsing verification report... Found 4 tasks requiring replanning: diff --git a/.claude/workflows/workflow-architecture.md b/.claude/workflows/workflow-architecture.md index 2405537c..1d18da5c 100644 --- a/.claude/workflows/workflow-architecture.md +++ b/.claude/workflows/workflow-architecture.md @@ -29,19 +29,19 @@ This document defines the complete workflow system architecture using a **JSON-o ```bash .workflow/ -β”œβ”€β”€ sessions/ -β”‚ β”œβ”€β”€ WFS-oauth-integration/ # Session directory (active or paused) -β”‚ β”œβ”€β”€ WFS-user-profile/ # Session directory (active or paused) -β”‚ └── WFS-bug-fix-123/ # Session directory (completed) +β”œβ”€β”€ active/ +β”‚ β”œβ”€β”€ WFS-oauth-integration/ # Active session directory +β”‚ β”œβ”€β”€ WFS-user-profile/ # Active session directory +β”‚ └── WFS-bug-fix-123/ # Active session directory └── archives/ └── WFS-old-feature/ # Archived session (completed) ``` **Directory-Based Benefits**: -- **Simple Discovery**: Session location determines state (sessions/ = active/paused, archives/ = completed) +- **Simple Discovery**: Session location determines state (active/ = active sessions, archives/ = completed) - **No Marker Files**: Location is the state - **Clean Structure**: Clear separation between active and completed sessions -- **Easy Migration**: Move between sessions/ and archives/ to change state +- **Easy Migration**: Move between active/ and archives/ to change state ### Session Operations @@ -709,7 +709,7 @@ All workflows use the same file structure definition regardless of complexity. * β”‚ β”‚ └── index.html # Navigation page β”‚ └── .run-metadata.json # Run configuration β”‚ -β”œβ”€β”€ sessions/ # Active/paused workflow sessions +β”œβ”€β”€ active/ # Active workflow sessions β”‚ └── WFS-[topic-slug]/ β”‚ β”œβ”€β”€ workflow-session.json # Session metadata and state (REQUIRED) β”‚ β”œβ”€β”€ [.brainstorming/] # Optional brainstorming phase (created when needed)