Files
Claude-Code-Workflow/.claude/workflows/context-search-strategy.md
catlog22 b945e2de55 docs: Enhance target_files documentation and fix cross-platform command compatibility
## Target Files Enhancement
- Add support for new file creation in target_files format
- Update task-generate.md with comprehensive target_files generation guide
- Update concept-enhanced.md to output code modification targets
- Add examples showing both modification (file:function:lines) and creation (file) formats

## Cross-Platform Command Fixes
- Replace ls with find commands for better Windows Git Bash compatibility
- Update workflow commands: execute.md, status.md, review.md
- Update session commands: list.md, complete.md
- Add Bash environment guidelines to context-search-strategy.md
- Document forbidden Windows commands (findstr, dir, where, etc.)

## Files Updated
- Core workflows: workflow-architecture.md, task-core.md
- Command docs: 9 workflow command files
- Agent docs: action-planning-agent.md, task-generate-agent.md
- Strategy docs: context-search-strategy.md

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-02 22:40:37 +08:00

2.9 KiB

name, description, type
name description type
context-search-strategy Strategic guidelines for context search commands search-guideline

Context Search Strategy

Execution Environment

CRITICAL: All commands execute in Bash environment (Git Bash on Windows, Bash on Linux/macOS)

Forbidden: Windows-specific commands (findstr, dir, where, type, copy, del) - Use Bash equivalents (grep, find, which, cat, cp, rm)

Core Search Tools

rg (ripgrep): Fast content search with regex support find: File/directory location by name patterns grep: Built-in pattern matching in files get_modules_by_depth.sh: Program architecture analysis and structural discovery

Decision Principles

  • Use rg for content - Fastest for searching within files
  • Use find for files - Locate files/directories by name
  • Use grep sparingly - Only when rg unavailable
  • Use get_modules_by_depth.sh first - MANDATORY for program architecture analysis before planning
  • Always use Bash commands - NEVER use Windows cmd/PowerShell commands

Quick Command Reference

# Program Architecture Analysis (MANDATORY FIRST)
~/.claude/scripts/get_modules_by_depth.sh  # Discover program architecture
bash(~/.claude/scripts/get_modules_by_depth.sh)  # Analyze structural hierarchy

# Content Search (rg preferred)
rg "pattern" --type js          # Search in JS files
rg -i "case-insensitive"        # Ignore case
rg -n "show-line-numbers"       # Show line numbers
rg -A 3 -B 3 "context-lines"    # Show 3 lines before/after

# File Search (find)
find . -name "*.ts" -type f     # Find TypeScript files
find . -path "*/node_modules" -prune -o -name "*.js" -print

# Built-in alternatives
grep -r "pattern" .             # Recursive search (slower)
grep -n -i "pattern" file.txt   # Line numbers, case-insensitive

Workflow Integration Examples

# Program Architecture Analysis (MANDATORY BEFORE PLANNING)
~/.claude/scripts/get_modules_by_depth.sh  # Discover program architecture
bash(~/.claude/scripts/get_modules_by_depth.sh)  # Analyze structural hierarchy

# Search for task definitions
rg "IMPL-\d+" .workflow/ --type json        # Find task IDs
find .workflow/ -name "*.json" -path "*/.task/*"  # Locate task files

# Analyze workflow structure
rg "status.*pending" .workflow/.task/      # Find pending tasks
rg "depends_on" .workflow/.task/ -A 2      # Show dependencies

# Find workflow sessions
find .workflow/ -name ".active-*"          # Active sessions
rg "WFS-" .workflow/ --type json           # Session references

# Content analysis for planning
rg "flow_control" .workflow/ -B 2 -A 5     # Flow control patterns
find . -name "IMPL_PLAN.md" -exec grep -l "requirements" {} \;

Performance Tips

  • rg > grep for content search
  • Use --type filters to limit file types
  • Exclude common dirs: --glob '!node_modules'
  • Use -F for literal strings (no regex)