mirror of
https://github.com/catlog22/Claude-Code-Workflow.git
synced 2026-02-11 02:33:51 +08:00
## New Features - **MCP Tools Integration**: Added support for Model Context Protocol tools - Exa MCP Server: External API patterns and best practices - Code Index MCP: Advanced internal codebase search and indexing - **Enhanced Workflow Planning**: Updated pre_analysis to include MCP tool steps - **Documentation Updates**: Added MCP tool setup guides and usage examples ## Changes ### Core Components - Updated `plan.md` with MCP integration principles and implementation approach guidelines - Added MCP tool steps in pre_analysis workflow: `mcp_codebase_exploration`, `mcp_external_context` - Enhanced context accumulation with external best practices lookup ### Documentation - Added comprehensive MCP tools section in both English and Chinese README - Updated installation requirements and integration guidelines - Added GitHub repository links for required MCP servers ### Agent Enhancements - Updated multiple agents to support MCP tool integration - Enhanced context gathering capabilities with external pattern analysis ## Technical Details - MCP tools provide faster analysis through direct codebase indexing - Automatic fallback to traditional bash/CLI tools when MCP unavailable - Enhanced pattern recognition and similarity detection capabilities 🧪 **Experimental**: MCP integration is currently experimental and optional 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
4.6 KiB
4.6 KiB
name, description, usage, examples
| name | description | usage | examples | |
|---|---|---|---|---|
| update-memory-related | Context-aware CLAUDE.md documentation updates based on recent changes | /update-memory-related |
|
🚀 Command Overview: /update-memory-related
Context-aware documentation update for modules affected by recent changes.
📝 Execution Template
#!/bin/bash
# Context-aware CLAUDE.md documentation update
# Step 1: Code Index refresh and architecture analysis
mcp__code-index__refresh_index()
mcp__code-index__search_code_advanced(pattern="class|function|interface", file_pattern="**/*.{ts,js,py}")
# Step 2: Detect changed modules (before staging)
changed=$(Bash(~/.claude/scripts/detect_changed_modules.sh list))
# Step 3: Cache git changes (protect current state)
Bash(git add -A 2>/dev/null || true)
# Step 3: Use detected changes or fallback
if [ -z "$changed" ]; then
changed=$(Bash(~/.claude/scripts/get_modules_by_depth.sh list | head -10))
fi
count=$(echo "$changed" | wc -l)
# Step 4: Analysis handover → Model takes control
# BASH_EXECUTION_STOPS → MODEL_ANALYSIS_BEGINS
# Pseudocode flow:
# IF (change_count > 15 OR complex_changes_detected):
# → Task "Complex project related update" subagent_type: "memory-gemini-bridge"
# ELSE:
# → Present plan and WAIT FOR USER APPROVAL before execution
🧠 Model Analysis Phase
After the bash script completes change detection, the model takes control to:
- Analyze Changes: Review change count and complexity
- Parse CLAUDE.md Status: Extract which changed modules have/need CLAUDE.md files
- Choose Strategy:
- Simple changes: Present execution plan with CLAUDE.md paths to user
- Complex changes: Delegate to memory-gemini-bridge agent
- Present Detailed Plan: Show user exactly which CLAUDE.md files will be created/updated for changed modules
- ⚠️ CRITICAL: WAIT FOR USER APPROVAL: No execution without explicit user consent
📋 Execution Strategies
For Simple Changes (≤15 modules):
Model will present detailed plan for affected modules:
📋 Related Update Plan:
CHANGED modules affecting CLAUDE.md:
NEW CLAUDE.md files (X):
- ./src/api/auth/CLAUDE.md [new module]
- ./src/utils/helpers/CLAUDE.md [new module]
UPDATE existing CLAUDE.md files (Y):
- ./src/api/CLAUDE.md [parent of changed auth/]
- ./src/CLAUDE.md [root level]
Total: N CLAUDE.md files will be processed for recent changes
⚠️ Confirm execution? (y/n)
# ⚠️ MANDATORY: User confirmation → MUST await explicit approval
IF user_explicitly_confirms():
continue_execution()
ELSE:
abort_execution()
# Step 4: Organize modules by depth → Prepare execution
depth_modules = organize_by_depth(changed_modules)
# Step 5: Execute depth-parallel updates → Process by depth
FOR depth FROM max_depth DOWN TO 0:
FOR each module IN depth_modules[depth]:
WHILE active_jobs >= 4: wait(0.1)
Bash(~/.claude/scripts/update_module_claude.sh "$module" "related" &)
wait_all_jobs()
# Step 6: Safety check and restore staging state
non_claude=$(Bash(git diff --cached --name-only | grep -v "CLAUDE.md" || true))
if [ -n "$non_claude" ]; then
Bash(git restore --staged .)
echo "⚠️ Warning: Non-CLAUDE.md files were modified, staging reverted"
echo "Modified files: $non_claude"
else
echo "✅ Only CLAUDE.md files modified, staging preserved"
fi
# Step 7: Display changes → Final status
Bash(git diff --stat)
For Complex Changes (>15 modules): The model will delegate to the memory-gemini-bridge agent using the Task tool:
Task "Complex project related update"
prompt: "Execute context-aware update for [count] changed modules using depth-parallel execution"
subagent_type: "memory-gemini-bridge"
📚 Usage Examples
# Daily development update
/update-memory-related
# After feature work
/update-memory-related
✨ Features
- Separated Commands: Each bash operation is a discrete, trackable step
- Intelligent Change Analysis: Model analyzes change complexity for optimal strategy
- Change Detection: Automatically finds affected modules using git diff
- Depth-Parallel Execution: Same depth modules run in parallel, depths run sequentially
- Git Integration: Auto-cache changes, show diff statistics after
- Fallback Mode: Updates recent files when no git changes found
- User Confirmation: Clear plan presentation with approval step
- CLAUDE.md Only: Only updates documentation, never source code