1- ---
2- name : intelligent-tools-strategy
3- description : Strategic decision framework for intelligent tool selection
4- type : strategic-guideline
5- ---
6-
71# Intelligent Tools Selection Strategy
82
93## 📋 Table of Contents
@@ -27,7 +21,7 @@ TASK: • [step 1] • [step 2] • [step 3]
2721MODE: [analysis|write|auto]
2822CONTEXT: @**/* | Memory: [session/tech/module context]
2923EXPECTED: [format + quality + structure]
30- RULES: [template + constraints] | MODE=[permission level]
24+ RULES: $(cat ~/.claude/workflows/cli-templates/prompts/analysis/pattern.txt) | [ constraints] | MODE=[permission level]
3125```
3226
3327### Tool Selection
@@ -37,12 +31,14 @@ RULES: [template + constraints] | MODE=[permission level]
3731
3832### Quick Command Syntax
3933
34+ ** ⚠️ Always specify model (` -m ` ) and analysis template in RULES field**
35+
4036``` bash
4137# Gemini/Qwen
42- cd [dir] && gemini -p " [prompt]" [ -m model] [--approval-mode yolo]
38+ cd [dir] && gemini -p " [prompt]" -m gemini-3-pro-preview-11-2025 [--approval-mode yolo]
4339
4440# Codex
45- codex -C [dir] --full-auto exec " [prompt]" [ -m model] [--skip-git-repo-check -s danger-full-access]
41+ codex -C [dir] --full-auto exec " [prompt]" -m gpt-5 [--skip-git-repo-check -s danger-full-access]
4642```
4743
4844### Model Selection
@@ -78,6 +74,8 @@ codex -C [dir] --full-auto exec "[prompt]" [-m model] [--skip-git-repo-check -s
7874- ** When in doubt, use both** - Parallel usage provides comprehensive coverage
7975- ** Default to tools** - Use for most coding tasks, no matter how small
8076- ** Minimize context noise** - Use ` cd ` + ` --include-directories ` to focus on relevant files
77+ - ** ⚠️ Always specify model** - REQUIRED: ` -m gemini-3-pro-preview-11-2025 ` for Gemini, ` -m gpt-5 ` for Codex
78+ - ** ⚠️ Always use analysis template** - REQUIRED: Include ` $(cat ~/.claude/workflows/cli-templates/prompts/analysis/pattern.txt) ` in RULES field
8179- ** ⚠️ Write protection** - Require EXPLICIT MODE=write or MODE=auto specification
8280
8381---
@@ -135,7 +133,13 @@ codex -C [dir] --full-auto exec "[prompt]" [-m model] [--skip-git-repo-check -s
135133- ` codex resume --last ` - Resume most recent session
136134- ` codex -i <image_file> ` - Attach image to prompt
137135
138- ** Multi-task Pattern** : First task uses ` exec ` , subsequent tasks use ` exec "..." resume --last ` for context continuity
136+ ** Multi-task Pattern** :
137+ - ** First task** : MUST use full Standard Prompt Template with ` exec ` to establish complete context
138+ - ** Subsequent tasks** : Can use brief prompt with ` exec "..." resume --last ` (inherits context from session)
139+
140+ ** Prompt Requirements** :
141+ - ** Without ` resume --last ` ** : ALWAYS use full Standard Prompt Template
142+ - ** With ` resume --last ` ** : Brief description sufficient (previous template context inherited)
139143
140144** Auto-Resume Rules** :
141145- ** Use ` resume --last ` ** : Related tasks, extending previous work, multi-step workflow
@@ -173,15 +177,12 @@ Every command MUST follow this structure:
173177 - ` @src/**/*.ts ` - TypeScript files in src directory
174178 - ` @../shared/**/* ` - Files from sibling directory (requires ` --include-directories ` )
175179 - ** Memory Context** : Reference previous session findings and context
176- - Workflow sessions: ` Previous WFS-session-id findings: [key insights] `
177180 - Related tasks: ` Building on previous analysis from [session/commit] `
178181 - Tech stack: ` Using patterns from [tech-stack-name] documentation `
179182 - Cross-reference: ` Related to implementation in [module/file] `
180- - ** Memory Sources** : Include relevant memory packages
181- - SKILL packages: Must load BEFORE CLI execution with ` Skill(workflow-progress) ` , ` Skill(react-dev) ` , ` Skill(project-name) `
182- - Session artifacts: ` .workflow/[session-id]/artifacts/ `
183+ - ** Memory Sources** : Include relevant memory sources
183184 - Documentation: ` CLAUDE.md ` , module-specific docs
184- - Example: "CONTEXT: @src/auth /** /* @CLAUDE .md | Memory: Previous WFS-20241105-001 identified JWT validation gap "
185+ - Example: "CONTEXT: @src/auth /** /* @CLAUDE .md | Memory: Building on previous auth refactoring (commit abc123) "
185186
186187- [ ] ** EXPECTED** - Clear expected results
187188 - Specify deliverable format (report, code, documentation, list)
@@ -209,82 +210,87 @@ TASK:
209210MODE: [analysis|write|auto]
210211CONTEXT: @**/* | Memory: [previous session findings, related implementations, tech stack patterns, workflow context]
211212EXPECTED: [deliverable format, quality criteria, output structure, testing requirements (if applicable)]
212- RULES: [template reference and constraints] | [MODE]=[READ-ONLY|CREATE/MODIFY/DELETE|FULL operations]
213+ RULES: $(cat ~/.claude/workflows/cli-templates/prompts/analysis/pattern.txt) | [additional constraints] | [MODE]=[READ-ONLY|CREATE/MODIFY/DELETE|FULL operations]
213214```
214215
215216### Tool-Specific Configuration
216217
218+ Use the ** [ Standard Prompt Template] ( #standard-prompt-template ) ** for all tools. This section only covers tool-specific command syntax.
219+
217220#### Gemini & Qwen
218221
219- ** Command Format** : ` cd [directory] && [tool] -p "[prompt ]" [options] `
222+ ** Command Format** : ` cd [directory] && [tool] -p "[Standard Prompt Template ]" [options] `
220223
221- ** Complete Examples** :
222- ``` bash
223- # Analysis Mode (read-only, default)
224- cd [directory] && gemini -p "
225- PURPOSE: [goal]
226- TASK: • [step 1] • [step 2] • [step 3]
227- MODE: analysis
228- CONTEXT: @**/* | Memory: [memory context]
229- EXPECTED: [expected output]
230- RULES: [rules] | analysis=READ-ONLY
231- "
224+ ** Syntax Elements** :
225+ - ** Directory** : ` cd [directory] && ` (navigate to target directory)
226+ - ** Tool** : ` gemini ` (primary) | ` qwen ` (fallback)
227+ - ** Prompt** : ` -p "[Standard Prompt Template]" ` (prompt BEFORE options)
228+ - ** Model** : ` -m [model-name] ` (REQUIRED, placed AFTER prompt)
229+ - Gemini: ` gemini-3-pro-preview-11-2025 ` (default) | ` gemini-2.5-pro ` | ` gemini-2.5-flash `
230+ - Qwen: ` coder-model ` (default) | ` vision-model `
231+ - ** Write Permission** : ` --approval-mode yolo ` (ONLY for MODE=write, placed AFTER prompt)
232232
233- # Analysis with specific model
234- cd [directory] && gemini -p " [prompt]" -m gemini-3-pro-preview-11-2025
233+ ** Command Examples** :
234+ ``` bash
235+ # Analysis Mode (default, read-only)
236+ cd [directory] && gemini -p " [Standard Prompt Template]" -m gemini-3-pro-preview-11-2025
235237
236- # Write Mode (requires explicit MODE=write)
237- cd [directory] && gemini -p "
238- PURPOSE: [goal]
239- TASK: • [step 1] • [step 2] • [step 3]
240- MODE: write
241- CONTEXT: @**/* | Memory: [memory context]
242- EXPECTED: [expected output]
243- RULES: [rules] | write=CREATE/MODIFY/DELETE
244- " -m gemini-2.5-flash --approval-mode yolo
238+ # Write Mode (requires MODE=write in template + --approval-mode yolo)
239+ cd [directory] && gemini -p " [Standard Prompt Template with MODE: write]" -m gemini-2.5-flash --approval-mode yolo
245240
246241# Fallback to Qwen
247- cd [directory] && qwen -p " [prompt]"
242+ cd [directory] && qwen -p " [Standard Prompt Template]" -m coder-model
243+
244+ # Multi-directory support
245+ cd [directory] && gemini -p " [Standard Prompt Template]" -m gemini-3-pro-preview-11-2025 --include-directories ../shared,../types
248246```
249247
250248#### Codex
251249
252- ** Command Format** : ` codex -C [directory] --full-auto exec "[prompt]" [options] `
250+ ** Command Format** : ` codex -C [directory] --full-auto exec "[Standard Prompt Template]" [options] `
251+
252+ ** Syntax Elements** :
253+ - ** Directory** : ` -C [directory] ` (target directory parameter)
254+ - ** Execution Mode** : ` --full-auto exec ` (required for autonomous execution)
255+ - ** Prompt** : ` exec "[Standard Prompt Template]" ` (prompt BEFORE options)
256+ - ** Model** : ` -m [model-name] ` (REQUIRED, placed AFTER prompt, BEFORE flags)
257+ - ` gpt-5 ` (default) | ` gpt5-codex ` (large context)
258+ - ** Write Permission** : ` --skip-git-repo-check -s danger-full-access ` (ONLY for MODE=auto or MODE=write, placed at command END)
259+ - ** Session Resume** : ` resume --last ` (placed AFTER prompt, BEFORE flags)
253260
254- ** Complete Examples** :
261+ ** Command Examples** :
255262``` bash
256- # Auto Mode (full autonomous development)
257- codex -C [directory] --full-auto exec "
258- PURPOSE: [development goal]
259- TASK: • [step 1] • [step 2] • [step 3]
260- MODE: auto
261- CONTEXT: @**/* | Memory: [memory context with workflow context]
262- EXPECTED: [deliverables with testing requirements]
263- RULES: [rules] | auto=FULL operations
264- " -m gpt-5 --skip-git-repo-check -s danger-full-access
263+ # Auto Mode (requires MODE=auto in template + permission flags)
264+ codex -C [directory] --full-auto exec " [Standard Prompt Template with MODE: auto]" -m gpt-5 --skip-git-repo-check -s danger-full-access
265265
266- # Write Mode (test generation, focused modifications)
267- codex -C [directory] --full-auto exec "
268- PURPOSE: [goal]
269- TASK: • [step 1] • [step 2] • [step 3]
270- MODE: write
271- CONTEXT: @**/* | Memory: [memory context]
272- EXPECTED: [deliverables with testing requirements]
273- RULES: [rules] | write=CREATE/MODIFY/DELETE
274- " -m gpt-5 --skip-git-repo-check -s danger-full-access
266+ # Write Mode (requires MODE=write in template + permission flags)
267+ codex -C [directory] --full-auto exec " [Standard Prompt Template with MODE: write]" -m gpt-5 --skip-git-repo-check -s danger-full-access
268+
269+ # Session continuity
270+ # First task - MUST use full Standard Prompt Template to establish context
271+ codex -C project --full-auto exec " [Standard Prompt Template with MODE: auto]" -m gpt-5 --skip-git-repo-check -s danger-full-access
272+
273+ # Subsequent tasks - Can use brief prompt ONLY when using 'resume --last'
274+ # (inherits full context from previous session, no need to repeat template)
275+ codex --full-auto exec " Add JWT refresh token validation" resume --last --skip-git-repo-check -s danger-full-access
275276
276- # Session continuity (using resume)
277- # First task - establish session
277+ # With image attachment
278+ codex -C [directory] -i design.png --full-auto exec " [Standard Prompt Template]" -m gpt-5 --skip-git-repo-check -s danger-full-access
279+ ```
280+
281+ ** Complete Example (Codex with full template)** :
282+ ``` bash
283+ # First task - establish session with full template
278284codex -C project --full-auto exec "
279285PURPOSE: Implement authentication module
280286TASK: • Create auth service • Add user validation • Setup JWT tokens
281287MODE: auto
282288CONTEXT: @**/* | Memory: Following security patterns from project standards
283289EXPECTED: Complete auth module with tests
284- RULES: Follow existing patterns | auto=FULL operations
285- " --skip-git-repo-check -s danger-full-access
290+ RULES: $( cat ~ /.claude/workflows/cli-templates/prompts/development/feature.txt ) | Follow existing patterns | auto=FULL operations
291+ " -m gpt-5 - -skip-git-repo-check -s danger-full-access
286292
287- # Subsequent tasks - continue same session
293+ # Subsequent tasks - brief description with resume
288294codex --full-auto exec " Add JWT refresh token validation" resume --last --skip-git-repo-check -s danger-full-access
289295```
290296
@@ -309,7 +315,7 @@ codex --full-auto exec "Add JWT refresh token validation" resume --last --skip-g
3093152 . Explicitly reference external files in CONTEXT field with @ patterns
3103163 . ⚠️ BOTH steps are MANDATORY
311317
312- Example: ` cd src/auth && gemini -p "CONTEXT: @**/* @../shared/**/*" --include-directories ../shared `
318+ Example: ` cd src/auth && gemini -p "CONTEXT: @**/* @../shared/**/*" -m gemini-3-pro-preview-11-2025 - -include-directories ../shared `
313319
314320** Rule** : If CONTEXT contains ` @../dir/**/* ` , command MUST include ` --include-directories ../dir `
315321
@@ -324,10 +330,10 @@ Example: `cd src/auth && gemini -p "CONTEXT: @**/* @../shared/**/*" --include-di
324330** Syntax** :
325331``` bash
326332# Comma-separated format
327- gemini -p " prompt" --include-directories /path/to/project1,/path/to/project2
333+ gemini -p " prompt" -m gemini-3-pro-preview-11-2025 - -include-directories /path/to/project1,/path/to/project2
328334
329335# Multiple flags format
330- gemini -p " prompt" --include-directories /path/to/project1 --include-directories /path/to/project2
336+ gemini -p " prompt" -m gemini-3-pro-preview-11-2025 - -include-directories /path/to/project1 --include-directories /path/to/project2
331337
332338# Recommended: cd + --include-directories
333339cd src/auth && gemini -p "
@@ -336,8 +342,8 @@ TASK: Review auth implementation and its dependencies
336342MODE: analysis
337343CONTEXT: @**/* @../shared/**/* @../types/**/*
338344EXPECTED: Complete analysis with cross-directory dependencies
339- RULES: Focus on integration patterns
340- " --include-directories ../shared,../types
345+ RULES: $( cat ~ /.claude/workflows/cli-templates/prompts/analysis/pattern.txt ) | Focus on integration patterns | analysis=READ-ONLY
346+ " -m gemini-3-pro-preview-11-2025 - -include-directories ../shared,../types
341347```
342348
343349** Best Practices** :
@@ -369,61 +375,31 @@ CONTEXT field consists of: **File Patterns** + **Memory Context**
369375
370376** Memory Sources** :
371377
372- 1 . ** Workflow Sessions** - Previous WFS session findings and artifacts
373- - Format: ` WFS-[session-id]: [key findings] `
374- - Artifact paths: ` .workflow/WFS-[session-id]/artifacts/[artifact-name].md `
375- - Common artifacts:
376- - Analysis: ` .workflow/WFS-[session-id]/artifacts/analysis.md `
377- - Plans: ` .workflow/WFS-[session-id]/artifacts/IMPL_PLAN.md `
378- - Tasks: ` .workflow/WFS-[session-id]/.task/task.json `
379- - Lessons: ` .workflow/WFS-[session-id]/artifacts/lessons.md `
380-
381- 2 . ** SKILL Packages** - ⚠️ MUST load BEFORE CLI execution
382- - ** CRITICAL** : Load using ` Skill() ` tool BEFORE CLI commands
383- - CLI tools do NOT support loading SKILL during execution
384- - Workflow: Load SKILL → Extract content → Reference in Memory → Execute CLI
385- - Types:
386- - Workflow: ` Skill(workflow-progress) ` for session history
387- - Tech stacks: ` Skill(react-dev) ` , ` Skill(typescript-dev) ` for patterns
388- - Project: ` Skill(project-name) ` for codebase architecture
389-
390- 3 . ** Related Tasks** - Cross-task context
378+ 1 . ** Related Tasks** - Cross-task context
391379 - Previous refactoring, task extensions, conflict resolution
392380
393- 4 . ** Tech Stack Patterns** - Framework and library conventions
381+ 2 . ** Tech Stack Patterns** - Framework and library conventions
394382 - React hooks patterns, TypeScript utilities, security guidelines
395383
396- 5 . ** Cross-Module References** - Inter-module dependencies
384+ 3 . ** Cross-Module References** - Inter-module dependencies
397385 - Integration points, shared utilities, type dependencies
398386
399387** Memory Context Examples** :
400388
401389``` bash
402- # Example 1: Building on previous session
403- # Step 1: Load SKILL packages BEFORE CLI execution
404- Skill(command: " workflow-progress" ) # Extract session findings
405- Skill(command: " react-dev" ) # Extract React patterns
406-
407- # Step 2: Execute CLI with memory context
408- CONTEXT: @src/auth/** /* @CLAUDE.md | Memory: WFS-20241105-001 identified JWT validation gap (see .workflow/WFS-20241105-001/artifacts/analysis.md line 45-67), implementing refresh token mechanism following React hooks patterns (loaded from react-dev SKILL)
390+ # Example 1: Building on related task
391+ CONTEXT: @src/auth/** /* @CLAUDE.md | Memory: Building on previous auth refactoring (commit abc123), implementing refresh token mechanism following React hooks patterns
409392
410393# Example 2: Cross-module integration
411- CONTEXT: @src/payment/** /* @src/shared/types/** /* | Memory: Integration with auth module from WFS-20241103-002 (implementation plan: .workflow/WFS-20241103-002/artifacts/IMPL_PLAN.md section 3.2), using shared error handling patterns from @shared/utils/errors.ts
412-
413- # Example 3: Workflow continuity
414- Skill(command: " workflow-progress" ) # Extract previous session findings
415- CONTEXT: @** /* | Memory: Continuing from WFS-20241104-005 API refactor (findings from workflow-progress SKILL, detailed analysis: .workflow/WFS-20241104-005/artifacts/analysis.md, implementation plan: .workflow/WFS-20241104-005/artifacts/IMPL_PLAN.md), applying RESTful patterns documented in section 2.1
394+ CONTEXT: @src/payment/** /* @src/shared/types/** /* | Memory: Integration with auth module from previous implementation, using shared error handling patterns from @shared/utils/errors.ts
416395```
417396
418397** Best Practices** :
419398- ** Always include memory context** when building on previous work
420- - ** Reference specific session IDs** : ` WFS-[session-id] ` for traceability
421- - ** Specify artifact paths** explicitly: ` .workflow/WFS-[session-id]/artifacts/[artifact-name].md `
422- - ** Include line numbers/sections** : ` (line 45-67) ` or ` (section 3.2) `
423- - ** Load SKILL packages BEFORE CLI** - CLI cannot load SKILL during execution
424- - ** Cross-reference artifacts** with full paths
399+ - ** Reference commits/tasks** : Use commit hashes or task IDs for traceability
425400- ** Document dependencies** with explicit file references
426- - ** Use consistent format** : ` CONTEXT: [file patterns] | Memory: [memory context with paths] `
401+ - ** Cross-reference implementations** with file paths
402+ - ** Use consistent format** : ` CONTEXT: [file patterns] | Memory: [memory context] `
427403
428404#### Complex Pattern Discovery
429405
@@ -437,29 +413,25 @@ For complex file pattern requirements, use semantic discovery BEFORE CLI executi
437413
438414** Example** :
439415``` bash
440- # Step 1: Load SKILL packages (CLI cannot load SKILL)
441- Skill(command: " workflow-progress" )
442- Skill(command: " react-dev" )
443-
444- # Step 2: Discover files semantically
416+ # Step 1: Discover files semantically
445417rg " export.*Component" --files-with-matches --type ts
446418mcp__code-index__search_code_advanced(pattern=" interface.*Props" , file_pattern=" *.tsx" )
447419
448- # Step 3 : Build precise CONTEXT with file patterns + memory
449- CONTEXT: @src/components/Auth.tsx @src/types/auth.d.ts @src/hooks/useAuth.ts | Memory: WFS-20241103-002 identified type inconsistencies (see .workflow/WFS-20241103-002/artifacts/analysis.md line 34-56, section 2.3), following React hooks patterns (loaded from react-dev SKILL)
420+ # Step 2 : Build precise CONTEXT with file patterns + memory
421+ CONTEXT: @src/components/Auth.tsx @src/types/auth.d.ts @src/hooks/useAuth.ts | Memory: Previous refactoring identified type inconsistencies, following React hooks patterns
450422
451- # Step 4 : Execute CLI with precise references
423+ # Step 3 : Execute CLI with precise references
452424cd src && gemini -p "
453425PURPOSE: Analyze authentication components for type safety improvements
454426TASK:
455427• Review auth component patterns and props interfaces
456- • Identify type inconsistencies documented in WFS-20241103-002 (line 34-56)
428+ • Identify type inconsistencies in auth components
457429• Recommend improvements following React best practices
458430MODE: analysis
459- CONTEXT: @components/Auth.tsx @types/auth.d.ts @hooks/useAuth.ts | Memory: WFS-20241103-002 identified type inconsistencies (detailed analysis: .workflow/WFS-20241103-002/artifacts/analysis.md line 34-56, section 2.3 'Type Safety Issues'), following React hooks patterns (loaded from react-dev SKILL) , related implementation in @hooks/useAuth.ts (commit abc123)
431+ CONTEXT: @components/Auth.tsx @types/auth.d.ts @hooks/useAuth.ts | Memory: Previous refactoring identified type inconsistencies, following React hooks patterns, related implementation in @hooks/useAuth.ts (commit abc123)
460432EXPECTED: Comprehensive analysis report with type safety recommendations, code examples, and references to previous findings
461- RULES: Focus on type safety and component composition | analysis=READ-ONLY
462- "
433+ RULES: $( cat ~ /.claude/workflows/cli-templates/prompts/analysis/pattern.txt ) | Focus on type safety and component composition | analysis=READ-ONLY
434+ " -m gemini-3-pro-preview-11-2025
463435```
464436
465437### RULES Field Configuration
@@ -566,14 +538,9 @@ tech-stacks/
566538- ** Be specific** - Clear PURPOSE, TASK, and EXPECTED fields with detailed descriptions
567539- ** Include constraints** - File patterns, scope, requirements in RULES
568540- ** Leverage memory context** - ALWAYS include Memory field when building on previous work
569- - Reference WFS sessions with explicit paths: ` .workflow/WFS-[session-id]/artifacts/[artifact-name].md `
570- - Include line numbers/sections: ` (line 45-67) ` or ` (section 3.2) `
571- - Load SKILL packages BEFORE CLI (CLI cannot load SKILL during execution):
572- - Workflow: ` Skill(command: "workflow-progress") ` → Extract → Reference in Memory
573- - Tech: ` Skill(command: "tech-name") ` → Extract → Reference in Memory
574- - Project: ` Skill(command: "project-name") ` → Extract → Reference in Memory
575541 - Cross-reference tasks with file paths and commit hashes
576542 - Document dependencies with explicit file references
543+ - Reference related implementations and patterns
577544- ** Discover patterns first** - Use rg/MCP for complex file discovery before CLI execution
578545- ** Build precise CONTEXT** - Convert discovery to explicit file references with memory
579546 - Format: ` CONTEXT: [file patterns] | Memory: [memory context] `
0 commit comments