mirror of
https://github.com/catlog22/Claude-Code-Workflow.git
synced 2026-02-06 01:54:11 +08:00
Compare commits
15 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
12034c8be5 | ||
|
|
467963eee2 | ||
|
|
a9d6de228e | ||
|
|
7d9adf5a55 | ||
|
|
3bf15ced59 | ||
|
|
dc228411d6 | ||
|
|
7dd83f150a | ||
|
|
4ec1a17ef4 | ||
|
|
9a49a86221 | ||
|
|
25a453d8f8 | ||
|
|
f574c0da47 | ||
|
|
5b38a63129 | ||
|
|
813a307c3d | ||
|
|
f1ffe9503c | ||
|
|
437897faff |
@@ -13,7 +13,6 @@ description: |
|
||||
user: "Create implementation plan for: real-time notifications system"
|
||||
assistant: "I'll create a staged implementation plan using provided context"
|
||||
commentary: Agent executes planning based on provided requirements and context
|
||||
model: sonnet
|
||||
color: yellow
|
||||
---
|
||||
|
||||
|
||||
@@ -13,7 +13,6 @@ description: |
|
||||
user: "Add user authentication"
|
||||
assistant: "I need to analyze the codebase first to understand the patterns"
|
||||
commentary: Use Gemini to gather implementation context, then execute
|
||||
model: sonnet
|
||||
color: blue
|
||||
---
|
||||
|
||||
|
||||
@@ -20,7 +20,6 @@ description: |
|
||||
auto.md: Assigns dedicated agent with ASSIGNED_ROLE: ui-designer
|
||||
agent: "I'll execute ui-designer analysis for this topic, creating UX-focused conceptual analysis in .brainstorming/ui-designer/ directory"
|
||||
|
||||
model: sonnet
|
||||
color: purple
|
||||
---
|
||||
|
||||
|
||||
@@ -22,7 +22,6 @@ description: |
|
||||
</commentary>
|
||||
</example>
|
||||
|
||||
model: sonnet
|
||||
color: green
|
||||
---
|
||||
|
||||
|
||||
@@ -13,7 +13,6 @@ description: |
|
||||
user: "Organize project documentation"
|
||||
assistant: "I need to understand the current documentation structure first"
|
||||
commentary: Gather context about existing documentation, then execute
|
||||
model: sonnet
|
||||
color: green
|
||||
---
|
||||
|
||||
|
||||
@@ -1,82 +1,88 @@
|
||||
---
|
||||
name: memory-gemini-bridge
|
||||
description: Execute complex project documentation updates using script coordination
|
||||
model: haiku
|
||||
color: purple
|
||||
---
|
||||
|
||||
You are a documentation update coordinator for complex projects. Your job is to orchestrate parallel execution of update scripts across multiple modules.
|
||||
You are a documentation update coordinator for complex projects. Orchestrate parallel CLAUDE.md updates efficiently and track every module.
|
||||
|
||||
## Core Responsibility
|
||||
## Core Mission
|
||||
|
||||
Coordinate parallel execution of `~/.claude/scripts/update_module_claude.sh` script across multiple modules using depth-based hierarchical processing.
|
||||
Execute depth-parallel updates for all modules using `~/.claude/scripts/update_module_claude.sh`. **Every module path must be processed**.
|
||||
|
||||
## Execution Protocol
|
||||
## Input Context
|
||||
|
||||
### 1. Analyze Project Structure
|
||||
You will receive:
|
||||
```
|
||||
- Total modules: [count]
|
||||
- Tool: [gemini|qwen|codex]
|
||||
- Mode: [full|related]
|
||||
- Module list (depth|path|files|types|has_claude format)
|
||||
```
|
||||
|
||||
## Execution Steps
|
||||
|
||||
**MANDATORY: Use TodoWrite to track all modules before execution**
|
||||
|
||||
### Step 1: Create Task List
|
||||
```bash
|
||||
# Step 1: Code Index architecture analysis
|
||||
mcp__code-index__search_code_advanced(pattern="class|function|interface", file_pattern="**/*.{ts,js,py}")
|
||||
mcp__code-index__find_files(pattern="**/*.{md,json,yaml,yml}")
|
||||
|
||||
# Step 2: Get module list with depth information
|
||||
modules=$(Bash(~/.claude/scripts/get_modules_by_depth.sh list))
|
||||
count=$(echo "$modules" | wc -l)
|
||||
|
||||
# Step 3: Display project structure
|
||||
Bash(~/.claude/scripts/get_modules_by_depth.sh grouped)
|
||||
# Parse module list and create todo items
|
||||
TodoWrite([
|
||||
{content: "Process depth 5 modules (N modules)", status: "pending", activeForm: "Processing depth 5 modules"},
|
||||
{content: "Process depth 4 modules (N modules)", status: "pending", activeForm: "Processing depth 4 modules"},
|
||||
# ... for each depth level
|
||||
{content: "Safety check: verify only CLAUDE.md modified", status: "pending", activeForm: "Running safety check"}
|
||||
])
|
||||
```
|
||||
|
||||
### 2. Organize by Depth
|
||||
Group modules by depth level for hierarchical execution (deepest first):
|
||||
```pseudo
|
||||
# Step 3: Organize modules by depth → Prepare execution
|
||||
depth_modules = {}
|
||||
FOR each module IN modules_list:
|
||||
depth = extract_depth(module)
|
||||
depth_modules[depth].add(module)
|
||||
### Step 2: Execute by Depth (Deepest First)
|
||||
```bash
|
||||
# For each depth level (5 → 0):
|
||||
# 1. Mark depth task as in_progress
|
||||
# 2. Extract module paths for current depth
|
||||
# 3. Launch parallel jobs (max 4)
|
||||
|
||||
# Depth 5 example:
|
||||
~/.claude/scripts/update_module_claude.sh "./.claude/workflows/cli-templates/prompts/analysis" "full" "gemini" &
|
||||
~/.claude/scripts/update_module_claude.sh "./.claude/workflows/cli-templates/prompts/development" "full" "gemini" &
|
||||
# ... up to 4 concurrent jobs
|
||||
|
||||
# 4. Wait for all depth jobs to complete
|
||||
wait
|
||||
|
||||
# 5. Mark depth task as completed
|
||||
# 6. Move to next depth
|
||||
```
|
||||
|
||||
### 3. Execute Updates
|
||||
For each depth level, run parallel updates:
|
||||
```pseudo
|
||||
# Step 4: 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" "$mode" &)
|
||||
wait_all_jobs()
|
||||
### Step 3: Safety Check
|
||||
```bash
|
||||
# After all depths complete:
|
||||
git diff --cached --name-only | grep -v "CLAUDE.md" || echo "✅ Safe"
|
||||
git status --short
|
||||
```
|
||||
|
||||
### 4. Execution Rules
|
||||
## Tool Parameter Flow
|
||||
|
||||
- **Core Command**: `Bash(~/.claude/scripts/update_module_claude.sh "$module" "$mode" &)`
|
||||
- **Concurrency Control**: Maximum 4 parallel jobs per depth level
|
||||
- **Execution Order**: Process depths sequentially, deepest first
|
||||
- **Job Control**: Monitor active jobs before spawning new ones
|
||||
- **Independence**: Each module update is independent within the same depth
|
||||
**Command Format**: `update_module_claude.sh <path> <mode> <tool>`
|
||||
|
||||
### 5. Update Modes
|
||||
Examples:
|
||||
- Gemini: `update_module_claude.sh "./.claude/agents" "full" "gemini" &`
|
||||
- Qwen: `update_module_claude.sh "./src/api" "full" "qwen" &`
|
||||
- Codex: `update_module_claude.sh "./tests" "full" "codex" &`
|
||||
|
||||
- **"full"** mode: Complete refresh → `Bash(update_module_claude.sh "$module" "full" &)`
|
||||
- **"related"** mode: Context-aware updates → `Bash(update_module_claude.sh "$module" "related" &)`
|
||||
## Execution Rules
|
||||
|
||||
### 6. Agent Protocol
|
||||
1. **Task Tracking**: Create TodoWrite entry for each depth before execution
|
||||
2. **Parallelism**: Max 4 jobs per depth, sequential across depths
|
||||
3. **Tool Passing**: Always pass tool parameter as 3rd argument
|
||||
4. **Path Accuracy**: Extract exact path from `depth:N|path:X|...` format
|
||||
5. **Completion**: Mark todo completed only after all depth jobs finish
|
||||
6. **No Skipping**: Process every module from input list
|
||||
|
||||
```pseudo
|
||||
# Agent Coordination Flow:
|
||||
RECEIVE task_with(module_count, update_mode)
|
||||
modules = Bash(get_modules_by_depth.sh list)
|
||||
Bash(get_modules_by_depth.sh grouped)
|
||||
depth_modules = organize_by_depth(modules)
|
||||
## Concise Output
|
||||
|
||||
FOR depth FROM max_depth DOWN TO 0:
|
||||
FOR module IN depth_modules[depth]:
|
||||
WHILE active_jobs >= 4: wait(0.1)
|
||||
Bash(update_module_claude.sh module update_mode &)
|
||||
wait_all_jobs()
|
||||
- Start: "Processing [count] modules with [tool]"
|
||||
- Progress: Update TodoWrite for each depth
|
||||
- End: "✅ Updated [count] CLAUDE.md files" + git status
|
||||
|
||||
REPORT final_status()
|
||||
```
|
||||
|
||||
This agent coordinates the same `Bash()` commands used in direct execution, providing intelligent orchestration for complex projects.
|
||||
**Do not explain, just execute efficiently.**
|
||||
@@ -18,7 +18,6 @@ description: |
|
||||
user: "Run the full test suite and ensure everything passes"
|
||||
assistant: "I'll use the test-fix-agent to execute all tests and fix any issues found"
|
||||
commentary: test-fix-agent serves as the quality gate - passing tests = approved code.
|
||||
model: sonnet
|
||||
color: green
|
||||
---
|
||||
|
||||
|
||||
@@ -14,71 +14,47 @@ allowed-tools: SlashCommand(*), Bash(*), TodoWrite(*), Read(*), Glob(*)
|
||||
|
||||
## Purpose
|
||||
|
||||
Execute CLI tool analysis on codebase patterns, architecture, or code quality.
|
||||
Quick codebase analysis using CLI tools. Automatically detects analysis type and selects appropriate template.
|
||||
|
||||
**Supported Tools**: codex, gemini (default), qwen
|
||||
**Reference**: @~/.claude/workflows/intelligent-tools-strategy.md for complete tool details
|
||||
|
||||
## Parameters
|
||||
|
||||
- `--tool <codex|gemini|qwen>` - Tool selection (default: gemini)
|
||||
- `--enhance` - Use `/enhance-prompt` for context-aware enhancement
|
||||
- `<analysis-target>` - Description of what to analyze
|
||||
|
||||
## Execution Flow
|
||||
|
||||
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
|
||||
2. If `--enhance`: Execute `/enhance-prompt` first to expand user intent
|
||||
3. Auto-detect analysis type from keywords → select template
|
||||
4. Build command with auto-detected file patterns
|
||||
5. Execute and return results
|
||||
|
||||
## Enhancement Integration
|
||||
## File Pattern Auto-Detection
|
||||
|
||||
**When `--enhance` flag present**: Execute `/enhance-prompt "[analysis-target]"` first, then use enhanced output (INTENT/CONTEXT/ACTION) to build the analysis command.
|
||||
Keywords trigger specific file patterns:
|
||||
- "auth" → `@{**/*auth*,**/*user*}`
|
||||
- "component" → `@{src/components/**/*,**/*.component.*}`
|
||||
- "API" → `@{**/api/**/*,**/routes/**/*}`
|
||||
- "test" → `@{**/*.test.*,**/*.spec.*}`
|
||||
- "config" → `@{*.config.*,**/config/**/*}`
|
||||
- Generic → `@{src/**/*}`
|
||||
|
||||
|
||||
## Command Template
|
||||
|
||||
**Gemini/Qwen**:
|
||||
```bash
|
||||
cd [dir] && ~/.claude/scripts/[gemini|qwen]-wrapper -p "
|
||||
PURPOSE: [analysis goal]
|
||||
TASK: [specific task]
|
||||
CONTEXT: @{[file-patterns]} @{CLAUDE.md}
|
||||
EXPECTED: [output format]
|
||||
RULES: $(cat ~/.claude/workflows/cli-templates/prompts/[category]/[template].txt) | [constraints]
|
||||
"
|
||||
```
|
||||
|
||||
**Codex**:
|
||||
```bash
|
||||
codex -C [dir] --full-auto exec "
|
||||
PURPOSE: [analysis goal]
|
||||
TASK: [specific task]
|
||||
CONTEXT: @{[file-patterns]} @{CLAUDE.md}
|
||||
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
|
||||
```
|
||||
For complex patterns, use `rg` or MCP tools to discover files first, then execute CLI with precise file references.
|
||||
|
||||
## Examples
|
||||
|
||||
```bash
|
||||
/cli:analyze "authentication patterns" # Gemini (default)
|
||||
/cli:analyze --tool qwen "component architecture" # Qwen architecture
|
||||
/cli:analyze "authentication patterns" # Auto: gemini + auth patterns
|
||||
/cli:analyze --tool qwen "component architecture" # Qwen architecture analysis
|
||||
/cli:analyze --tool codex "performance bottlenecks" # Codex deep analysis
|
||||
/cli:analyze --enhance "fix auth issues" # Enhanced prompt first
|
||||
/cli:analyze --enhance "fix auth issues" # Enhanced prompt → analysis
|
||||
```
|
||||
|
||||
## File Pattern Logic
|
||||
|
||||
Auto-detect file patterns from keywords:
|
||||
- "auth" → `@{**/*auth*}`
|
||||
- "component" → `@{src/components/**/*}`
|
||||
- "API" → `@{**/api/**/*}`
|
||||
- "test" → `@{**/*.test.*}`
|
||||
- Generic → `@{src/**/*}`
|
||||
|
||||
## Session Integration
|
||||
|
||||
- **Active Session**: Save results to `.workflow/WFS-[id]/.chat/analysis-[timestamp].md`
|
||||
- **No Session**: Return results directly to user
|
||||
## Notes
|
||||
|
||||
- Command templates, file patterns, and best practices: see intelligent-tools-strategy.md (loaded in memory)
|
||||
- Active workflow session: results saved to `.workflow/WFS-[id]/.chat/`
|
||||
- No session: results returned directly
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
---
|
||||
name: chat
|
||||
|
||||
description: Simple CLI interaction command for direct codebase analysis
|
||||
usage: /cli:chat [--tool <codex|gemini|qwen>] [--enhance] "inquiry"
|
||||
argument-hint: "[--tool codex|gemini|qwen] [--enhance] inquiry"
|
||||
@@ -9,72 +8,41 @@ examples:
|
||||
- /cli:chat --tool qwen --enhance "optimize React component"
|
||||
- /cli:chat --tool codex "review security vulnerabilities"
|
||||
allowed-tools: SlashCommand(*), Bash(*)
|
||||
model: sonnet
|
||||
---
|
||||
|
||||
# CLI Chat Command (/cli:chat)
|
||||
|
||||
## Purpose
|
||||
|
||||
Direct interaction with CLI tools for codebase analysis and Q&A.
|
||||
Direct Q&A interaction with CLI tools for codebase analysis.
|
||||
|
||||
**Supported Tools**: codex, gemini (default), qwen
|
||||
**Reference**: @~/.claude/workflows/intelligent-tools-strategy.md for complete tool details
|
||||
|
||||
## Parameters
|
||||
|
||||
- `<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
|
||||
- `<inquiry>` (Required) - Question or analysis request
|
||||
- `--tool <codex|gemini|qwen>` - Select CLI tool (default: gemini)
|
||||
- `--enhance` - Enhance inquiry with `/enhance-prompt` first
|
||||
- `--all-files` - Include entire codebase in context
|
||||
- `--save-session` - Save interaction to workflow session
|
||||
|
||||
## Execution Flow
|
||||
|
||||
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
|
||||
|
||||
## Enhancement Integration
|
||||
|
||||
**When `--enhance` flag present**: Execute `/enhance-prompt "[inquiry]"` first, then use enhanced output (INTENT/CONTEXT/ACTION) to build the chat command.
|
||||
2. If `--enhance`: Execute `/enhance-prompt` to expand user intent
|
||||
3. Assemble context: `@{CLAUDE.md}` + user-specified files or `--all-files`
|
||||
4. Execute CLI tool with assembled context
|
||||
5. Optionally save to workflow session
|
||||
|
||||
## Context Assembly
|
||||
|
||||
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
|
||||
**Always included**: `@{CLAUDE.md,**/*CLAUDE.md}` (project guidelines)
|
||||
|
||||
## Command Template
|
||||
**Optional**:
|
||||
- User-explicit files from inquiry keywords
|
||||
- `--all-files` flag includes entire codebase (`--all-files` wrapper parameter)
|
||||
|
||||
**Gemini/Qwen**:
|
||||
```bash
|
||||
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 "..."
|
||||
```
|
||||
|
||||
**Codex**:
|
||||
```bash
|
||||
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
|
||||
```
|
||||
For targeted analysis, use `rg` or MCP tools to discover relevant files first, then build precise CONTEXT field.
|
||||
|
||||
## Examples
|
||||
|
||||
@@ -82,11 +50,12 @@ codex -C [dir] -i screenshot.png --full-auto exec "..." --skip-git-repo-check -s
|
||||
/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
|
||||
/cli:chat --enhance "fix the login" # Enhanced prompt first
|
||||
/cli:chat --all-files "find all API endpoints" # Full codebase context
|
||||
```
|
||||
|
||||
## Session Persistence
|
||||
## Notes
|
||||
|
||||
- **Active Session**: Save to `.workflow/WFS-[id]/.chat/chat-[timestamp].md`
|
||||
- **No Session**: Return results directly
|
||||
- Command templates and file patterns: see intelligent-tools-strategy.md (loaded in memory)
|
||||
- Active workflow session: results saved to `.workflow/WFS-[id]/.chat/`
|
||||
- No session: results returned directly
|
||||
|
||||
@@ -17,18 +17,23 @@ allowed-tools: SlashCommand(*), Bash(*), TodoWrite(*), Read(*), Glob(*)
|
||||
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:
|
||||
0. Stage existing changes (git add -A) if valid git repo
|
||||
1. Execute with Codex
|
||||
2. [Optional] Git verification
|
||||
3. Mark complete in TodoWrite
|
||||
4. Resume next subtask with `codex resume --last`
|
||||
Task Input → Analyze Dependencies → Create Task Flow Diagram →
|
||||
Decompose into Subtask Groups → TodoWrite Tracking →
|
||||
For Each Subtask Group:
|
||||
For First Subtask in Group:
|
||||
0. Stage existing changes (git add -A) if valid git repo
|
||||
1. Execute with Codex (new session)
|
||||
2. [Optional] Git verification
|
||||
3. Mark complete in TodoWrite
|
||||
For Related Subtasks in Same Group:
|
||||
0. Stage changes from previous subtask
|
||||
1. Execute with `codex exec "..." resume --last` (continue session)
|
||||
2. [Optional] Git verification
|
||||
3. Mark complete in TodoWrite
|
||||
→ Final Summary
|
||||
```
|
||||
|
||||
@@ -41,17 +46,49 @@ For Each Subtask:
|
||||
|
||||
## Execution Flow
|
||||
|
||||
### Phase 1: Input Processing & Decomposition
|
||||
### Phase 1: Input Processing & Task Flow Analysis
|
||||
|
||||
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**:
|
||||
2. **Analyze Dependencies & Create Task Flow Diagram**:
|
||||
- Analyze task complexity and scope
|
||||
- Break down into 3-8 subtasks
|
||||
- Create TodoWrite tracker with all subtasks
|
||||
- Identify dependencies and relationships between subtasks
|
||||
- Create visual task flow diagram showing:
|
||||
- Independent task groups (parallel execution possible)
|
||||
- Sequential dependencies (must use resume)
|
||||
- Branching logic (conditional paths)
|
||||
- Display flow diagram for user review
|
||||
|
||||
**Task Flow Diagram Format**:
|
||||
```
|
||||
[Group A: Auth Core]
|
||||
A1: Create user model ──┐
|
||||
A2: Add validation ─┤─► [resume] ─► A3: Database schema
|
||||
│
|
||||
[Group B: API Layer] │
|
||||
B1: Auth endpoints ─────┘─► [new session]
|
||||
B2: Middleware ────────────► [resume] ─► B3: Error handling
|
||||
|
||||
[Group C: Testing]
|
||||
C1: Unit tests ─────────────► [new session]
|
||||
C2: Integration tests ──────► [resume]
|
||||
```
|
||||
|
||||
**Diagram Symbols**:
|
||||
- `──►` Sequential dependency (must resume previous session)
|
||||
- `─┐` Branch point (multiple paths)
|
||||
- `─┘` Merge point (wait for completion)
|
||||
- `[resume]` Use `codex exec "..." resume --last`
|
||||
- `[new session]` Start fresh Codex session
|
||||
|
||||
3. **Decompose into Subtask Groups**:
|
||||
- Group related subtasks that share context
|
||||
- Break down into 3-8 subtasks total
|
||||
- Assign each subtask to a group
|
||||
- Create TodoWrite tracker with groups
|
||||
- Display decomposition for user review
|
||||
|
||||
**Decomposition Criteria**:
|
||||
@@ -59,8 +96,30 @@ For Each Subtask:
|
||||
- Clear, testable outcomes
|
||||
- Explicit dependencies
|
||||
- Focused file scope (1-5 files per subtask)
|
||||
- **Group coherence**: Subtasks in same group share context/files
|
||||
|
||||
### Phase 2: Sequential Execution
|
||||
### File Discovery for Task Decomposition
|
||||
|
||||
Use `rg` or MCP tools to discover relevant files, then group by domain:
|
||||
|
||||
**Workflow**: Discover → Analyze scope → Group by files → Create task flow
|
||||
|
||||
**Example**:
|
||||
```bash
|
||||
# Discover files
|
||||
rg "authentication" --files-with-matches --type ts
|
||||
|
||||
# Group by domain
|
||||
# Group A: src/auth/model.ts, src/auth/schema.ts
|
||||
# Group B: src/api/auth.ts, src/middleware/auth.ts
|
||||
# Group C: tests/auth/*.test.ts
|
||||
|
||||
# Each group becomes a session with related subtasks
|
||||
```
|
||||
|
||||
File patterns: see intelligent-tools-strategy.md (loaded in memory)
|
||||
|
||||
### Phase 2: Group-Based Execution
|
||||
|
||||
**Pre-Execution Git Staging** (if valid git repository):
|
||||
```bash
|
||||
@@ -70,37 +129,61 @@ git add -A
|
||||
git status --short
|
||||
```
|
||||
|
||||
**For First Subtask**:
|
||||
**For First Subtask in Each Group** (New Session):
|
||||
```bash
|
||||
# Initial execution (no resume needed)
|
||||
# Start new Codex session for independent task group
|
||||
codex -C [dir] --full-auto exec "
|
||||
PURPOSE: [task goal]
|
||||
TASK: [subtask 1 description]
|
||||
PURPOSE: [group goal]
|
||||
TASK: [subtask description - first in group]
|
||||
CONTEXT: @{relevant_files} @{CLAUDE.md}
|
||||
EXPECTED: [specific deliverables]
|
||||
RULES: [constraints]
|
||||
Subtask 1 of N: [subtask title]
|
||||
Group [X]: [group name] - Subtask 1 of N in this group
|
||||
" --skip-git-repo-check -s danger-full-access
|
||||
```
|
||||
|
||||
**For Subsequent Subtasks** (using resume --last):
|
||||
**For Related Subtasks in Same Group** (Resume Session):
|
||||
```bash
|
||||
# Stage changes from previous subtask (if valid git repository)
|
||||
git add -A
|
||||
|
||||
# Resume previous session for context continuity
|
||||
# Resume session ONLY for subtasks in same group
|
||||
codex exec "
|
||||
CONTINUE TO NEXT SUBTASK:
|
||||
Subtask N of M: [subtask title]
|
||||
CONTINUE IN SAME GROUP:
|
||||
Group [X]: [group name] - Subtask N of M
|
||||
|
||||
PURPOSE: [continuation goal]
|
||||
PURPOSE: [continuation goal within group]
|
||||
TASK: [subtask N description]
|
||||
CONTEXT: Previous work completed, now focus on @{new_relevant_files}
|
||||
CONTEXT: Previous work in this group completed, now focus on @{new_relevant_files}
|
||||
EXPECTED: [specific deliverables]
|
||||
RULES: Build on previous subtask, maintain consistency
|
||||
RULES: Build on previous subtask in group, maintain consistency
|
||||
" resume --last --skip-git-repo-check -s danger-full-access
|
||||
```
|
||||
|
||||
**For First Subtask in Different Group** (New Session):
|
||||
```bash
|
||||
# Stage changes from previous group
|
||||
git add -A
|
||||
|
||||
# Start NEW session for different group (no resume)
|
||||
codex -C [dir] --full-auto exec "
|
||||
PURPOSE: [new group goal]
|
||||
TASK: [subtask description - first in new group]
|
||||
CONTEXT: @{different_files} @{CLAUDE.md}
|
||||
EXPECTED: [specific deliverables]
|
||||
RULES: [constraints]
|
||||
Group [Y]: [new group name] - Subtask 1 of N in this group
|
||||
" --skip-git-repo-check -s danger-full-access
|
||||
```
|
||||
|
||||
**Resume Decision Logic**:
|
||||
```
|
||||
if (subtask.group == previous_subtask.group):
|
||||
use `codex exec "..." resume --last` # Continue session
|
||||
else:
|
||||
use `codex -C [dir] exec "..."` # New session
|
||||
```
|
||||
|
||||
### Phase 3: Verification (if --verify-git enabled)
|
||||
|
||||
After each subtask completion:
|
||||
@@ -121,16 +204,26 @@ git ls-files --others --exclude-standard
|
||||
- No merge conflicts or errors
|
||||
- Code compiles/runs (if applicable)
|
||||
|
||||
### Phase 4: TodoWrite Tracking
|
||||
### Phase 4: TodoWrite Tracking with Groups
|
||||
|
||||
**Initial Setup**:
|
||||
**Initial Setup with Task Flow**:
|
||||
```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
|
||||
// Display task flow diagram first
|
||||
{ content: "Task Flow Analysis Complete - See diagram above", status: "completed", activeForm: "Analyzing task flow" },
|
||||
|
||||
// Group A subtasks (will use resume within group)
|
||||
{ content: "[Group A] Subtask 1: [description]", status: "in_progress", activeForm: "Executing Group A subtask 1" },
|
||||
{ content: "[Group A] Subtask 2: [description] [resume]", status: "pending", activeForm: "Executing Group A subtask 2" },
|
||||
|
||||
// Group B subtasks (new session, then resume within group)
|
||||
{ content: "[Group B] Subtask 1: [description] [new session]", status: "pending", activeForm: "Executing Group B subtask 1" },
|
||||
{ content: "[Group B] Subtask 2: [description] [resume]", status: "pending", activeForm: "Executing Group B subtask 2" },
|
||||
|
||||
// Group C subtasks (new session)
|
||||
{ content: "[Group C] Subtask 1: [description] [new session]", status: "pending", activeForm: "Executing Group C subtask 1" },
|
||||
|
||||
{ content: "Final verification and summary", status: "pending", activeForm: "Verifying and summarizing" }
|
||||
]
|
||||
})
|
||||
@@ -140,8 +233,9 @@ TodoWrite({
|
||||
```javascript
|
||||
TodoWrite({
|
||||
todos: [
|
||||
{ content: "Subtask 1: [description]", status: "completed", activeForm: "Executing subtask 1" },
|
||||
{ content: "Subtask 2: [description]", status: "in_progress", activeForm: "Executing subtask 2" },
|
||||
{ content: "Task Flow Analysis Complete - See diagram above", status: "completed", activeForm: "Analyzing task flow" },
|
||||
{ content: "[Group A] Subtask 1: [description]", status: "completed", activeForm: "Executing Group A subtask 1" },
|
||||
{ content: "[Group A] Subtask 2: [description] [resume]", status: "in_progress", activeForm: "Executing Group A subtask 2" },
|
||||
// ... update status
|
||||
]
|
||||
})
|
||||
@@ -149,18 +243,36 @@ TodoWrite({
|
||||
|
||||
## 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
|
||||
**Why Group-Based Resume?**
|
||||
- **Within Group**: Maintains conversation context for related subtasks
|
||||
- Codex remembers previous decisions and patterns
|
||||
- Reduces context repetition
|
||||
- Ensures consistency in implementation style
|
||||
- **Between Groups**: Fresh session for independent tasks
|
||||
- Avoids context pollution from unrelated work
|
||||
- Prevents confusion when switching domains
|
||||
- Maintains focused attention on current group
|
||||
|
||||
**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
|
||||
1. **First subtask in Group A**: Creates new Codex session
|
||||
2. **Subsequent subtasks in Group A**: Use `codex resume --last` to continue session
|
||||
3. **First subtask in Group B**: Creates NEW Codex session (no resume)
|
||||
4. **Subsequent subtasks in Group B**: Use `codex resume --last` within Group B
|
||||
5. Each group builds on its own context, isolated from other groups
|
||||
|
||||
**When to Resume vs New Session**:
|
||||
```
|
||||
✅ RESUME (same group):
|
||||
- Subtasks share files/modules
|
||||
- Logical continuation of previous work
|
||||
- Same architectural domain
|
||||
|
||||
❌ NEW SESSION (different group):
|
||||
- Independent task area
|
||||
- Different files/modules
|
||||
- Switching architectural domains
|
||||
- Testing after implementation
|
||||
```
|
||||
|
||||
**Image Support**:
|
||||
```bash
|
||||
@@ -199,25 +311,47 @@ codex exec "CONTINUE TO NEXT SUBTASK: ..." resume --last --skip-git-repo-check -
|
||||
|
||||
**During Execution**:
|
||||
```
|
||||
📋 Task Decomposition:
|
||||
1. [Subtask 1 description]
|
||||
2. [Subtask 2 description]
|
||||
...
|
||||
📊 Task Flow Diagram:
|
||||
[Group A: Auth Core]
|
||||
A1: Create user model ──┐
|
||||
A2: Add validation ─┤─► [resume] ─► A3: Database schema
|
||||
│
|
||||
[Group B: API Layer] │
|
||||
B1: Auth endpoints ─────┘─► [new session]
|
||||
B2: Middleware ────────────► [resume] ─► B3: Error handling
|
||||
|
||||
▶️ Executing Subtask 1/N: [title]
|
||||
Codex session started...
|
||||
[Group C: Testing]
|
||||
C1: Unit tests ─────────────► [new session]
|
||||
C2: Integration tests ──────► [resume]
|
||||
|
||||
📋 Task Decomposition:
|
||||
[Group A] 1. Create user model
|
||||
[Group A] 2. Add validation logic [resume]
|
||||
[Group A] 3. Implement database schema [resume]
|
||||
[Group B] 4. Create auth endpoints [new session]
|
||||
[Group B] 5. Add middleware [resume]
|
||||
[Group B] 6. Error handling [resume]
|
||||
[Group C] 7. Unit tests [new session]
|
||||
[Group C] 8. Integration tests [resume]
|
||||
|
||||
▶️ [Group A] Executing Subtask 1/8: Create user model
|
||||
Starting new Codex session for Group A...
|
||||
[Codex output]
|
||||
✅ Subtask 1 completed
|
||||
|
||||
🔍 Git Verification:
|
||||
M src/file1.ts
|
||||
A src/file2.ts
|
||||
M src/models/user.ts
|
||||
✅ Changes verified
|
||||
|
||||
▶️ Executing Subtask 2/N: [title]
|
||||
Resuming Codex session...
|
||||
▶️ [Group A] Executing Subtask 2/8: Add validation logic
|
||||
Resuming Codex session (same group)...
|
||||
[Codex output]
|
||||
✅ Subtask 2 completed
|
||||
|
||||
▶️ [Group B] Executing Subtask 4/8: Create auth endpoints
|
||||
Starting NEW Codex session for Group B...
|
||||
[Codex output]
|
||||
✅ Subtask 4 completed
|
||||
...
|
||||
|
||||
✅ All Subtasks Completed
|
||||
@@ -248,16 +382,30 @@ codex exec "CONTINUE TO NEXT SUBTASK: ..." resume --last --skip-git-repo-check -
|
||||
|
||||
## Examples
|
||||
|
||||
**Example 1: Simple Task**
|
||||
**Example 1: Simple Task with Groups**
|
||||
```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
|
||||
# Task Flow Diagram:
|
||||
# [Group A: Data Layer]
|
||||
# A1: Create user model ──► [resume] ──► A2: Database schema
|
||||
#
|
||||
# [Group B: Auth Logic]
|
||||
# B1: JWT token generation ──► [new session]
|
||||
# B2: Authentication middleware ──► [resume]
|
||||
#
|
||||
# [Group C: API Endpoints]
|
||||
# C1: Login/logout endpoints ──► [new session]
|
||||
#
|
||||
# [Group D: Testing]
|
||||
# D1: Unit tests ──► [new session]
|
||||
# D2: Integration tests ──► [resume]
|
||||
|
||||
# Execution:
|
||||
# Group A: A1 (new) → A2 (resume)
|
||||
# Group B: B1 (new) → B2 (resume)
|
||||
# Group C: C1 (new)
|
||||
# Group D: D1 (new) → D2 (resume)
|
||||
```
|
||||
|
||||
**Example 2: With Git Verification**
|
||||
@@ -280,13 +428,16 @@ codex exec "CONTINUE TO NEXT SUBTASK: ..." resume --last --skip-git-repo-check -
|
||||
|
||||
## 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. **Pre-Execution Staging**: Stage changes before each subtask to clearly see codex modifications
|
||||
5. **Context Continuity**: Let `codex resume --last` maintain context
|
||||
6. **Recovery Points**: TodoWrite provides clear progress tracking
|
||||
7. **Image References**: Attach design files for UI tasks
|
||||
1. **Task Flow First**: Always create visual flow diagram before execution
|
||||
2. **Group Related Work**: Cluster subtasks by domain/files for efficient resume
|
||||
3. **Subtask Granularity**: Keep subtasks small and focused (5-15 min each)
|
||||
4. **Clear Boundaries**: Each subtask should have well-defined input/output
|
||||
5. **Git Hygiene**: Use `--verify-git` for critical refactoring
|
||||
6. **Pre-Execution Staging**: Stage changes before each subtask to clearly see codex modifications
|
||||
7. **Smart Resume**: Use `resume --last` ONLY within same group
|
||||
8. **Fresh Sessions**: Start new session when switching to different group/domain
|
||||
9. **Recovery Points**: TodoWrite with group labels provides clear progress tracking
|
||||
10. **Image References**: Attach design files for UI tasks (first subtask in group)
|
||||
|
||||
## Input Processing
|
||||
|
||||
|
||||
@@ -9,29 +9,23 @@ examples:
|
||||
- /cli:execute --tool codex IMPL-001
|
||||
- /cli:execute --enhance "fix API performance issues"
|
||||
allowed-tools: SlashCommand(*), Bash(*)
|
||||
model: sonnet
|
||||
---
|
||||
|
||||
# CLI Execute Command (/cli:execute)
|
||||
|
||||
## Purpose
|
||||
|
||||
Execute implementation tasks with YOLO permissions (auto-approves all confirmations).
|
||||
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
|
||||
**Key Feature**: Automatic context inference and file pattern detection
|
||||
|
||||
## YOLO Permissions
|
||||
## Core Concepts
|
||||
|
||||
### YOLO Permissions
|
||||
Auto-approves: file pattern inference, execution, file modifications, summary generation
|
||||
|
||||
## Enhancement Integration
|
||||
|
||||
**When `--enhance` flag present** (Description Mode only): Execute `/enhance-prompt "[description]"` first, then use enhanced output (INTENT/CONTEXT/ACTION) for execution.
|
||||
|
||||
**Note**: Task ID Mode uses task JSON directly (no enhancement).
|
||||
|
||||
## Execution Modes
|
||||
### Execution Modes
|
||||
|
||||
**1. Description Mode** (supports `--enhance`):
|
||||
- Input: Natural language description
|
||||
@@ -41,71 +35,65 @@ Auto-approves: file pattern inference, execution, file modifications, summary ge
|
||||
- Input: Workflow task identifier (e.g., `IMPL-001`)
|
||||
- Process: Task JSON parsing → Scope analysis → Execute
|
||||
|
||||
## Context Inference
|
||||
### Context Inference
|
||||
|
||||
Auto-selects files based on:
|
||||
- **Keywords**: "auth" → `@{**/*auth*,**/*user*}`
|
||||
- **Technology**: "React" → `@{src/**/*.{jsx,tsx}}`
|
||||
- **Task Type**: "api" → `@{**/api/**/*,**/routes/**/*}`
|
||||
- **Always**: `@{CLAUDE.md,**/*CLAUDE.md}`
|
||||
Auto-selects files based on keywords and technology:
|
||||
- "auth" → `@{**/*auth*,**/*user*}`
|
||||
- "React" → `@{src/**/*.{jsx,tsx}}`
|
||||
- "api" → `@{**/api/**/*,**/routes/**/*}`
|
||||
- Always includes: `@{CLAUDE.md,**/*CLAUDE.md}`
|
||||
|
||||
## Options
|
||||
For precise file targeting, use `rg` or MCP tools to discover files first.
|
||||
|
||||
- `--debug`: Verbose logging
|
||||
- `--save-session`: Save execution to workflow session
|
||||
### Codex Session Continuity
|
||||
|
||||
**Resume Pattern** for related tasks:
|
||||
```bash
|
||||
# First task - establish session
|
||||
codex -C [dir] --full-auto exec "[task]" --skip-git-repo-check -s danger-full-access
|
||||
|
||||
# Related task - continue session
|
||||
codex --full-auto exec "[related-task]" resume --last --skip-git-repo-check -s danger-full-access
|
||||
```
|
||||
|
||||
Use `resume --last` when current task extends/relates to previous execution. See intelligent-tools-strategy.md for auto-resume rules.
|
||||
|
||||
## Parameters
|
||||
|
||||
- `--tool <codex|gemini|qwen>` - Select CLI tool (default: gemini)
|
||||
- `--enhance` - Enhance input with `/enhance-prompt` first (Description Mode only)
|
||||
- `<description|task-id>` - Natural language description or task identifier
|
||||
- `--debug` - Verbose logging
|
||||
- `--save-session` - Save execution to workflow session
|
||||
|
||||
## Workflow Integration
|
||||
|
||||
**Session Management**: Auto-detects `.workflow/.active-*` marker
|
||||
- **Active**: Save to `.workflow/WFS-[id]/.chat/execute-[timestamp].md`
|
||||
- **None**: Create new session
|
||||
- Active session: Save to `.workflow/WFS-[id]/.chat/execute-[timestamp].md`
|
||||
- No session: Create new session
|
||||
|
||||
**Task Integration**: Load from `.task/[TASK-ID].json`, update status, generate summary
|
||||
|
||||
## Command Template
|
||||
|
||||
**Gemini/Qwen** (with YOLO approval):
|
||||
```bash
|
||||
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]
|
||||
"
|
||||
```
|
||||
|
||||
**Codex**:
|
||||
```bash
|
||||
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
|
||||
```
|
||||
|
||||
## Examples
|
||||
|
||||
```bash
|
||||
/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
|
||||
# Description mode with auto-detection
|
||||
/cli:execute "implement JWT authentication with middleware"
|
||||
|
||||
# Enhanced prompt
|
||||
/cli:execute --enhance "implement JWT authentication"
|
||||
|
||||
# Task ID mode
|
||||
/cli:execute IMPL-001
|
||||
|
||||
# Codex execution
|
||||
/cli:execute --tool codex "optimize database queries"
|
||||
|
||||
# Qwen with enhancement
|
||||
/cli:execute --tool qwen --enhance "refactor auth module"
|
||||
```
|
||||
|
||||
## Auto-Generated Outputs
|
||||
|
||||
- **Summary**: `.summaries/[TASK-ID]-summary.md`
|
||||
- **Session**: `.chat/execute-[timestamp].md`
|
||||
|
||||
## Notes
|
||||
|
||||
**vs. `/cli:analyze`**: Execute performs implementation, analyze is read-only.
|
||||
|
||||
- Command templates, YOLO mode details, and session management: see intelligent-tools-strategy.md (loaded in memory)
|
||||
- Auto-generated outputs: `.summaries/[TASK-ID]-summary.md`, `.chat/execute-[timestamp].md`
|
||||
|
||||
@@ -8,107 +8,67 @@ examples:
|
||||
- /cli:mode:bug-index --tool qwen --enhance "login not working"
|
||||
- /cli:mode:bug-index --tool codex --cd "src/auth" "token validation fails"
|
||||
allowed-tools: SlashCommand(*), Bash(*)
|
||||
model: sonnet
|
||||
---
|
||||
|
||||
# CLI Mode: Bug Index (/cli:mode:bug-index)
|
||||
|
||||
## Purpose
|
||||
|
||||
Execute systematic bug analysis and fix suggestions using CLI tools with diagnostic template.
|
||||
Systematic bug analysis with diagnostic template (`~/.claude/prompt-templates/bug-fix.md`).
|
||||
|
||||
**Supported Tools**: codex, gemini (default), qwen
|
||||
**Key Feature**: `--cd` flag for directory-scoped analysis
|
||||
|
||||
## Parameters
|
||||
|
||||
- `--tool <codex|gemini|qwen>` - Tool selection (default: gemini)
|
||||
- `--enhance` - Enhance bug description with `/enhance-prompt` first
|
||||
- `--cd "path"` - Target directory for focused analysis
|
||||
- `<bug-description>` (Required) - Bug description or error message
|
||||
|
||||
## Execution Flow
|
||||
|
||||
1. **Parse tool selection**: Extract `--tool` flag (default: gemini)
|
||||
2. **If `--enhance` flag present**: Execute `/enhance-prompt "[bug-description]"` first
|
||||
3. Parse bug description (original or enhanced)
|
||||
4. Detect target directory (from `--cd` or auto-infer)
|
||||
5. Build command for selected tool with bug-fix template
|
||||
6. Execute analysis
|
||||
7. Save to session (if active)
|
||||
1. Parse tool and directory options
|
||||
2. If `--enhance`: Execute `/enhance-prompt` to expand bug context
|
||||
3. Use bug-fix template: `~/.claude/prompt-templates/bug-fix.md`
|
||||
4. Execute with `--all-files` in target directory
|
||||
5. Save to `.workflow/WFS-[id]/.chat/bug-index-[timestamp].md`
|
||||
|
||||
## Core Rules
|
||||
## Analysis Focus (via Template)
|
||||
|
||||
1. **Enhance First (if flagged)**: Execute `/enhance-prompt` before analysis
|
||||
2. **Directory Context**: Use `cd` when `--cd` provided or auto-detected
|
||||
3. **Template Required**: Always use bug-fix template
|
||||
4. **Session Output**: Save to `.workflow/WFS-[id]/.chat/bug-index-[timestamp].md`
|
||||
|
||||
## Command Template
|
||||
|
||||
**Core Guidelines**: @~/.claude/workflows/intelligent-tools-strategy.md
|
||||
|
||||
```bash
|
||||
cd [directory] && ~/.claude/scripts/gemini-wrapper --all-files -p "
|
||||
PURPOSE: [bug analysis goal]
|
||||
TASK: Systematic bug analysis and fix recommendations
|
||||
CONTEXT: @{CLAUDE.md,**/*CLAUDE.md} [entire codebase in directory]
|
||||
EXPECTED: Root cause analysis, code path tracing, targeted fixes
|
||||
RULES: $(cat ~/.claude/prompt-templates/bug-fix.md) | Bug: [description]
|
||||
"
|
||||
```
|
||||
- Root cause investigation
|
||||
- Code path tracing
|
||||
- Targeted minimal fixes
|
||||
- Impact assessment
|
||||
|
||||
## Examples
|
||||
|
||||
**Basic Bug Analysis**:
|
||||
```bash
|
||||
cd . && ~/.claude/scripts/gemini-wrapper --all-files -p "
|
||||
PURPOSE: Debug authentication null pointer error
|
||||
TASK: Identify root cause and provide fix
|
||||
CONTEXT: @{CLAUDE.md,**/*CLAUDE.md}
|
||||
EXPECTED: Root cause, code path, minimal fix, impact assessment
|
||||
RULES: $(cat ~/.claude/prompt-templates/bug-fix.md) | Bug: null pointer in login flow
|
||||
"
|
||||
# Basic bug analysis
|
||||
/cli:mode:bug-index "null pointer in authentication"
|
||||
|
||||
# Directory-specific
|
||||
/cli:mode:bug-index --cd "src/auth" "token validation fails"
|
||||
|
||||
# Enhanced description
|
||||
/cli:mode:bug-index --enhance "login broken"
|
||||
|
||||
# Qwen for architecture-related bugs
|
||||
/cli:mode:bug-index --tool qwen "circular dependency in modules"
|
||||
```
|
||||
|
||||
**Directory-Specific**:
|
||||
## Bug Investigation Workflow
|
||||
|
||||
```bash
|
||||
cd src/auth && ~/.claude/scripts/gemini-wrapper --all-files -p "
|
||||
PURPOSE: Fix token validation failure
|
||||
TASK: Analyze token validation bug in auth module
|
||||
CONTEXT: @{CLAUDE.md,**/*CLAUDE.md}
|
||||
EXPECTED: Validation logic analysis, fix recommendation
|
||||
RULES: $(cat ~/.claude/prompt-templates/bug-fix.md) | Bug: token validation fails intermittently
|
||||
"
|
||||
# 1. Find bug-related files
|
||||
rg "error_keyword" --files-with-matches
|
||||
|
||||
# 2. Execute bug analysis with focused context
|
||||
/cli:mode:bug-index --cd "src/module" "specific error description"
|
||||
```
|
||||
|
||||
**With Enhancement**:
|
||||
```bash
|
||||
# User: /gemini:mode:bug-index --enhance "login broken"
|
||||
## Notes
|
||||
|
||||
# Step 1: Enhance
|
||||
/enhance-prompt "login broken"
|
||||
# Returns:
|
||||
# INTENT: Debug login authentication failure
|
||||
# CONTEXT: Known session state issue
|
||||
# ACTION: Check session management → verify token → test flow
|
||||
|
||||
# Step 2: Analyze with enhanced context
|
||||
cd . && ~/.claude/scripts/gemini-wrapper --all-files -p "
|
||||
PURPOSE: Debug login authentication failure
|
||||
TASK: Analyze session management, token handling, auth flow
|
||||
CONTEXT: @{CLAUDE.md,**/*CLAUDE.md} Known: session state issue
|
||||
EXPECTED: Root cause in session/token, targeted fix
|
||||
RULES: $(cat ~/.claude/prompt-templates/bug-fix.md) | Focus on session management
|
||||
"
|
||||
```
|
||||
|
||||
## Analysis Focus
|
||||
|
||||
**Template provides**:
|
||||
- **Root Cause Analysis**: Systematic investigation
|
||||
- **Code Path Tracing**: Execution flow analysis
|
||||
- **Targeted Solutions**: Minimal, specific fixes
|
||||
- **Impact Assessment**: Side effect evaluation
|
||||
|
||||
## Session Output
|
||||
|
||||
**Location**: `.workflow/WFS-[topic]/.chat/bug-index-[timestamp].md`
|
||||
|
||||
**Includes**:
|
||||
- Bug description
|
||||
- Template used
|
||||
- Analysis results
|
||||
- Recommended actions
|
||||
- Command templates and file patterns: see intelligent-tools-strategy.md (loaded in memory)
|
||||
- Template path: `~/.claude/prompt-templates/bug-fix.md`
|
||||
- Always uses `--all-files` for comprehensive codebase context
|
||||
|
||||
@@ -8,197 +8,68 @@ examples:
|
||||
- /cli:mode:code-analysis --tool qwen --enhance "explain data transformation pipeline"
|
||||
- /cli:mode:code-analysis --tool codex --cd "src/core" "trace execution path for user registration"
|
||||
allowed-tools: SlashCommand(*), Bash(*)
|
||||
model: sonnet
|
||||
---
|
||||
|
||||
# CLI Mode: Code Analysis (/cli:mode:code-analysis)
|
||||
|
||||
## Purpose
|
||||
|
||||
Execute systematic code analysis and debugging using CLI tools with specialized code analysis template.
|
||||
Systematic code analysis with execution path tracing template (`~/.claude/prompt-templates/code-analysis.md`).
|
||||
|
||||
**Supported Tools**: codex, gemini (default), qwen
|
||||
**Key Feature**: `--cd` flag for directory-scoped analysis
|
||||
|
||||
## Parameters
|
||||
|
||||
- `--tool <codex|gemini|qwen>` - Tool selection (default: gemini)
|
||||
- `--enhance` - Enhance analysis target with `/enhance-prompt` first
|
||||
- `--cd "path"` - Target directory for focused analysis
|
||||
- `<analysis-target>` (Required) - Code analysis target or question
|
||||
|
||||
## Execution Flow
|
||||
|
||||
1. **Parse tool selection**: Extract `--tool` flag (default: gemini)
|
||||
2. **If `--enhance` flag present**: Execute `/enhance-prompt "[analysis-target]"` first
|
||||
3. Parse analysis target (original or enhanced)
|
||||
4. Detect target directory (from `--cd` or auto-infer)
|
||||
5. Build command for selected tool with code-analysis template
|
||||
6. Execute deep analysis
|
||||
7. Save to session (if active)
|
||||
1. Parse tool and directory options
|
||||
2. If `--enhance`: Execute `/enhance-prompt` to expand analysis intent
|
||||
3. Use code-analysis template: `~/.claude/prompt-templates/code-analysis.md`
|
||||
4. Execute with `--all-files` in target directory
|
||||
5. Save to `.workflow/WFS-[id]/.chat/code-analysis-[timestamp].md`
|
||||
|
||||
## Core Rules
|
||||
## Analysis Capabilities (via Template)
|
||||
|
||||
1. **Tool Selection**: Use `--tool` value or default to gemini
|
||||
2. **Enhance First (if flagged)**: Execute `/enhance-prompt` before analysis
|
||||
3. **Directory Context**: Use `cd` when `--cd` provided or auto-detected
|
||||
4. **Template Required**: Always use code-analysis template
|
||||
5. **Session Output**: Save to `.workflow/WFS-[id]/.chat/code-analysis-[timestamp].md`
|
||||
|
||||
## Analysis Capabilities
|
||||
|
||||
The code-analysis template provides:
|
||||
- **Systematic Code Analysis**: Break down complex code into manageable parts
|
||||
- **Execution Path Tracing**: Track variable states and call stacks
|
||||
- **Control & Data Flow**: Understand code logic and data transformations
|
||||
- **Call Flow Visualization**: Diagram function calling sequences
|
||||
- **Logical Reasoning**: Explain "why" behind code behavior
|
||||
- **Debugging Insights**: Identify potential bugs or inefficiencies
|
||||
|
||||
## Command Templates
|
||||
|
||||
**Core Guidelines**: @~/.claude/workflows/intelligent-tools-strategy.md
|
||||
|
||||
### Gemini (Default)
|
||||
```bash
|
||||
cd [directory] && ~/.claude/scripts/gemini-wrapper --all-files -p "
|
||||
PURPOSE: [analysis goal from target]
|
||||
TASK: Deep code analysis with execution path tracing
|
||||
CONTEXT: @{CLAUDE.md,**/*CLAUDE.md} [entire codebase in directory]
|
||||
EXPECTED: Systematic analysis, call flow diagram, data transformations, logical explanation
|
||||
RULES: $(cat ~/.claude/prompt-templates/code-analysis.md) | Focus on [specific aspect]
|
||||
"
|
||||
```
|
||||
|
||||
### Qwen
|
||||
```bash
|
||||
cd [directory] && ~/.claude/scripts/qwen-wrapper --all-files -p "
|
||||
PURPOSE: [analysis goal from target]
|
||||
TASK: Architecture-level code analysis and pattern recognition
|
||||
CONTEXT: @{CLAUDE.md,**/*CLAUDE.md} [entire codebase in directory]
|
||||
EXPECTED: Architectural insights, design patterns, code structure analysis
|
||||
RULES: $(cat ~/.claude/prompt-templates/code-analysis.md) | Focus on [specific aspect]
|
||||
"
|
||||
```
|
||||
|
||||
### Codex
|
||||
```bash
|
||||
codex -C [directory] --full-auto exec "
|
||||
PURPOSE: [analysis goal from target]
|
||||
TASK: Deep code inspection with debugging insights
|
||||
CONTEXT: @{CLAUDE.md,**/*CLAUDE.md} [entire codebase in directory]
|
||||
EXPECTED: Execution trace, bug identification, optimization opportunities
|
||||
RULES: $(cat ~/.claude/prompt-templates/code-analysis.md) | Focus on [specific aspect]
|
||||
" --skip-git-repo-check -s danger-full-access
|
||||
```
|
||||
- Execution path tracing with variable states
|
||||
- Call flow visualization and diagrams
|
||||
- Control & data flow analysis
|
||||
- Logical reasoning ("why" behind code behavior)
|
||||
- Debugging insights and inefficiency detection
|
||||
|
||||
## Examples
|
||||
|
||||
**Basic Code Analysis (Gemini)**:
|
||||
```bash
|
||||
cd . && ~/.claude/scripts/gemini-wrapper --all-files -p "
|
||||
PURPOSE: Analyze authentication flow logic
|
||||
TASK: Trace authentication execution path and identify key functions
|
||||
CONTEXT: @{CLAUDE.md,**/*CLAUDE.md}
|
||||
EXPECTED: Step-by-step flow, call diagram, data passing between functions
|
||||
RULES: $(cat ~/.claude/prompt-templates/code-analysis.md) | Focus on control flow and security
|
||||
"
|
||||
# Basic code analysis
|
||||
/cli:mode:code-analysis "trace authentication flow"
|
||||
|
||||
# Directory-specific with enhancement
|
||||
/cli:mode:code-analysis --cd "src/auth" --enhance "how does JWT work"
|
||||
|
||||
# Qwen for architecture analysis
|
||||
/cli:mode:code-analysis --tool qwen "explain microservices communication"
|
||||
|
||||
# Codex for deep tracing
|
||||
/cli:mode:code-analysis --tool codex --cd "src/api" "trace request lifecycle"
|
||||
```
|
||||
|
||||
**Architecture Analysis (Qwen)**:
|
||||
```bash
|
||||
# User: /cli:mode:code-analysis --tool qwen "explain data transformation pipeline"
|
||||
## Code Tracing Workflow
|
||||
|
||||
cd . && ~/.claude/scripts/qwen-wrapper --all-files -p "
|
||||
PURPOSE: Explain data transformation pipeline architecture
|
||||
TASK: Analyze data flow and transformation patterns
|
||||
CONTEXT: @{CLAUDE.md,**/*CLAUDE.md}
|
||||
EXPECTED: Pipeline structure, transformation stages, data format changes
|
||||
RULES: $(cat ~/.claude/prompt-templates/code-analysis.md) | Focus on data flow and patterns
|
||||
"
|
||||
```bash
|
||||
# 1. Find entry points
|
||||
rg "function.*main|export.*handler" --files-with-matches
|
||||
|
||||
# 2. Execute deep analysis
|
||||
/cli:mode:code-analysis --cd "src" "trace execution from entry point"
|
||||
```
|
||||
|
||||
**Deep Debugging (Codex)**:
|
||||
```bash
|
||||
# User: /cli:mode:code-analysis --tool codex --cd "src/core" "trace execution path for user registration"
|
||||
## Notes
|
||||
|
||||
codex -C src/core --full-auto exec "
|
||||
PURPOSE: Trace execution path for user registration
|
||||
TASK: Deep analysis of registration flow with debugging insights
|
||||
CONTEXT: @{CLAUDE.md,**/*CLAUDE.md}
|
||||
EXPECTED: Complete execution trace, variable states, potential issues
|
||||
RULES: $(cat ~/.claude/prompt-templates/code-analysis.md) | Focus on edge cases and error handling
|
||||
" --skip-git-repo-check -s danger-full-access
|
||||
```
|
||||
|
||||
**With Enhancement**:
|
||||
```bash
|
||||
# User: /cli:mode:code-analysis --enhance "why is login slow"
|
||||
|
||||
# Step 1: Enhance
|
||||
/enhance-prompt "why is login slow"
|
||||
# Returns:
|
||||
# INTENT: Identify performance bottlenecks in login flow
|
||||
# CONTEXT: Authentication module, database queries
|
||||
# ACTION: Trace execution path → identify slow operations → suggest optimizations
|
||||
|
||||
# Step 2: Analyze with enhanced context
|
||||
cd . && ~/.claude/scripts/gemini-wrapper --all-files -p "
|
||||
PURPOSE: Identify performance bottlenecks in login flow
|
||||
TASK: Trace login execution path and measure operation costs
|
||||
CONTEXT: @{CLAUDE.md,**/*CLAUDE.md} @{**/*auth*,**/*login*}
|
||||
EXPECTED: Performance analysis, bottleneck identification, optimization recommendations
|
||||
RULES: $(cat ~/.claude/prompt-templates/code-analysis.md) | Focus on performance and database queries
|
||||
"
|
||||
```
|
||||
|
||||
## Analysis Output Structure
|
||||
|
||||
Based on code-analysis.md template, output includes:
|
||||
|
||||
### 1. 思考过程 (Thinking Process)
|
||||
- Analysis strategy and approach
|
||||
- Key assumptions about code behavior
|
||||
|
||||
### 2. 对问题的理解 (Understanding)
|
||||
- Restate analysis target
|
||||
- Confirm understanding of requirements
|
||||
|
||||
### 3. 核心解答 (Core Answer)
|
||||
- Direct, concise answer to analysis question
|
||||
|
||||
### 4. 详细分析与调用逻辑 (Detailed Analysis)
|
||||
- **代码段识别**: Relevant code sections
|
||||
- **执行流程**: Step-by-step execution flow
|
||||
- **调用图**: Visual call flow diagram with symbols:
|
||||
- `───►` Function call
|
||||
- `◄───` Return
|
||||
- `│` Continuation
|
||||
- `├─` Intermediate step
|
||||
- `└─` Last step in block
|
||||
- **数据传递**: Data passing and state changes
|
||||
- **逻辑解释**: Why code behaves this way
|
||||
|
||||
### 5. 总结 (Summary)
|
||||
- Key findings and recommendations
|
||||
|
||||
## Session Output
|
||||
|
||||
**Location**: `.workflow/WFS-[topic]/.chat/code-analysis-[timestamp].md`
|
||||
|
||||
**Includes**:
|
||||
- Analysis target
|
||||
- Template used
|
||||
- Complete structured analysis
|
||||
- Call flow diagrams
|
||||
- Debugging insights
|
||||
- Recommendations
|
||||
|
||||
## Use Cases
|
||||
|
||||
| Use Case | Best Tool | Focus |
|
||||
|----------|-----------|-------|
|
||||
| **Understand execution flow** | gemini | Call sequences, data flow |
|
||||
| **Architectural patterns** | qwen | Design patterns, structure |
|
||||
| **Performance debugging** | codex | Bottlenecks, optimizations |
|
||||
| **Bug investigation** | codex | Error paths, edge cases |
|
||||
| **Code review** | gemini | Logic correctness, clarity |
|
||||
| **Refactoring planning** | qwen | Structure improvements |
|
||||
|
||||
## Tool Selection Guide
|
||||
|
||||
- **Gemini**: Best for general code understanding and tracing
|
||||
- **Qwen**: Best for architectural analysis and pattern recognition
|
||||
- **Codex**: Best for deep debugging and performance analysis
|
||||
- Command templates and file patterns: see intelligent-tools-strategy.md (loaded in memory)
|
||||
- Template path: `~/.claude/prompt-templates/code-analysis.md`
|
||||
- Always uses `--all-files` for comprehensive code context
|
||||
|
||||
@@ -8,97 +8,68 @@ examples:
|
||||
- /cli:mode:plan --tool qwen --enhance "plan microservices migration"
|
||||
- /cli:mode:plan --tool codex --cd "src/auth" "authentication system"
|
||||
allowed-tools: SlashCommand(*), Bash(*)
|
||||
model: sonnet
|
||||
---
|
||||
|
||||
# CLI Mode: Plan (/cli:mode:plan)
|
||||
|
||||
## Purpose
|
||||
|
||||
Execute planning and architecture analysis using CLI tools with specialized template.
|
||||
Comprehensive planning and architecture analysis with strategic planning template (`~/.claude/prompt-templates/plan.md`).
|
||||
|
||||
**Supported Tools**: codex, gemini (default), qwen
|
||||
**Key Feature**: `--cd` flag for directory-scoped planning
|
||||
|
||||
## Parameters
|
||||
|
||||
- `--tool <codex|gemini|qwen>` - Tool selection (default: gemini)
|
||||
- `--enhance` - Enhance topic with `/enhance-prompt` first
|
||||
- `--cd "path"` - Target directory for focused planning
|
||||
- `<topic>` (Required) - Planning topic or architectural question
|
||||
|
||||
## Execution Flow
|
||||
|
||||
1. **Parse tool selection**: Extract `--tool` flag (default: gemini)
|
||||
2. **If `--enhance` flag present**: Execute `/enhance-prompt "[topic]"` first
|
||||
3. Parse topic (original or enhanced)
|
||||
4. Detect target directory (from `--cd` or auto-infer)
|
||||
5. Build command for selected tool with planning template
|
||||
6. Execute analysis
|
||||
7. Save to session (if active)
|
||||
1. Parse tool and directory options
|
||||
2. If `--enhance`: Execute `/enhance-prompt` to expand planning context
|
||||
3. Use planning template: `~/.claude/prompt-templates/plan.md`
|
||||
4. Execute with `--all-files` in target directory
|
||||
5. Save to `.workflow/WFS-[id]/.chat/plan-[timestamp].md`
|
||||
|
||||
## Core Rules
|
||||
## Planning Capabilities (via Template)
|
||||
|
||||
1. **Enhance First (if flagged)**: Execute `/enhance-prompt` before planning
|
||||
2. **Directory Context**: Use `cd` when `--cd` provided or auto-detected
|
||||
3. **Template Required**: Always use planning template
|
||||
4. **Session Output**: Save to `.workflow/WFS-[id]/.chat/plan-[timestamp].md`
|
||||
|
||||
## Command Template
|
||||
|
||||
**Core Guidelines**: @~/.claude/workflows/intelligent-tools-strategy.md
|
||||
|
||||
```bash
|
||||
cd [directory] && ~/.claude/scripts/gemini-wrapper --all-files -p "
|
||||
PURPOSE: [planning goal from topic]
|
||||
TASK: Comprehensive planning and architecture analysis
|
||||
CONTEXT: @{CLAUDE.md,**/*CLAUDE.md} [entire codebase in directory]
|
||||
EXPECTED: Strategic insights, implementation roadmap, key decisions
|
||||
RULES: $(cat ~/.claude/prompt-templates/plan.md) | Focus on [topic area]
|
||||
"
|
||||
```
|
||||
- Strategic architecture insights
|
||||
- Implementation roadmaps
|
||||
- Key technical decisions
|
||||
- Risk assessment
|
||||
- Resource planning
|
||||
|
||||
## Examples
|
||||
|
||||
**Basic Planning**:
|
||||
```bash
|
||||
cd . && ~/.claude/scripts/gemini-wrapper --all-files -p "
|
||||
PURPOSE: Design user dashboard feature architecture
|
||||
TASK: Comprehensive architecture planning for dashboard
|
||||
CONTEXT: @{CLAUDE.md,**/*CLAUDE.md}
|
||||
EXPECTED: Architecture design, component structure, implementation roadmap
|
||||
RULES: $(cat ~/.claude/prompt-templates/plan.md) | Focus on scalability and UX
|
||||
"
|
||||
# Basic planning
|
||||
/cli:mode:plan "design user dashboard"
|
||||
|
||||
# Enhanced with directory scope
|
||||
/cli:mode:plan --cd "src/api" --enhance "plan API refactoring"
|
||||
|
||||
# Qwen for architecture planning
|
||||
/cli:mode:plan --tool qwen "plan microservices migration"
|
||||
|
||||
# Codex for technical planning
|
||||
/cli:mode:plan --tool codex "plan testing strategy"
|
||||
```
|
||||
|
||||
**Directory-Specific**:
|
||||
## Planning Workflow
|
||||
|
||||
```bash
|
||||
cd src/auth && ~/.claude/scripts/gemini-wrapper --all-files -p "
|
||||
PURPOSE: Plan authentication system redesign
|
||||
TASK: Analyze current auth and plan improvements
|
||||
CONTEXT: @{CLAUDE.md,**/*CLAUDE.md}
|
||||
EXPECTED: Migration strategy, security improvements, timeline
|
||||
RULES: $(cat ~/.claude/prompt-templates/plan.md) | Focus on security and backward compatibility
|
||||
"
|
||||
# 1. Gather existing architecture info
|
||||
rg "architecture|design" --files-with-matches
|
||||
|
||||
# 2. Execute planning analysis
|
||||
/cli:mode:plan "topic for strategic planning"
|
||||
```
|
||||
|
||||
**With Enhancement**:
|
||||
```bash
|
||||
# User: /gemini:mode:plan --enhance "fix auth issues"
|
||||
## Notes
|
||||
|
||||
# Step 1: Enhance
|
||||
/enhance-prompt "fix auth issues"
|
||||
# Returns structured planning context
|
||||
|
||||
# Step 2: Plan with enhanced input
|
||||
cd . && ~/.claude/scripts/gemini-wrapper --all-files -p "
|
||||
PURPOSE: [enhanced goal]
|
||||
TASK: [enhanced task description]
|
||||
CONTEXT: @{CLAUDE.md,**/*CLAUDE.md} [enhanced context]
|
||||
EXPECTED: Strategic plan with enhanced requirements
|
||||
RULES: $(cat ~/.claude/prompt-templates/plan.md) | [enhanced constraints]
|
||||
"
|
||||
```
|
||||
|
||||
## Session Output
|
||||
|
||||
**Location**: `.workflow/WFS-[topic]/.chat/plan-[timestamp].md`
|
||||
|
||||
**Includes**:
|
||||
- Planning topic
|
||||
- Template used
|
||||
- Analysis results
|
||||
- Implementation roadmap
|
||||
- Key decisions
|
||||
- Command templates and file patterns: see intelligent-tools-strategy.md (loaded in memory)
|
||||
- Template path: `~/.claude/prompt-templates/plan.md`
|
||||
- Always uses `--all-files` for comprehensive project context
|
||||
|
||||
@@ -1,33 +1,46 @@
|
||||
---
|
||||
name: update-memory-full
|
||||
description: Complete project-wide CLAUDE.md documentation update
|
||||
usage: /update-memory-full
|
||||
usage: /update-memory-full [--tool <gemini|qwen|codex>]
|
||||
argument-hint: "[--tool gemini|qwen|codex]"
|
||||
examples:
|
||||
- /update-memory-full # Full project documentation update
|
||||
- /update-memory-full # Full project documentation update (gemini default)
|
||||
- /update-memory-full --tool qwen # Use Qwen for architecture analysis
|
||||
- /update-memory-full --tool codex # Use Codex for implementation validation
|
||||
---
|
||||
|
||||
### 🚀 Command Overview: `/update-memory-full`
|
||||
|
||||
Complete project-wide documentation update using depth-parallel execution.
|
||||
|
||||
**Tool Selection**:
|
||||
- **Gemini (default)**: Documentation generation, pattern recognition, architecture review
|
||||
- **Qwen**: Architecture analysis, system design documentation
|
||||
- **Codex**: Implementation validation, code quality analysis
|
||||
|
||||
### 📝 Execution Template
|
||||
|
||||
```bash
|
||||
#!/bin/bash
|
||||
# Complete project-wide CLAUDE.md documentation update
|
||||
|
||||
# Step 1: Code Index architecture analysis
|
||||
# Step 1: Parse tool selection (default: gemini)
|
||||
tool="gemini"
|
||||
[[ "$*" == *"--tool qwen"* ]] && tool="qwen"
|
||||
[[ "$*" == *"--tool codex"* ]] && tool="codex"
|
||||
|
||||
# Step 2: Code Index architecture analysis
|
||||
mcp__code-index__search_code_advanced(pattern="class|function|interface", file_pattern="**/*.{ts,js,py}")
|
||||
mcp__code-index__find_files(pattern="**/*.{md,json,yaml,yml}")
|
||||
|
||||
# Step 2: Cache git changes
|
||||
# Step 3: Cache git changes
|
||||
Bash(git add -A 2>/dev/null || true)
|
||||
|
||||
# Step 3: Get and display project structure
|
||||
# Step 4: Get and display project structure
|
||||
modules=$(Bash(~/.claude/scripts/get_modules_by_depth.sh list))
|
||||
count=$(echo "$modules" | wc -l)
|
||||
|
||||
# Step 3: Analysis handover → Model takes control
|
||||
# Step 5: Analysis handover → Model takes control
|
||||
# BASH_EXECUTION_STOPS → MODEL_ANALYSIS_BEGINS
|
||||
|
||||
# Pseudocode flow:
|
||||
@@ -35,6 +48,8 @@ count=$(echo "$modules" | wc -l)
|
||||
# → Task "Complex project full update" subagent_type: "memory-gemini-bridge"
|
||||
# ELSE:
|
||||
# → Present plan and WAIT FOR USER APPROVAL before execution
|
||||
#
|
||||
# Pass tool parameter to update_module_claude.sh: "$tool"
|
||||
```
|
||||
|
||||
### 🧠 Model Analysis Phase
|
||||
@@ -43,7 +58,7 @@ After the bash script completes the initial analysis, the model takes control to
|
||||
|
||||
1. **Analyze Complexity**: Review module count and project context
|
||||
2. **Parse CLAUDE.md Status**: Extract which modules have/need CLAUDE.md files
|
||||
3. **Choose Strategy**:
|
||||
3. **Choose Strategy**:
|
||||
- Simple projects: Present execution plan with CLAUDE.md paths to user
|
||||
- Complex projects: Delegate to memory-gemini-bridge agent
|
||||
4. **Present Detailed Plan**: Show user exactly which CLAUDE.md files will be created/updated
|
||||
@@ -56,17 +71,19 @@ After the bash script completes the initial analysis, the model takes control to
|
||||
Model will present detailed plan:
|
||||
```
|
||||
📋 Update Plan:
|
||||
Tool: [gemini|qwen|codex] (from --tool parameter)
|
||||
|
||||
NEW CLAUDE.md files (X):
|
||||
- ./src/components/CLAUDE.md
|
||||
- ./src/services/CLAUDE.md
|
||||
|
||||
|
||||
UPDATE existing CLAUDE.md files (Y):
|
||||
- ./CLAUDE.md
|
||||
- ./src/CLAUDE.md
|
||||
- ./tests/CLAUDE.md
|
||||
|
||||
Total: N CLAUDE.md files will be processed
|
||||
|
||||
|
||||
⚠️ Confirm execution? (y/n)
|
||||
```
|
||||
|
||||
@@ -84,7 +101,7 @@ depth_modules = organize_by_depth(modules)
|
||||
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" "full" &)
|
||||
Bash(~/.claude/scripts/update_module_claude.sh "$module" "full" "$tool" &)
|
||||
wait_all_jobs()
|
||||
|
||||
# Step 6: Safety check and restore staging state
|
||||
@@ -102,13 +119,43 @@ Bash(git status --short)
|
||||
```
|
||||
|
||||
**For Complex Projects (>20 modules):**
|
||||
The model will delegate to the memory-gemini-bridge agent using the Task tool:
|
||||
```
|
||||
|
||||
The model will delegate to the memory-gemini-bridge agent with structured context:
|
||||
|
||||
```javascript
|
||||
Task "Complex project full update"
|
||||
prompt: "Execute full documentation update for [count] modules using depth-parallel execution"
|
||||
subagent_type: "memory-gemini-bridge"
|
||||
prompt: `
|
||||
CONTEXT:
|
||||
- Total modules: ${module_count}
|
||||
- Tool: ${tool} // from --tool parameter, default: gemini
|
||||
- Mode: full
|
||||
- Existing CLAUDE.md: ${existing_count}
|
||||
- New CLAUDE.md needed: ${new_count}
|
||||
|
||||
MODULE LIST:
|
||||
${modules_output} // Full output from get_modules_by_depth.sh list
|
||||
|
||||
REQUIREMENTS:
|
||||
1. Use TodoWrite to track each depth level before execution
|
||||
2. Process depths 5→0 sequentially, max 4 parallel jobs per depth
|
||||
3. Command format: update_module_claude.sh "<path>" "full" "${tool}" &
|
||||
4. Extract exact path from "depth:N|path:<PATH>|..." format
|
||||
5. Verify all ${module_count} modules are processed
|
||||
6. Run safety check after completion
|
||||
7. Display git status
|
||||
|
||||
Execute depth-parallel updates for all modules.
|
||||
`
|
||||
```
|
||||
|
||||
**Agent receives complete context:**
|
||||
- Module count and tool selection
|
||||
- Full structured module list
|
||||
- Clear execution requirements
|
||||
- Path extraction format
|
||||
- Success criteria
|
||||
|
||||
|
||||
### 📚 Usage Examples
|
||||
|
||||
|
||||
@@ -1,15 +1,23 @@
|
||||
---
|
||||
name: update-memory-related
|
||||
description: Context-aware CLAUDE.md documentation updates based on recent changes
|
||||
usage: /update-memory-related
|
||||
usage: /update-memory-related [--tool <gemini|qwen|codex>]
|
||||
argument-hint: "[--tool gemini|qwen|codex]"
|
||||
examples:
|
||||
- /update-memory-related # Update documentation based on recent changes
|
||||
- /update-memory-related # Update documentation based on recent changes (gemini default)
|
||||
- /update-memory-related --tool qwen # Use Qwen for architecture analysis
|
||||
- /update-memory-related --tool codex # Use Codex for implementation validation
|
||||
---
|
||||
|
||||
### 🚀 Command Overview: `/update-memory-related`
|
||||
|
||||
Context-aware documentation update for modules affected by recent changes.
|
||||
|
||||
**Tool Selection**:
|
||||
- **Gemini (default)**: Documentation generation, pattern recognition, architecture review
|
||||
- **Qwen**: Architecture analysis, system design documentation
|
||||
- **Codex**: Implementation validation, code quality analysis
|
||||
|
||||
|
||||
### 📝 Execution Template
|
||||
|
||||
@@ -17,23 +25,28 @@ Context-aware documentation update for modules affected by recent changes.
|
||||
#!/bin/bash
|
||||
# Context-aware CLAUDE.md documentation update
|
||||
|
||||
# Step 1: Code Index refresh and architecture analysis
|
||||
# Step 1: Parse tool selection (default: gemini)
|
||||
tool="gemini"
|
||||
[[ "$*" == *"--tool qwen"* ]] && tool="qwen"
|
||||
[[ "$*" == *"--tool codex"* ]] && tool="codex"
|
||||
|
||||
# Step 2: 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)
|
||||
# Step 3: Detect changed modules (before staging)
|
||||
changed=$(Bash(~/.claude/scripts/detect_changed_modules.sh list))
|
||||
|
||||
# Step 3: Cache git changes (protect current state)
|
||||
# Step 4: Cache git changes (protect current state)
|
||||
Bash(git add -A 2>/dev/null || true)
|
||||
|
||||
# Step 3: Use detected changes or fallback
|
||||
# Step 5: 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
|
||||
# Step 6: Analysis handover → Model takes control
|
||||
# BASH_EXECUTION_STOPS → MODEL_ANALYSIS_BEGINS
|
||||
|
||||
# Pseudocode flow:
|
||||
@@ -41,6 +54,8 @@ count=$(echo "$changed" | wc -l)
|
||||
# → Task "Complex project related update" subagent_type: "memory-gemini-bridge"
|
||||
# ELSE:
|
||||
# → Present plan and WAIT FOR USER APPROVAL before execution
|
||||
#
|
||||
# Pass tool parameter to update_module_claude.sh: "$tool"
|
||||
```
|
||||
|
||||
### 🧠 Model Analysis Phase
|
||||
@@ -62,18 +77,20 @@ After the bash script completes change detection, the model takes control to:
|
||||
Model will present detailed plan for affected modules:
|
||||
```
|
||||
📋 Related Update Plan:
|
||||
Tool: [gemini|qwen|codex] (from --tool parameter)
|
||||
|
||||
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)
|
||||
```
|
||||
|
||||
@@ -91,7 +108,7 @@ depth_modules = organize_by_depth(changed_modules)
|
||||
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" &)
|
||||
Bash(~/.claude/scripts/update_module_claude.sh "$module" "related" "$tool" &)
|
||||
wait_all_jobs()
|
||||
|
||||
# Step 6: Safety check and restore staging state
|
||||
@@ -109,13 +126,44 @@ Bash(git diff --stat)
|
||||
```
|
||||
|
||||
**For Complex Changes (>15 modules):**
|
||||
The model will delegate to the memory-gemini-bridge agent using the Task tool:
|
||||
```
|
||||
|
||||
The model will delegate to the memory-gemini-bridge agent with structured context:
|
||||
|
||||
```javascript
|
||||
Task "Complex project related update"
|
||||
prompt: "Execute context-aware update for [count] changed modules using depth-parallel execution"
|
||||
subagent_type: "memory-gemini-bridge"
|
||||
prompt: `
|
||||
CONTEXT:
|
||||
- Total modules: ${change_count}
|
||||
- Tool: ${tool} // from --tool parameter, default: gemini
|
||||
- Mode: related
|
||||
- Changed modules detected via: detect_changed_modules.sh
|
||||
- Existing CLAUDE.md: ${existing_count}
|
||||
- New CLAUDE.md needed: ${new_count}
|
||||
|
||||
MODULE LIST:
|
||||
${changed_modules_output} // Full output from detect_changed_modules.sh list
|
||||
|
||||
REQUIREMENTS:
|
||||
1. Use TodoWrite to track each depth level before execution
|
||||
2. Process depths sequentially (deepest→shallowest), max 4 parallel jobs per depth
|
||||
3. Command format: update_module_claude.sh "<path>" "related" "${tool}" &
|
||||
4. Extract exact path from "depth:N|path:<PATH>|..." format
|
||||
5. Verify all ${change_count} modules are processed
|
||||
6. Run safety check after completion
|
||||
7. Display git diff --stat
|
||||
|
||||
Execute depth-parallel updates for changed modules only.
|
||||
`
|
||||
```
|
||||
|
||||
**Agent receives complete context:**
|
||||
- Changed module count and tool selection
|
||||
- Full structured module list (changed only)
|
||||
- Clear execution requirements with "related" mode
|
||||
- Path extraction format
|
||||
- Success criteria
|
||||
|
||||
|
||||
### 📚 Usage Examples
|
||||
|
||||
|
||||
@@ -1,13 +1,15 @@
|
||||
#!/bin/bash
|
||||
# Update CLAUDE.md for a specific module with automatic layer detection
|
||||
# Usage: update_module_claude.sh <module_path> [update_type]
|
||||
# Usage: update_module_claude.sh <module_path> [update_type] [tool]
|
||||
# module_path: Path to the module directory
|
||||
# update_type: full|related (default: full)
|
||||
# tool: gemini|qwen|codex (default: gemini)
|
||||
# Script automatically detects layer depth and selects appropriate template
|
||||
|
||||
update_module_claude() {
|
||||
local module_path="$1"
|
||||
local update_type="${2:-full}"
|
||||
local tool="${3:-gemini}"
|
||||
|
||||
# Validate parameters
|
||||
if [ -z "$module_path" ]; then
|
||||
@@ -61,9 +63,9 @@ update_module_claude() {
|
||||
|
||||
# Prepare logging info
|
||||
local module_name=$(basename "$module_path")
|
||||
|
||||
|
||||
echo "⚡ Updating: $module_path"
|
||||
echo " Layer: $layer | Type: $update_type | Files: $file_count"
|
||||
echo " Layer: $layer | Type: $update_type | Tool: $tool | Files: $file_count"
|
||||
echo " Template: $(basename "$template_path") | Strategy: $analysis_strategy"
|
||||
|
||||
# Generate prompt with template injection
|
||||
@@ -106,31 +108,50 @@ update_module_claude() {
|
||||
# Execute update
|
||||
local start_time=$(date +%s)
|
||||
echo " 🔄 Starting update..."
|
||||
|
||||
|
||||
if cd "$module_path" 2>/dev/null; then
|
||||
# Execute gemini command with layer-specific analysis strategy
|
||||
local gemini_result=0
|
||||
if [ "$analysis_strategy" = "--all-files" ]; then
|
||||
gemini --all-files --yolo -p "$base_prompt
|
||||
local tool_result=0
|
||||
local final_prompt="$base_prompt
|
||||
|
||||
Module Information:
|
||||
- Name: $module_name
|
||||
- Path: $module_path
|
||||
- Layer: $layer
|
||||
- Analysis Strategy: $analysis_strategy" 2>&1
|
||||
gemini_result=$?
|
||||
else
|
||||
gemini --yolo -p "$analysis_strategy $base_prompt
|
||||
- Tool: $tool
|
||||
- Analysis Strategy: $analysis_strategy"
|
||||
|
||||
Module Information:
|
||||
- Name: $module_name
|
||||
- Path: $module_path
|
||||
- Layer: $layer
|
||||
- Analysis Strategy: $analysis_strategy" 2>&1
|
||||
gemini_result=$?
|
||||
fi
|
||||
|
||||
if [ $gemini_result -eq 0 ]; then
|
||||
# Execute with selected tool
|
||||
case "$tool" in
|
||||
qwen)
|
||||
if [ "$analysis_strategy" = "--all-files" ]; then
|
||||
qwen --all-files --yolo -p "$final_prompt" 2>&1
|
||||
tool_result=$?
|
||||
else
|
||||
qwen --yolo -p "$analysis_strategy $final_prompt" 2>&1
|
||||
tool_result=$?
|
||||
fi
|
||||
;;
|
||||
codex)
|
||||
if [ "$analysis_strategy" = "--all-files" ]; then
|
||||
codex --full-auto exec "$final_prompt" --skip-git-repo-check -s danger-full-access 2>&1
|
||||
tool_result=$?
|
||||
else
|
||||
codex --full-auto exec "$final_prompt CONTEXT: $analysis_strategy" --skip-git-repo-check -s danger-full-access 2>&1
|
||||
tool_result=$?
|
||||
fi
|
||||
;;
|
||||
gemini|*)
|
||||
if [ "$analysis_strategy" = "--all-files" ]; then
|
||||
gemini --all-files --yolo -p "$final_prompt" 2>&1
|
||||
tool_result=$?
|
||||
else
|
||||
gemini --yolo -p "$analysis_strategy $final_prompt" 2>&1
|
||||
tool_result=$?
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ $tool_result -eq 0 ]; then
|
||||
local end_time=$(date +%s)
|
||||
local duration=$((end_time - start_time))
|
||||
echo " ✅ Completed in ${duration}s"
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
{
|
||||
"version": "3.4.0",
|
||||
"installation_mode": "Local",
|
||||
"installation_path": "D:\\Claude_dms3\\.claude",
|
||||
"source_branch": "main",
|
||||
"installation_date_utc": "2025-10-04T00:00:00Z"
|
||||
}
|
||||
@@ -6,11 +6,22 @@ type: strategic-guideline
|
||||
|
||||
# Intelligent Tools Selection Strategy
|
||||
|
||||
## 📋 Table of Contents
|
||||
1. [Core Framework](#-core-framework)
|
||||
2. [Tool Specifications](#-tool-specifications)
|
||||
3. [Command Templates](#-command-templates)
|
||||
4. [Tool Selection Guide](#-tool-selection-guide)
|
||||
5. [Usage Patterns](#-usage-patterns)
|
||||
6. [Best Practices](#-best-practices)
|
||||
|
||||
---
|
||||
|
||||
## ⚡ Core Framework
|
||||
|
||||
**Gemini**: Analysis, understanding, exploration & documentation
|
||||
**Qwen**: Architecture analysis, code generation & implementation
|
||||
**Codex**: Development, implementation & automation
|
||||
### Tool Overview
|
||||
- **Gemini**: Analysis, understanding, exploration & documentation
|
||||
- **Qwen**: Architecture analysis, code generation & implementation
|
||||
- **Codex**: Development, implementation & automation
|
||||
|
||||
### Decision Principles
|
||||
- **Use tools early and often** - Tools are faster, more thorough, and reliable than manual approaches
|
||||
@@ -27,40 +38,118 @@ type: strategic-guideline
|
||||
4. **Not sure?** → Use multiple tools in parallel
|
||||
5. **Small task?** → Still use tools - they're faster than manual work
|
||||
|
||||
### Core Execution Rules
|
||||
- **Dynamic Timeout (20-120min)**: Allocate execution time based on task complexity
|
||||
- Simple tasks (analysis, search): 20-40min (1200000-2400000ms)
|
||||
- Medium tasks (refactoring, documentation): 40-60min (2400000-3600000ms)
|
||||
- Complex tasks (implementation, migration): 60-120min (3600000-7200000ms)
|
||||
- **Codex Multiplier**: Codex commands use 1.5x of allocated time
|
||||
- **Apply to All Tools**: All bash() wrapped commands including Gemini, Qwen wrapper and Codex executions
|
||||
- **Command Examples**: `bash(~/.claude/scripts/gemini-wrapper -p "prompt")`, `bash(codex -C directory --full-auto exec "task")`
|
||||
- **Auto-detect**: Analyze PURPOSE and TASK fields to determine appropriate timeout
|
||||
---
|
||||
|
||||
### Permission Framework
|
||||
- **⚠️ WRITE PROTECTION**: Local codebase write/modify requires EXPLICIT user confirmation
|
||||
- **Analysis Mode (default)**: Read-only, safe for auto-execution
|
||||
- **Write Mode**: Requires user explicitly states MODE=write or MODE=auto in prompt
|
||||
- **Exception**: User provides clear instructions like "modify", "create", "implement"
|
||||
- **Gemini/Qwen Write Access**: Use `--approval-mode yolo` ONLY when MODE=write explicitly specified
|
||||
- **Codex Write Access**: Use `-s danger-full-access` and `--skip-git-repo-check` ONLY when MODE=auto explicitly specified
|
||||
- **Default Behavior**: All tools default to analysis/read-only mode without explicit write permission
|
||||
## 🎯 Tool Specifications
|
||||
|
||||
## 🎯 Universal Command Template
|
||||
### Gemini
|
||||
- **Command**: `~/.claude/scripts/gemini-wrapper`
|
||||
- **Strengths**: Large context window, pattern recognition
|
||||
- **Best For**: Analysis, documentation generation, code exploration
|
||||
- **Permissions**: Default read-only analysis, MODE=write requires explicit specification (auto-enables --approval-mode yolo)
|
||||
- **Default MODE**: `analysis` (read-only)
|
||||
- **⚠️ Write Trigger**: Only when user explicitly requests "generate documentation", "modify code", or specifies MODE=write
|
||||
|
||||
### Standard Format (REQUIRED)
|
||||
#### MODE Options
|
||||
- `analysis` (default) - Read-only analysis and documentation generation
|
||||
- `write` - ⚠️ Create/modify codebase files (requires explicit specification, auto-enables --approval-mode yolo)
|
||||
|
||||
### Qwen
|
||||
- **Command**: `~/.claude/scripts/qwen-wrapper`
|
||||
- **Strengths**: Architecture analysis, pattern recognition
|
||||
- **Best For**: System design analysis, architectural review
|
||||
- **Permissions**: Architecture analysis only, no automatic code generation
|
||||
- **Default MODE**: `analysis` (read-only)
|
||||
- **⚠️ Write Trigger**: Explicitly prohibited from auto-calling write mode
|
||||
|
||||
#### MODE Options
|
||||
- `analysis` (default) - Architecture analysis only, no code generation/modification (read-only)
|
||||
- `write` - ⚠️ Code generation (requires explicit specification, disabled by default)
|
||||
|
||||
### Codex
|
||||
- **Command**: `codex --full-auto exec`
|
||||
- **Strengths**: Autonomous development, mathematical reasoning
|
||||
- **Best For**: Implementation, testing, automation
|
||||
- **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
|
||||
|
||||
#### MODE Options
|
||||
- `auto` - ⚠️ Autonomous development with full file operations (requires explicit specification, enables -s danger-full-access)
|
||||
- `write` - ⚠️ Test generation and file modification (requires explicit specification)
|
||||
- **Default**: No default mode, MODE must be explicitly specified
|
||||
|
||||
#### 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
|
||||
- **Parameter Position**: `resume --last` must be placed AFTER the prompt string at command END
|
||||
- **Example**:
|
||||
```bash
|
||||
# First task - establish session
|
||||
codex -C project --full-auto exec "Implement auth module" --skip-git-repo-check -s danger-full-access
|
||||
|
||||
# Subsequent tasks - continue same session
|
||||
codex --full-auto exec "Add JWT validation" resume --last --skip-git-repo-check -s danger-full-access
|
||||
codex --full-auto exec "Write auth tests" resume --last --skip-git-repo-check -s danger-full-access
|
||||
```
|
||||
|
||||
#### Auto-Resume Decision Rules
|
||||
**When to use `resume --last`**:
|
||||
- Current task is related to/extends previous Codex task in conversation memory
|
||||
- Current task requires context from previous implementation
|
||||
- Current task is part of multi-step workflow (e.g., implement → enhance → test)
|
||||
- Session memory indicates recent Codex execution on same module/feature
|
||||
|
||||
**When NOT to use `resume --last`**:
|
||||
- First Codex task in conversation
|
||||
- New independent task unrelated to previous work
|
||||
- Switching to different module/feature area
|
||||
- No recent Codex task in conversation memory
|
||||
|
||||
---
|
||||
|
||||
## 🎯 Command Templates
|
||||
|
||||
### Universal Template Structure
|
||||
Every command MUST follow this structure:
|
||||
- [ ] **PURPOSE** - Clear goal and intent
|
||||
- [ ] **TASK** - Specific execution task
|
||||
- [ ] **MODE** - Execution mode and permission level
|
||||
- [ ] **CONTEXT** - File references and memory context from previous sessions
|
||||
- [ ] **EXPECTED** - Clear expected results
|
||||
- [ ] **RULES** - Template reference and constraints
|
||||
|
||||
### Standard Command Formats
|
||||
|
||||
#### Gemini Commands
|
||||
```bash
|
||||
# Gemini Analysis (read/write capable)
|
||||
# Gemini Analysis (read-only, default)
|
||||
cd [directory] && ~/.claude/scripts/gemini-wrapper -p "
|
||||
PURPOSE: [clear analysis goal]
|
||||
TASK: [specific analysis task]
|
||||
MODE: [analysis|write]
|
||||
MODE: analysis
|
||||
CONTEXT: [file references and memory context]
|
||||
EXPECTED: [expected output]
|
||||
RULES: [template reference and constraints]
|
||||
"
|
||||
|
||||
# Qwen Architecture Analysis (read-only analysis)
|
||||
# Gemini Write Mode (requires explicit MODE=write)
|
||||
# NOTE: --approval-mode yolo must be placed AFTER wrapper command, BEFORE -p
|
||||
cd [directory] && ~/.claude/scripts/gemini-wrapper --approval-mode yolo -p "
|
||||
PURPOSE: [clear goal]
|
||||
TASK: [specific task]
|
||||
MODE: write
|
||||
CONTEXT: [file references and memory context]
|
||||
EXPECTED: [expected output]
|
||||
RULES: [template reference and constraints]
|
||||
"
|
||||
```
|
||||
|
||||
#### Qwen Commands
|
||||
```bash
|
||||
# Qwen Architecture Analysis (read-only, default)
|
||||
cd [directory] && ~/.claude/scripts/qwen-wrapper -p "
|
||||
PURPOSE: [clear architecture goal]
|
||||
TASK: [specific analysis task]
|
||||
@@ -70,43 +159,44 @@ EXPECTED: [expected deliverables]
|
||||
RULES: [template reference and constraints]
|
||||
"
|
||||
|
||||
# Codex Development
|
||||
# Qwen Write Mode (requires explicit MODE=write)
|
||||
# NOTE: --approval-mode yolo must be placed AFTER wrapper command, BEFORE -p
|
||||
cd [directory] && ~/.claude/scripts/qwen-wrapper --approval-mode yolo -p "
|
||||
PURPOSE: [clear goal]
|
||||
TASK: [specific task]
|
||||
MODE: write
|
||||
CONTEXT: [file references and memory context]
|
||||
EXPECTED: [expected deliverables]
|
||||
RULES: [template reference and constraints]
|
||||
"
|
||||
```
|
||||
|
||||
#### Codex Commands
|
||||
```bash
|
||||
# Codex Development (requires explicit MODE=auto)
|
||||
# NOTE: --skip-git-repo-check and -s danger-full-access must be placed at command END
|
||||
codex -C [directory] --full-auto exec "
|
||||
PURPOSE: [clear development goal]
|
||||
TASK: [specific development task]
|
||||
MODE: [auto|write]
|
||||
MODE: auto
|
||||
CONTEXT: [file references and memory context]
|
||||
EXPECTED: [expected deliverables]
|
||||
RULES: [template reference and constraints]
|
||||
" --skip-git-repo-check -s danger-full-access
|
||||
|
||||
# Codex Test/Write Mode (requires explicit MODE=write)
|
||||
# NOTE: --skip-git-repo-check and -s danger-full-access must be placed at command END
|
||||
codex -C [directory] --full-auto exec "
|
||||
PURPOSE: [clear goal]
|
||||
TASK: [specific task]
|
||||
MODE: write
|
||||
CONTEXT: [file references and memory context]
|
||||
EXPECTED: [expected deliverables]
|
||||
RULES: [template reference and constraints]
|
||||
" --skip-git-repo-check -s danger-full-access
|
||||
```
|
||||
|
||||
### Template Structure
|
||||
- [ ] **PURPOSE** - Clear goal and intent
|
||||
- [ ] **TASK** - Specific execution task
|
||||
- [ ] **MODE** - Execution mode and permission level
|
||||
- [ ] **CONTEXT** - File references and memory context from previous sessions
|
||||
- [ ] **EXPECTED** - Clear expected results
|
||||
- [ ] **RULES** - Template reference and constraints
|
||||
|
||||
### MODE Field Definition
|
||||
|
||||
The MODE field controls execution behavior and file permissions:
|
||||
|
||||
**For Gemini**:
|
||||
- `analysis` (default) - Read-only analysis and documentation generation
|
||||
- `write` - ⚠️ Create/modify codebase files (requires explicit specification, auto-enables --approval-mode yolo)
|
||||
|
||||
**For Qwen**:
|
||||
- `analysis` (default) - Architecture analysis only, no code generation/modification (read-only)
|
||||
- `write` - ⚠️ Code generation (requires explicit specification, disabled by default)
|
||||
|
||||
**For Codex**:
|
||||
- `auto` - ⚠️ Autonomous development with full file operations (requires explicit specification, enables -s danger-full-access)
|
||||
- `write` - ⚠️ Test generation and file modification (requires explicit specification)
|
||||
- **Default**: No default mode, MODE must be explicitly specified
|
||||
|
||||
### Directory Context
|
||||
### Directory Context Configuration
|
||||
Tools execute in current working directory:
|
||||
- **Gemini**: `cd path/to/project && ~/.claude/scripts/gemini-wrapper -p "prompt"`
|
||||
- **Qwen**: `cd path/to/project && ~/.claude/scripts/qwen-wrapper -p "prompt"`
|
||||
@@ -114,7 +204,7 @@ Tools execute in current working directory:
|
||||
- **Path types**: Supports both relative (`../project`) and absolute (`/full/path`) paths
|
||||
- **Token analysis**: For gemini-wrapper and qwen-wrapper, token counting happens in current directory
|
||||
|
||||
### Rules Field Format
|
||||
### RULES Field Format
|
||||
```bash
|
||||
RULES: $(cat "~/.claude/workflows/cli-templates/prompts/[category]/[template].txt") | [constraints]
|
||||
```
|
||||
@@ -125,7 +215,44 @@ RULES: $(cat "~/.claude/workflows/cli-templates/prompts/[category]/[template].tx
|
||||
- No template: `Focus on security patterns, include dependency analysis`
|
||||
- File patterns: `@{src/**/*.ts,CLAUDE.md} - Stay within scope`
|
||||
|
||||
## 📊 Tool Selection Matrix
|
||||
### File Pattern Reference
|
||||
- All files: `@{**/*}`
|
||||
- Source files: `@{src/**/*}`
|
||||
- TypeScript: `@{*.ts,*.tsx}`
|
||||
- With docs: `@{CLAUDE.md,**/*CLAUDE.md}`
|
||||
- Tests: `@{src/**/*.test.*}`
|
||||
|
||||
**Complex Pattern Discovery**:
|
||||
For complex file pattern requirements, use semantic discovery tools BEFORE CLI execution:
|
||||
- **rg (ripgrep)**: Content-based file discovery with regex patterns
|
||||
- **Code Index MCP**: Semantic file search based on task requirements
|
||||
- **Workflow**: Discover → Extract precise paths → Build CONTEXT field
|
||||
|
||||
**Example**:
|
||||
```bash
|
||||
# Step 1: Discover files semantically
|
||||
rg "export.*Component" --files-with-matches --type ts # Find component files
|
||||
mcp__code-index__search_code_advanced(pattern="interface.*Props", file_pattern="*.tsx") # Find interface files
|
||||
|
||||
# Step 2: Build precise CONTEXT from discovery results
|
||||
CONTEXT: @{src/components/Auth.tsx,src/types/auth.d.ts,src/hooks/useAuth.ts}
|
||||
|
||||
# Step 3: Execute CLI with precise file references
|
||||
cd src && ~/.claude/scripts/gemini-wrapper -p "
|
||||
PURPOSE: Analyze authentication components
|
||||
TASK: Review auth component patterns and props interfaces
|
||||
MODE: analysis
|
||||
CONTEXT: @{components/Auth.tsx,types/auth.d.ts,hooks/useAuth.ts}
|
||||
EXPECTED: Pattern analysis and improvement suggestions
|
||||
RULES: Focus on type safety and component composition
|
||||
"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 📊 Tool Selection Guide
|
||||
|
||||
### Selection Matrix
|
||||
|
||||
| Task Type | Tool | Use Case | Template |
|
||||
|-----------|------|----------|-----------|
|
||||
@@ -138,11 +265,11 @@ RULES: $(cat "~/.claude/workflows/cli-templates/prompts/[category]/[template].tx
|
||||
| **Security** | Codex | Vulnerability assessment, fixes | `analysis/security.txt` |
|
||||
| **Refactoring** | Multiple | Gemini for analysis, Qwen/Codex for execution | `development/refactor.txt` |
|
||||
|
||||
## 📁 Template System
|
||||
### Template System
|
||||
|
||||
**Base Structure**: `~/.claude/workflows/cli-templates/`
|
||||
|
||||
### Available Templates
|
||||
#### Available Templates
|
||||
```
|
||||
prompts/
|
||||
├── analysis/
|
||||
@@ -168,6 +295,8 @@ tech-stacks/
|
||||
└── react-dev.md - React architecture
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🚀 Usage Patterns
|
||||
|
||||
### Workflow Integration (REQUIRED)
|
||||
@@ -179,8 +308,9 @@ When planning any coding task, **ALWAYS** integrate CLI tools:
|
||||
4. **Quality Phase**: Use Codex for testing and validation
|
||||
|
||||
### Common Scenarios
|
||||
|
||||
#### Code Analysis
|
||||
```bash
|
||||
# Gemini - Code Analysis
|
||||
~/.claude/scripts/gemini-wrapper -p "
|
||||
PURPOSE: Understand codebase architecture
|
||||
TASK: Analyze project structure and identify patterns
|
||||
@@ -189,8 +319,10 @@ CONTEXT: @{src/**/*.ts,CLAUDE.md} Previous analysis of auth system
|
||||
EXPECTED: Architecture overview and integration points
|
||||
RULES: $(cat '~/.claude/workflows/cli-templates/prompts/analysis/architecture.txt') | Focus on integration points
|
||||
"
|
||||
```
|
||||
|
||||
# Gemini - Generate Documentation
|
||||
#### Documentation Generation
|
||||
```bash
|
||||
~/.claude/scripts/gemini-wrapper -p "
|
||||
PURPOSE: Generate API documentation
|
||||
TASK: Create comprehensive API reference from code
|
||||
@@ -199,8 +331,10 @@ CONTEXT: @{src/api/**/*}
|
||||
EXPECTED: API.md with all endpoints documented
|
||||
RULES: Follow project documentation standards
|
||||
"
|
||||
```
|
||||
|
||||
# Qwen - Architecture Analysis
|
||||
#### Architecture Analysis
|
||||
```bash
|
||||
cd src/auth && ~/.claude/scripts/qwen-wrapper -p "
|
||||
PURPOSE: Analyze authentication system architecture
|
||||
TASK: Review JWT-based auth system design
|
||||
@@ -209,8 +343,11 @@ CONTEXT: @{src/auth/**/*} Existing patterns and requirements
|
||||
EXPECTED: Architecture analysis report with recommendations
|
||||
RULES: $(cat '~/.claude/workflows/cli-templates/prompts/analysis/architecture.txt') | Focus on security
|
||||
"
|
||||
```
|
||||
|
||||
# Codex - Feature Development
|
||||
#### Feature Development (Multi-task with Resume)
|
||||
```bash
|
||||
# First task - establish session
|
||||
codex -C path/to/project --full-auto exec "
|
||||
PURPOSE: Implement user authentication
|
||||
TASK: Create JWT-based authentication system
|
||||
@@ -220,74 +357,46 @@ EXPECTED: Complete auth module with tests
|
||||
RULES: $(cat '~/.claude/workflows/cli-templates/prompts/development/feature.txt') | Follow security best practices
|
||||
" --skip-git-repo-check -s danger-full-access
|
||||
|
||||
# Codex - Test Generation
|
||||
codex -C src/auth --full-auto exec "
|
||||
# Continue in same session - Add JWT validation
|
||||
codex --full-auto exec "
|
||||
PURPOSE: Enhance authentication security
|
||||
TASK: Add JWT token validation and refresh logic
|
||||
MODE: auto
|
||||
CONTEXT: Previous auth implementation from current session
|
||||
EXPECTED: JWT validation middleware and token refresh endpoints
|
||||
RULES: Follow JWT best practices, maintain session context
|
||||
" resume --last --skip-git-repo-check -s danger-full-access
|
||||
|
||||
# Continue in same session - Add tests
|
||||
codex --full-auto exec "
|
||||
PURPOSE: Increase test coverage
|
||||
TASK: Generate comprehensive tests for auth module
|
||||
MODE: write
|
||||
CONTEXT: @{**/*.ts} Exclude existing tests
|
||||
CONTEXT: Auth implementation from current session
|
||||
EXPECTED: Complete test suite with 80%+ coverage
|
||||
RULES: Use Jest, follow existing patterns
|
||||
" --skip-git-repo-check -s danger-full-access
|
||||
" resume --last --skip-git-repo-check -s danger-full-access
|
||||
```
|
||||
|
||||
## 📋 Planning Checklist
|
||||
#### Interactive Session Resume
|
||||
```bash
|
||||
# Resume previous session with picker
|
||||
codex resume
|
||||
|
||||
For every development task:
|
||||
- [ ] **Purpose defined** - Clear goal and intent
|
||||
- [ ] **Mode selected** - Execution mode and permission level determined
|
||||
- [ ] **Context gathered** - File references and session memory documented
|
||||
- [ ] **Gemini analysis** completed for understanding
|
||||
- [ ] **Template selected** - Appropriate template chosen
|
||||
- [ ] **Constraints specified** - File patterns, scope, requirements
|
||||
- [ ] **Implementation approach** - Tool selection and workflow
|
||||
- [ ] **Quality measures** - Testing and validation plan
|
||||
- [ ] **Tool configuration** - Review `.gemini/CLAUDE.md` or `.codex/Agent.md` if needed
|
||||
# Or resume most recent session directly
|
||||
codex resume --last
|
||||
```
|
||||
|
||||
## 🎯 Key Features
|
||||
|
||||
### Gemini
|
||||
- **Command**: `~/.claude/scripts/gemini-wrapper`
|
||||
- **Strengths**: Large context window, pattern recognition
|
||||
- **Best For**: Analysis, documentation generation, code exploration
|
||||
- **Permissions**: Default read-only analysis, MODE=write requires explicit specification (auto-enables --approval-mode yolo)
|
||||
- **Default MODE**: `analysis` (read-only)
|
||||
- **⚠️ Write Trigger**: Only when user explicitly requests "generate documentation", "modify code", or specifies MODE=write
|
||||
|
||||
### Qwen
|
||||
- **Command**: `~/.claude/scripts/qwen-wrapper`
|
||||
- **Strengths**: Architecture analysis, pattern recognition
|
||||
- **Best For**: System design analysis, architectural review
|
||||
- **Permissions**: Architecture analysis only, no automatic code generation
|
||||
- **Default MODE**: `analysis` (read-only)
|
||||
- **⚠️ Write Trigger**: Explicitly prohibited from auto-calling write mode
|
||||
|
||||
### Codex
|
||||
- **Command**: `codex --full-auto exec`
|
||||
- **Strengths**: Autonomous development, mathematical reasoning
|
||||
- **Best For**: Implementation, testing, automation
|
||||
- **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: `@{**/*}`
|
||||
- Source files: `@{src/**/*}`
|
||||
- TypeScript: `@{*.ts,*.tsx}`
|
||||
- With docs: `@{CLAUDE.md,**/*CLAUDE.md}`
|
||||
- Tests: `@{src/**/*.test.*}`
|
||||
---
|
||||
|
||||
## 🔧 Best Practices
|
||||
|
||||
### General Guidelines
|
||||
- **Start with templates** - Use predefined templates for consistency
|
||||
- **Be specific** - Clear PURPOSE, TASK, and EXPECTED fields
|
||||
- **Include constraints** - File patterns, scope, requirements in RULES
|
||||
- **Test patterns first** - Validate file patterns with `ls`
|
||||
- **Discover patterns first** - Use rg/MCP for complex file discovery before CLI execution
|
||||
- **Build precise CONTEXT** - Convert discovery results to explicit file references
|
||||
- **Document context** - Always reference CLAUDE.md for context
|
||||
|
||||
### Context Optimization Strategy
|
||||
@@ -329,4 +438,42 @@ CONTEXT: @{**/*.ts}
|
||||
EXPECTED: Code improvements and fixes
|
||||
RULES: Maintain backward compatibility
|
||||
" --skip-git-repo-check -s danger-full-access
|
||||
```
|
||||
```
|
||||
|
||||
### Planning Checklist
|
||||
|
||||
For every development task:
|
||||
- [ ] **Purpose defined** - Clear goal and intent
|
||||
- [ ] **Mode selected** - Execution mode and permission level determined
|
||||
- [ ] **Context gathered** - File references and session memory documented
|
||||
- [ ] **Gemini analysis** completed for understanding
|
||||
- [ ] **Template selected** - Appropriate template chosen
|
||||
- [ ] **Constraints specified** - File patterns, scope, requirements
|
||||
- [ ] **Implementation approach** - Tool selection and workflow
|
||||
- [ ] **Quality measures** - Testing and validation plan
|
||||
- [ ] **Tool configuration** - Review `.gemini/CLAUDE.md` or `.codex/Agent.md` if needed
|
||||
|
||||
---
|
||||
|
||||
## ⚙️ Execution Configuration
|
||||
|
||||
### Core Execution Rules
|
||||
- **Dynamic Timeout (20-120min)**: Allocate execution time based on task complexity
|
||||
- Simple tasks (analysis, search): 20-40min (1200000-2400000ms)
|
||||
- Medium tasks (refactoring, documentation): 40-60min (2400000-3600000ms)
|
||||
- Complex tasks (implementation, migration): 60-120min (3600000-7200000ms)
|
||||
- **Codex Multiplier**: Codex commands use 1.5x of allocated time
|
||||
- **Apply to All Tools**: All bash() wrapped commands including Gemini, Qwen wrapper and Codex executions
|
||||
- **Command Examples**: `bash(~/.claude/scripts/gemini-wrapper -p "prompt")`, `bash(codex -C directory --full-auto exec "task")`
|
||||
- **Auto-detect**: Analyze PURPOSE and TASK fields to determine appropriate timeout
|
||||
|
||||
### Permission Framework
|
||||
- **⚠️ WRITE PROTECTION**: Local codebase write/modify requires EXPLICIT user confirmation
|
||||
- **Analysis Mode (default)**: Read-only, safe for auto-execution
|
||||
- **Write Mode**: Requires user explicitly states MODE=write or MODE=auto in prompt
|
||||
- **Exception**: User provides clear instructions like "modify", "create", "implement"
|
||||
- **Gemini/Qwen Write Access**: Use `--approval-mode yolo` ONLY when MODE=write explicitly specified
|
||||
- **Parameter Position**: Place AFTER the wrapper command: `gemini-wrapper --approval-mode yolo -p "..."`
|
||||
- **Codex Write Access**: Use `-s danger-full-access` and `--skip-git-repo-check` ONLY when MODE=auto explicitly specified
|
||||
- **Parameter Position**: Place AFTER the prompt string at command END: `codex ... exec "..." --skip-git-repo-check -s danger-full-access`
|
||||
- **Default Behavior**: All tools default to analysis/read-only mode without explicit write permission
|
||||
|
||||
@@ -46,6 +46,30 @@ RULES: Build on previous subtask, maintain consistency
|
||||
|
||||
## Execution Requirements
|
||||
|
||||
### System Optimization
|
||||
|
||||
**Hard Requirement**: Call binaries directly in `functions.shell`, always set `workdir`, and avoid shell wrappers such as `bash -lc`, `sh -lc`, `zsh -lc`, `cmd /c`, `pwsh.exe -NoLogo -NoProfile -Command`, and `powershell.exe -NoLogo -NoProfile -Command`.
|
||||
|
||||
**Text Editing Priority**: Use the `apply_patch` tool for all routine text edits; fall back to `sed` for single-line substitutions only if `apply_patch` is unavailable, and avoid `python` editing scripts unless both options fail.
|
||||
|
||||
**`apply_patch` Usage**: Invoke `apply_patch` with the patch payload as the second element in the command array (no shell-style flags). Provide `workdir` and, when helpful, a short `justification` alongside the command.
|
||||
|
||||
**Example invocation**:
|
||||
```json
|
||||
{
|
||||
"command": ["apply_patch", "*** Begin Patch\n*** Update File: path/to/file\n@@\n- old\n+ new\n*** End Patch\n"],
|
||||
"workdir": "<workdir>",
|
||||
"justification": "Brief reason for the change"
|
||||
}
|
||||
```
|
||||
|
||||
**Windows UTF-8 Encoding**: Before executing commands on Windows systems, ensure proper UTF-8 encoding by running:
|
||||
```powershell
|
||||
[Console]::InputEncoding = [Text.UTF8Encoding]::new($false)
|
||||
[Console]::OutputEncoding = [Text.UTF8Encoding]::new($false)
|
||||
chcp 65001 > $null
|
||||
```
|
||||
|
||||
### ALWAYS
|
||||
|
||||
- **Parse all fields** - Understand PURPOSE, TASK, MODE, CONTEXT, EXPECTED, RULES
|
||||
@@ -58,6 +82,9 @@ RULES: Build on previous subtask, maintain consistency
|
||||
- **Match project style** - Follow existing patterns exactly
|
||||
- **Validate EXPECTED** - Ensure all deliverables are met
|
||||
- **Report context** (subtasks) - Summarize key info for next subtask
|
||||
- **Use direct binary calls** - Avoid shell wrappers for efficiency
|
||||
- **Prefer apply_patch** - Use for text edits over Python scripts
|
||||
- **Configure Windows encoding** - Set UTF-8 for Chinese character support
|
||||
|
||||
### NEVER
|
||||
|
||||
@@ -335,6 +362,10 @@ Subtask 3: Add authentication (resume --last)
|
||||
|
||||
---
|
||||
|
||||
**Version**: 2.1.0
|
||||
**Version**: 2.2.0
|
||||
**Last Updated**: 2025-10-04
|
||||
**Changes**: Added multi-step task execution support with resume mechanism
|
||||
**Changes**:
|
||||
- Added system optimization requirements for direct binary calls
|
||||
- Added apply_patch tool priority for text editing
|
||||
- Added Windows UTF-8 encoding configuration for Chinese character support
|
||||
- Previous: Multi-step task execution support with resume mechanism
|
||||
|
||||
3
.gitignore
vendored
3
.gitignore
vendored
@@ -18,4 +18,5 @@ Thumbs.db
|
||||
|
||||
.env
|
||||
settings.local.json
|
||||
.workflow
|
||||
.workflow
|
||||
version.json
|
||||
143
.qwen/QWEN.md
Normal file
143
.qwen/QWEN.md
Normal file
@@ -0,0 +1,143 @@
|
||||
# QWEN Execution Protocol
|
||||
|
||||
## Overview
|
||||
|
||||
**Role**: QWEN - code analysis and documentation generation
|
||||
|
||||
## Prompt Structure
|
||||
|
||||
**Receive prompts in this format**:
|
||||
|
||||
```
|
||||
PURPOSE: [goal statement]
|
||||
TASK: [specific task]
|
||||
MODE: [analysis|write]
|
||||
CONTEXT: [file patterns]
|
||||
EXPECTED: [deliverables]
|
||||
RULES: [constraints and templates]
|
||||
```
|
||||
|
||||
## Execution Requirements
|
||||
|
||||
### ALWAYS
|
||||
|
||||
- **Parse all six fields** - Understand PURPOSE, TASK, MODE, CONTEXT, EXPECTED, RULES
|
||||
- **Follow MODE strictly** - Respect permission boundaries
|
||||
- **Analyze CONTEXT files** - Read all matching patterns thoroughly
|
||||
- **Apply RULES** - Follow templates and constraints exactly
|
||||
- **Provide evidence** - Quote code with file:line references
|
||||
- **Match EXPECTED** - Deliver exactly what's requested
|
||||
|
||||
### NEVER
|
||||
|
||||
- **Assume behavior** - Verify with actual code
|
||||
- **Ignore CONTEXT** - Stay within specified file patterns
|
||||
- **Skip RULES** - Templates are mandatory when provided
|
||||
- **Make unsubstantiated claims** - Always back with code references
|
||||
- **Deviate from MODE** - Respect read/write boundaries
|
||||
|
||||
## MODE Behavior
|
||||
|
||||
### MODE: analysis (default)
|
||||
|
||||
**Permissions**:
|
||||
- Read all CONTEXT files
|
||||
- Create/modify documentation files
|
||||
|
||||
**Execute**:
|
||||
1. Read and analyze CONTEXT files
|
||||
2. Identify patterns and issues
|
||||
3. Generate insights and recommendations
|
||||
4. Create documentation if needed
|
||||
5. Output structured analysis
|
||||
|
||||
**Constraint**: Do NOT modify source code files
|
||||
|
||||
### MODE: write
|
||||
|
||||
**Permissions**:
|
||||
- Full file operations
|
||||
- Create/modify any files
|
||||
|
||||
**Execute**:
|
||||
1. Read CONTEXT files
|
||||
2. Perform requested file operations
|
||||
3. Create/modify files as specified
|
||||
4. Validate changes
|
||||
5. Report file changes
|
||||
|
||||
## Output Format
|
||||
|
||||
### Standard Analysis Structure
|
||||
|
||||
```markdown
|
||||
# Analysis: [TASK Title]
|
||||
|
||||
## Summary
|
||||
[2-3 sentence overview]
|
||||
|
||||
## Key Findings
|
||||
1. [Finding] - path/to/file:123
|
||||
2. [Finding] - path/to/file:456
|
||||
|
||||
## Detailed Analysis
|
||||
[Evidence-based analysis with code quotes]
|
||||
|
||||
## Recommendations
|
||||
1. [Actionable recommendation]
|
||||
2. [Actionable recommendation]
|
||||
```
|
||||
|
||||
### Code References
|
||||
|
||||
Always use format: `path/to/file:line_number`
|
||||
|
||||
Example: "Authentication logic at `src/auth/jwt.ts:45` uses deprecated algorithm"
|
||||
|
||||
## RULES Processing
|
||||
|
||||
- **Parse the RULES field** to identify template content and additional constraints
|
||||
- **Recognize `|` as separator** between template and additional constraints
|
||||
- **ALWAYS apply all template guidelines** provided in the prompt
|
||||
- **ALWAYS apply all additional constraints** specified after `|`
|
||||
- **Treat all rules as mandatory** - both template and constraints must be followed
|
||||
- **Failure to follow any rule** constitutes task failure
|
||||
|
||||
## Error Handling
|
||||
|
||||
**File Not Found**:
|
||||
- Report missing files
|
||||
- Continue with available files
|
||||
- Note in output
|
||||
|
||||
**Invalid CONTEXT Pattern**:
|
||||
- Report invalid pattern
|
||||
- Request correction
|
||||
- Do not guess
|
||||
|
||||
## Quality Standards
|
||||
|
||||
### Thoroughness
|
||||
- Analyze ALL files in CONTEXT
|
||||
- Check cross-file patterns
|
||||
- Identify edge cases
|
||||
- Quantify when possible
|
||||
|
||||
### Evidence-Based
|
||||
- Quote relevant code
|
||||
- Provide file:line references
|
||||
- Link related patterns
|
||||
|
||||
### Actionable
|
||||
- Clear recommendations
|
||||
- Prioritized by impact
|
||||
- Specific, not vague
|
||||
|
||||
## Philosophy
|
||||
|
||||
- **Incremental over big bangs** - Suggest small, testable changes
|
||||
- **Learn from existing code** - Reference project patterns
|
||||
- **Pragmatic over dogmatic** - Adapt to project reality
|
||||
- **Clear over clever** - Prefer obvious solutions
|
||||
- **Simple over complex** - Avoid over-engineering
|
||||
|
||||
113
CHANGELOG.md
113
CHANGELOG.md
@@ -5,6 +5,119 @@ 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.4.2] - 2025-10-05
|
||||
|
||||
### 📚 CLI Documentation Refactoring
|
||||
|
||||
This release focuses on eliminating redundant documentation by establishing a single source of truth (SSOT) pattern for CLI command references.
|
||||
|
||||
#### Changed
|
||||
|
||||
**CLI Command Documentation Refactoring**:
|
||||
- Refactored 7 CLI command documentation files to eliminate redundancy
|
||||
- Removed **681 total lines** of duplicate content across all files
|
||||
- Established implicit reference pattern to `intelligent-tools-strategy.md` (loaded in memory)
|
||||
- Preserved all unique command-specific content and capabilities
|
||||
|
||||
**Specific File Reductions**:
|
||||
- `analyze.md`: 117→61 lines (48% reduction)
|
||||
- `chat.md`: 118→62 lines (47% reduction)
|
||||
- `execute.md`: 180→100 lines (44% reduction)
|
||||
- `codex-execute.md`: 481→473 lines (2% - preserved unique workflow content)
|
||||
- `mode/bug-index.md`: 144→75 lines (48% reduction)
|
||||
- `mode/code-analysis.md`: 188→76 lines (60% reduction)
|
||||
- `mode/plan.md`: 100→76 lines (24% reduction)
|
||||
|
||||
**Removed Duplicate Sections**:
|
||||
- Universal Command Template (now only in `intelligent-tools-strategy.md`)
|
||||
- File Pattern Reference (centralized in strategy guide)
|
||||
- Complex Pattern Discovery (centralized in strategy guide)
|
||||
- MODE Field Definition (centralized in strategy guide)
|
||||
- Enhancement Integration details (referenced implicitly)
|
||||
- Session Persistence details (referenced implicitly)
|
||||
|
||||
**Preserved Unique Content**:
|
||||
- Command-specific purpose and parameters
|
||||
- Unique execution flows and capabilities
|
||||
- Specialized features (YOLO permissions, task decomposition, resume patterns)
|
||||
- Command-specific examples and workflows
|
||||
- File pattern auto-detection logic for analyze command
|
||||
- Group-based execution workflow for codex-execute command
|
||||
|
||||
#### Added
|
||||
|
||||
**Documentation Enhancement** (prior to refactoring):
|
||||
- Enhanced file pattern examples and complex pattern discovery documentation
|
||||
- Added semantic discovery workflow integration examples
|
||||
|
||||
#### Technical Details
|
||||
|
||||
**Single Source of Truth Pattern**:
|
||||
All CLI commands now reference `intelligent-tools-strategy.md` for:
|
||||
- Universal command template structure
|
||||
- File pattern syntax and examples
|
||||
- Complex pattern discovery workflows
|
||||
- MODE field definitions and permissions
|
||||
- Tool-specific features and capabilities
|
||||
|
||||
**Reference Pattern**:
|
||||
```markdown
|
||||
## Notes
|
||||
- Command templates and file patterns: see intelligent-tools-strategy.md (loaded in memory)
|
||||
```
|
||||
|
||||
This approach reduces maintenance overhead while ensuring documentation consistency across all CLI commands.
|
||||
|
||||
## [3.4.1] - 2025-10-04
|
||||
|
||||
### 🎯 Multi-Tool Support for Documentation Updates
|
||||
|
||||
This release adds flexible tool selection for CLAUDE.md documentation generation, allowing users to choose between Gemini, Qwen, or Codex based on their analysis needs.
|
||||
|
||||
#### Added
|
||||
|
||||
**Multi-Tool Support**:
|
||||
- **`/update-memory-full --tool <gemini|qwen|codex>`**: Choose tool for full project documentation update
|
||||
- **`/update-memory-related --tool <gemini|qwen|codex>`**: Choose tool for context-aware documentation update
|
||||
- **Default**: Gemini (documentation generation, pattern recognition)
|
||||
- **Qwen**: Architecture analysis, system design documentation
|
||||
- **Codex**: Implementation validation, code quality analysis
|
||||
|
||||
**Script Enhancement** (`update_module_claude.sh`):
|
||||
- Added third parameter for tool selection: `<module_path> [update_type] [tool]`
|
||||
- Support for three tools with consistent parameter syntax:
|
||||
- `gemini --all-files --yolo -p` (default)
|
||||
- `qwen --all-files --yolo -p` (direct command, no wrapper)
|
||||
- `codex --full-auto exec` (with danger-full-access)
|
||||
- Automatic tool routing via case statement
|
||||
- Improved logging with tool information display
|
||||
|
||||
#### Changed
|
||||
|
||||
**Command Documentation**:
|
||||
- Updated `/update-memory-full.md` with tool selection usage and examples
|
||||
- Updated `/update-memory-related.md` with tool selection usage and examples
|
||||
- Added tool selection strategy and rationale documentation
|
||||
|
||||
#### Technical Details
|
||||
|
||||
**Tool Execution Patterns**:
|
||||
```bash
|
||||
# Gemini (default)
|
||||
gemini --all-files --yolo -p "$prompt"
|
||||
|
||||
# Qwen (architecture analysis)
|
||||
qwen --all-files --yolo -p "$prompt"
|
||||
|
||||
# Codex (implementation validation)
|
||||
codex --full-auto exec "$prompt" --skip-git-repo-check -s danger-full-access
|
||||
```
|
||||
|
||||
**Backward Compatibility**:
|
||||
- ✅ Existing commands without `--tool` parameter default to Gemini
|
||||
- ✅ All three tools support Layer 1-4 template system
|
||||
- ✅ No breaking changes to existing workflows
|
||||
|
||||
## [3.3.0] - 2025-10-04
|
||||
|
||||
### 🚀 CLI Tool Enhancements & Codex Multi-Step Execution
|
||||
|
||||
@@ -63,7 +63,9 @@ param(
|
||||
|
||||
[string]$SourceVersion = "",
|
||||
|
||||
[string]$SourceBranch = ""
|
||||
[string]$SourceBranch = "",
|
||||
|
||||
[string]$SourceCommit = ""
|
||||
)
|
||||
|
||||
# Set encoding for proper Unicode support
|
||||
@@ -78,7 +80,10 @@ if ($PSVersionTable.PSVersion.Major -ge 6) {
|
||||
|
||||
# Script metadata
|
||||
$ScriptName = "Claude Code Workflow System Installer"
|
||||
$Version = "2.1.0"
|
||||
$ScriptVersion = "2.2.0" # Installer script version
|
||||
|
||||
# Default version (will be overridden by -SourceVersion from install-remote.ps1)
|
||||
$DefaultVersion = "unknown"
|
||||
|
||||
# Initialize backup behavior - backup is enabled by default unless NoBackup is specified
|
||||
if (-not $BackupAll -and -not $NoBackup) {
|
||||
@@ -141,8 +146,15 @@ function Show-Banner {
|
||||
}
|
||||
|
||||
function Show-Header {
|
||||
param(
|
||||
[string]$InstallVersion = $DefaultVersion
|
||||
)
|
||||
|
||||
Show-Banner
|
||||
Write-ColorOutput " $ScriptName v$Version" $ColorInfo
|
||||
Write-ColorOutput " $ScriptName v$ScriptVersion" $ColorInfo
|
||||
if ($InstallVersion -ne "unknown") {
|
||||
Write-ColorOutput " Installing Claude Code Workflow v$InstallVersion" $ColorInfo
|
||||
}
|
||||
Write-ColorOutput " Unified workflow system with comprehensive coordination" $ColorInfo
|
||||
Write-ColorOutput "========================================================================" $ColorInfo
|
||||
if ($NoBackup) {
|
||||
@@ -167,6 +179,7 @@ function Test-Prerequisites {
|
||||
$claudeMd = Join-Path $sourceDir "CLAUDE.md"
|
||||
$codexDir = Join-Path $sourceDir ".codex"
|
||||
$geminiDir = Join-Path $sourceDir ".gemini"
|
||||
$qwenDir = Join-Path $sourceDir ".qwen"
|
||||
|
||||
if (-not (Test-Path $claudeDir)) {
|
||||
Write-ColorOutput "ERROR: .claude directory not found in $sourceDir" $ColorError
|
||||
@@ -188,6 +201,11 @@ function Test-Prerequisites {
|
||||
return $false
|
||||
}
|
||||
|
||||
if (-not (Test-Path $qwenDir)) {
|
||||
Write-ColorOutput "ERROR: .qwen directory not found in $sourceDir" $ColorError
|
||||
return $false
|
||||
}
|
||||
|
||||
Write-ColorOutput "Prerequisites check passed" $ColorSuccess
|
||||
return $true
|
||||
}
|
||||
@@ -632,24 +650,27 @@ function Create-VersionJson {
|
||||
[string]$InstallationMode
|
||||
)
|
||||
|
||||
# Determine version from source or default
|
||||
$versionNumber = if ($SourceVersion) { $SourceVersion } else { $Version }
|
||||
# Determine version from source parameter (passed from install-remote.ps1)
|
||||
$versionNumber = if ($SourceVersion) { $SourceVersion } else { $DefaultVersion }
|
||||
$sourceBranch = if ($SourceBranch) { $SourceBranch } else { "unknown" }
|
||||
$commitSha = if ($SourceCommit) { $SourceCommit } else { "unknown" }
|
||||
|
||||
# Create version.json content
|
||||
$versionInfo = @{
|
||||
version = $versionNumber
|
||||
commit_sha = $commitSha
|
||||
installation_mode = $InstallationMode
|
||||
installation_path = $TargetClaudeDir
|
||||
installation_date_utc = (Get-Date).ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ssZ")
|
||||
source_branch = $sourceBranch
|
||||
installer_version = $ScriptVersion
|
||||
}
|
||||
|
||||
$versionJsonPath = Join-Path $TargetClaudeDir "version.json"
|
||||
|
||||
try {
|
||||
$versionInfo | ConvertTo-Json | Out-File -FilePath $versionJsonPath -Encoding utf8 -Force
|
||||
Write-ColorOutput "Created version.json: $versionNumber ($InstallationMode)" $ColorSuccess
|
||||
Write-ColorOutput "Created version.json: $versionNumber ($commitSha) - $InstallationMode" $ColorSuccess
|
||||
return $true
|
||||
} catch {
|
||||
Write-ColorOutput "WARNING: Failed to create version.json: $($_.Exception.Message)" $ColorWarning
|
||||
@@ -666,6 +687,7 @@ function Install-Global {
|
||||
$globalClaudeMd = Join-Path $globalClaudeDir "CLAUDE.md"
|
||||
$globalCodexDir = Join-Path $userProfile ".codex"
|
||||
$globalGeminiDir = Join-Path $userProfile ".gemini"
|
||||
$globalQwenDir = Join-Path $userProfile ".qwen"
|
||||
|
||||
Write-ColorOutput "Global installation path: $userProfile" $ColorInfo
|
||||
|
||||
@@ -675,11 +697,12 @@ function Install-Global {
|
||||
$sourceClaudeMd = Join-Path $sourceDir "CLAUDE.md"
|
||||
$sourceCodexDir = Join-Path $sourceDir ".codex"
|
||||
$sourceGeminiDir = Join-Path $sourceDir ".gemini"
|
||||
$sourceQwenDir = Join-Path $sourceDir ".qwen"
|
||||
|
||||
# Create backup folder if needed (default behavior unless NoBackup is specified)
|
||||
$backupFolder = $null
|
||||
if (-not $NoBackup) {
|
||||
if ((Test-Path $globalClaudeDir) -or (Test-Path $globalCodexDir) -or (Test-Path $globalGeminiDir)) {
|
||||
if ((Test-Path $globalClaudeDir) -or (Test-Path $globalCodexDir) -or (Test-Path $globalGeminiDir) -or (Test-Path $globalQwenDir)) {
|
||||
$existingFiles = @()
|
||||
if (Test-Path $globalClaudeDir) {
|
||||
$existingFiles += Get-ChildItem $globalClaudeDir -Recurse -File -ErrorAction SilentlyContinue
|
||||
@@ -690,6 +713,9 @@ function Install-Global {
|
||||
if (Test-Path $globalGeminiDir) {
|
||||
$existingFiles += Get-ChildItem $globalGeminiDir -Recurse -File -ErrorAction SilentlyContinue
|
||||
}
|
||||
if (Test-Path $globalQwenDir) {
|
||||
$existingFiles += Get-ChildItem $globalQwenDir -Recurse -File -ErrorAction SilentlyContinue
|
||||
}
|
||||
if (($existingFiles -and ($existingFiles | Measure-Object).Count -gt 0)) {
|
||||
$backupFolder = Get-BackupDirectory -TargetDirectory $userProfile
|
||||
Write-ColorOutput "Backup folder created: $backupFolder" $ColorInfo
|
||||
@@ -717,6 +743,10 @@ function Install-Global {
|
||||
Write-ColorOutput "Merging .gemini directory contents..." $ColorInfo
|
||||
$geminiMerged = Merge-DirectoryContents -Source $sourceGeminiDir -Destination $globalGeminiDir -Description ".gemini directory contents" -BackupFolder $backupFolder
|
||||
|
||||
# Merge .qwen directory contents
|
||||
Write-ColorOutput "Merging .qwen directory contents..." $ColorInfo
|
||||
$qwenMerged = Merge-DirectoryContents -Source $sourceQwenDir -Destination $globalQwenDir -Description ".qwen directory contents" -BackupFolder $backupFolder
|
||||
|
||||
# Create version.json in global .claude directory
|
||||
Write-ColorOutput "Creating version.json..." $ColorInfo
|
||||
Create-VersionJson -TargetClaudeDir $globalClaudeDir -InstallationMode "Global"
|
||||
@@ -753,16 +783,18 @@ function Install-Path {
|
||||
$sourceClaudeMd = Join-Path $sourceDir "CLAUDE.md"
|
||||
$sourceCodexDir = Join-Path $sourceDir ".codex"
|
||||
$sourceGeminiDir = Join-Path $sourceDir ".gemini"
|
||||
$sourceQwenDir = Join-Path $sourceDir ".qwen"
|
||||
|
||||
# Local paths - for agents, commands, output-styles, .codex, .gemini
|
||||
# Local paths - for agents, commands, output-styles, .codex, .gemini, .qwen
|
||||
$localClaudeDir = Join-Path $TargetDirectory ".claude"
|
||||
$localCodexDir = Join-Path $TargetDirectory ".codex"
|
||||
$localGeminiDir = Join-Path $TargetDirectory ".gemini"
|
||||
$localQwenDir = Join-Path $TargetDirectory ".qwen"
|
||||
|
||||
# Create backup folder if needed
|
||||
$backupFolder = $null
|
||||
if (-not $NoBackup) {
|
||||
if ((Test-Path $localClaudeDir) -or (Test-Path $localCodexDir) -or (Test-Path $localGeminiDir) -or (Test-Path $globalClaudeDir)) {
|
||||
if ((Test-Path $localClaudeDir) -or (Test-Path $localCodexDir) -or (Test-Path $localGeminiDir) -or (Test-Path $localQwenDir) -or (Test-Path $globalClaudeDir)) {
|
||||
$backupFolder = Get-BackupDirectory -TargetDirectory $TargetDirectory
|
||||
Write-ColorOutput "Backup folder created: $backupFolder" $ColorInfo
|
||||
}
|
||||
@@ -858,6 +890,10 @@ function Install-Path {
|
||||
Write-ColorOutput "Merging .gemini directory contents to local location..." $ColorInfo
|
||||
$geminiMerged = Merge-DirectoryContents -Source $sourceGeminiDir -Destination $localGeminiDir -Description ".gemini directory contents" -BackupFolder $backupFolder
|
||||
|
||||
# Merge .qwen directory contents to local location
|
||||
Write-ColorOutput "Merging .qwen directory contents to local location..." $ColorInfo
|
||||
$qwenMerged = Merge-DirectoryContents -Source $sourceQwenDir -Destination $localQwenDir -Description ".qwen directory contents" -BackupFolder $backupFolder
|
||||
|
||||
# Create version.json in local .claude directory
|
||||
Write-ColorOutput "Creating version.json in local directory..." $ColorInfo
|
||||
Create-VersionJson -TargetClaudeDir $localClaudeDir -InstallationMode "Path"
|
||||
@@ -971,11 +1007,11 @@ function Show-Summary {
|
||||
if ($Mode -eq "Path") {
|
||||
Write-Host " Local Path: $Path"
|
||||
Write-Host " Global Path: $([Environment]::GetFolderPath('UserProfile'))"
|
||||
Write-Host " Local Components: agents, commands, output-styles, .codex, .gemini"
|
||||
Write-Host " Local Components: agents, commands, output-styles, .codex, .gemini, .qwen"
|
||||
Write-Host " Global Components: workflows, scripts, python_script, etc."
|
||||
} else {
|
||||
Write-Host " Path: $Path"
|
||||
Write-Host " Global Components: .claude, .codex, .gemini"
|
||||
Write-Host " Global Components: .claude, .codex, .gemini, .qwen"
|
||||
}
|
||||
|
||||
if ($NoBackup) {
|
||||
@@ -991,10 +1027,11 @@ function Show-Summary {
|
||||
Write-Host "1. Review CLAUDE.md - Customize guidelines for your project"
|
||||
Write-Host "2. Review .codex/Agent.md - Codex agent execution protocol"
|
||||
Write-Host "3. Review .gemini/CLAUDE.md - Gemini agent execution protocol"
|
||||
Write-Host "4. Configure settings - Edit .claude/settings.local.json as needed"
|
||||
Write-Host "5. Start using Claude Code with Agent workflow coordination!"
|
||||
Write-Host "6. Use /workflow commands for task execution"
|
||||
Write-Host "7. Use /update-memory commands for memory system management"
|
||||
Write-Host "4. Review .qwen/QWEN.md - Qwen agent execution protocol"
|
||||
Write-Host "5. Configure settings - Edit .claude/settings.local.json as needed"
|
||||
Write-Host "6. Start using Claude Code with Agent workflow coordination!"
|
||||
Write-Host "7. Use /workflow commands for task execution"
|
||||
Write-Host "8. Use /update-memory commands for memory system management"
|
||||
|
||||
Write-Host ""
|
||||
Write-ColorOutput "Documentation: https://github.com/catlog22/Claude-CCW" $ColorInfo
|
||||
@@ -1002,7 +1039,10 @@ function Show-Summary {
|
||||
}
|
||||
|
||||
function Main {
|
||||
Show-Header
|
||||
# Use SourceVersion parameter if provided, otherwise use default
|
||||
$installVersion = if ($SourceVersion) { $SourceVersion } else { $DefaultVersion }
|
||||
|
||||
Show-Header -InstallVersion $installVersion
|
||||
|
||||
# Test prerequisites
|
||||
Write-ColorOutput "Checking system requirements..." $ColorInfo
|
||||
|
||||
18
README.md
18
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,15 +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.4.0** - TDD workflow optimization & test generation enhancements. See [CHANGELOG.md](CHANGELOG.md) for details.
|
||||
> **🎉 Latest: v3.4.2** - CLI documentation refactoring & single source of truth. See [CHANGELOG.md](CHANGELOG.md) for details.
|
||||
>
|
||||
> **What's New in v3.4.0**:
|
||||
> - 🧪 **TDD Workflow Streamlining**: Unified IMPL_PLAN.md structure, 33% reduction in redundant files
|
||||
> - 🔄 **Test Coverage Analysis**: TDD workflow upgraded to 6 phases with Phase 3 test context gathering
|
||||
> - 🔁 **Iterative Green Phase**: Built-in test-fix-cycle in IMPL tasks with Gemini auto-diagnosis
|
||||
> - 🛠️ **Manual-First Fixes**: Gemini + bug-fix template diagnosis by default, optional `--use-codex` automation
|
||||
> - ✅ **Test-Gen Workflow Enhancement**: Added 3 supporting tool commands for complete test generation flow
|
||||
> - ⏱️ **Dynamic Timeout Allocation**: CLI tools default to 20-120min for large-scale analysis
|
||||
> **What's New in v3.4.2**:
|
||||
> - 📚 **CLI Documentation Refactoring**: Eliminated 681 lines of duplicate content across 7 command files
|
||||
> - 🎯 **Single Source of Truth**: Established implicit reference pattern to `intelligent-tools-strategy.md`
|
||||
> - 🔍 **Documentation Consistency**: All CLI commands now reference centralized strategy guide
|
||||
> - 💡 **Maintenance Optimization**: Reduced maintenance overhead while preserving unique command features
|
||||
> - ✨ **Enhanced Clarity**: Streamlined documentation focuses on command-specific capabilities
|
||||
> - 📖 **Better Organization**: File patterns, templates, and MODE definitions centralized
|
||||
|
||||
---
|
||||
|
||||
|
||||
18
README_CN.md
18
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,15 +15,15 @@
|
||||
|
||||
**Claude Code Workflow (CCW)** 是一个新一代的多智能体自动化开发框架,通过智能工作流管理和自主执行来协调复杂的软件开发任务。
|
||||
|
||||
> **🎉 最新版本: v3.4.0** - TDD 工作流优化与测试生成增强。详见 [CHANGELOG.md](CHANGELOG.md)。
|
||||
> **🎉 最新版本: v3.4.2** - CLI 文档重构与单一信息源。详见 [CHANGELOG.md](CHANGELOG.md)。
|
||||
>
|
||||
> **v3.4.0 版本新特性**:
|
||||
> - 🧪 **TDD 工作流优化**: 精简文件结构,统一使用 IMPL_PLAN.md,减少 33% 冗余文件
|
||||
> - 🔄 **测试覆盖分析**: TDD 工作流升级至 6 阶段,新增 Phase 3 测试上下文收集
|
||||
> - 🔁 **迭代 Green Phase**: IMPL 任务内置 test-fix-cycle,支持 Gemini 自动诊断和修复
|
||||
> - 🛠️ **手动优先修复**: 默认使用 Gemini + bug-fix 模板诊断,可选 `--use-codex` 自动化
|
||||
> - ✅ **test-gen 工作流增强**: 新增 3 个配套工具命令,完整测试生成和修复流程
|
||||
> - ⏱️ **动态超时分配**: CLI 工具默认 20-120 分钟超时,适应大型项目分析
|
||||
> **v3.4.2 版本新特性**:
|
||||
> - 📚 **CLI 文档重构**: 消除 7 个命令文件中的 681 行重复内容
|
||||
> - 🎯 **单一信息源**: 建立对 `intelligent-tools-strategy.md` 的隐式引用模式
|
||||
> - 🔍 **文档一致性**: 所有 CLI 命令现在引用集中的策略指南
|
||||
> - 💡 **维护优化**: 降低维护开销,同时保留独特的命令功能
|
||||
> - ✨ **增强清晰度**: 精简的文档专注于命令特定功能
|
||||
> - 📖 **更好的组织**: 文件模式、模板和 MODE 定义集中化
|
||||
|
||||
---
|
||||
|
||||
|
||||
@@ -260,7 +260,8 @@ function Invoke-LocalInstaller {
|
||||
param(
|
||||
[string]$RepoDir,
|
||||
[string]$VersionInfo = "",
|
||||
[string]$BranchInfo = ""
|
||||
[string]$BranchInfo = "",
|
||||
[string]$CommitSha = ""
|
||||
)
|
||||
|
||||
$installerPath = Join-Path $RepoDir "Install-Claude.ps1"
|
||||
@@ -285,9 +286,10 @@ function Invoke-LocalInstaller {
|
||||
if ($NonInteractive) { $params["NonInteractive"] = $NonInteractive }
|
||||
if ($BackupAll) { $params["BackupAll"] = $BackupAll }
|
||||
|
||||
# Pass version and branch information
|
||||
# Pass version, branch, and commit information
|
||||
if ($VersionInfo) { $params["SourceVersion"] = $VersionInfo }
|
||||
if ($BranchInfo) { $params["SourceBranch"] = $BranchInfo }
|
||||
if ($CommitSha) { $params["SourceCommit"] = $CommitSha }
|
||||
|
||||
try {
|
||||
# Change to repo directory and run installer
|
||||
@@ -562,14 +564,51 @@ function Main {
|
||||
throw "Extraction failed"
|
||||
}
|
||||
|
||||
# Get commit SHA from the downloaded repository first
|
||||
$commitSha = ""
|
||||
try {
|
||||
Push-Location $repoDir
|
||||
$commitSha = (git rev-parse --short HEAD 2>$null)
|
||||
if (-not $commitSha) {
|
||||
# Fallback: try to get from GitHub API
|
||||
$commitUrl = "https://api.github.com/repos/catlog22/Claude-Code-Workflow/commits/$Branch"
|
||||
$commitResponse = Invoke-RestMethod -Uri $commitUrl -UseBasicParsing -TimeoutSec 5 -ErrorAction SilentlyContinue
|
||||
if ($commitResponse.sha) {
|
||||
$commitSha = $commitResponse.sha.Substring(0, 7)
|
||||
}
|
||||
}
|
||||
Pop-Location
|
||||
} catch {
|
||||
Pop-Location
|
||||
$commitSha = "unknown"
|
||||
}
|
||||
|
||||
# Determine version and branch information to pass
|
||||
$versionToPass = if ($Tag) { $Tag } else { "latest" }
|
||||
$versionToPass = ""
|
||||
|
||||
if ($Tag) {
|
||||
# Specific tag version
|
||||
$versionToPass = $Tag -replace '^v', '' # Remove 'v' prefix
|
||||
} elseif ($Version -eq "stable") {
|
||||
# Auto-detected latest stable
|
||||
$latestTag = Get-LatestRelease
|
||||
if ($latestTag) {
|
||||
$versionToPass = $latestTag -replace '^v', ''
|
||||
} else {
|
||||
# Fallback: use commit SHA as version
|
||||
$versionToPass = "dev-$commitSha"
|
||||
}
|
||||
} else {
|
||||
# Latest development or branch - use commit SHA as version
|
||||
$versionToPass = "dev-$commitSha"
|
||||
}
|
||||
|
||||
$branchToPass = if ($Version -eq "branch") { $Branch } elseif ($Version -eq "latest") { "main" } elseif ($Tag) { $Tag } else { "main" }
|
||||
|
||||
Write-ColorOutput "Version info: $versionToPass (branch: $branchToPass)" $ColorInfo
|
||||
Write-ColorOutput "Version info: $versionToPass (branch: $branchToPass, commit: $commitSha)" $ColorInfo
|
||||
|
||||
# Run local installer with version information
|
||||
$success = Invoke-LocalInstaller -RepoDir $repoDir -VersionInfo $versionToPass -BranchInfo $branchToPass
|
||||
$success = Invoke-LocalInstaller -RepoDir $repoDir -VersionInfo $versionToPass -BranchInfo $branchToPass -CommitSha $commitSha
|
||||
if (-not $success) {
|
||||
throw "Installation script failed"
|
||||
}
|
||||
|
||||
@@ -209,6 +209,9 @@ function extract_repository() {
|
||||
|
||||
function invoke_local_installer() {
|
||||
local repo_dir="$1"
|
||||
local version_info="$2"
|
||||
local branch_info="$3"
|
||||
local commit_sha="$4"
|
||||
local installer_path="${repo_dir}/Install-Claude.sh"
|
||||
|
||||
# Make installer executable
|
||||
@@ -249,6 +252,19 @@ function invoke_local_installer() {
|
||||
params+=("-BackupAll")
|
||||
fi
|
||||
|
||||
# Pass version, branch, and commit information
|
||||
if [ -n "$version_info" ]; then
|
||||
params+=("-SourceVersion" "$version_info")
|
||||
fi
|
||||
|
||||
if [ -n "$branch_info" ]; then
|
||||
params+=("-SourceBranch" "$branch_info")
|
||||
fi
|
||||
|
||||
if [ -n "$commit_sha" ]; then
|
||||
params+=("-SourceCommit" "$commit_sha")
|
||||
fi
|
||||
|
||||
# Execute installer
|
||||
if (cd "$repo_dir" && "$installer_path" "${params[@]}"); then
|
||||
return 0
|
||||
@@ -632,8 +648,54 @@ function main() {
|
||||
if [ $extract_status -eq 0 ] && [ -n "$repo_dir" ] && [ -d "$repo_dir" ]; then
|
||||
write_color "Extraction successful: $repo_dir" "$COLOR_SUCCESS"
|
||||
|
||||
# Run local installer
|
||||
if invoke_local_installer "$repo_dir"; then
|
||||
# Get commit SHA from the downloaded repository first
|
||||
local commit_sha=""
|
||||
if command -v git &> /dev/null && [ -d "$repo_dir/.git" ]; then
|
||||
commit_sha=$(cd "$repo_dir" && git rev-parse --short HEAD 2>/dev/null || echo "unknown")
|
||||
else
|
||||
# Fallback: try to get from GitHub API
|
||||
local temp_branch="main"
|
||||
[ "$VERSION_TYPE" = "branch" ] && temp_branch="$BRANCH"
|
||||
commit_sha=$(curl -fsSL "https://api.github.com/repos/catlog22/Claude-Code-Workflow/commits/$temp_branch" 2>/dev/null | grep -o '"sha": *"[^"]*"' | head -1 | cut -d'"' -f4 | cut -c1-7)
|
||||
[ -z "$commit_sha" ] && commit_sha="unknown"
|
||||
fi
|
||||
|
||||
# Determine version and branch information to pass
|
||||
local version_to_pass=""
|
||||
local branch_to_pass=""
|
||||
|
||||
if [ -n "$TAG_VERSION" ]; then
|
||||
# Specific tag version - remove 'v' prefix
|
||||
version_to_pass="${TAG_VERSION#v}"
|
||||
elif [ "$VERSION_TYPE" = "stable" ]; then
|
||||
# Auto-detected latest stable
|
||||
local latest_tag
|
||||
latest_tag=$(get_latest_release)
|
||||
if [ -n "$latest_tag" ]; then
|
||||
version_to_pass="${latest_tag#v}"
|
||||
else
|
||||
# Fallback: use commit SHA as version
|
||||
version_to_pass="dev-$commit_sha"
|
||||
fi
|
||||
else
|
||||
# Latest development or branch - use commit SHA as version
|
||||
version_to_pass="dev-$commit_sha"
|
||||
fi
|
||||
|
||||
if [ "$VERSION_TYPE" = "branch" ]; then
|
||||
branch_to_pass="$BRANCH"
|
||||
elif [ "$VERSION_TYPE" = "latest" ]; then
|
||||
branch_to_pass="main"
|
||||
elif [ -n "$TAG_VERSION" ]; then
|
||||
branch_to_pass="$TAG_VERSION"
|
||||
else
|
||||
branch_to_pass="main"
|
||||
fi
|
||||
|
||||
write_color "Version info: $version_to_pass (branch: $branch_to_pass, commit: $commit_sha)" "$COLOR_INFO"
|
||||
|
||||
# Run local installer with version information
|
||||
if invoke_local_installer "$repo_dir" "$version_to_pass" "$branch_to_pass" "$commit_sha"; then
|
||||
success=true
|
||||
echo ""
|
||||
write_color "✓ Remote installation completed successfully!" "$COLOR_SUCCESS"
|
||||
|
||||
Reference in New Issue
Block a user