refactor(cli): remove --agent flag and enhance agent execution context

- Remove --agent parameter from all CLI commands (now default behavior)
- Restore and enhance Task() invocation context for cli-execution-agent
- Add detailed execution phases and context discovery strategies
- Simplify documentation by removing redundant CLI command templates
- Consolidate output documentation to unified format

Modified commands:
- /cli:analyze, /cli:chat, /cli:execute
- /cli:mode:plan, /cli:mode:code-analysis, /cli:mode:bug-diagnosis

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

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
catlog22
2025-11-10 16:12:04 +08:00
parent ccbec186b2
commit bc959b1a0f
6 changed files with 206 additions and 426 deletions

View File

@@ -1,7 +1,7 @@
--- ---
name: analyze name: analyze
description: Read-only codebase analysis using Gemini (default), Qwen, or Codex with auto-pattern detection and template selection description: Read-only codebase analysis using Gemini (default), Qwen, or Codex with auto-pattern detection and template selection
argument-hint: "[--agent] [--tool codex|gemini|qwen] [--enhance] analysis target" argument-hint: "[--tool codex|gemini|qwen] [--enhance] analysis target"
allowed-tools: SlashCommand(*), Bash(*), TodoWrite(*), Read(*), Glob(*), Task(*) allowed-tools: SlashCommand(*), Bash(*), TodoWrite(*), Read(*), Glob(*), Task(*)
--- ---
@@ -19,7 +19,6 @@ Quick codebase analysis using CLI tools. **Read-only - does NOT modify code**.
## Parameters ## Parameters
- `--tool <gemini|qwen|codex>` - Tool selection (default: gemini) - `--tool <gemini|qwen|codex>` - Tool selection (default: gemini)
- `--agent` - Use cli-execution-agent for automated context discovery
- `--enhance` - Use `/enhance-prompt` for context-aware enhancement - `--enhance` - Use `/enhance-prompt` for context-aware enhancement
- `<analysis-target>` - Description of what to analyze - `<analysis-target>` - Description of what to analyze
@@ -42,43 +41,41 @@ Quick codebase analysis using CLI tools. **Read-only - does NOT modify code**.
## Execution Flow ## Execution Flow
### Standard Mode Uses **cli-execution-agent** (default) for automated analysis:
1. Parse tool selection (default: gemini)
2. Optional: enhance with `/enhance-prompt`
3. Auto-detect file patterns from keywords
4. Build command with analysis template
5. Execute analysis (read-only)
6. Save results
### Agent Mode (`--agent`)
Delegates to agent for intelligent analysis:
```javascript ```javascript
Task( Task(
subagent_type="cli-execution-agent", subagent_type="cli-execution-agent",
description="Codebase analysis", description="Codebase analysis with pattern detection",
prompt=` prompt=`
Task: ${analysis_target} Task: ${analysis_target}
Mode: analyze Mode: analyze
Tool: ${tool_flag || 'auto-select'} // gemini|qwen|codex Tool: ${tool_flag || 'gemini'}
Enhance: ${enhance_flag || false} Enhance: ${enhance_flag}
Execute codebase analysis with auto-pattern detection:
Agent responsibilities:
1. Context Discovery: 1. Context Discovery:
- Discover relevant files/patterns - Extract keywords from analysis target
- Identify analysis scope - Auto-detect file patterns (auth→auth files, component→components, etc.)
- Build file context - Discover additional relevant files using MCP
- Build comprehensive file context
2. CLI Command Generation: 2. Template Selection:
- Build Gemini/Qwen/Codex command - Auto-select analysis template based on keywords
- Apply analysis template - Apply appropriate analysis methodology
- Include discovered files - Include @CLAUDE.md for project context
3. Execution & Output: 3. CLI Command Construction:
- Execute analysis - Tool: ${tool_flag || 'gemini'} (qwen fallback, codex for deep analysis)
- Generate insights report - Context: @CLAUDE.md + auto-detected patterns + discovered files
- Save to .workflow/.chat/ or .scratchpad/ - Mode: analysis (read-only)
- Expected: Insights, recommendations, pattern analysis
4. Execution & Output:
- Execute CLI tool with assembled context
- Generate comprehensive analysis report
- Save to .workflow/WFS-[id]/.chat/analyze-[timestamp].md (or .scratchpad/)
` `
) )
``` ```
@@ -86,51 +83,5 @@ Task(
## Core Rules ## Core Rules
- **Read-only**: Analyzes code, does NOT modify files - **Read-only**: Analyzes code, does NOT modify files
- **Auto-pattern**: Detects file patterns from keywords - **Auto-pattern**: Detects file patterns from keywords (auth→auth files, component→components, API→api/routes, test→test files)
- **Template-based**: Auto-selects analysis template - **Output**: `.workflow/WFS-[id]/.chat/analyze-[timestamp].md` (or `.scratchpad/` if no session)
- **Output**: Saves to `.workflow/WFS-[id]/.chat/` or `.scratchpad/`
## File Pattern Auto-Detection
Keywords → file patterns:
- "auth" → `@**/*auth* @**/*user*`
- "component" → `@src/components/**/*`
- "API" → `@**/api/**/* @**/routes/**/*`
- "test" → `@**/*.test.* @**/*.spec.*`
- Generic → `@src/**/*`
## CLI Command Templates
**Gemini/Qwen**:
```bash
cd . && gemini -p "
PURPOSE: [goal]
TASK: [analysis type]
MODE: analysis
CONTEXT: @CLAUDE.md [auto-detected patterns]
EXPECTED: Insights, recommendations
RULES: [auto-selected template]
"
# Qwen: Replace 'gemini' with 'qwen'
```
**Codex**:
```bash
codex -C . --full-auto exec "
PURPOSE: [goal]
TASK: [analysis type]
MODE: analysis
CONTEXT: @CLAUDE.md [patterns]
EXPECTED: Deep insights
RULES: [template]
" -m gpt-5 --skip-git-repo-check -s danger-full-access
```
## Output
- **With session**: `.workflow/WFS-[id]/.chat/analyze-[timestamp].md`
- **No session**: `.workflow/.scratchpad/analyze-[desc]-[timestamp].md`
## Notes
- See `intelligent-tools-strategy.md` for detailed tool usage and templates

View File

@@ -1,7 +1,7 @@
--- ---
name: chat name: chat
description: Read-only Q&A interaction with Gemini/Qwen/Codex for codebase questions with automatic context inference description: Read-only Q&A interaction with Gemini/Qwen/Codex for codebase questions with automatic context inference
argument-hint: "[--agent] [--tool codex|gemini|qwen] [--enhance] inquiry" argument-hint: "[--tool codex|gemini|qwen] [--enhance] inquiry"
allowed-tools: SlashCommand(*), Bash(*), Task(*) allowed-tools: SlashCommand(*), Bash(*), Task(*)
--- ---
@@ -19,7 +19,6 @@ Direct Q&A interaction with CLI tools for codebase analysis. **Read-only - does
## Parameters ## Parameters
- `--tool <gemini|qwen|codex>` - Tool selection (default: gemini) - `--tool <gemini|qwen|codex>` - Tool selection (default: gemini)
- `--agent` - Use cli-execution-agent for automated context discovery
- `--enhance` - Enhance inquiry with `/enhance-prompt` - `--enhance` - Enhance inquiry with `/enhance-prompt`
- `<inquiry>` (Required) - Question or analysis request - `<inquiry>` (Required) - Question or analysis request
@@ -42,42 +41,36 @@ Direct Q&A interaction with CLI tools for codebase analysis. **Read-only - does
## Execution Flow ## Execution Flow
### Standard Mode Uses **cli-execution-agent** (default) for automated Q&A:
1. Parse tool selection (default: gemini)
2. Optional: enhance with `/enhance-prompt`
3. Assemble context: `@CLAUDE.md` + inferred files
4. Execute Q&A (read-only)
5. Return answer
### Agent Mode (`--agent`)
Delegates to agent for intelligent Q&A:
```javascript ```javascript
Task( Task(
subagent_type="cli-execution-agent", subagent_type="cli-execution-agent",
description="Codebase Q&A", description="Codebase Q&A with intelligent context discovery",
prompt=` prompt=`
Task: ${inquiry} Task: ${inquiry}
Mode: chat (Q&A) Mode: chat
Tool: ${tool_flag || 'auto-select'} // gemini|qwen|codex Tool: ${tool_flag || 'gemini'}
Enhance: ${enhance_flag || false} Enhance: ${enhance_flag}
Execute codebase Q&A with intelligent context discovery:
Agent responsibilities:
1. Context Discovery: 1. Context Discovery:
- Discover files relevant to question - Parse inquiry to identify relevant topics/keywords
- Identify key code sections - Discover related files using MCP/ripgrep (prioritize precision)
- Build precise context - Include @CLAUDE.md + discovered files
- Validate context relevance to question
2. CLI Command Generation: 2. CLI Command Construction:
- Build Gemini/Qwen/Codex command - Tool: ${tool_flag || 'gemini'} (qwen fallback, codex for deep dives)
- Include discovered context - Context: @CLAUDE.md + discovered file patterns
- Apply Q&A template - Mode: analysis (read-only)
- Expected: Clear, accurate answer with code references
3. Execution & Output: 3. Execution & Output:
- Execute Q&A analysis - Execute CLI tool with assembled context
- Generate detailed answer - Validate answer completeness
- Save to .workflow/.chat/ or .scratchpad/ - Save to .workflow/WFS-[id]/.chat/chat-[timestamp].md (or .scratchpad/)
` `
) )
``` ```
@@ -86,40 +79,4 @@ Task(
- **Read-only**: Provides answers, does NOT modify code - **Read-only**: Provides answers, does NOT modify code
- **Context**: `@CLAUDE.md` + inferred or all files (`@**/*`) - **Context**: `@CLAUDE.md` + inferred or all files (`@**/*`)
- **Output**: Saves to `.workflow/WFS-[id]/.chat/` or `.scratchpad/` - **Output**: `.workflow/WFS-[id]/.chat/chat-[timestamp].md` (or `.scratchpad/` if no session)
## CLI Command Templates
**Gemini/Qwen**:
```bash
cd . && gemini -p "
PURPOSE: Answer question
TASK: [inquiry]
MODE: analysis
CONTEXT: @CLAUDE.md [inferred or @**/*]
EXPECTED: Clear answer
RULES: Focus on accuracy
"
# Qwen: Replace 'gemini' with 'qwen'
```
**Codex**:
```bash
codex -C . --full-auto exec "
PURPOSE: Answer question
TASK: [inquiry]
MODE: analysis
CONTEXT: @CLAUDE.md [inferred or @**/*]
EXPECTED: Detailed answer
RULES: Technical depth
" -m gpt-5 --skip-git-repo-check -s danger-full-access
```
## Output
- **With session**: `.workflow/WFS-[id]/.chat/chat-[timestamp].md`
- **No session**: `.workflow/.scratchpad/chat-[desc]-[timestamp].md`
## Notes
- See `intelligent-tools-strategy.md` for detailed tool usage and templates

View File

@@ -1,7 +1,7 @@
--- ---
name: execute name: execute
description: Autonomous code implementation with YOLO auto-approval using Gemini/Qwen/Codex, supports task ID or description input with automatic file pattern detection description: Autonomous code implementation with YOLO auto-approval using Gemini/Qwen/Codex, supports task ID or description input with automatic file pattern detection
argument-hint: "[--agent] [--tool codex|gemini|qwen] [--enhance] description or task-id" argument-hint: "[--tool codex|gemini|qwen] [--enhance] description or task-id"
allowed-tools: SlashCommand(*), Bash(*), Task(*) allowed-tools: SlashCommand(*), Bash(*), Task(*)
--- ---
@@ -39,7 +39,7 @@ Auto-approves: file pattern inference, execution, **file modifications**, summar
- Input: Workflow task identifier (e.g., `IMPL-001`) - Input: Workflow task identifier (e.g., `IMPL-001`)
- Process: Task JSON parsing → Scope analysis → Execute - Process: Task JSON parsing → Scope analysis → Execute
**3. Agent Mode** (`--agent` flag): **3. Agent Mode** (default):
- Input: Description or task-id - Input: Description or task-id
- Process: 5-Phase Workflow → Context Discovery → Optimal Tool Selection → Execute - Process: 5-Phase Workflow → Context Discovery → Optimal Tool Selection → Execute
@@ -68,8 +68,7 @@ Use `resume --last` when current task extends/relates to previous execution. See
## Parameters ## Parameters
- `--agent` - Use cli-execution-agent for automated context discovery (5-phase intelligent mode) - `--tool <codex|gemini|qwen>` - Select CLI tool (default: auto-select by agent based on complexity)
- `--tool <codex|gemini|qwen>` - Select CLI tool (default: gemini, ignored in agent mode unless specified)
- `--enhance` - Enhance input with `/enhance-prompt` first (Description Mode only) - `--enhance` - Enhance input with `/enhance-prompt` first (Description Mode only)
- `<description|task-id>` - Natural language description or task identifier - `<description|task-id>` - Natural language description or task identifier
- `--debug` - Verbose logging - `--debug` - Verbose logging
@@ -83,96 +82,83 @@ Use `resume --last` when current task extends/relates to previous execution. See
**Task Integration**: Load from `.task/[TASK-ID].json`, update status, generate summary **Task Integration**: Load from `.task/[TASK-ID].json`, update status, generate summary
## Output Routing ## Execution Flow
**Execution Log Destination**: Uses **cli-execution-agent** (default) for automated implementation:
- **IF** active workflow session exists:
- Save to `.workflow/WFS-[id]/.chat/execute-[timestamp].md`
- Update task status in `.task/[TASK-ID].json` (if task ID provided)
- Generate summary in `.workflow/WFS-[id]/.summaries/[TASK-ID]-summary.md`
- **ELSE** (no active session):
- **Option 1**: Create new workflow session for task
- **Option 2**: Save to `.workflow/.scratchpad/execute-[description]-[timestamp].md`
**Output Files** (when active session exists):
- Execution log: `.workflow/WFS-[id]/.chat/execute-[timestamp].md`
- Task summary: `.workflow/WFS-[id]/.summaries/[TASK-ID]-summary.md` (if task ID)
- Modified code: Project files per implementation
**Examples**:
- During session `WFS-auth-system`, executing `IMPL-001`:
- Log: `.workflow/WFS-auth-system/.chat/execute-20250105-143022.md`
- Summary: `.workflow/WFS-auth-system/.summaries/IMPL-001-summary.md`
- No session, ad-hoc implementation:
- Log: `.workflow/.scratchpad/execute-jwt-auth-20250105-143045.md`
## Execution Modes
### Standard Mode (Default)
```bash
# Gemini/Qwen: MODE=write with --approval-mode yolo
cd . && gemini --approval-mode yolo "
PURPOSE: [implementation goal]
TASK: [specific implementation]
MODE: write
CONTEXT: @CLAUDE.md [auto-detected files]
EXPECTED: Working implementation with code changes
RULES: [constraints] | Auto-approve all changes
"
# Codex: MODE=auto with danger-full-access
codex -C . --full-auto exec "
PURPOSE: [implementation goal]
TASK: [specific implementation]
MODE: auto
CONTEXT: [auto-detected files]
EXPECTED: Complete implementation with tests
" --skip-git-repo-check -s danger-full-access
```
### Agent Mode (`--agent` flag)
Delegate implementation to `cli-execution-agent` for intelligent execution with automated context discovery.
**Agent invocation**:
```javascript ```javascript
Task( Task(
subagent_type="cli-execution-agent", subagent_type="cli-execution-agent",
description="Implement with automated context discovery and optimal tool selection", description="Autonomous code implementation with YOLO auto-approval",
prompt=` prompt=`
Task: ${description_or_task_id} Task: ${description_or_task_id}
Mode: execute Mode: execute
Tool Preference: ${tool_flag || 'auto-select'} Tool: ${tool_flag || 'auto-select'}
${enhance_flag ? 'Enhance: true' : ''} Enhance: ${enhance_flag}
Task-ID: ${task_id}
Agent will autonomously: Execute autonomous code implementation with full modification permissions:
- Discover implementation files and dependencies
- Assess complexity and select optimal tool 1. Task Analysis:
- Execute with YOLO permissions (auto-approve) ${task_id ? '- Load task spec from .task/' + task_id + '.json' : ''}
- Generate task summary if task-id provided - Parse requirements and implementation scope
- Classify complexity (simple/medium/complex)
- Extract keywords for context discovery
2. Context Discovery:
- Discover implementation files using MCP/ripgrep
- Identify existing patterns and conventions (CLAUDE.md)
- Map dependencies and integration points
- Gather related tests and documentation
- Auto-detect file patterns from keywords
3. Tool Selection & Execution:
- Complexity assessment:
* Simple/Medium → Gemini/Qwen (MODE=write, --approval-mode yolo)
* Complex → Codex (MODE=auto, --skip-git-repo-check -s danger-full-access)
- Tool preference: ${tool_flag || 'auto-select based on complexity'}
- Apply appropriate implementation template
- Execute with YOLO auto-approval (bypasses all confirmations)
4. Implementation:
- Modify/create/delete code files per requirements
- Follow existing code patterns and conventions
- Include comprehensive context in CLI command
- 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' : ''}
${task_id ? '- Update task status in .task/' + task_id + '.json' : ''}
- Document all code changes made
⚠️ YOLO Mode: All file operations auto-approved without confirmation
` `
) )
``` ```
The agent handles all phases internally, including complexity-based tool selection. **Output**: `.workflow/WFS-[id]/.chat/execute-[timestamp].md` + `.summaries/[TASK-ID]-summary.md` (or `.scratchpad/` if no session)
## Examples ## Examples
**Basic Implementation (Standard Mode)** (modifies code): **Basic Implementation** (modifies code):
```bash ```bash
/cli:execute "implement JWT authentication with middleware" /cli:execute "implement JWT authentication with middleware"
# Executes: Creates auth middleware, updates routes, modifies config # Agent Phase 1: Classifies intent=execute, complexity=medium, keywords=['jwt', 'auth', 'middleware']
# Agent Phase 2: Discovers auth patterns, existing middleware structure
# Agent Phase 3: Selects Gemini (medium complexity)
# Agent Phase 4: Executes with auto-approval
# Result: NEW/MODIFIED code files with JWT implementation # Result: NEW/MODIFIED code files with JWT implementation
``` ```
**Intelligent Implementation (Agent Mode)** (modifies code): **Complex Implementation** (modifies code):
```bash ```bash
/cli:execute --agent "implement OAuth2 authentication with token refresh" /cli:execute "implement OAuth2 authentication with token refresh"
# Phase 1: Classifies intent=execute, complexity=complex, keywords=['oauth2', 'auth', 'token', 'refresh'] # Agent Phase 1: Classifies intent=execute, complexity=complex, keywords=['oauth2', 'auth', 'token', 'refresh']
# Phase 2: MCP discovers auth patterns, existing middleware, JWT dependencies # Agent Phase 2: MCP discovers auth patterns, existing middleware, JWT dependencies
# Phase 3: Enhances prompt with discovered patterns and best practices # Agent Phase 3: Enhances prompt with discovered patterns and best practices
# Phase 4: Selects Codex (complex task), executes with comprehensive context # Agent Phase 4: Selects Codex (complex task), executes with comprehensive context
# Phase 5: Saves execution log + generates implementation summary # Agent Phase 5: Saves execution log + generates implementation summary
# Result: Complete OAuth2 implementation + detailed execution log # Result: Complete OAuth2 implementation + detailed execution log
``` ```
@@ -214,8 +200,3 @@ The agent handles all phases internally, including complexity-based tool selecti
| `/cli:analyze` | Understand code | NO | N/A | | `/cli:analyze` | Understand code | NO | N/A |
| `/cli:chat` | Ask questions | NO | N/A | | `/cli:chat` | Ask questions | NO | N/A |
| `/cli:execute` | **Implement** | **YES** | **YES** | | `/cli:execute` | **Implement** | **YES** | **YES** |
## Notes
- Command templates, YOLO mode details, and session management: see intelligent-tools-strategy.md (loaded in memory)
- **Code Modification**: This command modifies code - execution logs document changes made

View File

@@ -1,7 +1,7 @@
--- ---
name: bug-diagnosis name: bug-diagnosis
description: Read-only bug root cause analysis using Gemini/Qwen/Codex with systematic diagnosis template for fix suggestions description: Read-only bug root cause analysis using Gemini/Qwen/Codex with systematic diagnosis template for fix suggestions
argument-hint: "[--agent] [--tool codex|gemini|qwen] [--enhance] [--cd path] bug description" argument-hint: "[--tool codex|gemini|qwen] [--enhance] [--cd path] bug description"
allowed-tools: SlashCommand(*), Bash(*), Task(*) allowed-tools: SlashCommand(*), Bash(*), Task(*)
--- ---
@@ -19,7 +19,6 @@ Systematic bug diagnosis with root cause analysis template (`~/.claude/workflows
## Parameters ## Parameters
- `--tool <gemini|qwen|codex>` - Tool selection (default: gemini) - `--tool <gemini|qwen|codex>` - Tool selection (default: gemini)
- `--agent` - Use cli-execution-agent for automated context discovery
- `--enhance` - Enhance bug description with `/enhance-prompt` - `--enhance` - Enhance bug description with `/enhance-prompt`
- `--cd "path"` - Target directory for focused diagnosis - `--cd "path"` - Target directory for focused diagnosis
- `<bug-description>` (Required) - Bug description or error details - `<bug-description>` (Required) - Bug description or error details
@@ -44,44 +43,48 @@ Systematic bug diagnosis with root cause analysis template (`~/.claude/workflows
## Execution Flow ## Execution Flow
### Standard Mode Uses **cli-execution-agent** (default) for automated bug diagnosis:
1. Parse tool selection (default: gemini)
2. Optional: enhance with `/enhance-prompt`
3. Detect directory from `--cd` or auto-infer
4. Build command with template
5. Execute diagnosis (read-only)
6. Save to `.workflow/WFS-[id]/.chat/`
### Agent Mode (`--agent`)
Delegates to agent for intelligent diagnosis:
```javascript ```javascript
Task( Task(
subagent_type="cli-execution-agent", subagent_type="cli-execution-agent",
description="Bug root cause diagnosis", description="Bug root cause diagnosis with fix suggestions",
prompt=` prompt=`
Task: ${bug_description} Task: ${bug_description}
Mode: bug-diagnosis Mode: bug-diagnosis
Tool: ${tool_flag || 'auto-select'} // gemini|qwen|codex Tool: ${tool_flag || 'gemini'}
Directory: ${cd_path || 'auto-detect'} Directory: ${cd_path || '.'}
Enhance: ${enhance_flag}
Template: ~/.claude/workflows/cli-templates/prompts/analysis/01-diagnose-bug-root-cause.txt Template: ~/.claude/workflows/cli-templates/prompts/analysis/01-diagnose-bug-root-cause.txt
Agent responsibilities: Execute systematic bug diagnosis and root cause analysis:
1. Context Discovery: 1. Context Discovery:
- Locate error traces and logs - Locate error traces, stack traces, and log messages
- Find related code sections - Find related code sections and affected modules
- Identify data flow paths - Identify data flow paths leading to the bug
- Discover test cases related to bug area
- Use MCP/ripgrep for comprehensive context gathering
2. CLI Command Generation: 2. Root Cause Analysis:
- Build Gemini/Qwen/Codex command - Apply diagnostic template methodology
- Include diagnostic context - Trace execution to identify failure point
- Apply ~/.claude/workflows/cli-templates/prompts/analysis/01-diagnose-bug-root-cause.txt template - Analyze state, data, and logic causing issue
- Document potential root causes with evidence
- Assess bug severity and impact scope
3. Execution & Output: 3. CLI Command Construction:
- Execute root cause analysis - Tool: ${tool_flag || 'gemini'} (qwen fallback, codex for complex bugs)
- Generate fix suggestions - Directory: cd ${cd_path || '.'} &&
- Save to .workflow/.chat/ - Context: @**/* + error traces + affected code
- Mode: analysis (read-only)
- Template: analysis/01-diagnose-bug-root-cause.txt
4. Output Generation:
- Root cause diagnosis with evidence
- Fix suggestions and recommendations
- Prevention strategies
- Save to .workflow/WFS-[id]/.chat/bug-diagnosis-[timestamp].md (or .scratchpad/)
` `
) )
``` ```
@@ -89,42 +92,5 @@ Task(
## Core Rules ## Core Rules
- **Read-only**: Diagnoses bugs, does NOT modify code - **Read-only**: Diagnoses bugs, does NOT modify code
- **Template**: Uses `~/.claude/workflows/cli-templates/prompts/analysis/01-diagnose-bug-root-cause.txt` for root cause analysis - **Template**: `~/.claude/workflows/cli-templates/prompts/analysis/01-diagnose-bug-root-cause.txt`
- **Output**: Saves to `.workflow/WFS-[id]/.chat/` - **Output**: `.workflow/WFS-[id]/.chat/bug-diagnosis-[timestamp].md` (or `.scratchpad/` if no session)
## CLI Command Templates
**Gemini/Qwen** (default, diagnosis only):
```bash
cd [dir] && gemini -p "
PURPOSE: [goal]
TASK: Root cause analysis
MODE: analysis
CONTEXT: @**/*
EXPECTED: Diagnosis, fix plan
RULES: $(cat ~/.claude/workflows/cli-templates/prompts/analysis/01-diagnose-bug-root-cause.txt)
"
# Qwen: Replace 'gemini' with 'qwen'
```
**Codex** (diagnosis + potential fixes):
```bash
codex -C [dir] --full-auto exec "
PURPOSE: [goal]
TASK: Bug diagnosis
MODE: analysis
CONTEXT: @**/*
EXPECTED: Diagnosis, fix suggestions
RULES: $(cat ~/.claude/workflows/cli-templates/prompts/analysis/01-diagnose-bug-root-cause.txt)
" -m gpt-5 --skip-git-repo-check -s danger-full-access
```
## Output
- **With session**: `.workflow/WFS-[id]/.chat/bug-diagnosis-[timestamp].md`
- **No session**: `.workflow/.scratchpad/bug-diagnosis-[desc]-[timestamp].md`
## Notes
- Template: `~/.claude/workflows/cli-templates/prompts/analysis/01-diagnose-bug-root-cause.txt`
- See `intelligent-tools-strategy.md` for detailed tool usage

View File

@@ -1,7 +1,7 @@
--- ---
name: code-analysis name: code-analysis
description: Read-only execution path tracing using Gemini/Qwen/Codex with specialized analysis template for call flow and optimization description: Read-only execution path tracing using Gemini/Qwen/Codex with specialized analysis template for call flow and optimization
argument-hint: "[--agent] [--tool codex|gemini|qwen] [--enhance] [--cd path] analysis target" argument-hint: "[--tool codex|gemini|qwen] [--enhance] [--cd path] analysis target"
allowed-tools: SlashCommand(*), Bash(*), Task(*) allowed-tools: SlashCommand(*), Bash(*), Task(*)
--- ---
@@ -21,7 +21,6 @@ Systematic code analysis with execution path tracing template (`~/.claude/workfl
## Parameters ## Parameters
- `--tool <gemini|qwen|codex>` - Tool selection (default: gemini) - `--tool <gemini|qwen|codex>` - Tool selection (default: gemini)
- `--agent` - Use cli-execution-agent for automated context discovery
- `--enhance` - Enhance analysis target with `/enhance-prompt` first - `--enhance` - Enhance analysis target with `/enhance-prompt` first
- `--cd "path"` - Target directory for focused analysis - `--cd "path"` - Target directory for focused analysis
- `<analysis-target>` (Required) - Code analysis target or question - `<analysis-target>` (Required) - Code analysis target or question
@@ -47,91 +46,53 @@ Systematic code analysis with execution path tracing template (`~/.claude/workfl
## Execution Flow ## Execution Flow
### Standard Mode (Default) Uses **cli-execution-agent** (default) for automated code analysis:
1. Parse tool selection (default: gemini)
2. Optional: enhance analysis target with `/enhance-prompt`
3. Detect target directory from `--cd` or auto-infer
4. Build command with template
5. Execute analysis (read-only)
6. Save to `.workflow/WFS-[id]/.chat/code-analysis-[timestamp].md`
### Agent Mode (`--agent` flag)
Delegates to `cli-execution-agent` for intelligent context discovery and analysis.
## Core Rules
- **Read-only**: Analyzes code, does NOT modify files
- **Template**: Uses `~/.claude/workflows/cli-templates/prompts/analysis/01-trace-code-execution.txt` for systematic analysis
- **Output**: Saves to `.workflow/WFS-[id]/.chat/`
## CLI Command Templates
**Gemini/Qwen** (default, read-only analysis):
```bash
cd [dir] && gemini -p "
PURPOSE: [goal]
TASK: Execution path tracing
MODE: analysis
CONTEXT: @**/*
EXPECTED: Trace, call diagram
RULES: $(cat ~/.claude/workflows/cli-templates/prompts/analysis/01-trace-code-execution.txt)
"
# Qwen: Replace 'gemini' with 'qwen'
```
**Codex** (analysis + optimization suggestions):
```bash
codex -C [dir] --full-auto exec "
PURPOSE: [goal]
TASK: Path analysis
MODE: analysis
CONTEXT: @**/*
EXPECTED: Trace, optimization
RULES: $(cat ~/.claude/workflows/cli-templates/prompts/analysis/01-trace-code-execution.txt)
" -m gpt-5 --skip-git-repo-check -s danger-full-access
```
## Agent Execution Context
When `--agent` flag is used, delegate to agent:
```javascript ```javascript
Task( Task(
subagent_type="cli-execution-agent", subagent_type="cli-execution-agent",
description="Code execution path analysis", description="Execution path tracing and call flow analysis",
prompt=` prompt=`
Task: ${analysis_target} Task: ${analysis_target}
Mode: code-analysis Mode: code-analysis
Tool: ${tool_flag || 'auto-select'} // gemini|qwen|codex Tool: ${tool_flag || 'gemini'}
Directory: ${cd_path || 'auto-detect'} Directory: ${cd_path || '.'}
Enhance: ${enhance_flag}
Template: ~/.claude/workflows/cli-templates/prompts/analysis/01-trace-code-execution.txt Template: ~/.claude/workflows/cli-templates/prompts/analysis/01-trace-code-execution.txt
Agent responsibilities: Execute systematic code analysis with execution path tracing:
1. Context Discovery: 1. Context Discovery:
- Identify entry points and call chains - Identify entry points and function signatures
- Discover related files (MCP/ripgrep) - Trace call chains and execution flows
- Map execution flow paths - Discover related files (implementations, dependencies, tests)
- Map data flow and state transformations
- Use MCP/ripgrep for comprehensive file discovery
2. CLI Command Generation: 2. Analysis Execution:
- Build Gemini/Qwen/Codex command - Apply execution tracing template
- Include discovered context - Generate call flow diagrams (textual)
- Apply ~/.claude/workflows/cli-templates/prompts/analysis/01-trace-code-execution.txt template - Document execution paths and branching logic
- Identify optimization opportunities
3. Execution & Output: 3. CLI Command Construction:
- Execute analysis with selected tool - Tool: ${tool_flag || 'gemini'} (qwen fallback, codex for complex analysis)
- Save to .workflow/WFS-[id]/.chat/ - Directory: cd ${cd_path || '.'} &&
- Context: @**/* + discovered execution context
- Mode: analysis (read-only)
- Template: analysis/01-trace-code-execution.txt
4. Output Generation:
- Execution trace documentation
- Call flow analysis with diagrams
- Performance and optimization insights
- Save to .workflow/WFS-[id]/.chat/code-analysis-[timestamp].md (or .scratchpad/)
` `
) )
``` ```
## Output ## Core Rules
- **With session**: `.workflow/WFS-[id]/.chat/code-analysis-[timestamp].md` - **Read-only**: Analyzes code, does NOT modify files
- **No session**: `.workflow/.scratchpad/code-analysis-[desc]-[timestamp].md` - **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)
## Notes
- Template: `~/.claude/workflows/cli-templates/prompts/analysis/01-trace-code-execution.txt`
- See `intelligent-tools-strategy.md` for detailed tool usage

View File

@@ -1,7 +1,7 @@
--- ---
name: plan name: plan
description: Read-only architecture planning using Gemini/Qwen/Codex with strategic planning template for modification plans and impact analysis description: Read-only architecture planning using Gemini/Qwen/Codex with strategic planning template for modification plans and impact analysis
argument-hint: "[--agent] [--tool codex|gemini|qwen] [--enhance] [--cd path] topic" argument-hint: "[--tool codex|gemini|qwen] [--enhance] [--cd path] topic"
allowed-tools: SlashCommand(*), Bash(*), Task(*) allowed-tools: SlashCommand(*), Bash(*), Task(*)
--- ---
@@ -19,7 +19,6 @@ Strategic software architecture planning template (`~/.claude/workflows/cli-temp
## Parameters ## Parameters
- `--tool <gemini|qwen|codex>` - Tool selection (default: gemini) - `--tool <gemini|qwen|codex>` - Tool selection (default: gemini)
- `--agent` - Use cli-execution-agent for automated context discovery
- `--enhance` - Enhance task with `/enhance-prompt` - `--enhance` - Enhance task with `/enhance-prompt`
- `--cd "path"` - Target directory for focused planning - `--cd "path"` - Target directory for focused planning
- `<planning-task>` (Required) - Architecture planning task or modification requirements - `<planning-task>` (Required) - Architecture planning task or modification requirements
@@ -43,87 +42,52 @@ Strategic software architecture planning template (`~/.claude/workflows/cli-temp
## Execution Flow ## Execution Flow
### Standard Mode Uses **cli-execution-agent** (default) for automated planning:
1. Parse tool selection (default: gemini)
2. Optional: enhance with `/enhance-prompt`
3. Detect directory from `--cd` or auto-infer
4. Build command with template
5. Execute planning (read-only, no code generation)
6. Save to `.workflow/WFS-[id]/.chat/`
### Agent Mode (`--agent`)
Delegates to agent for intelligent planning:
```javascript ```javascript
Task( Task(
subagent_type="cli-execution-agent", subagent_type="cli-execution-agent",
description="Architecture modification planning", description="Architecture planning with impact analysis",
prompt=` prompt=`
Task: ${planning_task} Task: ${planning_task}
Mode: architecture-planning Mode: plan
Tool: ${tool_flag || 'auto-select'} // gemini|qwen|codex Tool: ${tool_flag || 'gemini'}
Directory: ${cd_path || 'auto-detect'} Directory: ${cd_path || '.'}
Enhance: ${enhance_flag}
Template: ~/.claude/workflows/cli-templates/prompts/planning/01-plan-architecture-design.txt Template: ~/.claude/workflows/cli-templates/prompts/planning/01-plan-architecture-design.txt
Agent responsibilities: Execute strategic architecture planning:
1. Context Discovery: 1. Context Discovery:
- Analyze current architecture - Analyze current architecture structure
- Identify affected components - Identify affected components and modules
- Map dependencies and impacts - Map dependencies and integration points
- Assess modification impacts (scope, complexity, risks)
2. CLI Command Generation: 2. Planning Analysis:
- Build Gemini/Qwen/Codex command - Apply strategic planning template
- Include architecture context - Generate modification plan with phases
- Apply ~/.claude/workflows/cli-templates/prompts/planning/01-plan-architecture-design.txt template - Document architectural decisions and rationale
- Identify potential conflicts and mitigation strategies
3. Execution & Output: 3. CLI Command Construction:
- Execute strategic planning - Tool: ${tool_flag || 'gemini'} (qwen fallback, codex for implementation guidance)
- Generate modification plan - Directory: cd ${cd_path || '.'} &&
- Save to .workflow/.chat/ - Context: @**/* (full architecture context)
- Mode: analysis (read-only, no code generation)
- Template: planning/01-plan-architecture-design.txt
4. Output Generation:
- Strategic modification plan
- Impact analysis and risk assessment
- Implementation roadmap
- Save to .workflow/WFS-[id]/.chat/plan-[timestamp].md (or .scratchpad/)
` `
) )
``` ```
## Core Rules ## Core Rules
- **Planning only**: Creates modification plans, does NOT generate code - **Read-only**: Creates modification plans, does NOT generate code
- **Template**: Uses `~/.claude/workflows/cli-templates/prompts/planning/01-plan-architecture-design.txt` for strategic planning - **Template**: `~/.claude/workflows/cli-templates/prompts/planning/01-plan-architecture-design.txt`
- **Output**: Saves to `.workflow/WFS-[id]/.chat/` - **Output**: `.workflow/WFS-[id]/.chat/plan-[timestamp].md` (or `.scratchpad/` if no session)
## CLI Command Templates
**Gemini/Qwen** (default, planning only):
```bash
cd [dir] && gemini -p "
PURPOSE: [goal]
TASK: Architecture planning
MODE: analysis
CONTEXT: @**/*
EXPECTED: Modification plan, impact analysis
RULES: $(cat ~/.claude/workflows/cli-templates/prompts/planning/01-plan-architecture-design.txt)
"
# Qwen: Replace 'gemini' with 'qwen'
```
**Codex** (planning + implementation guidance):
```bash
codex -C [dir] --full-auto exec "
PURPOSE: [goal]
TASK: Architecture planning
MODE: analysis
CONTEXT: @**/*
EXPECTED: Plan, implementation roadmap
RULES: $(cat ~/.claude/workflows/cli-templates/prompts/planning/01-plan-architecture-design.txt)
" -m gpt-5 --skip-git-repo-check -s danger-full-access
```
## Output
- **With session**: `.workflow/WFS-[id]/.chat/plan-[timestamp].md`
- **No session**: `.workflow/.scratchpad/plan-[desc]-[timestamp].md`
## Notes
- Template: `~/.claude/workflows/cli-templates/prompts/planning/01-plan-architecture-design.txt`
- See `intelligent-tools-strategy.md` for detailed tool usage