From d82bf5a823c60bc9c2b72290f01e88fc5fdc9e8c Mon Sep 17 00:00:00 2001 From: catlog22 Date: Sat, 29 Nov 2025 17:06:13 +0800 Subject: [PATCH] fix: Preserve user intent in test workflow session creation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add Step 1.0 to test-gen.md to load source session task_description - Add Step 1.0 to test-fix-gen.md (Session Mode) to load original user intent - Include originalTaskDescription in session creation to enable semantic CLI selection - Fixes data flow gap identified by Gemini review: user's CLI tool preferences (e.g., "use Codex for fixes") now propagate through test workflow sessions This ensures semantic CLI tool selection works correctly in derivative test sessions by preserving the original user's task description from the source session. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- .claude/commands/workflow/test-fix-gen.md | 24 ++++++++++++++----- .claude/commands/workflow/test-gen.md | 22 ++++++++++++++--- .../commands/workflow/test-fix-gen.md | 24 ++++++++++++++----- .../reference/commands/workflow/test-gen.md | 22 ++++++++++++++--- 4 files changed, 74 insertions(+), 18 deletions(-) diff --git a/.claude/commands/workflow/test-fix-gen.md b/.claude/commands/workflow/test-fix-gen.md index ad559a92..080da660 100644 --- a/.claude/commands/workflow/test-fix-gen.md +++ b/.claude/commands/workflow/test-fix-gen.md @@ -143,13 +143,25 @@ This command is a **pure planning coordinator**: #### Phase 1: Create Test Session -**Step 1.1: Dispatch** - Create test workflow session +**Step 1.0: Load Source Session Intent (Session Mode Only)** - Preserve user's original task description for semantic CLI selection ```javascript -// Session Mode -SlashCommand(command="/workflow:session:start --new \"Test validation for [sourceSessionId]\"") +// Session Mode: Read source session metadata to get original task description +Read(".workflow/active/[sourceSessionId]/workflow-session.json") +// OR if context-package exists: +Read(".workflow/active/[sourceSessionId]/.process/context-package.json") -// Prompt Mode +// Extract: metadata.task_description or project/description field +// This preserves user's CLI tool preferences (e.g., "use Codex for fixes") +``` + +**Step 1.1: Dispatch** - Create test workflow session with preserved intent + +```javascript +// Session Mode - Include original task description to enable semantic CLI selection +SlashCommand(command="/workflow:session:start --new \"Test validation for [sourceSessionId]: [originalTaskDescription]\"") + +// Prompt Mode - User's description already contains their intent SlashCommand(command="/workflow:session:start --new \"Test generation for: [description]\"") ``` @@ -158,8 +170,8 @@ SlashCommand(command="/workflow:session:start --new \"Test generation for: [desc **Expected Behavior**: - Creates new session: `WFS-test-[slug]` - Writes `workflow-session.json` metadata: - - **Session Mode**: Includes `workflow_type: "test_session"`, `source_session_id: "[sourceId]"` - - **Prompt Mode**: Includes `workflow_type: "test_session"` only + - **Session Mode**: Includes `workflow_type: "test_session"`, `source_session_id: "[sourceId]"`, description with original user intent + - **Prompt Mode**: Includes `workflow_type: "test_session"` only (user's description already contains intent) - Returns new session ID **Parse Output**: diff --git a/.claude/commands/workflow/test-gen.md b/.claude/commands/workflow/test-gen.md index 99ea7d5e..916a58ab 100644 --- a/.claude/commands/workflow/test-gen.md +++ b/.claude/commands/workflow/test-gen.md @@ -57,19 +57,35 @@ allowed-tools: SlashCommand(*), TodoWrite(*), Read(*), Bash(*) ### Phase 1: Create Test Session -**Step 1.1: Dispatch** - Create new test workflow session +**Step 1.0: Load Source Session Intent** - Preserve user's original task description for semantic CLI selection ```javascript -SlashCommand(command="/workflow:session:start --new \"Test validation for [sourceSessionId]\"") +// Read source session metadata to get original task description +Read(".workflow/active/[sourceSessionId]/workflow-session.json") +// OR if context-package exists: +Read(".workflow/active/[sourceSessionId]/.process/context-package.json") + +// Extract: metadata.task_description or project/description field +// This preserves user's CLI tool preferences (e.g., "use Codex for fixes") ``` -**Input**: `sourceSessionId` from user argument (e.g., `WFS-user-auth`) +**Step 1.1: Dispatch** - Create new test workflow session with preserved intent + +```javascript +// Include original task description to enable semantic CLI selection +SlashCommand(command="/workflow:session:start --new \"Test validation for [sourceSessionId]: [originalTaskDescription]\"") +``` + +**Input**: +- `sourceSessionId` from user argument (e.g., `WFS-user-auth`) +- `originalTaskDescription` from source session metadata (preserves CLI tool preferences) **Expected Behavior**: - Creates new session with pattern `WFS-test-[source-slug]` (e.g., `WFS-test-user-auth`) - Writes metadata to `workflow-session.json`: - `workflow_type: "test_session"` - `source_session_id: "[sourceSessionId]"` + - Description includes original user intent for semantic CLI selection - Returns new session ID for subsequent phases **Parse Output**: diff --git a/.claude/skills/command-guide/reference/commands/workflow/test-fix-gen.md b/.claude/skills/command-guide/reference/commands/workflow/test-fix-gen.md index ad559a92..080da660 100644 --- a/.claude/skills/command-guide/reference/commands/workflow/test-fix-gen.md +++ b/.claude/skills/command-guide/reference/commands/workflow/test-fix-gen.md @@ -143,13 +143,25 @@ This command is a **pure planning coordinator**: #### Phase 1: Create Test Session -**Step 1.1: Dispatch** - Create test workflow session +**Step 1.0: Load Source Session Intent (Session Mode Only)** - Preserve user's original task description for semantic CLI selection ```javascript -// Session Mode -SlashCommand(command="/workflow:session:start --new \"Test validation for [sourceSessionId]\"") +// Session Mode: Read source session metadata to get original task description +Read(".workflow/active/[sourceSessionId]/workflow-session.json") +// OR if context-package exists: +Read(".workflow/active/[sourceSessionId]/.process/context-package.json") -// Prompt Mode +// Extract: metadata.task_description or project/description field +// This preserves user's CLI tool preferences (e.g., "use Codex for fixes") +``` + +**Step 1.1: Dispatch** - Create test workflow session with preserved intent + +```javascript +// Session Mode - Include original task description to enable semantic CLI selection +SlashCommand(command="/workflow:session:start --new \"Test validation for [sourceSessionId]: [originalTaskDescription]\"") + +// Prompt Mode - User's description already contains their intent SlashCommand(command="/workflow:session:start --new \"Test generation for: [description]\"") ``` @@ -158,8 +170,8 @@ SlashCommand(command="/workflow:session:start --new \"Test generation for: [desc **Expected Behavior**: - Creates new session: `WFS-test-[slug]` - Writes `workflow-session.json` metadata: - - **Session Mode**: Includes `workflow_type: "test_session"`, `source_session_id: "[sourceId]"` - - **Prompt Mode**: Includes `workflow_type: "test_session"` only + - **Session Mode**: Includes `workflow_type: "test_session"`, `source_session_id: "[sourceId]"`, description with original user intent + - **Prompt Mode**: Includes `workflow_type: "test_session"` only (user's description already contains intent) - Returns new session ID **Parse Output**: diff --git a/.claude/skills/command-guide/reference/commands/workflow/test-gen.md b/.claude/skills/command-guide/reference/commands/workflow/test-gen.md index 99ea7d5e..916a58ab 100644 --- a/.claude/skills/command-guide/reference/commands/workflow/test-gen.md +++ b/.claude/skills/command-guide/reference/commands/workflow/test-gen.md @@ -57,19 +57,35 @@ allowed-tools: SlashCommand(*), TodoWrite(*), Read(*), Bash(*) ### Phase 1: Create Test Session -**Step 1.1: Dispatch** - Create new test workflow session +**Step 1.0: Load Source Session Intent** - Preserve user's original task description for semantic CLI selection ```javascript -SlashCommand(command="/workflow:session:start --new \"Test validation for [sourceSessionId]\"") +// Read source session metadata to get original task description +Read(".workflow/active/[sourceSessionId]/workflow-session.json") +// OR if context-package exists: +Read(".workflow/active/[sourceSessionId]/.process/context-package.json") + +// Extract: metadata.task_description or project/description field +// This preserves user's CLI tool preferences (e.g., "use Codex for fixes") ``` -**Input**: `sourceSessionId` from user argument (e.g., `WFS-user-auth`) +**Step 1.1: Dispatch** - Create new test workflow session with preserved intent + +```javascript +// Include original task description to enable semantic CLI selection +SlashCommand(command="/workflow:session:start --new \"Test validation for [sourceSessionId]: [originalTaskDescription]\"") +``` + +**Input**: +- `sourceSessionId` from user argument (e.g., `WFS-user-auth`) +- `originalTaskDescription` from source session metadata (preserves CLI tool preferences) **Expected Behavior**: - Creates new session with pattern `WFS-test-[source-slug]` (e.g., `WFS-test-user-auth`) - Writes metadata to `workflow-session.json`: - `workflow_type: "test_session"` - `source_session_id: "[sourceSessionId]"` + - Description includes original user intent for semantic CLI selection - Returns new session ID for subsequent phases **Parse Output**: