mirror of
https://github.com/catlog22/Claude-Code-Workflow.git
synced 2026-02-05 01:50:27 +08:00
release: v3.3.0 - CLI Tool Enhancements & Codex Multi-Step Execution
✨ Features: - New /cli:codex-execute command for automated multi-step task execution - Codex resume mechanism (codex exec "..." resume --last) for context continuity - TodoWrite progress tracking for subtask execution - Optional Git verification after each subtask (--verify-git flag) - Automatic task JSON detection and loading - Enhanced Codex agent configuration (.codex/AGENTS.md v2.1.0) 📚 Documentation: - Streamlined CLI documentation (60% reduction in redundancy) - Updated /cli:analyze, /cli:chat, /cli:execute commands - Enhanced intelligent-tools-strategy.md with Codex resume patterns - Unified command templates for Gemini/Qwen vs Codex - Added Codex -i parameter documentation for image attachment 🔧 Technical: - Multi-task prompt format (Single-Task & Multi-Task) - Subtask coordination guidelines and best practices - Enhanced MODE: auto with subtask execution flow - Progress reporting for multi-step workflows 📦 Updates: - Version bumped to 3.3.0 in README.md, README_CN.md - Created .claude/version.json for version tracking - Comprehensive CHANGELOG.md entry with all changes 🤖 Generated with Claude Code (https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -17,185 +17,68 @@ allowed-tools: SlashCommand(*), Bash(*), TodoWrite(*), Read(*), Glob(*)
|
||||
Execute CLI tool analysis on codebase patterns, architecture, or code quality.
|
||||
|
||||
**Supported Tools**: codex, gemini (default), qwen
|
||||
**Reference**: @~/.claude/workflows/intelligent-tools-strategy.md for complete tool details
|
||||
|
||||
## Execution Flow
|
||||
|
||||
1. **Parse tool selection**: Extract `--tool` flag (default: gemini)
|
||||
2. **If `--enhance` flag present**: Execute `/enhance-prompt "[analysis-target]"` and use enhanced output
|
||||
3. Parse analysis target (original or enhanced)
|
||||
4. Detect analysis type (pattern/architecture/security/quality)
|
||||
5. Build command for selected tool with template
|
||||
6. Execute analysis
|
||||
7. Return results
|
||||
|
||||
## Core Rules
|
||||
|
||||
1. **Tool Selection**: Use `--tool` value or default to gemini
|
||||
2. **Enhance First (if flagged)**: Execute `/enhance-prompt` before analysis when `--enhance` present
|
||||
3. **Execute Immediately**: Build and run command without preliminary analysis
|
||||
4. **Template Selection**: Auto-select template based on keywords
|
||||
5. **Context Inclusion**: Always include CLAUDE.md in context
|
||||
6. **Direct Output**: Return tool output directly to user
|
||||
|
||||
## Tool Selection
|
||||
|
||||
| Tool | Wrapper | Best For | Permissions |
|
||||
|------|---------|----------|-------------|
|
||||
| **gemini** (default) | `~/.claude/scripts/gemini-wrapper` | Analysis, exploration, documentation | Read-only |
|
||||
| **qwen** | `~/.claude/scripts/qwen-wrapper` | Architecture, code generation | Read-only for analyze |
|
||||
| **codex** | `codex --full-auto exec` | Development analysis, deep inspection | `-s danger-full-access --skip-git-repo-check` |
|
||||
1. Parse tool selection (default: gemini)
|
||||
2. If `--enhance`: Execute `/enhance-prompt` first
|
||||
3. Detect analysis type and select template
|
||||
4. Build and execute command
|
||||
5. Return results
|
||||
|
||||
## Enhancement Integration
|
||||
|
||||
**When `--enhance` flag present**:
|
||||
**When `--enhance` flag present**: Execute `/enhance-prompt "[analysis-target]"` first, then use enhanced output (INTENT/CONTEXT/ACTION) to build the analysis command.
|
||||
|
||||
|
||||
## Command Template
|
||||
|
||||
**Gemini/Qwen**:
|
||||
```bash
|
||||
# Step 1: Enhance the prompt
|
||||
SlashCommand(command="/enhance-prompt \"[analysis-target]\"")
|
||||
|
||||
# Step 2: Use enhanced output as analysis target
|
||||
# Enhanced output provides:
|
||||
# - INTENT: Clear technical goal
|
||||
# - CONTEXT: Session memory + patterns
|
||||
# - ACTION: Implementation steps
|
||||
# - ATTENTION: Critical constraints
|
||||
```
|
||||
|
||||
**Example**:
|
||||
```bash
|
||||
# User: /gemini:analyze --enhance "fix auth issues"
|
||||
|
||||
# Step 1: Enhance
|
||||
/enhance-prompt "fix auth issues"
|
||||
# Returns:
|
||||
# INTENT: Debug authentication failures
|
||||
# CONTEXT: JWT implementation in src/auth/, known token expiry issue
|
||||
# ACTION: Analyze token lifecycle → verify refresh flow → check middleware
|
||||
# ATTENTION: Preserve existing session management
|
||||
|
||||
# Step 2: Analyze with enhanced context
|
||||
cd . && ~/.claude/scripts/gemini-wrapper -p "
|
||||
PURPOSE: Debug authentication failures (from enhanced: JWT token lifecycle)
|
||||
TASK: Analyze token lifecycle, refresh flow, and middleware integration
|
||||
CONTEXT: @{src/auth/**/*} @{CLAUDE.md} Session context: known token expiry issue
|
||||
EXPECTED: Root cause analysis with file references
|
||||
RULES: $(cat ~/.claude/workflows/cli-templates/prompts/analysis/security.txt) | Focus on JWT token handling
|
||||
"
|
||||
```
|
||||
|
||||
## Analysis Types
|
||||
|
||||
| Type | Keywords | Template | Context |
|
||||
|------|----------|----------|---------|
|
||||
| **pattern** | pattern, hooks, usage | analysis/pattern.txt | Matched files + CLAUDE.md |
|
||||
| **architecture** | architecture, structure, design | analysis/architecture.txt | Full codebase + CLAUDE.md |
|
||||
| **security** | security, vulnerability, auth | analysis/security.txt | Matched files + CLAUDE.md |
|
||||
| **quality** | quality, test, coverage | analysis/quality.txt | Source + test files + CLAUDE.md |
|
||||
|
||||
## Command Templates
|
||||
|
||||
### Gemini (Default)
|
||||
```bash
|
||||
cd [target-dir] && ~/.claude/scripts/gemini-wrapper -p "
|
||||
PURPOSE: [analysis goal from user input]
|
||||
TASK: [specific analysis task]
|
||||
cd [dir] && ~/.claude/scripts/[gemini|qwen]-wrapper -p "
|
||||
PURPOSE: [analysis goal]
|
||||
TASK: [specific task]
|
||||
CONTEXT: @{[file-patterns]} @{CLAUDE.md}
|
||||
EXPECTED: [expected output format]
|
||||
EXPECTED: [output format]
|
||||
RULES: $(cat ~/.claude/workflows/cli-templates/prompts/[category]/[template].txt) | [constraints]
|
||||
"
|
||||
```
|
||||
|
||||
### Qwen
|
||||
**Codex**:
|
||||
```bash
|
||||
cd [target-dir] && ~/.claude/scripts/qwen-wrapper -p "
|
||||
PURPOSE: [analysis goal from user input]
|
||||
TASK: [specific analysis task]
|
||||
codex -C [dir] --full-auto exec "
|
||||
PURPOSE: [analysis goal]
|
||||
TASK: [specific task]
|
||||
CONTEXT: @{[file-patterns]} @{CLAUDE.md}
|
||||
EXPECTED: [expected output format]
|
||||
RULES: $(cat ~/.claude/workflows/cli-templates/prompts/[category]/[template].txt) | [constraints]
|
||||
"
|
||||
```
|
||||
|
||||
### Codex
|
||||
```bash
|
||||
codex -C [target-dir] --full-auto exec "
|
||||
PURPOSE: [analysis goal from user input]
|
||||
TASK: [specific analysis task]
|
||||
CONTEXT: @{[file-patterns]} @{CLAUDE.md}
|
||||
EXPECTED: [expected output format]
|
||||
RULES: $(cat ~/.claude/workflows/cli-templates/prompts/[category]/[template].txt) | [constraints]
|
||||
EXPECTED: [output format]
|
||||
RULES: [constraints]
|
||||
" --skip-git-repo-check -s danger-full-access
|
||||
|
||||
# With image attachment (e.g., UI screenshots, diagrams)
|
||||
codex -C [dir] -i screenshot.png --full-auto exec "..." --skip-git-repo-check -s danger-full-access
|
||||
```
|
||||
|
||||
## Examples
|
||||
|
||||
**Pattern Analysis (Gemini - default)**:
|
||||
```bash
|
||||
cd . && ~/.claude/scripts/gemini-wrapper -p "
|
||||
PURPOSE: Analyze authentication patterns
|
||||
TASK: Identify auth implementation patterns and conventions
|
||||
CONTEXT: @{**/*auth*} @{CLAUDE.md}
|
||||
EXPECTED: Pattern summary with file references
|
||||
RULES: $(cat ~/.claude/workflows/cli-templates/prompts/analysis/pattern.txt) | Focus on security
|
||||
"
|
||||
```
|
||||
|
||||
**Architecture Review (Qwen)**:
|
||||
```bash
|
||||
# User: /cli:analyze --tool qwen "component architecture"
|
||||
|
||||
cd . && ~/.claude/scripts/qwen-wrapper -p "
|
||||
PURPOSE: Review component architecture
|
||||
TASK: Analyze component structure and dependencies
|
||||
CONTEXT: @{src/**/*} @{CLAUDE.md}
|
||||
EXPECTED: Architecture diagram and integration points
|
||||
RULES: $(cat ~/.claude/workflows/cli-templates/prompts/analysis/architecture.txt) | Focus on modularity
|
||||
"
|
||||
```
|
||||
|
||||
**Deep Inspection (Codex)**:
|
||||
```bash
|
||||
# User: /cli:analyze --tool codex "performance bottlenecks"
|
||||
|
||||
codex -C . --full-auto exec "
|
||||
PURPOSE: Identify performance bottlenecks
|
||||
TASK: Deep analysis of performance issues
|
||||
CONTEXT: @{src/**/*} @{CLAUDE.md}
|
||||
EXPECTED: Performance metrics and optimization recommendations
|
||||
RULES: Focus on computational complexity and memory usage
|
||||
" --skip-git-repo-check -s danger-full-access
|
||||
/cli:analyze "authentication patterns" # Gemini (default)
|
||||
/cli:analyze --tool qwen "component architecture" # Qwen architecture
|
||||
/cli:analyze --tool codex "performance bottlenecks" # Codex deep analysis
|
||||
/cli:analyze --enhance "fix auth issues" # Enhanced prompt first
|
||||
```
|
||||
|
||||
## File Pattern Logic
|
||||
|
||||
**Keyword Matching**:
|
||||
Auto-detect file patterns from keywords:
|
||||
- "auth" → `@{**/*auth*}`
|
||||
- "component" → `@{src/components/**/*}`
|
||||
- "API" → `@{**/api/**/*}`
|
||||
- "test" → `@{**/*.test.*}`
|
||||
- Generic → `@{src/**/*}` or `@{**/*}`
|
||||
- Generic → `@{src/**/*}`
|
||||
|
||||
## Session Integration
|
||||
|
||||
**Detect Active Session**: Check for `.workflow/.active-*` marker file
|
||||
|
||||
**If Session Active**:
|
||||
- Save results to `.workflow/WFS-[id]/.chat/analysis-[timestamp].md`
|
||||
- Include session context in analysis
|
||||
|
||||
**If No Session**:
|
||||
- Return results directly to user
|
||||
|
||||
## Output Format
|
||||
|
||||
Return Gemini's output directly, which includes:
|
||||
- File references (file:line format)
|
||||
- Code snippets
|
||||
- Pattern analysis
|
||||
- Recommendations
|
||||
|
||||
## Error Handling
|
||||
|
||||
- **Missing Template**: Use generic analysis prompt
|
||||
- **No Context**: Use `@{**/*}` as fallback
|
||||
- **Command Failure**: Report error and suggest manual command
|
||||
- **Active Session**: Save results to `.workflow/WFS-[id]/.chat/analysis-[timestamp].md`
|
||||
- **No Session**: Return results directly to user
|
||||
|
||||
|
||||
@@ -12,150 +12,81 @@ allowed-tools: SlashCommand(*), Bash(*)
|
||||
model: sonnet
|
||||
---
|
||||
|
||||
### 🚀 **Command Overview: `/cli:chat`**
|
||||
## Purpose
|
||||
|
||||
- **Type**: CLI Tool Wrapper for Interactive Analysis
|
||||
- **Purpose**: Direct interaction with CLI tools for codebase analysis
|
||||
- **Supported Tools**: codex, gemini (default), qwen
|
||||
Direct interaction with CLI tools for codebase analysis and Q&A.
|
||||
|
||||
### 📥 **Parameters & Usage**
|
||||
**Supported Tools**: codex, gemini (default), qwen
|
||||
**Reference**: @~/.claude/workflows/intelligent-tools-strategy.md for complete tool details
|
||||
|
||||
- **`<inquiry>` (Required)**: Your question or analysis request
|
||||
- **`--tool <codex|gemini|qwen>` (Optional)**: Select CLI tool (default: gemini)
|
||||
- **`--enhance` (Optional)**: Enhance inquiry with `/enhance-prompt` before execution
|
||||
- **`--all-files` (Optional)**: Includes the entire codebase in the analysis context
|
||||
- **`--save-session` (Optional)**: Saves the interaction to current workflow session directory
|
||||
- **File References**: Specify files or patterns using `@{path/to/file}` syntax
|
||||
## Parameters
|
||||
|
||||
### 🔄 **Execution Workflow**
|
||||
- `<inquiry>` (Required): Question or analysis request
|
||||
- `--tool <codex|gemini|qwen>` (Optional): Select CLI tool (default: gemini)
|
||||
- `--enhance` (Optional): Enhance inquiry with `/enhance-prompt` first
|
||||
- `--all-files` (Optional): Include entire codebase in context
|
||||
- `--save-session` (Optional): Save interaction to workflow session
|
||||
|
||||
`Parse Tool` **->** `Parse Input` **->** `[Optional] Enhance` **->** `Assemble Context` **->** `Construct Prompt` **->** `Execute CLI Tool` **->** `(Optional) Save Session`
|
||||
## Execution Flow
|
||||
|
||||
### 🛠️ **Tool Selection**
|
||||
1. Parse tool selection (default: gemini)
|
||||
2. If `--enhance`: Execute `/enhance-prompt` first
|
||||
3. Assemble context (files + CLAUDE.md)
|
||||
4. Execute CLI tool
|
||||
5. Optional: Save to session
|
||||
|
||||
| Tool | Best For | Wrapper |
|
||||
|------|----------|---------|
|
||||
| **gemini** (default) | General analysis, exploration | `~/.claude/scripts/gemini-wrapper` |
|
||||
| **qwen** | Architecture, design patterns | `~/.claude/scripts/qwen-wrapper` |
|
||||
| **codex** | Development queries, deep analysis | `codex --full-auto exec` |
|
||||
## Enhancement Integration
|
||||
|
||||
### 🔄 **Original Execution Workflow**
|
||||
**When `--enhance` flag present**: Execute `/enhance-prompt "[inquiry]"` first, then use enhanced output (INTENT/CONTEXT/ACTION) to build the chat command.
|
||||
|
||||
`Parse Input` **->** `[Optional] Enhance` **->** `Assemble Context` **->** `Construct Prompt` **->** `Execute Gemini CLI` **->** `(Optional) Save Session`
|
||||
## Context Assembly
|
||||
|
||||
### 🎯 **Enhancement Integration**
|
||||
Context gathered from:
|
||||
1. **Project Guidelines**: `@{CLAUDE.md,**/*CLAUDE.md}` (always)
|
||||
2. **User-Explicit Files**: Files specified by user
|
||||
3. **All Files Flag**: `--all-files` includes entire codebase
|
||||
|
||||
**When `--enhance` flag present**:
|
||||
## Command Template
|
||||
|
||||
**Gemini/Qwen**:
|
||||
```bash
|
||||
# Step 1: Enhance the inquiry
|
||||
SlashCommand(command="/enhance-prompt \"[inquiry]\"")
|
||||
|
||||
# Step 2: Use enhanced output for chat
|
||||
# Enhanced output provides enriched context and structured intent
|
||||
```
|
||||
|
||||
**Example**:
|
||||
```bash
|
||||
# User: /gemini:chat --enhance "fix the login"
|
||||
|
||||
# Step 1: Enhance
|
||||
/enhance-prompt "fix the login"
|
||||
# Returns:
|
||||
# INTENT: Debug login authentication failure
|
||||
# CONTEXT: JWT auth in src/auth/, session state issue
|
||||
# ACTION: Check token validation → verify middleware → test flow
|
||||
|
||||
# Step 2: Chat with enhanced context
|
||||
gemini -p "Debug login authentication failure. Focus on JWT token validation
|
||||
in src/auth/, verify middleware integration, and test authentication flow.
|
||||
Known issue: session state management"
|
||||
```
|
||||
|
||||
### 📚 **Context Assembly**
|
||||
|
||||
Context is gathered from:
|
||||
1. **Project Guidelines**: Always includes `@{CLAUDE.md,**/*CLAUDE.md}`
|
||||
2. **User-Explicit Files**: Files specified by the user (e.g., `@{src/auth/*.js}`)
|
||||
3. **All Files Flag**: The `--all-files` flag includes the entire codebase
|
||||
|
||||
### 📝 **Prompt Format**
|
||||
|
||||
**Core Guidelines**: @~/.claude/workflows/intelligent-tools-strategy.md
|
||||
|
||||
```bash
|
||||
cd [directory] && ~/.claude/scripts/gemini-wrapper -p "
|
||||
PURPOSE: [clear analysis/inquiry goal]
|
||||
TASK: [specific analysis or question]
|
||||
CONTEXT: @{CLAUDE.md,**/*CLAUDE.md} @{target_files}
|
||||
EXPECTED: [expected response format]
|
||||
RULES: [constraints or focus areas]
|
||||
cd [dir] && ~/.claude/scripts/[gemini|qwen]-wrapper -p "
|
||||
PURPOSE: [inquiry goal]
|
||||
TASK: [specific question]
|
||||
CONTEXT: @{CLAUDE.md} @{target_files}
|
||||
EXPECTED: [response format]
|
||||
RULES: [constraints]
|
||||
"
|
||||
|
||||
# With --all-files
|
||||
cd [dir] && ~/.claude/scripts/[gemini|qwen]-wrapper --all-files -p "..."
|
||||
```
|
||||
|
||||
### ⚙️ **Execution Implementation**
|
||||
|
||||
**Standard Template**:
|
||||
**Codex**:
|
||||
```bash
|
||||
cd . && ~/.claude/scripts/gemini-wrapper -p "
|
||||
PURPOSE: [user inquiry goal]
|
||||
TASK: [specific question or analysis]
|
||||
CONTEXT: @{CLAUDE.md,**/*CLAUDE.md} @{inferred_or_specified_files}
|
||||
EXPECTED: Analysis with file references and code examples
|
||||
RULES: [focus areas based on inquiry]
|
||||
"
|
||||
codex -C [dir] --full-auto exec "
|
||||
PURPOSE: [inquiry goal]
|
||||
TASK: [specific question]
|
||||
CONTEXT: @{CLAUDE.md} @{target_files}
|
||||
EXPECTED: [response format]
|
||||
RULES: [constraints]
|
||||
" --skip-git-repo-check -s danger-full-access
|
||||
|
||||
# With image attachment
|
||||
codex -C [dir] -i screenshot.png --full-auto exec "..." --skip-git-repo-check -s danger-full-access
|
||||
```
|
||||
|
||||
**With --all-files flag**:
|
||||
## Examples
|
||||
|
||||
```bash
|
||||
cd . && ~/.claude/scripts/gemini-wrapper --all-files -p "
|
||||
PURPOSE: [user inquiry goal]
|
||||
TASK: [specific question or analysis]
|
||||
CONTEXT: @{CLAUDE.md,**/*CLAUDE.md} [entire codebase]
|
||||
EXPECTED: Comprehensive analysis across all files
|
||||
RULES: [focus areas based on inquiry]
|
||||
"
|
||||
/cli:chat "analyze the authentication flow" # Gemini (default)
|
||||
/cli:chat --tool qwen "optimize React component" # Qwen
|
||||
/cli:chat --tool codex "review security vulnerabilities" # Codex
|
||||
/cli:chat --enhance "fix the login" # Enhanced prompt
|
||||
/cli:chat --all-files "find all API endpoints" # Full codebase
|
||||
```
|
||||
|
||||
**Example - Authentication Analysis**:
|
||||
```bash
|
||||
cd . && ~/.claude/scripts/gemini-wrapper -p "
|
||||
PURPOSE: Understand authentication flow implementation
|
||||
TASK: Analyze authentication flow and identify patterns
|
||||
CONTEXT: @{**/*auth*,**/*login*} @{CLAUDE.md}
|
||||
EXPECTED: Flow diagram, security assessment, integration points
|
||||
RULES: Focus on security patterns and JWT handling
|
||||
"
|
||||
```
|
||||
## Session Persistence
|
||||
|
||||
**Example - Performance Optimization**:
|
||||
```bash
|
||||
cd src/components && ~/.claude/scripts/gemini-wrapper -p "
|
||||
PURPOSE: Optimize React component performance
|
||||
TASK: Identify performance bottlenecks in component rendering
|
||||
CONTEXT: @{**/*.{jsx,tsx}} @{CLAUDE.md}
|
||||
EXPECTED: Specific optimization recommendations with file:line references
|
||||
RULES: Focus on re-render patterns and memoization opportunities
|
||||
"
|
||||
```
|
||||
|
||||
### 💾 **Session Persistence**
|
||||
|
||||
When `--save-session` flag is used:
|
||||
- Check for existing active session (`.workflow/.active-*` markers)
|
||||
- Save to existing session's `.chat/` directory or create new session
|
||||
- File format: `chat-YYYYMMDD-HHMMSS.md`
|
||||
- Include query, context, and response in saved file
|
||||
|
||||
**Session Template:**
|
||||
```markdown
|
||||
# Chat Session: [Timestamp]
|
||||
|
||||
## Query
|
||||
[Original user inquiry]
|
||||
|
||||
## Context
|
||||
[Files and patterns included in analysis]
|
||||
|
||||
## Gemini Response
|
||||
[Complete response from Gemini CLI]
|
||||
```
|
||||
- **Active Session**: Save to `.workflow/WFS-[id]/.chat/chat-[timestamp].md`
|
||||
- **No Session**: Return results directly
|
||||
309
.claude/commands/cli/codex-execute.md
Normal file
309
.claude/commands/cli/codex-execute.md
Normal file
@@ -0,0 +1,309 @@
|
||||
---
|
||||
name: codex-execute
|
||||
description: Automated task decomposition and execution with Codex using resume mechanism
|
||||
usage: /cli:codex-execute [--verify-git] <task-description|task-id>
|
||||
argument-hint: "[--verify-git] task description or task-id"
|
||||
examples:
|
||||
- /cli:codex-execute "implement user authentication system"
|
||||
- /cli:codex-execute --verify-git "refactor API layer"
|
||||
- /cli:codex-execute IMPL-001
|
||||
allowed-tools: SlashCommand(*), Bash(*), TodoWrite(*), Read(*), Glob(*)
|
||||
---
|
||||
|
||||
# CLI Codex Execute Command (/cli:codex-execute)
|
||||
|
||||
## Purpose
|
||||
|
||||
Automated task decomposition and sequential execution with Codex, using `codex exec "..." resume --last` mechanism for continuity between subtasks.
|
||||
|
||||
**Input**: User description or task ID (automatically loads from `.task/[ID].json` if applicable)
|
||||
**Reference**: @~/.claude/workflows/intelligent-tools-strategy.md for Codex details
|
||||
|
||||
## Core Workflow
|
||||
|
||||
```
|
||||
Task Input → Decompose into Subtasks → TodoWrite Tracking →
|
||||
For Each Subtask:
|
||||
1. Execute with Codex
|
||||
2. [Optional] Git verification
|
||||
3. Mark complete in TodoWrite
|
||||
4. Resume next subtask with `codex resume --last`
|
||||
→ Final Summary
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
- `<input>` (Required): Task description or task ID (e.g., "implement auth" or "IMPL-001")
|
||||
- If input matches task ID format, loads from `.task/[ID].json`
|
||||
- Otherwise, uses input as task description
|
||||
- `--verify-git` (Optional): Verify git status after each subtask completion
|
||||
|
||||
## Execution Flow
|
||||
|
||||
### Phase 1: Input Processing & Decomposition
|
||||
|
||||
1. **Parse Input**:
|
||||
- Check if input matches task ID pattern (e.g., `IMPL-001`, `TASK-123`)
|
||||
- If yes: Load from `.task/[ID].json` and extract requirements
|
||||
- If no: Use input as task description directly
|
||||
|
||||
2. **Analyze & Decompose**:
|
||||
- Analyze task complexity and scope
|
||||
- Break down into 3-8 subtasks
|
||||
- Create TodoWrite tracker with all subtasks
|
||||
- Display decomposition for user review
|
||||
|
||||
**Decomposition Criteria**:
|
||||
- Each subtask: 5-15 minutes completable
|
||||
- Clear, testable outcomes
|
||||
- Explicit dependencies
|
||||
- Focused file scope (1-5 files per subtask)
|
||||
|
||||
### Phase 2: Sequential Execution
|
||||
|
||||
**For First Subtask**:
|
||||
```bash
|
||||
# Initial execution (no resume needed)
|
||||
codex -C [dir] --full-auto exec "
|
||||
PURPOSE: [task goal]
|
||||
TASK: [subtask 1 description]
|
||||
CONTEXT: @{relevant_files} @{CLAUDE.md}
|
||||
EXPECTED: [specific deliverables]
|
||||
RULES: [constraints]
|
||||
Subtask 1 of N: [subtask title]
|
||||
" --skip-git-repo-check -s danger-full-access
|
||||
```
|
||||
|
||||
**For Subsequent Subtasks** (using resume --last):
|
||||
```bash
|
||||
# Resume previous session for context continuity
|
||||
codex exec "
|
||||
CONTINUE TO NEXT SUBTASK:
|
||||
Subtask N of M: [subtask title]
|
||||
|
||||
PURPOSE: [continuation goal]
|
||||
TASK: [subtask N description]
|
||||
CONTEXT: Previous work completed, now focus on @{new_relevant_files}
|
||||
EXPECTED: [specific deliverables]
|
||||
RULES: Build on previous subtask, maintain consistency
|
||||
" resume --last --skip-git-repo-check -s danger-full-access
|
||||
```
|
||||
|
||||
### Phase 3: Verification (if --verify-git enabled)
|
||||
|
||||
After each subtask completion:
|
||||
```bash
|
||||
# Check git status
|
||||
git status --short
|
||||
|
||||
# Verify expected changes
|
||||
git diff --stat
|
||||
|
||||
# Optional: Check for untracked files that should be committed
|
||||
git ls-files --others --exclude-standard
|
||||
```
|
||||
|
||||
**Verification Checks**:
|
||||
- Files modified match subtask scope
|
||||
- No unexpected changes in unrelated files
|
||||
- No merge conflicts or errors
|
||||
- Code compiles/runs (if applicable)
|
||||
|
||||
### Phase 4: TodoWrite Tracking
|
||||
|
||||
**Initial Setup**:
|
||||
```javascript
|
||||
TodoWrite({
|
||||
todos: [
|
||||
{ content: "Subtask 1: [description]", status: "in_progress", activeForm: "Executing subtask 1" },
|
||||
{ content: "Subtask 2: [description]", status: "pending", activeForm: "Executing subtask 2" },
|
||||
{ content: "Subtask 3: [description]", status: "pending", activeForm: "Executing subtask 3" },
|
||||
// ... more subtasks
|
||||
{ content: "Final verification and summary", status: "pending", activeForm: "Verifying and summarizing" }
|
||||
]
|
||||
})
|
||||
```
|
||||
|
||||
**After Each Subtask**:
|
||||
```javascript
|
||||
TodoWrite({
|
||||
todos: [
|
||||
{ content: "Subtask 1: [description]", status: "completed", activeForm: "Executing subtask 1" },
|
||||
{ content: "Subtask 2: [description]", status: "in_progress", activeForm: "Executing subtask 2" },
|
||||
// ... update status
|
||||
]
|
||||
})
|
||||
```
|
||||
|
||||
## Codex Resume Mechanism
|
||||
|
||||
**Why `codex resume --last`?**
|
||||
- Maintains conversation context across subtasks
|
||||
- Codex remembers previous decisions and patterns
|
||||
- Reduces context repetition
|
||||
- Ensures consistency in implementation style
|
||||
|
||||
**How It Works**:
|
||||
1. First subtask creates new Codex session
|
||||
2. After completion, session is saved
|
||||
3. Subsequent subtasks use `codex resume --last` to continue
|
||||
4. Each subtask builds on previous context
|
||||
5. Final subtask completes full task
|
||||
|
||||
**Image Support**:
|
||||
```bash
|
||||
# First subtask with design reference
|
||||
codex -C [dir] -i design.png --full-auto exec "..." --skip-git-repo-check -s danger-full-access
|
||||
|
||||
# Resume for next subtask (image context preserved)
|
||||
codex exec "CONTINUE TO NEXT SUBTASK: ..." resume --last --skip-git-repo-check -s danger-full-access
|
||||
```
|
||||
|
||||
## Error Handling
|
||||
|
||||
**Subtask Failure**:
|
||||
1. Mark subtask as blocked in TodoWrite
|
||||
2. Report error details to user
|
||||
3. Pause execution for manual intervention
|
||||
4. User can choose to:
|
||||
- Retry current subtask
|
||||
- Continue to next subtask
|
||||
- Abort entire task
|
||||
|
||||
**Git Verification Failure** (if --verify-git):
|
||||
1. Show unexpected changes
|
||||
2. Pause execution
|
||||
3. Request user decision:
|
||||
- Continue anyway
|
||||
- Rollback and retry
|
||||
- Manual fix
|
||||
|
||||
**Codex Session Lost**:
|
||||
1. Detect if `codex exec "..." resume --last` fails
|
||||
2. Attempt retry with fresh session
|
||||
3. Report to user if manual intervention needed
|
||||
|
||||
## Output Format
|
||||
|
||||
**During Execution**:
|
||||
```
|
||||
📋 Task Decomposition:
|
||||
1. [Subtask 1 description]
|
||||
2. [Subtask 2 description]
|
||||
...
|
||||
|
||||
▶️ Executing Subtask 1/N: [title]
|
||||
Codex session started...
|
||||
[Codex output]
|
||||
✅ Subtask 1 completed
|
||||
|
||||
🔍 Git Verification:
|
||||
M src/file1.ts
|
||||
A src/file2.ts
|
||||
✅ Changes verified
|
||||
|
||||
▶️ Executing Subtask 2/N: [title]
|
||||
Resuming Codex session...
|
||||
[Codex output]
|
||||
✅ Subtask 2 completed
|
||||
...
|
||||
|
||||
✅ All Subtasks Completed
|
||||
📊 Summary: [file references, changes, next steps]
|
||||
```
|
||||
|
||||
**Final Summary**:
|
||||
```markdown
|
||||
# Task Execution Summary: [Task Description]
|
||||
|
||||
## Subtasks Completed
|
||||
1. ✅ [Subtask 1]: [files modified]
|
||||
2. ✅ [Subtask 2]: [files modified]
|
||||
...
|
||||
|
||||
## Files Modified
|
||||
- src/file1.ts:10-50 - [changes]
|
||||
- src/file2.ts - [changes]
|
||||
|
||||
## Git Status
|
||||
- N files modified
|
||||
- M files added
|
||||
- No conflicts
|
||||
|
||||
## Next Steps
|
||||
- [Suggested follow-up actions]
|
||||
```
|
||||
|
||||
## Examples
|
||||
|
||||
**Example 1: Simple Task**
|
||||
```bash
|
||||
/cli:codex-execute "implement user authentication system"
|
||||
|
||||
# Decomposes into:
|
||||
# 1. Create user model and database schema
|
||||
# 2. Implement JWT token generation
|
||||
# 3. Create authentication middleware
|
||||
# 4. Add login/logout endpoints
|
||||
# 5. Write tests for auth flow
|
||||
```
|
||||
|
||||
**Example 2: With Git Verification**
|
||||
```bash
|
||||
/cli:codex-execute --verify-git "refactor API layer to use dependency injection"
|
||||
|
||||
# After each subtask, verifies:
|
||||
# - Only expected files modified
|
||||
# - No breaking changes in unrelated code
|
||||
# - Tests still pass
|
||||
```
|
||||
|
||||
**Example 3: With Task ID**
|
||||
```bash
|
||||
/cli:codex-execute IMPL-001
|
||||
|
||||
# Loads task from .task/IMPL-001.json
|
||||
# Decomposes based on task requirements
|
||||
```
|
||||
|
||||
## Best Practices
|
||||
|
||||
1. **Subtask Granularity**: Keep subtasks small and focused
|
||||
2. **Clear Boundaries**: Each subtask should have well-defined input/output
|
||||
3. **Git Hygiene**: Use `--verify-git` for critical refactoring
|
||||
4. **Context Continuity**: Let `codex resume --last` maintain context
|
||||
5. **Recovery Points**: TodoWrite provides clear progress tracking
|
||||
6. **Image References**: Attach design files for UI tasks
|
||||
|
||||
## Input Processing
|
||||
|
||||
**Automatic Detection**:
|
||||
- Input matches task ID pattern → Load from `.task/[ID].json`
|
||||
- Otherwise → Use as task description
|
||||
|
||||
**Task JSON Structure** (when loading from file):
|
||||
```json
|
||||
{
|
||||
"task_id": "IMPL-001",
|
||||
"title": "Implement user authentication",
|
||||
"description": "Create JWT-based auth system",
|
||||
"acceptance_criteria": [...],
|
||||
"scope": {...},
|
||||
"brainstorming_refs": [...]
|
||||
}
|
||||
```
|
||||
|
||||
**Save Results**:
|
||||
- Execution log: `.chat/codex-execute-[timestamp].md` (if workflow active)
|
||||
- Summary: `.summaries/[TASK-ID]-summary.md` (if task ID provided)
|
||||
- TodoWrite tracking embedded in session
|
||||
|
||||
## Notes
|
||||
|
||||
**vs. `/cli:execute`**:
|
||||
- `/cli:execute`: Single-shot execution with Gemini/Qwen/Codex
|
||||
- `/cli:codex-execute`: Multi-stage Codex execution with automatic task decomposition and resume mechanism
|
||||
|
||||
**Input Flexibility**: Accepts both freeform descriptions and task IDs (auto-detects and loads JSON)
|
||||
|
||||
**Context Window**: `codex exec "..." resume --last` maintains conversation history, ensuring consistency across subtasks without redundant context injection.
|
||||
@@ -14,222 +14,98 @@ model: sonnet
|
||||
|
||||
# CLI Execute Command (/cli:execute)
|
||||
|
||||
## Overview
|
||||
## Purpose
|
||||
|
||||
**⚡ YOLO-enabled execution**: Auto-approves all confirmations for streamlined implementation workflow.
|
||||
|
||||
**Purpose**: Execute implementation tasks using intelligent context inference and CLI tools with full permissions.
|
||||
Execute implementation tasks with YOLO permissions (auto-approves all confirmations).
|
||||
|
||||
**Supported Tools**: codex, gemini (default), qwen
|
||||
**Reference**: @~/.claude/workflows/intelligent-tools-strategy.md for complete tool details
|
||||
|
||||
**Core Guidelines**: @~/.claude/workflows/intelligent-tools-strategy.md
|
||||
## YOLO Permissions
|
||||
|
||||
## 🚨 YOLO Permissions
|
||||
Auto-approves: file pattern inference, execution, file modifications, summary generation
|
||||
|
||||
**All confirmations auto-approved by default:**
|
||||
- ✅ File pattern inference confirmation
|
||||
- ✅ Gemini execution confirmation
|
||||
- ✅ File modification confirmation
|
||||
- ✅ Implementation summary generation
|
||||
## Enhancement Integration
|
||||
|
||||
## 🎯 Enhancement Integration
|
||||
**When `--enhance` flag present** (Description Mode only): Execute `/enhance-prompt "[description]"` first, then use enhanced output (INTENT/CONTEXT/ACTION) for execution.
|
||||
|
||||
**When `--enhance` flag present** (for Description Mode only):
|
||||
```bash
|
||||
# Step 1: Enhance the description
|
||||
SlashCommand(command="/enhance-prompt \"[description]\"")
|
||||
|
||||
# Step 2: Use enhanced output for execution
|
||||
# Enhanced output provides:
|
||||
# - INTENT: Clear technical goal
|
||||
# - CONTEXT: Session memory + codebase patterns
|
||||
# - ACTION: Specific implementation steps
|
||||
# - ATTENTION: Critical constraints
|
||||
```
|
||||
|
||||
**Example**:
|
||||
```bash
|
||||
# User: /gemini:execute --enhance "fix login"
|
||||
|
||||
# Step 1: Enhance
|
||||
/enhance-prompt "fix login"
|
||||
# Returns:
|
||||
# INTENT: Debug authentication failure in login flow
|
||||
# CONTEXT: JWT auth in src/auth/, known token expiry issue
|
||||
# ACTION: Fix token validation → update refresh logic → test flow
|
||||
# ATTENTION: Preserve existing session management
|
||||
|
||||
# Step 2: Execute with enhanced context
|
||||
gemini --all-files -p "@{src/auth/**/*} @{CLAUDE.md}
|
||||
Implementation: Debug authentication failure in login flow
|
||||
Focus: Token validation, refresh logic, test flow
|
||||
Constraints: Preserve existing session management"
|
||||
```
|
||||
|
||||
**Note**: `--enhance` only applies to Description Mode. Task ID Mode uses task JSON directly.
|
||||
**Note**: Task ID Mode uses task JSON directly (no enhancement).
|
||||
|
||||
## Execution Modes
|
||||
|
||||
### 1. Description Mode (supports --enhance)
|
||||
**Input**: Natural language description
|
||||
```bash
|
||||
/gemini:execute "implement JWT authentication with middleware"
|
||||
/gemini:execute --enhance "implement JWT authentication with middleware"
|
||||
```
|
||||
**Process**: [Optional: Enhance] → Keyword analysis → Pattern inference → Context collection → Execution
|
||||
**1. Description Mode** (supports `--enhance`):
|
||||
- Input: Natural language description
|
||||
- Process: [Optional: Enhance] → Keyword analysis → Pattern inference → Execute
|
||||
|
||||
### 2. Task ID Mode (no --enhance)
|
||||
**Input**: Workflow task identifier
|
||||
```bash
|
||||
/gemini:execute IMPL-001
|
||||
```
|
||||
**Process**: Task JSON parsing → Scope analysis → Context integration → Execution
|
||||
**2. Task ID Mode** (no `--enhance`):
|
||||
- Input: Workflow task identifier (e.g., `IMPL-001`)
|
||||
- Process: Task JSON parsing → Scope analysis → Execute
|
||||
|
||||
## Context Inference Logic
|
||||
## Context Inference
|
||||
|
||||
**Auto-selects relevant files based on:**
|
||||
Auto-selects files based on:
|
||||
- **Keywords**: "auth" → `@{**/*auth*,**/*user*}`
|
||||
- **Technology**: "React" → `@{src/**/*.{jsx,tsx}}`
|
||||
- **Task Type**: "api" → `@{**/api/**/*,**/routes/**/*}`
|
||||
- **Always includes**: `@{CLAUDE.md,**/*CLAUDE.md}`
|
||||
- **Always**: `@{CLAUDE.md,**/*CLAUDE.md}`
|
||||
|
||||
## Command Options
|
||||
## Options
|
||||
|
||||
| Option | Purpose |
|
||||
|--------|---------|
|
||||
| `--debug` | Verbose execution logging |
|
||||
| `--save-session` | Save complete execution session to workflow |
|
||||
- `--debug`: Verbose logging
|
||||
- `--save-session`: Save execution to workflow session
|
||||
|
||||
## Workflow Integration
|
||||
|
||||
### Session Management
|
||||
⚠️ **Auto-detects active session**: Checks `.workflow/.active-*` marker file
|
||||
**Session Management**: Auto-detects `.workflow/.active-*` marker
|
||||
- **Active**: Save to `.workflow/WFS-[id]/.chat/execute-[timestamp].md`
|
||||
- **None**: Create new session
|
||||
|
||||
**Session storage:**
|
||||
- **Active session exists**: Saves to `.workflow/WFS-[topic]/.chat/execute-[timestamp].md`
|
||||
- **No active session**: Creates new session directory
|
||||
**Task Integration**: Load from `.task/[TASK-ID].json`, update status, generate summary
|
||||
|
||||
### Task Integration
|
||||
## Command Template
|
||||
|
||||
**Gemini/Qwen** (with YOLO approval):
|
||||
```bash
|
||||
# Execute specific workflow task
|
||||
/gemini:execute IMPL-001
|
||||
|
||||
# Loads from: .task/IMPL-001.json
|
||||
# Uses: task context, brainstorming refs, scope definitions
|
||||
# Updates: workflow status, generates summary
|
||||
```
|
||||
|
||||
## Execution Templates
|
||||
|
||||
**Core Guidelines**: @~/.claude/workflows/intelligent-tools-strategy.md
|
||||
|
||||
### Permission Requirements
|
||||
|
||||
**Gemini Write Access** (when file modifications needed):
|
||||
- Add `--approval-mode yolo` flag for auto-approval
|
||||
- Required for: file creation, modification, deletion
|
||||
|
||||
### User Description Template
|
||||
```bash
|
||||
cd [target-directory] && ~/.claude/scripts/gemini-wrapper --approval-mode yolo -p "
|
||||
PURPOSE: [clear implementation goal from description]
|
||||
TASK: [specific implementation task]
|
||||
CONTEXT: @{inferred_patterns} @{CLAUDE.md,**/*CLAUDE.md}
|
||||
EXPECTED: Implementation code with file:line locations, test cases, integration guidance
|
||||
RULES: [template reference if applicable] | [constraints]
|
||||
cd [dir] && ~/.claude/scripts/[gemini|qwen]-wrapper --approval-mode yolo -p "
|
||||
PURPOSE: [implementation goal]
|
||||
TASK: [specific task]
|
||||
MODE: write
|
||||
CONTEXT: @{inferred_patterns} @{CLAUDE.md}
|
||||
EXPECTED: Implementation with file:line references
|
||||
RULES: $(cat ~/.claude/workflows/cli-templates/prompts/[category]/[template].txt) | [constraints]
|
||||
"
|
||||
```
|
||||
|
||||
**Example**:
|
||||
**Codex**:
|
||||
```bash
|
||||
cd . && ~/.claude/scripts/gemini-wrapper --approval-mode yolo -p "
|
||||
PURPOSE: Implement JWT authentication with middleware
|
||||
TASK: Create authentication system with token validation
|
||||
CONTEXT: @{**/*auth*,**/*middleware*} @{CLAUDE.md}
|
||||
EXPECTED: Auth service, middleware, tests with file modifications
|
||||
RULES: Follow existing auth patterns | Security best practices
|
||||
"
|
||||
codex -C [dir] --full-auto exec "
|
||||
PURPOSE: [implementation goal]
|
||||
TASK: [specific task]
|
||||
MODE: auto
|
||||
CONTEXT: @{inferred_patterns} @{CLAUDE.md}
|
||||
EXPECTED: Implementation with file:line references
|
||||
RULES: [constraints]
|
||||
" --skip-git-repo-check -s danger-full-access
|
||||
|
||||
# With image attachment
|
||||
codex -C [dir] -i design.png --full-auto exec "..." --skip-git-repo-check -s danger-full-access
|
||||
```
|
||||
|
||||
### Task ID Template
|
||||
```bash
|
||||
cd [task-directory] && ~/.claude/scripts/gemini-wrapper --approval-mode yolo -p "
|
||||
PURPOSE: [task_title]
|
||||
TASK: Execute [task-id] implementation
|
||||
CONTEXT: @{task_files} @{brainstorming_refs} @{CLAUDE.md,**/*CLAUDE.md}
|
||||
EXPECTED: Complete implementation following acceptance criteria
|
||||
RULES: $(cat [task_template]) | Task type: [task_type], Scope: [task_scope]
|
||||
"
|
||||
```
|
||||
## Examples
|
||||
|
||||
**Example**:
|
||||
```bash
|
||||
cd .workflow/WFS-123 && ~/.claude/scripts/gemini-wrapper --approval-mode yolo -p "
|
||||
PURPOSE: Implement user profile editing
|
||||
TASK: Execute IMPL-001 implementation
|
||||
CONTEXT: @{src/user/**/*} @{.brainstorming/product-owner/analysis.md} @{CLAUDE.md}
|
||||
EXPECTED: Profile edit API, UI components, validation, tests
|
||||
RULES: $(cat ~/.claude/workflows/cli-templates/prompts/development/feature.txt) | Type: feature, Scope: user module
|
||||
"
|
||||
/cli:execute "implement JWT authentication with middleware" # Description mode
|
||||
/cli:execute --enhance "implement JWT authentication" # Enhanced
|
||||
/cli:execute IMPL-001 # Task ID mode
|
||||
/cli:execute --tool codex "optimize database queries" # Codex execution
|
||||
```
|
||||
|
||||
## Auto-Generated Outputs
|
||||
|
||||
### 1. Implementation Summary
|
||||
**Location**: `.summaries/[TASK-ID]-summary.md` or auto-generated ID
|
||||
- **Summary**: `.summaries/[TASK-ID]-summary.md`
|
||||
- **Session**: `.chat/execute-[timestamp].md`
|
||||
|
||||
```markdown
|
||||
# Task Summary: [Task-ID] [Description]
|
||||
## Notes
|
||||
|
||||
## Implementation
|
||||
- **Files Modified**: [file:line references]
|
||||
- **Features Added**: [specific functionality]
|
||||
- **Context Used**: [inferred patterns]
|
||||
|
||||
## Integration
|
||||
- [Links to workflow documents]
|
||||
```
|
||||
|
||||
### 2. Execution Session
|
||||
**Location**: `.chat/execute-[timestamp].md`
|
||||
|
||||
```markdown
|
||||
# Execution Session: [Timestamp]
|
||||
|
||||
## Input
|
||||
[User description or Task ID]
|
||||
|
||||
## Context Inference
|
||||
[File patterns used with rationale]
|
||||
|
||||
## Implementation Results
|
||||
[Generated code and modifications]
|
||||
|
||||
## Status Updates
|
||||
[Workflow integration updates]
|
||||
```
|
||||
|
||||
## Error Handling
|
||||
|
||||
- **Task ID not found**: Lists available tasks
|
||||
- **Pattern inference failure**: Uses generic `src/**/*` pattern
|
||||
- **Execution failure**: Attempts fallback with simplified context
|
||||
- **File modification errors**: Reports specific file/permission issues
|
||||
|
||||
## Performance Features
|
||||
|
||||
- **Smart caching**: Frequently used pattern mappings
|
||||
- **Progressive inference**: Precise → broad pattern fallback
|
||||
- **Parallel execution**: When multiple contexts needed
|
||||
- **Directory optimization**: Switches to optimal execution path
|
||||
|
||||
## Integration Workflow
|
||||
|
||||
**Typical sequence:**
|
||||
1. `workflow:plan` → Creates tasks
|
||||
2. `/gemini:execute IMPL-001` → Executes with YOLO permissions
|
||||
3. Auto-updates workflow status and generates summaries
|
||||
4. `workflow:review` → Final validation
|
||||
|
||||
**vs. `/gemini:analyze`**: Execute performs analysis **and implementation**, analyze is read-only.
|
||||
**vs. `/cli:analyze`**: Execute performs implementation, analyze is read-only.
|
||||
|
||||
|
||||
7
.claude/version.json
Normal file
7
.claude/version.json
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"version": "3.3.0",
|
||||
"installation_mode": "Local",
|
||||
"installation_path": "D:\\Claude_dms3\\.claude",
|
||||
"source_branch": "main",
|
||||
"installation_date_utc": "2025-10-04T00:00:00Z"
|
||||
}
|
||||
@@ -265,6 +265,11 @@ For every development task:
|
||||
- **Permissions**: Requires explicit MODE=auto or MODE=write specification
|
||||
- **Default MODE**: No default, must be explicitly specified
|
||||
- **⚠️ Write Trigger**: Only when user explicitly requests "implement", "modify", "generate code" AND specifies MODE
|
||||
- **Session Management**:
|
||||
- `codex resume` - Resume previous interactive session (picker by default)
|
||||
- `codex exec "task" resume --last` - Continue most recent session with new task (maintains context)
|
||||
- `codex -i <image_file>` - Attach image(s) to initial prompt (useful for UI/design references)
|
||||
- **Multi-task Pattern**: First task uses `exec`, subsequent tasks use `exec "..." resume --last` for context continuity
|
||||
|
||||
### File Patterns
|
||||
- All files: `@{**/*}`
|
||||
|
||||
139
.codex/AGENTS.md
139
.codex/AGENTS.md
@@ -6,6 +6,8 @@
|
||||
|
||||
## Prompt Structure
|
||||
|
||||
### Single-Task Format
|
||||
|
||||
**Receive prompts in this format**:
|
||||
|
||||
```
|
||||
@@ -17,11 +19,37 @@ EXPECTED: [deliverables]
|
||||
RULES: [constraints and templates]
|
||||
```
|
||||
|
||||
### Multi-Task Format (Subtask Execution)
|
||||
|
||||
**First subtask** (creates new session):
|
||||
```
|
||||
PURPOSE: [overall goal]
|
||||
TASK: [subtask 1 description]
|
||||
MODE: auto
|
||||
CONTEXT: [file patterns]
|
||||
EXPECTED: [subtask deliverables]
|
||||
RULES: [constraints]
|
||||
Subtask 1 of N: [subtask title]
|
||||
```
|
||||
|
||||
**Subsequent subtasks** (continues via `resume --last`):
|
||||
```
|
||||
CONTINUE TO NEXT SUBTASK:
|
||||
Subtask N of M: [subtask title]
|
||||
|
||||
PURPOSE: [continuation goal]
|
||||
TASK: [subtask N description]
|
||||
CONTEXT: Previous work completed, now focus on [new files]
|
||||
EXPECTED: [subtask deliverables]
|
||||
RULES: Build on previous subtask, maintain consistency
|
||||
```
|
||||
|
||||
## Execution Requirements
|
||||
|
||||
### ALWAYS
|
||||
|
||||
- **Parse all six fields** - Understand PURPOSE, TASK, MODE, CONTEXT, EXPECTED, RULES
|
||||
- **Parse all fields** - Understand PURPOSE, TASK, MODE, CONTEXT, EXPECTED, RULES
|
||||
- **Detect subtask format** - Check for "Subtask N of M" or "CONTINUE TO NEXT SUBTASK"
|
||||
- **Follow MODE strictly** - Respect execution boundaries
|
||||
- **Study CONTEXT files** - Find 3+ similar patterns before implementing
|
||||
- **Apply RULES** - Follow templates and constraints exactly
|
||||
@@ -29,6 +57,7 @@ RULES: [constraints and templates]
|
||||
- **Commit incrementally** - Small, working commits
|
||||
- **Match project style** - Follow existing patterns exactly
|
||||
- **Validate EXPECTED** - Ensure all deliverables are met
|
||||
- **Report context** (subtasks) - Summarize key info for next subtask
|
||||
|
||||
### NEVER
|
||||
|
||||
@@ -49,7 +78,7 @@ RULES: [constraints and templates]
|
||||
- Run tests and builds
|
||||
- Commit code incrementally
|
||||
|
||||
**Execute**:
|
||||
**Execute (Single Task)**:
|
||||
1. Parse PURPOSE and TASK
|
||||
2. Analyze CONTEXT files - find 3+ similar patterns
|
||||
3. Plan implementation approach
|
||||
@@ -60,7 +89,17 @@ RULES: [constraints and templates]
|
||||
8. Validate all EXPECTED deliverables
|
||||
9. Report results
|
||||
|
||||
**Use For**: Feature implementation, bug fixes, refactoring
|
||||
**Execute (Multi-Task/Subtask)**:
|
||||
1. **First subtask**: Follow single-task flow above
|
||||
2. **Subsequent subtasks** (via `resume --last`):
|
||||
- Recall context from previous subtask(s)
|
||||
- Build on previous work (don't repeat)
|
||||
- Maintain consistency with previous decisions
|
||||
- Focus on current subtask scope only
|
||||
- Test integration with previous subtasks
|
||||
- Report subtask completion status
|
||||
|
||||
**Use For**: Feature implementation, bug fixes, refactoring, multi-step tasks
|
||||
|
||||
### MODE: write
|
||||
|
||||
@@ -119,7 +158,7 @@ RULES: [constraints and templates]
|
||||
|
||||
## Progress Reporting
|
||||
|
||||
### During Execution
|
||||
### During Execution (Single Task)
|
||||
|
||||
```
|
||||
[1/5] Analyzing existing code patterns...
|
||||
@@ -129,7 +168,17 @@ RULES: [constraints and templates]
|
||||
[5/5] Running validation...
|
||||
```
|
||||
|
||||
### On Success
|
||||
### During Execution (Subtask)
|
||||
|
||||
```
|
||||
[Subtask N/M: Subtask Title]
|
||||
[1/4] Recalling context from previous subtasks...
|
||||
[2/4] Implementing current subtask...
|
||||
[3/4] Testing integration with previous work...
|
||||
[4/4] Validating subtask completion...
|
||||
```
|
||||
|
||||
### On Success (Single Task)
|
||||
|
||||
```
|
||||
✅ Task completed
|
||||
@@ -146,6 +195,26 @@ Validation:
|
||||
Next Steps: [recommendations]
|
||||
```
|
||||
|
||||
### On Success (Subtask)
|
||||
|
||||
```
|
||||
✅ Subtask N/M completed
|
||||
|
||||
Changes:
|
||||
- Created: [files]
|
||||
- Modified: [files]
|
||||
|
||||
Integration:
|
||||
✅ Compatible with previous subtasks
|
||||
✅ Tests: [count] passing
|
||||
✅ Build: Success
|
||||
|
||||
Context for next subtask:
|
||||
- [Key decisions made]
|
||||
- [Files created/modified]
|
||||
- [Patterns established]
|
||||
```
|
||||
|
||||
### On Partial Completion
|
||||
|
||||
```
|
||||
@@ -178,6 +247,60 @@ Recommendation: [next steps]
|
||||
- Graceful degradation
|
||||
- Don't expose sensitive info
|
||||
|
||||
## Multi-Step Task Execution
|
||||
|
||||
### Context Continuity via Resume
|
||||
|
||||
When executing subtasks via `codex exec "..." resume --last`:
|
||||
|
||||
**Advantages**:
|
||||
- Session memory preserves previous decisions
|
||||
- Maintains implementation style consistency
|
||||
- Avoids redundant context re-injection
|
||||
- Enables incremental testing and validation
|
||||
|
||||
**Best Practices**:
|
||||
1. **First subtask**: Establish patterns and architecture
|
||||
2. **Subsequent subtasks**: Build on established patterns
|
||||
3. **Test integration**: After each subtask, verify compatibility
|
||||
4. **Report context**: Summarize key decisions for next subtask
|
||||
5. **Maintain scope**: Focus only on current subtask goals
|
||||
|
||||
### Subtask Coordination
|
||||
|
||||
**DO**:
|
||||
- Remember decisions from previous subtasks
|
||||
- Reuse patterns established earlier
|
||||
- Test integration with previous work
|
||||
- Report what's ready for next subtask
|
||||
|
||||
**DON'T**:
|
||||
- Re-implement what previous subtasks completed
|
||||
- Change patterns established earlier (unless explicitly requested)
|
||||
- Skip testing integration points
|
||||
- Assume next subtask's requirements
|
||||
|
||||
### Example Flow
|
||||
|
||||
```
|
||||
Subtask 1: Create data models
|
||||
→ Establishes: Schema patterns, validation approach
|
||||
→ Delivers: Models with tests
|
||||
→ Context for next: Model structure, validation rules
|
||||
|
||||
Subtask 2: Implement API endpoints (resume --last)
|
||||
→ Recalls: Model structure from subtask 1
|
||||
→ Builds on: Uses established models
|
||||
→ Delivers: API with integration tests
|
||||
→ Context for next: API patterns, error handling
|
||||
|
||||
Subtask 3: Add authentication (resume --last)
|
||||
→ Recalls: API patterns from subtask 2
|
||||
→ Integrates: Auth middleware into existing endpoints
|
||||
→ Delivers: Secured API
|
||||
→ Final validation: Full integration test
|
||||
```
|
||||
|
||||
## Philosophy
|
||||
|
||||
- **Incremental progress over big bangs** - Small, testable changes
|
||||
@@ -186,6 +309,7 @@ Recommendation: [next steps]
|
||||
- **Clear intent over clever code** - Boring, obvious solutions
|
||||
- **Simple over complex** - Avoid over-engineering
|
||||
- **Follow existing style** - Match project patterns exactly
|
||||
- **Context continuity** - Leverage resume for multi-step consistency
|
||||
|
||||
## Execution Checklist
|
||||
|
||||
@@ -211,5 +335,6 @@ Recommendation: [next steps]
|
||||
|
||||
---
|
||||
|
||||
**Version**: 2.0.0
|
||||
**Last Updated**: 2025-10-02
|
||||
**Version**: 2.1.0
|
||||
**Last Updated**: 2025-10-04
|
||||
**Changes**: Added multi-step task execution support with resume mechanism
|
||||
|
||||
116
CHANGELOG.md
116
CHANGELOG.md
@@ -5,6 +5,122 @@ All notable changes to Claude Code Workflow (CCW) will be documented in this fil
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [3.3.0] - 2025-10-04
|
||||
|
||||
### 🚀 CLI Tool Enhancements & Codex Multi-Step Execution
|
||||
|
||||
This release streamlines CLI tool documentation and introduces automated multi-step task execution with Codex.
|
||||
|
||||
#### Added
|
||||
|
||||
**New Command: `/cli:codex-execute`**:
|
||||
- **Purpose**: Automated task decomposition and sequential execution with Codex
|
||||
- **Features**:
|
||||
- Automatic task breakdown into 3-8 manageable subtasks
|
||||
- Sequential execution using `codex exec "..." resume --last` mechanism
|
||||
- TodoWrite progress tracking for each subtask
|
||||
- Optional Git verification after each subtask (`--verify-git` flag)
|
||||
- Supports both freeform descriptions and workflow task IDs
|
||||
- Automatic detection and loading of task JSON files
|
||||
- Context continuity across subtasks via resume mechanism
|
||||
- Integration with workflow system (optional)
|
||||
|
||||
**Codex Resume Mechanism**:
|
||||
- **First Subtask**: Creates new Codex session with `codex exec`
|
||||
- **Subsequent Subtasks**: Continues with `codex exec "..." resume --last`
|
||||
- **Benefits**:
|
||||
- Session memory preserves previous decisions
|
||||
- Maintains implementation style consistency
|
||||
- Avoids redundant context re-injection
|
||||
- Enables incremental testing and validation
|
||||
|
||||
**Enhanced Codex Agent Configuration** (`.codex/AGENTS.md`):
|
||||
- Added multi-task prompt format (Single-Task & Multi-Task)
|
||||
- Enhanced MODE: auto with subtask execution flow
|
||||
- New "Multi-Step Task Execution" section with:
|
||||
- Context continuity best practices
|
||||
- Subtask coordination guidelines
|
||||
- Example 3-subtask workflow demonstration
|
||||
- Updated progress reporting for subtasks
|
||||
- Version 2.1.0 with multi-step task execution support
|
||||
|
||||
#### Changed
|
||||
|
||||
**CLI Documentation Optimization**:
|
||||
- **Streamlined Documentation**: Reduced redundancy by referencing `intelligent-tools-strategy.md`
|
||||
- **Updated Commands**:
|
||||
- `/cli:analyze` - Simplified from ~200 to ~78 lines
|
||||
- `/cli:chat` - Simplified from ~161 to ~92 lines
|
||||
- `/cli:execute` - Simplified from ~235 to ~111 lines
|
||||
- **Unified Command Templates**:
|
||||
- Separated Gemini/Qwen (uses `-p` parameter) from Codex (uses `exec` command)
|
||||
- Added Codex `-i` parameter documentation for image attachment
|
||||
- Consistent template structure across all CLI commands
|
||||
|
||||
**Intelligent Tools Strategy Updates**:
|
||||
- Enhanced Codex session management documentation
|
||||
- Added `codex exec "..." resume --last` syntax explanation
|
||||
- Documented multi-task execution pattern
|
||||
- Clarified image attachment workflow with resume
|
||||
|
||||
**Command Template Improvements**:
|
||||
- **Gemini/Qwen**: `cd [dir] && ~/.claude/scripts/[tool]-wrapper -p "..."`
|
||||
- **Codex**: `codex -C [dir] --full-auto exec "..." --skip-git-repo-check -s danger-full-access`
|
||||
- **Codex with Resume**: `codex exec "..." resume --last --skip-git-repo-check -s danger-full-access`
|
||||
- **Image Support**: `codex -C [dir] -i image.png --full-auto exec "..."`
|
||||
|
||||
#### Technical Details
|
||||
|
||||
**Multi-Step Execution Flow**:
|
||||
```
|
||||
Input → Parse (Description/Task ID) → Decompose into Subtasks → TodoWrite Tracking →
|
||||
For Each Subtask:
|
||||
1. Execute with Codex (first: exec, subsequent: exec resume --last)
|
||||
2. [Optional] Git verification
|
||||
3. Mark complete in TodoWrite
|
||||
→ Final Summary
|
||||
```
|
||||
|
||||
**Subtask Decomposition Criteria**:
|
||||
- Each subtask: 5-15 minutes completable
|
||||
- Clear, testable outcomes
|
||||
- Explicit dependencies
|
||||
- Focused file scope (1-5 files per subtask)
|
||||
|
||||
**Error Handling**:
|
||||
- Subtask failure: Pause for user intervention
|
||||
- Git verification failure: Request user decision
|
||||
- Codex session lost: Attempt retry with fresh session
|
||||
|
||||
**Integration Features**:
|
||||
- Automatic task ID detection (e.g., `IMPL-001`, `TASK-123`)
|
||||
- JSON task loading from `.task/[ID].json`
|
||||
- Execution logging to `.chat/codex-execute-[timestamp].md`
|
||||
- Summary generation to `.summaries/[TASK-ID]-summary.md`
|
||||
|
||||
#### Benefits
|
||||
|
||||
**Developer Experience**:
|
||||
- 🚀 Automated task breakdown reduces planning overhead
|
||||
- 📊 Clear progress tracking with TodoWrite integration
|
||||
- 🔄 Context continuity improves code consistency
|
||||
- ✅ Optional Git verification ensures code quality
|
||||
- 🎯 Focused subtask execution reduces complexity
|
||||
|
||||
**Code Quality**:
|
||||
- 🧪 Incremental testing after each subtask
|
||||
- 🔍 Git verification catches unexpected changes
|
||||
- 📝 Comprehensive execution logs for audit trail
|
||||
- 🎨 Image attachment support for UI/design tasks
|
||||
|
||||
**Documentation**:
|
||||
- 📚 Reduced documentation redundancy by ~60%
|
||||
- 🔗 Clear references to master documentation
|
||||
- ✨ Consistent command structure across all CLI tools
|
||||
- 📖 Better separation of concerns (strategy vs. command docs)
|
||||
|
||||
---
|
||||
|
||||
## [3.2.3] - 2025-10-03
|
||||
|
||||
### ✨ Version Management System
|
||||
|
||||
19
README.md
19
README.md
@@ -2,7 +2,7 @@
|
||||
|
||||
<div align="center">
|
||||
|
||||
[](https://github.com/catlog22/Claude-Code-Workflow/releases)
|
||||
[](https://github.com/catlog22/Claude-Code-Workflow/releases)
|
||||
[](LICENSE)
|
||||
[]()
|
||||
[](https://github.com/modelcontextprotocol)
|
||||
@@ -15,14 +15,15 @@
|
||||
|
||||
**Claude Code Workflow (CCW)** is a next-generation multi-agent automation framework that orchestrates complex software development tasks through intelligent workflow management and autonomous execution.
|
||||
|
||||
> **🎉 Latest: v3.2.3** - Version management system with upgrade notifications. See [CHANGELOG.md](CHANGELOG.md) for details.
|
||||
> **🎉 Latest: v3.3.0** - CLI tool enhancements & Codex multi-step execution. See [CHANGELOG.md](CHANGELOG.md) for details.
|
||||
>
|
||||
> **What's New in v3.2.3**:
|
||||
> - 🔍 New `/version` command for checking installed versions
|
||||
> - 📊 GitHub API integration for latest release detection
|
||||
> - 🔄 Automatic upgrade notifications and recommendations
|
||||
> - 📁 Version tracking in both local and global installations
|
||||
> - ⚡ Quick version check with comprehensive status display
|
||||
> **What's New in v3.3.0**:
|
||||
> - 🚀 New `/cli:codex-execute` command for automated multi-step task execution
|
||||
> - 🔄 Codex resume mechanism (`codex exec "..." resume --last`) for context continuity
|
||||
> - 📋 TodoWrite progress tracking for subtask execution
|
||||
> - 📚 Streamlined CLI documentation (60% reduction in redundancy)
|
||||
> - 🔧 Enhanced Codex agent configuration for multi-task workflows
|
||||
> - ✅ Optional Git verification after each subtask completion
|
||||
|
||||
---
|
||||
|
||||
@@ -342,7 +343,7 @@ MCP (Model Context Protocol) tools provide advanced codebase analysis. **Complet
|
||||
|
||||
| MCP Server | Purpose | Installation Guide |
|
||||
|------------|---------|-------------------|
|
||||
| **Exa MCP** | External API patterns & best practices | [Install Guide](https://github.com/exa-labs/exa-mcp-server) |
|
||||
| **Exa MCP** | External API patterns & best practices | [Install Guide](https://smithery.ai/server/exa) |
|
||||
| **Code Index MCP** | Advanced internal code search | [Install Guide](https://github.com/johnhuang316/code-index-mcp) |
|
||||
|
||||
#### Benefits When Enabled
|
||||
|
||||
19
README_CN.md
19
README_CN.md
@@ -2,7 +2,7 @@
|
||||
|
||||
<div align="center">
|
||||
|
||||
[](https://github.com/catlog22/Claude-Code-Workflow/releases)
|
||||
[](https://github.com/catlog22/Claude-Code-Workflow/releases)
|
||||
[](LICENSE)
|
||||
[]()
|
||||
[](https://github.com/modelcontextprotocol)
|
||||
@@ -15,14 +15,15 @@
|
||||
|
||||
**Claude Code Workflow (CCW)** 是一个新一代的多智能体自动化开发框架,通过智能工作流管理和自主执行来协调复杂的软件开发任务。
|
||||
|
||||
> **🎉 最新版本: v3.2.3** - 版本管理系统与升级通知。详见 [CHANGELOG.md](CHANGELOG.md)。
|
||||
> **🎉 最新版本: v3.3.0** - CLI 工具增强与 Codex 多步骤执行。详见 [CHANGELOG.md](CHANGELOG.md)。
|
||||
>
|
||||
> **v3.2.3 版本新特性**:
|
||||
> - 🔍 新增 `/version` 命令用于检查已安装版本
|
||||
> - 📊 GitHub API 集成,获取最新版本信息
|
||||
> - 🔄 自动升级通知与建议
|
||||
> - 📁 支持本地和全局安装的版本跟踪
|
||||
> - ⚡ 一键版本检查,全面展示状态信息
|
||||
> **v3.3.0 版本新特性**:
|
||||
> - 🚀 新增 `/cli:codex-execute` 命令,实现自动化多步骤任务执行
|
||||
> - 🔄 Codex resume 机制(`codex exec "..." resume --last`),保持上下文连续性
|
||||
> - 📋 TodoWrite 进度跟踪,监控子任务执行状态
|
||||
> - 📚 精简 CLI 文档(减少 60% 冗余内容)
|
||||
> - 🔧 增强 Codex 智能体配置,支持多任务工作流
|
||||
> - ✅ 可选的 Git 验证,每个子任务完成后检查代码变更
|
||||
|
||||
---
|
||||
|
||||
@@ -342,7 +343,7 @@ MCP (模型上下文协议) 工具提供高级代码库分析。**完全可选**
|
||||
|
||||
| MCP 服务器 | 用途 | 安装指南 |
|
||||
|------------|------|---------|
|
||||
| **Exa MCP** | 外部 API 模式和最佳实践 | [安装指南](https://github.com/exa-labs/exa-mcp-server) |
|
||||
| **Exa MCP** | 外部 API 模式和最佳实践 | [安装指南](https://smithery.ai/server/exahttps://smithery.ai/server/exa) |
|
||||
| **Code Index MCP** | 高级内部代码搜索 | [安装指南](https://github.com/johnhuang316/code-index-mcp) |
|
||||
|
||||
#### 启用后的好处
|
||||
|
||||
Reference in New Issue
Block a user