mirror of
https://github.com/catlog22/Claude-Code-Workflow.git
synced 2026-02-13 02:41:50 +08:00
chore: 删除 intelligent-tools-strategy.md 中的参考链接以简化文档
This commit is contained in:
@@ -17,7 +17,6 @@ allowed-tools: SlashCommand(*), Bash(*), TodoWrite(*), Read(*), Glob(*)
|
|||||||
Execute CLI tool analysis on codebase patterns, architecture, or code quality.
|
Execute CLI tool analysis on codebase patterns, architecture, or code quality.
|
||||||
|
|
||||||
**Supported Tools**: codex, gemini (default), qwen
|
**Supported Tools**: codex, gemini (default), qwen
|
||||||
**Reference**: @~/.claude/workflows/intelligent-tools-strategy.md for complete tool details
|
|
||||||
|
|
||||||
## Execution Flow
|
## Execution Flow
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,6 @@ allowed-tools: SlashCommand(*), Bash(*)
|
|||||||
Direct interaction with CLI tools for codebase analysis and Q&A.
|
Direct interaction with CLI tools for codebase analysis and Q&A.
|
||||||
|
|
||||||
**Supported Tools**: codex, gemini (default), qwen
|
**Supported Tools**: codex, gemini (default), qwen
|
||||||
**Reference**: @~/.claude/workflows/intelligent-tools-strategy.md for complete tool details
|
|
||||||
|
|
||||||
## Parameters
|
## Parameters
|
||||||
|
|
||||||
|
|||||||
@@ -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.
|
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)
|
**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
|
## Core Workflow
|
||||||
|
|
||||||
```
|
```
|
||||||
Task Input → Decompose into Subtasks → TodoWrite Tracking →
|
Task Input → Analyze Dependencies → Create Task Flow Diagram →
|
||||||
For Each Subtask:
|
Decompose into Subtask Groups → TodoWrite Tracking →
|
||||||
0. Stage existing changes (git add -A) if valid git repo
|
For Each Subtask Group:
|
||||||
1. Execute with Codex
|
For First Subtask in Group:
|
||||||
2. [Optional] Git verification
|
0. Stage existing changes (git add -A) if valid git repo
|
||||||
3. Mark complete in TodoWrite
|
1. Execute with Codex (new session)
|
||||||
4. Resume next subtask with `codex resume --last`
|
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
|
→ Final Summary
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -41,17 +46,49 @@ For Each Subtask:
|
|||||||
|
|
||||||
## Execution Flow
|
## Execution Flow
|
||||||
|
|
||||||
### Phase 1: Input Processing & Decomposition
|
### Phase 1: Input Processing & Task Flow Analysis
|
||||||
|
|
||||||
1. **Parse Input**:
|
1. **Parse Input**:
|
||||||
- Check if input matches task ID pattern (e.g., `IMPL-001`, `TASK-123`)
|
- Check if input matches task ID pattern (e.g., `IMPL-001`, `TASK-123`)
|
||||||
- If yes: Load from `.task/[ID].json` and extract requirements
|
- If yes: Load from `.task/[ID].json` and extract requirements
|
||||||
- If no: Use input as task description directly
|
- If no: Use input as task description directly
|
||||||
|
|
||||||
2. **Analyze & Decompose**:
|
2. **Analyze Dependencies & Create Task Flow Diagram**:
|
||||||
- Analyze task complexity and scope
|
- Analyze task complexity and scope
|
||||||
- Break down into 3-8 subtasks
|
- Identify dependencies and relationships between subtasks
|
||||||
- Create TodoWrite tracker with all 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
|
- Display decomposition for user review
|
||||||
|
|
||||||
**Decomposition Criteria**:
|
**Decomposition Criteria**:
|
||||||
@@ -59,8 +96,9 @@ For Each Subtask:
|
|||||||
- Clear, testable outcomes
|
- Clear, testable outcomes
|
||||||
- Explicit dependencies
|
- Explicit dependencies
|
||||||
- Focused file scope (1-5 files per subtask)
|
- Focused file scope (1-5 files per subtask)
|
||||||
|
- **Group coherence**: Subtasks in same group share context/files
|
||||||
|
|
||||||
### Phase 2: Sequential Execution
|
### Phase 2: Group-Based Execution
|
||||||
|
|
||||||
**Pre-Execution Git Staging** (if valid git repository):
|
**Pre-Execution Git Staging** (if valid git repository):
|
||||||
```bash
|
```bash
|
||||||
@@ -70,37 +108,61 @@ git add -A
|
|||||||
git status --short
|
git status --short
|
||||||
```
|
```
|
||||||
|
|
||||||
**For First Subtask**:
|
**For First Subtask in Each Group** (New Session):
|
||||||
```bash
|
```bash
|
||||||
# Initial execution (no resume needed)
|
# Start new Codex session for independent task group
|
||||||
codex -C [dir] --full-auto exec "
|
codex -C [dir] --full-auto exec "
|
||||||
PURPOSE: [task goal]
|
PURPOSE: [group goal]
|
||||||
TASK: [subtask 1 description]
|
TASK: [subtask description - first in group]
|
||||||
CONTEXT: @{relevant_files} @{CLAUDE.md}
|
CONTEXT: @{relevant_files} @{CLAUDE.md}
|
||||||
EXPECTED: [specific deliverables]
|
EXPECTED: [specific deliverables]
|
||||||
RULES: [constraints]
|
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
|
" --skip-git-repo-check -s danger-full-access
|
||||||
```
|
```
|
||||||
|
|
||||||
**For Subsequent Subtasks** (using resume --last):
|
**For Related Subtasks in Same Group** (Resume Session):
|
||||||
```bash
|
```bash
|
||||||
# Stage changes from previous subtask (if valid git repository)
|
# Stage changes from previous subtask (if valid git repository)
|
||||||
git add -A
|
git add -A
|
||||||
|
|
||||||
# Resume previous session for context continuity
|
# Resume session ONLY for subtasks in same group
|
||||||
codex exec "
|
codex exec "
|
||||||
CONTINUE TO NEXT SUBTASK:
|
CONTINUE IN SAME GROUP:
|
||||||
Subtask N of M: [subtask title]
|
Group [X]: [group name] - Subtask N of M
|
||||||
|
|
||||||
PURPOSE: [continuation goal]
|
PURPOSE: [continuation goal within group]
|
||||||
TASK: [subtask N description]
|
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]
|
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
|
" 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)
|
### Phase 3: Verification (if --verify-git enabled)
|
||||||
|
|
||||||
After each subtask completion:
|
After each subtask completion:
|
||||||
@@ -121,16 +183,26 @@ git ls-files --others --exclude-standard
|
|||||||
- No merge conflicts or errors
|
- No merge conflicts or errors
|
||||||
- Code compiles/runs (if applicable)
|
- Code compiles/runs (if applicable)
|
||||||
|
|
||||||
### Phase 4: TodoWrite Tracking
|
### Phase 4: TodoWrite Tracking with Groups
|
||||||
|
|
||||||
**Initial Setup**:
|
**Initial Setup with Task Flow**:
|
||||||
```javascript
|
```javascript
|
||||||
TodoWrite({
|
TodoWrite({
|
||||||
todos: [
|
todos: [
|
||||||
{ content: "Subtask 1: [description]", status: "in_progress", activeForm: "Executing subtask 1" },
|
// Display task flow diagram first
|
||||||
{ content: "Subtask 2: [description]", status: "pending", activeForm: "Executing subtask 2" },
|
{ content: "Task Flow Analysis Complete - See diagram above", status: "completed", activeForm: "Analyzing task flow" },
|
||||||
{ content: "Subtask 3: [description]", status: "pending", activeForm: "Executing subtask 3" },
|
|
||||||
// ... more subtasks
|
// 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" }
|
{ content: "Final verification and summary", status: "pending", activeForm: "Verifying and summarizing" }
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
@@ -140,8 +212,9 @@ TodoWrite({
|
|||||||
```javascript
|
```javascript
|
||||||
TodoWrite({
|
TodoWrite({
|
||||||
todos: [
|
todos: [
|
||||||
{ content: "Subtask 1: [description]", status: "completed", activeForm: "Executing subtask 1" },
|
{ content: "Task Flow Analysis Complete - See diagram above", status: "completed", activeForm: "Analyzing task flow" },
|
||||||
{ content: "Subtask 2: [description]", status: "in_progress", activeForm: "Executing subtask 2" },
|
{ 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
|
// ... update status
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
@@ -149,18 +222,36 @@ TodoWrite({
|
|||||||
|
|
||||||
## Codex Resume Mechanism
|
## Codex Resume Mechanism
|
||||||
|
|
||||||
**Why `codex resume --last`?**
|
**Why Group-Based Resume?**
|
||||||
- Maintains conversation context across subtasks
|
- **Within Group**: Maintains conversation context for related subtasks
|
||||||
- Codex remembers previous decisions and patterns
|
- Codex remembers previous decisions and patterns
|
||||||
- Reduces context repetition
|
- Reduces context repetition
|
||||||
- Ensures consistency in implementation style
|
- 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**:
|
**How It Works**:
|
||||||
1. First subtask creates new Codex session
|
1. **First subtask in Group A**: Creates new Codex session
|
||||||
2. After completion, session is saved
|
2. **Subsequent subtasks in Group A**: Use `codex resume --last` to continue session
|
||||||
3. Subsequent subtasks use `codex resume --last` to continue
|
3. **First subtask in Group B**: Creates NEW Codex session (no resume)
|
||||||
4. Each subtask builds on previous context
|
4. **Subsequent subtasks in Group B**: Use `codex resume --last` within Group B
|
||||||
5. Final subtask completes full task
|
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**:
|
**Image Support**:
|
||||||
```bash
|
```bash
|
||||||
@@ -199,25 +290,47 @@ codex exec "CONTINUE TO NEXT SUBTASK: ..." resume --last --skip-git-repo-check -
|
|||||||
|
|
||||||
**During Execution**:
|
**During Execution**:
|
||||||
```
|
```
|
||||||
📋 Task Decomposition:
|
📊 Task Flow Diagram:
|
||||||
1. [Subtask 1 description]
|
[Group A: Auth Core]
|
||||||
2. [Subtask 2 description]
|
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]
|
[Group C: Testing]
|
||||||
Codex session started...
|
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]
|
[Codex output]
|
||||||
✅ Subtask 1 completed
|
✅ Subtask 1 completed
|
||||||
|
|
||||||
🔍 Git Verification:
|
🔍 Git Verification:
|
||||||
M src/file1.ts
|
M src/models/user.ts
|
||||||
A src/file2.ts
|
|
||||||
✅ Changes verified
|
✅ Changes verified
|
||||||
|
|
||||||
▶️ Executing Subtask 2/N: [title]
|
▶️ [Group A] Executing Subtask 2/8: Add validation logic
|
||||||
Resuming Codex session...
|
Resuming Codex session (same group)...
|
||||||
[Codex output]
|
[Codex output]
|
||||||
✅ Subtask 2 completed
|
✅ 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
|
✅ All Subtasks Completed
|
||||||
@@ -248,16 +361,30 @@ codex exec "CONTINUE TO NEXT SUBTASK: ..." resume --last --skip-git-repo-check -
|
|||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
**Example 1: Simple Task**
|
**Example 1: Simple Task with Groups**
|
||||||
```bash
|
```bash
|
||||||
/cli:codex-execute "implement user authentication system"
|
/cli:codex-execute "implement user authentication system"
|
||||||
|
|
||||||
# Decomposes into:
|
# Task Flow Diagram:
|
||||||
# 1. Create user model and database schema
|
# [Group A: Data Layer]
|
||||||
# 2. Implement JWT token generation
|
# A1: Create user model ──► [resume] ──► A2: Database schema
|
||||||
# 3. Create authentication middleware
|
#
|
||||||
# 4. Add login/logout endpoints
|
# [Group B: Auth Logic]
|
||||||
# 5. Write tests for auth flow
|
# 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**
|
**Example 2: With Git Verification**
|
||||||
@@ -280,13 +407,16 @@ codex exec "CONTINUE TO NEXT SUBTASK: ..." resume --last --skip-git-repo-check -
|
|||||||
|
|
||||||
## Best Practices
|
## Best Practices
|
||||||
|
|
||||||
1. **Subtask Granularity**: Keep subtasks small and focused
|
1. **Task Flow First**: Always create visual flow diagram before execution
|
||||||
2. **Clear Boundaries**: Each subtask should have well-defined input/output
|
2. **Group Related Work**: Cluster subtasks by domain/files for efficient resume
|
||||||
3. **Git Hygiene**: Use `--verify-git` for critical refactoring
|
3. **Subtask Granularity**: Keep subtasks small and focused (5-15 min each)
|
||||||
4. **Pre-Execution Staging**: Stage changes before each subtask to clearly see codex modifications
|
4. **Clear Boundaries**: Each subtask should have well-defined input/output
|
||||||
5. **Context Continuity**: Let `codex resume --last` maintain context
|
5. **Git Hygiene**: Use `--verify-git` for critical refactoring
|
||||||
6. **Recovery Points**: TodoWrite provides clear progress tracking
|
6. **Pre-Execution Staging**: Stage changes before each subtask to clearly see codex modifications
|
||||||
7. **Image References**: Attach design files for UI tasks
|
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
|
## Input Processing
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ allowed-tools: SlashCommand(*), Bash(*)
|
|||||||
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
|
**Supported Tools**: codex, gemini (default), qwen
|
||||||
**Reference**: @~/.claude/workflows/intelligent-tools-strategy.md for complete tool details
|
|
||||||
|
|
||||||
## YOLO Permissions
|
## YOLO Permissions
|
||||||
|
|
||||||
|
|||||||
@@ -37,8 +37,6 @@ Execute systematic bug analysis and fix suggestions using CLI tools with diagnos
|
|||||||
|
|
||||||
## Command Template
|
## Command Template
|
||||||
|
|
||||||
**Core Guidelines**: @~/.claude/workflows/intelligent-tools-strategy.md
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
cd [directory] && ~/.claude/scripts/gemini-wrapper --all-files -p "
|
cd [directory] && ~/.claude/scripts/gemini-wrapper --all-files -p "
|
||||||
PURPOSE: [bug analysis goal]
|
PURPOSE: [bug analysis goal]
|
||||||
|
|||||||
@@ -48,8 +48,6 @@ The code-analysis template provides:
|
|||||||
|
|
||||||
## Command Templates
|
## Command Templates
|
||||||
|
|
||||||
**Core Guidelines**: @~/.claude/workflows/intelligent-tools-strategy.md
|
|
||||||
|
|
||||||
### Gemini (Default)
|
### Gemini (Default)
|
||||||
```bash
|
```bash
|
||||||
cd [directory] && ~/.claude/scripts/gemini-wrapper --all-files -p "
|
cd [directory] && ~/.claude/scripts/gemini-wrapper --all-files -p "
|
||||||
|
|||||||
@@ -37,8 +37,6 @@ Execute planning and architecture analysis using CLI tools with specialized temp
|
|||||||
|
|
||||||
## Command Template
|
## Command Template
|
||||||
|
|
||||||
**Core Guidelines**: @~/.claude/workflows/intelligent-tools-strategy.md
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
cd [directory] && ~/.claude/scripts/gemini-wrapper --all-files -p "
|
cd [directory] && ~/.claude/scripts/gemini-wrapper --all-files -p "
|
||||||
PURPOSE: [planning goal from topic]
|
PURPOSE: [planning goal from topic]
|
||||||
|
|||||||
@@ -6,11 +6,22 @@ type: strategic-guideline
|
|||||||
|
|
||||||
# Intelligent Tools Selection Strategy
|
# 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
|
## ⚡ Core Framework
|
||||||
|
|
||||||
**Gemini**: Analysis, understanding, exploration & documentation
|
### Tool Overview
|
||||||
**Qwen**: Architecture analysis, code generation & implementation
|
- **Gemini**: Analysis, understanding, exploration & documentation
|
||||||
**Codex**: Development, implementation & automation
|
- **Qwen**: Architecture analysis, code generation & implementation
|
||||||
|
- **Codex**: Development, implementation & automation
|
||||||
|
|
||||||
### Decision Principles
|
### Decision Principles
|
||||||
- **Use tools early and often** - Tools are faster, more thorough, and reliable than manual approaches
|
- **Use tools early and often** - Tools are faster, more thorough, and reliable than manual approaches
|
||||||
@@ -27,30 +38,92 @@ type: strategic-guideline
|
|||||||
4. **Not sure?** → Use multiple tools in parallel
|
4. **Not sure?** → Use multiple tools in parallel
|
||||||
5. **Small task?** → Still use tools - they're faster than manual work
|
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
|
## 🎯 Tool Specifications
|
||||||
- **⚠️ 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
|
|
||||||
|
|
||||||
## 🎯 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
|
```bash
|
||||||
# Gemini Analysis (read-only, default)
|
# Gemini Analysis (read-only, default)
|
||||||
cd [directory] && ~/.claude/scripts/gemini-wrapper -p "
|
cd [directory] && ~/.claude/scripts/gemini-wrapper -p "
|
||||||
@@ -72,7 +145,10 @@ CONTEXT: [file references and memory context]
|
|||||||
EXPECTED: [expected output]
|
EXPECTED: [expected output]
|
||||||
RULES: [template reference and constraints]
|
RULES: [template reference and constraints]
|
||||||
"
|
"
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Qwen Commands
|
||||||
|
```bash
|
||||||
# Qwen Architecture Analysis (read-only, default)
|
# Qwen Architecture Analysis (read-only, default)
|
||||||
cd [directory] && ~/.claude/scripts/qwen-wrapper -p "
|
cd [directory] && ~/.claude/scripts/qwen-wrapper -p "
|
||||||
PURPOSE: [clear architecture goal]
|
PURPOSE: [clear architecture goal]
|
||||||
@@ -93,7 +169,10 @@ CONTEXT: [file references and memory context]
|
|||||||
EXPECTED: [expected deliverables]
|
EXPECTED: [expected deliverables]
|
||||||
RULES: [template reference and constraints]
|
RULES: [template reference and constraints]
|
||||||
"
|
"
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Codex Commands
|
||||||
|
```bash
|
||||||
# Codex Development (requires explicit MODE=auto)
|
# Codex Development (requires explicit MODE=auto)
|
||||||
# NOTE: --skip-git-repo-check and -s danger-full-access must be placed at command END
|
# NOTE: --skip-git-repo-check and -s danger-full-access must be placed at command END
|
||||||
codex -C [directory] --full-auto exec "
|
codex -C [directory] --full-auto exec "
|
||||||
@@ -117,32 +196,7 @@ RULES: [template reference and constraints]
|
|||||||
" --skip-git-repo-check -s danger-full-access
|
" --skip-git-repo-check -s danger-full-access
|
||||||
```
|
```
|
||||||
|
|
||||||
### Template Structure
|
### Directory Context Configuration
|
||||||
- [ ] **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
|
|
||||||
Tools execute in current working directory:
|
Tools execute in current working directory:
|
||||||
- **Gemini**: `cd path/to/project && ~/.claude/scripts/gemini-wrapper -p "prompt"`
|
- **Gemini**: `cd path/to/project && ~/.claude/scripts/gemini-wrapper -p "prompt"`
|
||||||
- **Qwen**: `cd path/to/project && ~/.claude/scripts/qwen-wrapper -p "prompt"`
|
- **Qwen**: `cd path/to/project && ~/.claude/scripts/qwen-wrapper -p "prompt"`
|
||||||
@@ -150,7 +204,7 @@ Tools execute in current working directory:
|
|||||||
- **Path types**: Supports both relative (`../project`) and absolute (`/full/path`) paths
|
- **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
|
- **Token analysis**: For gemini-wrapper and qwen-wrapper, token counting happens in current directory
|
||||||
|
|
||||||
### Rules Field Format
|
### RULES Field Format
|
||||||
```bash
|
```bash
|
||||||
RULES: $(cat "~/.claude/workflows/cli-templates/prompts/[category]/[template].txt") | [constraints]
|
RULES: $(cat "~/.claude/workflows/cli-templates/prompts/[category]/[template].txt") | [constraints]
|
||||||
```
|
```
|
||||||
@@ -161,167 +215,7 @@ RULES: $(cat "~/.claude/workflows/cli-templates/prompts/[category]/[template].tx
|
|||||||
- No template: `Focus on security patterns, include dependency analysis`
|
- No template: `Focus on security patterns, include dependency analysis`
|
||||||
- File patterns: `@{src/**/*.ts,CLAUDE.md} - Stay within scope`
|
- File patterns: `@{src/**/*.ts,CLAUDE.md} - Stay within scope`
|
||||||
|
|
||||||
## 📊 Tool Selection Matrix
|
### File Pattern Reference
|
||||||
|
|
||||||
| Task Type | Tool | Use Case | Template |
|
|
||||||
|-----------|------|----------|-----------|
|
|
||||||
| **Analysis** | Gemini | Code exploration, architecture review, patterns | `analysis/pattern.txt` |
|
|
||||||
| **Architecture** | Qwen | System design, code generation, architectural analysis | `analysis/architecture.txt` |
|
|
||||||
| **Code Generation** | Qwen | Implementation patterns, code scaffolding, component creation | `development/feature.txt` |
|
|
||||||
| **Development** | Codex | Feature implementation, bug fixes, testing | `development/feature.txt` |
|
|
||||||
| **Planning** | Multiple | Task breakdown, migration planning | `planning/task-breakdown.txt` |
|
|
||||||
| **Documentation** | Multiple | Code docs, API specs, guides | `analysis/quality.txt` |
|
|
||||||
| **Security** | Codex | Vulnerability assessment, fixes | `analysis/security.txt` |
|
|
||||||
| **Refactoring** | Multiple | Gemini for analysis, Qwen/Codex for execution | `development/refactor.txt` |
|
|
||||||
|
|
||||||
## 📁 Template System
|
|
||||||
|
|
||||||
**Base Structure**: `~/.claude/workflows/cli-templates/`
|
|
||||||
|
|
||||||
### Available Templates
|
|
||||||
```
|
|
||||||
prompts/
|
|
||||||
├── analysis/
|
|
||||||
│ ├── pattern.txt - Code pattern analysis
|
|
||||||
│ ├── architecture.txt - System architecture review
|
|
||||||
│ ├── security.txt - Security assessment
|
|
||||||
│ └── quality.txt - Code quality review
|
|
||||||
├── development/
|
|
||||||
│ ├── feature.txt - Feature implementation
|
|
||||||
│ ├── refactor.txt - Refactoring tasks
|
|
||||||
│ └── testing.txt - Test generation
|
|
||||||
└── planning/
|
|
||||||
└── task-breakdown.txt - Task decomposition
|
|
||||||
|
|
||||||
planning-roles/
|
|
||||||
├── system-architect.md - System design perspective
|
|
||||||
├── security-expert.md - Security architecture
|
|
||||||
└── feature-planner.md - Feature specification
|
|
||||||
|
|
||||||
tech-stacks/
|
|
||||||
├── typescript-dev.md - TypeScript guidelines
|
|
||||||
├── python-dev.md - Python conventions
|
|
||||||
└── react-dev.md - React architecture
|
|
||||||
```
|
|
||||||
|
|
||||||
## 🚀 Usage Patterns
|
|
||||||
|
|
||||||
### Workflow Integration (REQUIRED)
|
|
||||||
When planning any coding task, **ALWAYS** integrate CLI tools:
|
|
||||||
|
|
||||||
1. **Understanding Phase**: Use Gemini for analysis
|
|
||||||
2. **Architecture Phase**: Use Qwen for design and code generation
|
|
||||||
3. **Implementation Phase**: Use Qwen/Codex for development
|
|
||||||
4. **Quality Phase**: Use Codex for testing and validation
|
|
||||||
|
|
||||||
### Common Scenarios
|
|
||||||
```bash
|
|
||||||
# Gemini - Code Analysis
|
|
||||||
~/.claude/scripts/gemini-wrapper -p "
|
|
||||||
PURPOSE: Understand codebase architecture
|
|
||||||
TASK: Analyze project structure and identify patterns
|
|
||||||
MODE: analysis
|
|
||||||
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
|
|
||||||
~/.claude/scripts/gemini-wrapper -p "
|
|
||||||
PURPOSE: Generate API documentation
|
|
||||||
TASK: Create comprehensive API reference from code
|
|
||||||
MODE: write
|
|
||||||
CONTEXT: @{src/api/**/*}
|
|
||||||
EXPECTED: API.md with all endpoints documented
|
|
||||||
RULES: Follow project documentation standards
|
|
||||||
"
|
|
||||||
|
|
||||||
# Qwen - Architecture Analysis
|
|
||||||
cd src/auth && ~/.claude/scripts/qwen-wrapper -p "
|
|
||||||
PURPOSE: Analyze authentication system architecture
|
|
||||||
TASK: Review JWT-based auth system design
|
|
||||||
MODE: analysis
|
|
||||||
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
|
|
||||||
codex -C path/to/project --full-auto exec "
|
|
||||||
PURPOSE: Implement user authentication
|
|
||||||
TASK: Create JWT-based authentication system
|
|
||||||
MODE: auto
|
|
||||||
CONTEXT: @{src/auth/**/*} Database schema from session memory
|
|
||||||
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 "
|
|
||||||
PURPOSE: Increase test coverage
|
|
||||||
TASK: Generate comprehensive tests for auth module
|
|
||||||
MODE: write
|
|
||||||
CONTEXT: @{**/*.ts} Exclude existing tests
|
|
||||||
EXPECTED: Complete test suite with 80%+ coverage
|
|
||||||
RULES: Use Jest, follow existing patterns
|
|
||||||
" --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
|
|
||||||
|
|
||||||
## 🎯 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
|
|
||||||
- **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
|
|
||||||
```
|
|
||||||
|
|
||||||
### File Patterns
|
|
||||||
- All files: `@{**/*}`
|
- All files: `@{**/*}`
|
||||||
- Source files: `@{src/**/*}`
|
- Source files: `@{src/**/*}`
|
||||||
- TypeScript: `@{*.ts,*.tsx}`
|
- TypeScript: `@{*.ts,*.tsx}`
|
||||||
@@ -354,8 +248,150 @@ RULES: Focus on type safety and component composition
|
|||||||
"
|
"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 📊 Tool Selection Guide
|
||||||
|
|
||||||
|
### Selection Matrix
|
||||||
|
|
||||||
|
| Task Type | Tool | Use Case | Template |
|
||||||
|
|-----------|------|----------|-----------|
|
||||||
|
| **Analysis** | Gemini | Code exploration, architecture review, patterns | `analysis/pattern.txt` |
|
||||||
|
| **Architecture** | Qwen | System design, code generation, architectural analysis | `analysis/architecture.txt` |
|
||||||
|
| **Code Generation** | Qwen | Implementation patterns, code scaffolding, component creation | `development/feature.txt` |
|
||||||
|
| **Development** | Codex | Feature implementation, bug fixes, testing | `development/feature.txt` |
|
||||||
|
| **Planning** | Multiple | Task breakdown, migration planning | `planning/task-breakdown.txt` |
|
||||||
|
| **Documentation** | Multiple | Code docs, API specs, guides | `analysis/quality.txt` |
|
||||||
|
| **Security** | Codex | Vulnerability assessment, fixes | `analysis/security.txt` |
|
||||||
|
| **Refactoring** | Multiple | Gemini for analysis, Qwen/Codex for execution | `development/refactor.txt` |
|
||||||
|
|
||||||
|
### Template System
|
||||||
|
|
||||||
|
**Base Structure**: `~/.claude/workflows/cli-templates/`
|
||||||
|
|
||||||
|
#### Available Templates
|
||||||
|
```
|
||||||
|
prompts/
|
||||||
|
├── analysis/
|
||||||
|
│ ├── pattern.txt - Code pattern analysis
|
||||||
|
│ ├── architecture.txt - System architecture review
|
||||||
|
│ ├── security.txt - Security assessment
|
||||||
|
│ └── quality.txt - Code quality review
|
||||||
|
├── development/
|
||||||
|
│ ├── feature.txt - Feature implementation
|
||||||
|
│ ├── refactor.txt - Refactoring tasks
|
||||||
|
│ └── testing.txt - Test generation
|
||||||
|
└── planning/
|
||||||
|
└── task-breakdown.txt - Task decomposition
|
||||||
|
|
||||||
|
planning-roles/
|
||||||
|
├── system-architect.md - System design perspective
|
||||||
|
├── security-expert.md - Security architecture
|
||||||
|
└── feature-planner.md - Feature specification
|
||||||
|
|
||||||
|
tech-stacks/
|
||||||
|
├── typescript-dev.md - TypeScript guidelines
|
||||||
|
├── python-dev.md - Python conventions
|
||||||
|
└── react-dev.md - React architecture
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 🚀 Usage Patterns
|
||||||
|
|
||||||
|
### Workflow Integration (REQUIRED)
|
||||||
|
When planning any coding task, **ALWAYS** integrate CLI tools:
|
||||||
|
|
||||||
|
1. **Understanding Phase**: Use Gemini for analysis
|
||||||
|
2. **Architecture Phase**: Use Qwen for design and code generation
|
||||||
|
3. **Implementation Phase**: Use Qwen/Codex for development
|
||||||
|
4. **Quality Phase**: Use Codex for testing and validation
|
||||||
|
|
||||||
|
### Common Scenarios
|
||||||
|
|
||||||
|
#### Code Analysis
|
||||||
|
```bash
|
||||||
|
~/.claude/scripts/gemini-wrapper -p "
|
||||||
|
PURPOSE: Understand codebase architecture
|
||||||
|
TASK: Analyze project structure and identify patterns
|
||||||
|
MODE: analysis
|
||||||
|
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
|
||||||
|
"
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Documentation Generation
|
||||||
|
```bash
|
||||||
|
~/.claude/scripts/gemini-wrapper -p "
|
||||||
|
PURPOSE: Generate API documentation
|
||||||
|
TASK: Create comprehensive API reference from code
|
||||||
|
MODE: write
|
||||||
|
CONTEXT: @{src/api/**/*}
|
||||||
|
EXPECTED: API.md with all endpoints documented
|
||||||
|
RULES: Follow project documentation standards
|
||||||
|
"
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Architecture Analysis
|
||||||
|
```bash
|
||||||
|
cd src/auth && ~/.claude/scripts/qwen-wrapper -p "
|
||||||
|
PURPOSE: Analyze authentication system architecture
|
||||||
|
TASK: Review JWT-based auth system design
|
||||||
|
MODE: analysis
|
||||||
|
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
|
||||||
|
"
|
||||||
|
```
|
||||||
|
|
||||||
|
#### 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
|
||||||
|
MODE: auto
|
||||||
|
CONTEXT: @{src/auth/**/*} Database schema from session memory
|
||||||
|
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
|
||||||
|
|
||||||
|
# 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: Auth implementation from current session
|
||||||
|
EXPECTED: Complete test suite with 80%+ coverage
|
||||||
|
RULES: Use Jest, follow existing patterns
|
||||||
|
" resume --last --skip-git-repo-check -s danger-full-access
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Interactive Session Resume
|
||||||
|
```bash
|
||||||
|
# Resume previous session with picker
|
||||||
|
codex resume
|
||||||
|
|
||||||
|
# Or resume most recent session directly
|
||||||
|
codex resume --last
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
## 🔧 Best Practices
|
## 🔧 Best Practices
|
||||||
|
|
||||||
|
### General Guidelines
|
||||||
- **Start with templates** - Use predefined templates for consistency
|
- **Start with templates** - Use predefined templates for consistency
|
||||||
- **Be specific** - Clear PURPOSE, TASK, and EXPECTED fields
|
- **Be specific** - Clear PURPOSE, TASK, and EXPECTED fields
|
||||||
- **Include constraints** - File patterns, scope, requirements in RULES
|
- **Include constraints** - File patterns, scope, requirements in RULES
|
||||||
@@ -403,3 +439,41 @@ EXPECTED: Code improvements and fixes
|
|||||||
RULES: Maintain backward compatibility
|
RULES: Maintain backward compatibility
|
||||||
" --skip-git-repo-check -s danger-full-access
|
" --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
|
||||||
|
|||||||
Reference in New Issue
Block a user