refactor(agents): remove code-index MCP dependencies

Remove references to mcp__code-index MCP tool and simplify context discovery to use native search tools (ripgrep, find) with MCP Exa for external research.

Changes:
- action-planning-agent.md: Remove code-index from capabilities and examples
- cli-execution-agent.md: Remove MCP code-index discovery section, update to use ripgrep/find only
- code-developer.md: Minor documentation updates
- task-json-agent-mode.txt: Remove code-index references
- task-json-cli-mode.txt: Remove code-index references
- workflow-architecture.md: Update MCP integration documentation

Rationale:
- Simplify dependency stack
- Native tools (rg, find) provide sufficient file discovery capabilities
- MCP Exa remains for external research (best practices, documentation)
- Reduces maintenance overhead and improves reliability

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

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
catlog22
2025-10-24 17:35:07 +08:00
parent 7f82d0da86
commit 7701bbd28c
6 changed files with 44 additions and 94 deletions

View File

@@ -28,7 +28,7 @@ You are a pure execution agent specialized in creating actionable implementation
- `analysis_results`: Analysis recommendations and task breakdown
- `artifacts_inventory`: Detected brainstorming outputs (role analyses, guidance-specification, role analyses)
- `context_package`: Project context and assets
- `mcp_capabilities`: Available MCP tools (code-index, exa-code, exa-web)
- `mcp_capabilities`: Available MCP tools (exa-code, exa-web)
- `mcp_analysis`: Optional pre-executed MCP analysis results
**Legacy Support** (backward compatibility):
@@ -46,8 +46,8 @@ Phase 1: Context Validation & Enhancement (Discovery Results Provided)
→ artifacts_inventory: Use provided list (from memory or scan)
→ mcp_analysis: Use provided results (optional)
3. Optional MCP enhancement (if not pre-executed):
→ mcp__code-index__find_files() for codebase structure
→ mcp__exa__get_code_context_exa() for best practices
→ mcp__exa__web_search_exa() for external research
4. Assess task complexity (simple/medium/complex) from analysis
Phase 2: Document Generation (Autonomous Output)
@@ -89,12 +89,10 @@ Phase 2: Document Generation (Autonomous Output)
"focus_areas": [...]
},
"mcp_capabilities": {
"code_index": true,
"exa_code": true,
"exa_web": true
},
"mcp_analysis": {
"code_structure": "...",
"external_research": "..."
}
}
@@ -108,21 +106,6 @@ Phase 2: Document Generation (Autonomous Output)
### MCP Integration Guidelines
**Code Index MCP** (`mcp_capabilities.code_index = true`):
```javascript
// Discover relevant files
mcp__code-index__find_files(pattern="*auth*")
// Search for patterns
mcp__code-index__search_code_advanced(
pattern="authentication|oauth|jwt",
file_pattern="*.{ts,js}"
)
// Get file summary
mcp__code-index__get_file_summary(file_path="src/auth/index.ts")
```
**Exa Code Context** (`mcp_capabilities.exa_code = true`):
```javascript
// Get best practices and examples
@@ -135,9 +118,12 @@ mcp__exa__get_code_context_exa(
**Integration in flow_control.pre_analysis**:
```json
{
"step": "mcp_codebase_exploration",
"step": "local_codebase_exploration",
"action": "Explore codebase structure",
"command": "mcp__code-index__find_files(pattern=\"[task_patterns]\") && mcp__code-index__search_code_advanced(pattern=\"[relevant_patterns]\")",
"commands": [
"bash(rg '^(function|class|interface).*[task_keyword]' --type ts -n --max-count 15)",
"bash(find . -name '*[task_keyword]*' -type f | grep -v node_modules | head -10)"
],
"output_to": "codebase_structure"
}
```

View File

@@ -1,23 +1,23 @@
---
name: cli-execution-agent
description: |
Intelligent CLI execution agent with automated context discovery and smart tool selection. Orchestrates 5-phase workflow from task understanding to optimized CLI execution with MCP integration.
Intelligent CLI execution agent with automated context discovery and smart tool selection. Orchestrates 5-phase workflow from task understanding to optimized CLI execution with MCP Exa integration.
Examples:
- Context: User provides task without context
user: "Implement user authentication"
assistant: "I'll discover relevant context, enhance the task description, select optimal tool, and execute"
commentary: Agent autonomously discovers context via MCP code-index, researches best practices, builds enhanced prompt, selects Codex for complex implementation
commentary: Agent autonomously discovers context via ripgrep/find, researches best practices via MCP Exa, builds enhanced prompt, selects Codex for complex implementation
- Context: User provides analysis task
user: "Analyze API architecture patterns"
assistant: "I'll gather API-related files, analyze patterns, and execute with Gemini for comprehensive analysis"
commentary: Agent discovers API files, identifies patterns, selects Gemini for architecture analysis
commentary: Agent discovers API files via local search, identifies patterns, selects Gemini for architecture analysis
- Context: User provides task with session context
user: "Execute IMPL-001 from active workflow"
assistant: "I'll load task context, discover implementation files, enhance requirements, and execute"
commentary: Agent loads task JSON, discovers code context, routes output to workflow session
commentary: Agent loads task JSON, discovers code context via local search, routes output to workflow session
color: purple
---
@@ -88,7 +88,7 @@ Score < 2 → Simple
## Phase 2: Context Discovery
### Multi-Tool Parallel Strategy
### Context Discovery Strategy
**1. Project Structure Analysis**:
```bash
@@ -96,27 +96,7 @@ Score < 2 → Simple
```
Output: Module hierarchy and organization
**2. MCP Code Index Discovery**:
```javascript
// Set project context
mcp__code-index__set_project_path(path="{cwd}")
mcp__code-index__refresh_index()
// Discover files by keywords
mcp__code-index__find_files(pattern="*{keyword}*")
// Search code content
mcp__code-index__search_code_advanced(
pattern="{keyword_patterns}",
file_pattern="*.{ts,js,py}",
context_lines=3
)
// Get file summaries for key files
mcp__code-index__get_file_summary(file_path="{discovered_file}")
```
**3. Content Search (ripgrep fallback)**:
**2. Content Search (ripgrep)**:
```bash
# Function/class definitions
rg "^(function|def|func|class|interface).*{keyword}" \
@@ -130,7 +110,7 @@ find . \( -name "*{keyword}*test*" -o -name "*{keyword}*spec*" \) \
-type f | grep -E "\.(js|ts|py|go)$" | head -10
```
**4. External Research (MCP Exa - Optional)**:
**3. External Research (MCP Exa - Optional)**:
```javascript
// Best practices for complex tasks
mcp__exa__get_code_context_exa(
@@ -438,30 +418,6 @@ if (activeSession.exists) {
## MCP Integration Guidelines
### Code Index Usage
**Project Setup**:
```javascript
mcp__code-index__set_project_path(path="{project_root}")
mcp__code-index__refresh_index()
```
**File Discovery**:
```javascript
// Find by pattern
mcp__code-index__find_files(pattern="*auth*")
// Search content
mcp__code-index__search_code_advanced(
pattern="function.*authenticate",
file_pattern="*.ts",
context_lines=3
)
// Get structure
mcp__code-index__get_file_summary(file_path="src/auth/index.ts")
```
### Exa Research Usage
**Best Practices**:
@@ -484,13 +440,11 @@ mcp__exa__get_code_context_exa(
### Graceful Degradation
**MCP Unavailable**:
**MCP Exa Unavailable**:
```bash
# Fallback to ripgrep + find
if ! mcp__code-index__find_files; then
find . -name "*{keyword}*" -type f | grep -v node_modules
rg "{keyword}" --type ts --max-count 20
fi
# Fallback to local search only
find . -name "*{keyword}*" -type f | grep -v node_modules
rg "{keyword}" --type ts --max-count 20
```
**Tool Unavailable**:

View File

@@ -92,11 +92,14 @@ ELIF context insufficient OR task has flow control marker:
**Rule**: Before referencing modules/components, use `rg` or search to verify existence first.
**MCP Tools Integration**: Use Code Index and Exa for comprehensive development:
- Find existing patterns: `mcp__code-index__search_code_advanced(pattern="auth.*function")`
- Locate files: `mcp__code-index__find_files(pattern="src/**/*.ts")`
**MCP Tools Integration**: Use Exa for external research and best practices:
- Get API examples: `mcp__exa__get_code_context_exa(query="React authentication hooks", tokensNum="dynamic")`
- Update after changes: `mcp__code-index__refresh_index()`
- Research patterns: `mcp__exa__web_search_exa(query="TypeScript authentication patterns")`
**Local Search Tools**:
- Find patterns: `rg "auth.*function" --type ts -n`
- Locate files: `find . -name "*.ts" -type f | grep -v node_modules`
- Content search: `rg -i "authentication" src/ -C 3`
**Implementation Approach Execution**:
When task JSON contains `flow_control.implementation_approach` array:

View File

@@ -52,9 +52,12 @@ Task JSON Schema - Agent Mode (No Command Field)
"on_error": "fail"
},
{
"step": "mcp_codebase_exploration",
"action": "Explore codebase using MCP",
"command": "mcp__code-index__find_files(pattern=\"{file_pattern}\") && mcp__code-index__search_code_advanced(pattern=\"{search_pattern}\")",
"step": "local_codebase_exploration",
"action": "Explore codebase using local search",
"commands": [
"bash(rg '^(function|class|interface).*{keyword}' --type ts -n --max-count 15)",
"bash(find . -name '*{keyword}*' -type f | grep -v node_modules | head -10)"
],
"output_to": "codebase_structure",
"on_error": "skip_optional"
}

View File

@@ -52,9 +52,12 @@ Task JSON Schema - CLI Execute Mode (With Command Field)
"on_error": "fail"
},
{
"step": "mcp_codebase_exploration",
"action": "Explore codebase using MCP",
"command": "mcp__code-index__find_files(pattern=\"{file_pattern}\")",
"step": "local_codebase_exploration",
"action": "Explore codebase using local search",
"commands": [
"bash(rg '^(function|class|interface).*{keyword}' --type ts -n --max-count 15)",
"bash(find . -name '*{keyword}*' -type f | grep -v node_modules | head -10)"
],
"output_to": "codebase_structure",
"on_error": "skip_optional"
}

View File

@@ -343,9 +343,12 @@ The `[FLOW_CONTROL]` marker indicates that a task or prompt contains flow contro
"on_error": "skip_optional"
},
{
"step": "mcp_codebase_exploration",
"action": "Explore codebase using MCP",
"command": "mcp__code-index__find_files(pattern=\"*.ts\") && mcp__code-index__search_code_advanced(pattern=\"auth\")",
"step": "local_codebase_exploration",
"action": "Explore codebase using local search",
"commands": [
"bash(rg '^(function|class|interface).*auth' --type ts -n --max-count 15)",
"bash(find . -name '*auth*' -type f | grep -v node_modules | head -10)"
],
"output_to": "codebase_structure"
}
],
@@ -416,7 +419,7 @@ The `[FLOW_CONTROL]` marker indicates that a task or prompt contains flow contro
**Command Types Supported**:
- **Bash commands**: `bash(command)` - Any shell command
- **Tool calls**: `Read(file)`, `Glob(pattern)`, `Grep(pattern)`
- **MCP tools**: `mcp__code-index__find_files()`, `mcp__exa__get_code_context_exa()`
- **MCP tools**: `mcp__exa__get_code_context_exa()`, `mcp__exa__web_search_exa()`
- **CLI commands**: `gemini`, `qwen`, `codex --full-auto exec`
**Example**:
@@ -541,8 +544,6 @@ codex --full-auto exec "task" resume --last --skip-git-repo-check -s danger-full
- `bash(command)` - Execute bash command
**MCP Tools**:
- `mcp__code-index__find_files(pattern="*.ts")` - Find files using code index
- `mcp__code-index__search_code_advanced(pattern="auth")` - Search code patterns
- `mcp__exa__get_code_context_exa(query="...")` - Get code context from Exa
- `mcp__exa__web_search_exa(query="...")` - Web search via Exa