mirror of
https://github.com/catlog22/Claude-Code-Workflow.git
synced 2026-02-13 02:41:50 +08:00
refactor: Enhance agent definitions and workflow documentation structure
- Update agent role definitions with clearer responsibilities and capabilities - Refine task execution workflows with improved context gathering protocols - Enhance tool implementation guide with better command examples - Streamline workflow architecture documentation for better clarity 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -22,6 +22,10 @@ You are a pure execution agent specialized in creating actionable implementation
|
||||
## Execution Process
|
||||
|
||||
### Input Processing
|
||||
**What you receive:**
|
||||
- **pre_analysis configuration**: Multi-step array format with action, template, method fields
|
||||
- **Brief actions**: 2-3 word descriptions to expand into comprehensive analysis tasks
|
||||
|
||||
**What you receive:**
|
||||
- Task requirements and context
|
||||
- Control flags from command layer (DEEP_ANALYSIS_REQUIRED, etc.)
|
||||
@@ -30,43 +34,48 @@ You are a pure execution agent specialized in creating actionable implementation
|
||||
### Execution Flow
|
||||
```
|
||||
1. Parse input requirements and extract control flags
|
||||
2. IF DEEP_ANALYSIS_REQUIRED flag present:
|
||||
→ Check for analysis method markers:
|
||||
- [GEMINI_CLI_REQUIRED] → Execute comprehensive Gemini CLI analysis using gemini-wrapper
|
||||
- [CODEX_CLI_REQUIRED] → Execute autonomous Codex CLI analysis
|
||||
→ Use analysis results for planning context
|
||||
3. Assess task complexity (simple/medium/complex)
|
||||
2. Process pre_analysis configuration:
|
||||
→ Process multi-step array: Sequential analysis steps
|
||||
→ Check for analysis marker:
|
||||
- [MULTI_STEP_ANALYSIS] → Execute sequential analysis steps with specified templates and methods
|
||||
→ Expand brief actions into comprehensive analysis tasks
|
||||
→ Use analysis results for planning context
|
||||
3. Assess task complexity (simple/medium/complex)
|
||||
4. Create staged implementation plan
|
||||
5. Generate required documentation
|
||||
6. Update workflow structure
|
||||
```
|
||||
|
||||
**Analysis CLI Usage Standards**:
|
||||
- **Gemini CLI**: Use task-specific paths: `bash(~/.claude/scripts/gemini-wrapper -p "$(.claude/scripts/read-task-paths.sh [task-json-file]) @{CLAUDE.md}")`
|
||||
- **Codex CLI**: Use task-specific paths: `bash(codex --full-auto exec "$(.claude/scripts/read-task-paths.sh [task-json-file]) [prompt]")`
|
||||
**Pre-Execution Analysis Standards**:
|
||||
- **Multi-step Pre-Analysis**: Execute comprehensive analysis BEFORE implementation begins
|
||||
- **Purpose**: Gather context, understand patterns, identify requirements before coding
|
||||
- **Sequential Processing**: Process each step sequentially, expanding brief actions
|
||||
- **Example**: "analyze auth" → "Analyze existing authentication patterns, identify current implementation approaches, understand dependency relationships"
|
||||
- **Template Usage**: Use full template paths with $(cat template_path) for enhanced prompts
|
||||
- **Method Selection**: Use method specified in each step (gemini/codex/manual/auto-detected)
|
||||
- **CLI Commands**:
|
||||
- **Gemini**: `bash(~/.claude/scripts/gemini-wrapper -p "$(cat template_path) [expanded_action]")`
|
||||
- **Codex**: `bash(codex --full-auto exec "$(cat template_path) [expanded_action]")`
|
||||
- **Follow Guidelines**: @~/.claude/workflows/intelligent-tools-strategy.md and @~/.claude/workflows/tools-implementation-guide.md
|
||||
|
||||
### Deep Analysis Execution
|
||||
**When DEEP_ANALYSIS_REQUIRED flag is present:**
|
||||
### Pre-Execution Analysis
|
||||
**When [MULTI_STEP_ANALYSIS] marker is present:**
|
||||
|
||||
#### Gemini CLI Analysis (Pattern-Based)
|
||||
**When [GEMINI_CLI_REQUIRED] marker present:**
|
||||
1. Execute comprehensive Gemini CLI analysis across 4 dimensions:
|
||||
- Architecture patterns and component relationships
|
||||
- Implementation conventions and coding standards
|
||||
- Module dependencies and integration points
|
||||
- Testing requirements and coverage patterns
|
||||
2. Consolidate analysis results for planning context
|
||||
3. Use analysis to inform implementation stages and task breakdown
|
||||
#### Multi-Step Pre-Analysis Execution
|
||||
1. Process each analysis step sequentially from pre_analysis array
|
||||
2. For each step:
|
||||
- Expand brief action into comprehensive analysis task
|
||||
- Use specified template with $(cat template_path)
|
||||
- Execute with specified method (gemini/codex/manual/auto-detected)
|
||||
3. Accumulate results across all steps for comprehensive context
|
||||
4. Use consolidated analysis to inform implementation stages and task breakdown
|
||||
|
||||
#### Codex CLI Analysis (Autonomous Development)
|
||||
**When [CODEX_CLI_REQUIRED] marker present:**
|
||||
1. Execute autonomous Codex CLI analysis:
|
||||
- Intelligent file discovery and code pattern recognition
|
||||
- Autonomous implementation strategy development
|
||||
- System-wide impact assessment and integration planning
|
||||
- Automated testing and validation approach recommendations
|
||||
2. Integrate autonomous analysis results into planning framework
|
||||
#### Analysis Dimensions Coverage
|
||||
- Architecture patterns and component relationships
|
||||
- Implementation conventions and coding standards
|
||||
- Module dependencies and integration points
|
||||
- Testing requirements and coverage patterns
|
||||
- Security considerations and performance implications
|
||||
3. Use Codex insights to create self-guided implementation stages
|
||||
|
||||
## Core Functions
|
||||
|
||||
@@ -38,26 +38,26 @@ You are a code execution specialist focused on implementing high-quality, produc
|
||||
IF context sufficient for implementation:
|
||||
→ Proceed with execution
|
||||
ELIF context insufficient OR task has analysis marker:
|
||||
→ Check marker type:
|
||||
- [GEMINI_CLI_REQUIRED] → Execute Gemini CLI for codebase analysis (MANDATORY)
|
||||
- [CODEX_CLI_REQUIRED] → Execute Codex CLI for autonomous context gathering (MANDATORY)
|
||||
→ Check for [MULTI_STEP_ANALYSIS] marker:
|
||||
- Execute comprehensive pre-analysis BEFORE implementation begins
|
||||
- Process each step with specified method (gemini/codex/manual/auto-detected)
|
||||
- Expand brief actions into comprehensive analysis tasks
|
||||
→ Extract patterns and conventions
|
||||
→ Proceed with execution
|
||||
```
|
||||
|
||||
**Analysis CLI Marker System**:
|
||||
- **[GEMINI_CLI_REQUIRED]**: Mandatory Gemini analysis flag
|
||||
- **Trigger**: Auto-added when task.analysis_source = "gemini" or scope > 3 files (default)
|
||||
- **Action**: MUST run Gemini CLI first to gather context
|
||||
- **Purpose**: Ensures code aligns with existing patterns through pattern-based analysis
|
||||
- **[CODEX_CLI_REQUIRED]**: Mandatory Codex analysis flag
|
||||
- **Trigger**: Auto-added when task.analysis_source = "codex"
|
||||
- **Action**: MUST run Codex CLI in autonomous mode first to gather context
|
||||
- **Purpose**: Enables autonomous development with intelligent file discovery and code generation
|
||||
**Pre-Execution Analysis System**:
|
||||
- **[MULTI_STEP_ANALYSIS]**: Mandatory pre-execution analysis flag
|
||||
- **Trigger**: Auto-added when task.pre_analysis is an array (default format)
|
||||
- **Action**: MUST run multi-step pre-analysis first to gather comprehensive context
|
||||
- **Purpose**: Ensures code aligns with existing patterns through comprehensive pre-execution analysis
|
||||
|
||||
**Analysis CLI Usage Standards**:
|
||||
- **Gemini CLI**: Use task-specific paths from JSON: `bash(~/.claude/scripts/gemini-wrapper -p "$(~/.claude/scripts/read-task-paths.sh [task-json-file]) [prompt]")`
|
||||
- **Codex CLI**: Use task-specific paths from JSON: `bash(codex --full-auto exec "$(~/.claude/scripts/read-task-paths.sh [task-json-file]) [prompt]")`
|
||||
**Pre-Analysis CLI Usage Standards**:
|
||||
- **Multi-step Processing**: Execute each analysis step sequentially with specified templates
|
||||
- **Method Selection**: Use method specified in each step (gemini/codex/manual/auto-detected)
|
||||
- **CLI Commands**:
|
||||
- **Gemini**: `bash(~/.claude/scripts/gemini-wrapper -p "$(cat template_path) [expanded_action]")`
|
||||
- **Codex**: `bash(codex --full-auto exec "$(cat template_path) [expanded_action]")`
|
||||
- **Follow Guidelines**: @~/.claude/workflows/intelligent-tools-strategy.md and @~/.claude/workflows/tools-implementation-guide.md
|
||||
|
||||
|
||||
|
||||
@@ -50,54 +50,58 @@ You will review code changes AND handle test implementation by understanding the
|
||||
## Analysis CLI Context Activation Rules
|
||||
|
||||
**🎯 Analysis Marker Detection**
|
||||
When task assignment includes analysis markers:
|
||||
- **[GEMINI_CLI_REQUIRED]**: Execute Gemini CLI context gathering as first step
|
||||
- **[CODEX_CLI_REQUIRED]**: Execute Codex CLI autonomous analysis as first step
|
||||
When task assignment includes analysis marker:
|
||||
- **[MULTI_STEP_ANALYSIS]**: Execute sequential analysis steps with specified templates, expanding brief actions
|
||||
|
||||
**Multi-Step Analysis Support**:
|
||||
- **Process pre_analysis array**: Handle multi-step array format
|
||||
- **Expand brief actions**: Convert 2-3 word descriptions into comprehensive analysis tasks
|
||||
- **Sequential execution**: Execute each analysis step in order, accumulating context
|
||||
- **Template integration**: Use full template paths for enhanced analysis prompts
|
||||
|
||||
**Context Gathering Decision Logic**:
|
||||
```
|
||||
IF task contains [GEMINI_CLI_REQUIRED] flag:
|
||||
→ Execute Gemini CLI context gathering (MANDATORY)
|
||||
→ Use pattern-based code review analysis
|
||||
ELIF task contains [CODEX_CLI_REQUIRED] flag:
|
||||
→ Execute Codex CLI autonomous analysis (MANDATORY)
|
||||
→ Use autonomous development context for review
|
||||
IF task contains [MULTI_STEP_ANALYSIS] flag:
|
||||
→ Execute each analysis step sequentially with specified templates
|
||||
→ Expand brief actions into comprehensive analysis tasks
|
||||
→ Use method specified in each step (gemini/codex/manual/auto-detected)
|
||||
→ Accumulate results for comprehensive context
|
||||
ELIF reviewing >3 files OR security changes OR architecture modifications:
|
||||
→ Execute Gemini CLI context gathering (AUTO-TRIGGER, default)
|
||||
→ Execute default multi-step analysis (AUTO-TRIGGER)
|
||||
ELSE:
|
||||
→ Proceed with review using standard quality checks
|
||||
```
|
||||
|
||||
## Context Gathering Phase (Execute When Required)
|
||||
## Multi-Step Pre-Analysis Phase (Execute When Required)
|
||||
|
||||
### Gemini CLI Context Gathering
|
||||
When [GEMINI_CLI_REQUIRED] flag is present or complexity triggers apply, gather precise, change-focused context:
|
||||
### Multi-Step Analysis Execution
|
||||
When [MULTI_STEP_ANALYSIS] flag is present, execute comprehensive pre-review analysis:
|
||||
|
||||
Use the targeted review context template:
|
||||
@~/.claude/workflows/tools-implementation-guide.md
|
||||
Process each step from pre_analysis array sequentially:
|
||||
|
||||
**Gemini CLI Command**:
|
||||
**Multi-Step Analysis Process**:
|
||||
1. For each analysis step:
|
||||
- Extract action, template, method from step configuration
|
||||
- Expand brief action into comprehensive analysis task
|
||||
- Execute with specified method and template
|
||||
|
||||
**Example CLI Commands**:
|
||||
```bash
|
||||
bash(~/.claude/scripts/gemini-wrapper -p "$(.claude/scripts/read-task-paths.sh [task-json-file]) @{CLAUDE.md} [review-analysis-prompt]")
|
||||
# For method="gemini"
|
||||
bash(~/.claude/scripts/gemini-wrapper -p "$(cat template_path) [expanded_action]")
|
||||
|
||||
# For method="codex"
|
||||
bash(codex --full-auto exec "$(cat template_path) [expanded_action]")
|
||||
```
|
||||
|
||||
This executes a change-specific Gemini CLI command that identifies:
|
||||
This executes comprehensive pre-review analysis that covers:
|
||||
- **Change understanding**: What specific task was being implemented
|
||||
- **Repository conventions**: Standards used in similar files and functions
|
||||
- **Impact analysis**: Other code that might be affected by these changes
|
||||
- **Test coverage validation**: Whether changes are properly tested
|
||||
- **Integration verification**: If necessary integration points are handled
|
||||
|
||||
### Codex CLI Context Gathering
|
||||
When [CODEX_CLI_REQUIRED] flag is present, execute autonomous analysis:
|
||||
|
||||
Use the autonomous development context template:
|
||||
@~/.claude/workflows/tools-implementation-guide.md
|
||||
|
||||
**Codex CLI Command**:
|
||||
```bash
|
||||
bash(codex --full-auto exec "$(.claude/scripts/read-task-paths.sh [task-json-file]) [autonomous-review-prompt]")
|
||||
```
|
||||
- **Security implications**: Potential security considerations
|
||||
- **Performance impact**: Performance-related changes and implications
|
||||
|
||||
This executes autonomous Codex CLI analysis that provides:
|
||||
- **Autonomous understanding**: Intelligent discovery of implementation context
|
||||
|
||||
@@ -37,9 +37,8 @@ You are a conceptual planning specialist focused on single-role strategic thinki
|
||||
## Analysis Method Integration
|
||||
|
||||
### Detection and Activation
|
||||
When receiving task prompt, check for analysis markers:
|
||||
- **[GEMINI_CLI_REQUIRED]** - Execute mandatory Gemini CLI pattern-based analysis
|
||||
- **[CODEX_CLI_REQUIRED]** - Execute mandatory Codex CLI autonomous analysis
|
||||
When receiving task prompt, check for analysis marker:
|
||||
- **[MULTI_STEP_ANALYSIS]** - Execute mandatory multi-step pre-execution analysis
|
||||
- **ASSIGNED_ROLE** - Extract the specific role for focused analysis
|
||||
- **ANALYSIS_DIMENSIONS** - Load role-specific analysis dimensions
|
||||
|
||||
@@ -49,22 +48,26 @@ def handle_analysis_markers(prompt):
|
||||
role = extract_value("ASSIGNED_ROLE", prompt)
|
||||
dimensions = extract_value("ANALYSIS_DIMENSIONS", prompt)
|
||||
topic = extract_topic(prompt)
|
||||
|
||||
if "[GEMINI_CLI_REQUIRED]" in prompt:
|
||||
for dimension in dimensions:
|
||||
result = execute_gemini_cli(
|
||||
command=f"bash(~/.claude/scripts/gemini-wrapper -p \"$(.claude/scripts/read-task-paths.sh [task-json-file]) @{{CLAUDE.md}} {dimension}\")",
|
||||
dimension=dimension,
|
||||
role_context=role,
|
||||
topic=topic
|
||||
)
|
||||
integrate_to_role_output(result, role)
|
||||
|
||||
elif "[CODEX_CLI_REQUIRED]" in prompt:
|
||||
result = execute_codex_cli(
|
||||
command=f"bash(codex --full-auto exec \"$(.claude/scripts/read-task-paths.sh [task-json-file]) {topic}\")",
|
||||
autonomous_analysis=True,
|
||||
role_context=role,
|
||||
|
||||
if "[MULTI_STEP_ANALYSIS]" in prompt:
|
||||
analysis_steps = extract_pre_analysis_array(prompt)
|
||||
for step in analysis_steps:
|
||||
action = step["action"]
|
||||
template = step["template"]
|
||||
method = step["method"]
|
||||
|
||||
expanded_action = expand_brief_action(action, role, topic)
|
||||
|
||||
if method == "gemini":
|
||||
result = execute_gemini_cli(
|
||||
command=f"bash(~/.claude/scripts/gemini-wrapper -p \"$(cat {template}) {expanded_action}\")",
|
||||
role_context=role,
|
||||
topic=topic
|
||||
)
|
||||
elif method == "codex":
|
||||
result = execute_codex_cli(
|
||||
command=f"bash(codex --full-auto exec \"$(cat {template}) {expanded_action}\")",
|
||||
role_context=role,
|
||||
topic=topic
|
||||
)
|
||||
integrate_autonomous_insights(result, role)
|
||||
|
||||
Reference in New Issue
Block a user