feat: Add Codex CLI support as alternative analysis method in workflow system

## Major Changes
- Add --AM flag to /workflow:plan command for analysis method selection
- Support both Gemini CLI (pattern-based) and Codex CLI (autonomous) analysis
- Implement dual marker system: [GEMINI_CLI_REQUIRED] and [CODEX_CLI_REQUIRED]
- Update all 4 agents to handle both analysis markers
- Create analysis method templates for standardized CLI usage

## Files Modified
- workflow-architecture.md: Add Analysis Method Integration section
- plan.md: Add --AM flag and bilingual rule standardization
- execute.md: Update marker mapping logic and standardize to English
- 4 agent files: Add dual CLI support with usage guidelines
- New: analysis-methods/ templates for Gemini and Codex CLI

## Backward Compatibility
- Gemini CLI remains default analysis method
- Existing workflows continue to work unchanged
- Progressive enhancement for autonomous development scenarios

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

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
catlog22
2025-09-12 23:40:12 +08:00
parent 2038d83398
commit 685c0f7f79
7 changed files with 215 additions and 56 deletions

View File

@@ -23,15 +23,19 @@ The intelligent execution approach focuses on:
- **Dynamic task orchestration** - Coordinate based on discovered task relationships
- **Progress tracking** - Update task status after agent completion
**GEMINI_CLI_REQUIRED Marker**:
- **Purpose**: Forces agent to analyze existing codebase before implementation
- **Auto-trigger**: When task.analysis_source = "gemini" OR scope > 3 files
- **Agent Action**: MUST execute Gemini CLI as first step
**Analysis Markers**:
- **[GEMINI_CLI_REQUIRED]**: Forces agent to use Gemini CLI for pattern-based codebase analysis
- **Auto-trigger**: When task.analysis_source = "gemini" OR scope > 3 files (default)
- **Agent Action**: MUST execute Gemini CLI as first step
- **[CODEX_CLI_REQUIRED]**: Forces agent to use Codex CLI for autonomous development analysis
- **Auto-trigger**: When task.analysis_source = "codex"
- **Agent Action**: MUST execute Codex CLI in autonomous mode as first step
**analysis_source 到标记的映射**:
- **"gemini"** → 添加 [GEMINI_CLI_REQUIRED]
- **"auto-detected"** + scope > 3 files → 添加 [GEMINI_CLI_REQUIRED]
- **"manual"** → 不添加标记
**analysis_source to Marker Mapping**:
- **"gemini"** → Add [GEMINI_CLI_REQUIRED]
- **"codex"** → Add [CODEX_CLI_REQUIRED]
- **"auto-detected"** + scope > 3 files → Add [GEMINI_CLI_REQUIRED] (default)
- **"manual"** → No marker added
## Execution Flow
@@ -62,11 +66,13 @@ Workflow Discovery:
## Execution Plan
- [ ] **TASK-001**: [Agent: planning-agent] [GEMINI_CLI_REQUIRED] Design auth schema (impl-1.1)
- [ ] **TASK-002**: [Agent: code-developer] [GEMINI_CLI_REQUIRED] Implement auth logic (impl-1.2)
- [ ] **TASK-002**: [Agent: code-developer] [CODEX_CLI_REQUIRED] Implement auth logic (impl-1.2)
- [ ] **TASK-003**: [Agent: code-review-agent] Review implementations
- [ ] **TASK-004**: Update task statuses and session state
**Marker Legend**: [GEMINI_CLI_REQUIRED] = Agent must analyze codebase context first
**Marker Legend**:
- [GEMINI_CLI_REQUIRED] = Agent must use Gemini CLI for pattern analysis
- [CODEX_CLI_REQUIRED] = Agent must use Codex CLI for autonomous analysis
```
### 3. Agent Context Assignment

View File

@@ -20,7 +20,19 @@ Creates actionable implementation plans with intelligent input source detection.
## Usage
```bash
/workflow/plan <input>
/workflow:plan [--AM gemini|codex] <input>
```
### Analysis Method Flag (--AM)
Optional flag to specify which CLI tool to use for context analysis:
- **gemini** (default): Uses Gemini CLI for pattern-based analysis and architectural understanding
- **codex**: Uses Codex CLI for autonomous development context gathering with intelligent file discovery
**Examples**:
```bash
/workflow:plan --AM codex "Build authentication system"
/workflow:plan --AM gemini requirements.md
/workflow:plan ISS-001 # Uses default (gemini)
```
## Input Detection Logic
@@ -83,30 +95,42 @@ The command automatically detects input type:
### Implementation Field Requirements
⚠️ **CRITICAL**: All generated tasks must include detailed implementation guidance
**analysis_source 赋值规则**:
- **"manual"**: 用户提供完整实现细节(包含具体文件、代码片段)
- **"gemini"**: 信息不足,需要 Gemini 分析(缺少文件路径或代码上下文)
- **"auto-detected"**: 系统自动推断实现细节(基于模式识别)
**analysis_source Assignment Rules**:
- **"manual"**: User provides complete implementation details (including specific files and code snippets)
- **"gemini"**: Insufficient information, requires Gemini analysis (missing file paths or code context)
- **"codex"**: Insufficient information, requires Codex autonomous development analysis (complex refactoring or intelligent file discovery)
- **"auto-detected"**: System automatically infers implementation details (based on pattern recognition)
**判断流程**:
1. **IF** 用户提供文件路径 + 代码片段 → "manual"
2. **ELIF** 系统能推断实现位置 → "auto-detected"
3. **ELSE** → "gemini" (需要深度分析)
**Decision Flow**:
1. **IF** user provides file paths + code snippets → "manual"
2. **ELIF** system can infer implementation location → "auto-detected"
3. **ELIF** --AM codex specified → "codex" (requires autonomous development analysis)
4. **ELSE** → "gemini" (requires deep analysis, default method)
**Auto-fill Strategy**:
1. **Sufficient Information**: Auto-fill implementation field based on user input and project context
2. **Insufficient Information**: Mark analysis_source as "gemini" and prompt:
2. **Insufficient Information**: Mark analysis_source appropriately and prompt:
**For Gemini Analysis (default)**:
```
⚠️ Implementation details incomplete, recommend using gemini analysis:
gemini --all-files -p "@{relevant-file-patterns} @{CLAUDE.md}
Analyze task: [task description]
Extract: 1) File locations and code snippets 2) Modification logic and data flow 3) Risks and dependencies"
```
**For Codex Analysis (when --AM codex specified)**:
```
⚠️ Implementation details incomplete, recommend using codex analysis:
codex --full-auto exec "Analyze and implement: [task description]
Context: Autonomous analysis and implementation guidance needed
Extract: 1) Intelligent file discovery 2) Implementation strategy 3) Autonomous development approach"
```
**Required Implementation Sub-fields**:
- **files**: Must contain at least 1 file with detailed info (path, location, original_code, modifications)
- **context_notes**: Dependencies, risks, performance considerations
- **analysis_source**: manual|gemini|auto-detected
- **analysis_source**: manual|gemini|codex|auto-detected
**Quality Standards**:
- logic_flow must use specified symbols (───►, ◊───, ◄───)