diff --git a/.claude/scripts/update_module_claude.sh b/.claude/scripts/update_module_claude.sh index db4eb117..539b5632 100644 --- a/.claude/scripts/update_module_claude.sh +++ b/.claude/scripts/update_module_claude.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Update CLAUDE.md for a specific module with automatic layer detection +# Update CLAUDE.md for a specific module with unified template # Usage: update_module_claude.sh [update_type] [tool] # module_path: Path to the module directory # update_type: full|related (default: full) @@ -7,7 +7,7 @@ # # Features: # - Respects .gitignore patterns (current directory or git root) -# - Automatic layer detection (Root/Domain/Module/Sub-Module) +# - Unified template for all modules (folders and files) # - Template-based documentation generation # Build exclusion filters from .gitignore @@ -86,43 +86,16 @@ update_module_claude() { return 0 fi - # Determine documentation layer based on path patterns - local layer="" - local template_path="" - local analysis_strategy="" - - # Clean path for pattern matching - local clean_path=$(echo "$module_path" | sed 's|^\./||') - - # Pattern-based layer detection - if [ "$module_path" = "." ]; then - # Root directory - layer="Layer 1 (Root)" - template_path="$HOME/.claude/workflows/cli-templates/prompts/memory/claude-layer1-root.txt" - analysis_strategy="--all-files" - elif [[ "$clean_path" =~ ^[^/]+$ ]]; then - # Top-level directories (e.g., .claude, src, tests) - layer="Layer 2 (Domain)" - template_path="$HOME/.claude/workflows/cli-templates/prompts/memory/claude-layer2-domain.txt" - analysis_strategy="@{*/CLAUDE.md}" - elif [[ "$clean_path" =~ ^[^/]+/[^/]+$ ]]; then - # Second-level directories (e.g., .claude/scripts, src/components) - layer="Layer 3 (Module)" - template_path="$HOME/.claude/workflows/cli-templates/prompts/memory/claude-layer3-module.txt" - analysis_strategy="@{*/CLAUDE.md}" - else - # Deeper directories (e.g., .claude/workflows/cli-templates/prompts) - layer="Layer 4 (Sub-Module)" - template_path="$HOME/.claude/workflows/cli-templates/prompts/memory/claude-layer4-submodule.txt" - analysis_strategy="--all-files" - fi + # Use unified template for all modules + local template_path="$HOME/.claude/workflows/cli-templates/prompts/memory/claude-module-unified.txt" + local analysis_strategy="--all-files" # Prepare logging info local module_name=$(basename "$module_path") echo "⚡ Updating: $module_path" - echo " Layer: $layer | Type: $update_type | Tool: $tool | Files: $file_count" - echo " Template: $(basename "$template_path") | Strategy: $analysis_strategy" + echo " Type: $update_type | Tool: $tool | Files: $file_count" + echo " Template: $(basename "$template_path")" # Generate prompt with template injection local template_content="" @@ -130,7 +103,7 @@ update_module_claude() { template_content=$(cat "$template_path") else echo " ⚠️ Template not found: $template_path, using fallback" - template_content="Update CLAUDE.md documentation for this module following hierarchy standards." + template_content="Update CLAUDE.md documentation for this module: document structure, key components, dependencies, and integration points." fi local update_context="" @@ -138,8 +111,7 @@ update_module_claude() { update_context=" Update Mode: Complete refresh - Perform comprehensive analysis of all content - - Document patterns, architecture, and purpose - - Consider existing documentation hierarchy + - Document module structure, dependencies, and key components - Follow template guidelines strictly" else update_context=" @@ -152,13 +124,13 @@ update_module_claude() { local base_prompt=" ⚠️ CRITICAL RULES - MUST FOLLOW: - 1. ONLY modify CLAUDE.md files at any hierarchy level + 1. ONLY modify CLAUDE.md files 2. NEVER modify source code files 3. Focus exclusively on updating documentation 4. Follow the template guidelines exactly - + $template_content - + $update_context" # Execute update @@ -172,38 +144,21 @@ update_module_claude() { Module Information: - Name: $module_name - Path: $module_path - - Layer: $layer - - Tool: $tool - - Analysis Strategy: $analysis_strategy" + - Tool: $tool" - # Execute with selected tool + # Execute with selected tool (always use --all-files) 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 + qwen --all-files --yolo -p "$final_prompt" 2>&1 + tool_result=$? ;; 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 + codex --full-auto exec "$final_prompt" --skip-git-repo-check -s danger-full-access 2>&1 + tool_result=$? ;; 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 + gemini --all-files --yolo -p "$final_prompt" 2>&1 + tool_result=$? ;; esac diff --git a/.claude/workflows/cli-templates/prompts/memory/claude-layer1-root.txt b/.claude/workflows/cli-templates/prompts/memory/archive/claude-layer1-root.txt similarity index 100% rename from .claude/workflows/cli-templates/prompts/memory/claude-layer1-root.txt rename to .claude/workflows/cli-templates/prompts/memory/archive/claude-layer1-root.txt diff --git a/.claude/workflows/cli-templates/prompts/memory/claude-layer2-domain.txt b/.claude/workflows/cli-templates/prompts/memory/archive/claude-layer2-domain.txt similarity index 100% rename from .claude/workflows/cli-templates/prompts/memory/claude-layer2-domain.txt rename to .claude/workflows/cli-templates/prompts/memory/archive/claude-layer2-domain.txt diff --git a/.claude/workflows/cli-templates/prompts/memory/claude-layer3-module.txt b/.claude/workflows/cli-templates/prompts/memory/archive/claude-layer3-module.txt similarity index 100% rename from .claude/workflows/cli-templates/prompts/memory/claude-layer3-module.txt rename to .claude/workflows/cli-templates/prompts/memory/archive/claude-layer3-module.txt diff --git a/.claude/workflows/cli-templates/prompts/memory/claude-layer4-submodule.txt b/.claude/workflows/cli-templates/prompts/memory/archive/claude-layer4-submodule.txt similarity index 100% rename from .claude/workflows/cli-templates/prompts/memory/claude-layer4-submodule.txt rename to .claude/workflows/cli-templates/prompts/memory/archive/claude-layer4-submodule.txt diff --git a/.claude/workflows/cli-templates/prompts/memory/claude-module-unified.txt b/.claude/workflows/cli-templates/prompts/memory/claude-module-unified.txt new file mode 100644 index 00000000..58bf8605 --- /dev/null +++ b/.claude/workflows/cli-templates/prompts/memory/claude-module-unified.txt @@ -0,0 +1,138 @@ +Create or update CLAUDE.md documentation with unified module/file template: + +## Unified Module Documentation Requirements + +### Analysis Strategy +- **For Folders/Modules**: Analyze directory structure, sub-modules, and architectural patterns +- **For Code Files**: Analyze classes, functions, interfaces, and implementation details + +### Content Focus (MUST INCLUDE): + +#### 1. Purpose and Scope +- Clear description of what this module/file does +- Main responsibilities and boundaries +- Role within the larger system + +#### 2. Structure Overview +**For Folders/Modules**: +- Directory organization and file structure +- Sub-module categorization +- Architectural layout + +**For Code Files**: +- File organization (imports, exports, structure) +- Core classes and their hierarchy +- Main functions and their grouping + +#### 3. Key Components +**For Folders/Modules**: +- Sub-modules and their responsibilities +- Major components and their interactions +- Entry points and public interfaces + +**For Code Files**: +- Core classes with brief descriptions +- Key methods/functions with signatures +- Important interfaces/types +- Exported APIs + +#### 4. Dependencies +- **Internal Dependencies**: Other modules/files within the project + - What it imports/requires + - Dependency relationships and flow +- **External Dependencies**: Third-party libraries and frameworks + - Critical dependencies and their purposes + - Version constraints if important + +#### 5. Integration Points +- How this module/file connects to other parts +- Public APIs or interfaces exposed +- Data flow patterns (input → processing → output) +- Event handling or callbacks +- Extension points for customization + +#### 6. Implementation Notes +- Key design patterns used (e.g., Singleton, Factory, Observer) +- Important technical decisions and rationale +- Configuration requirements or environment variables +- Performance considerations +- Security considerations if applicable +- Known limitations or caveats + +### Documentation Style Guidelines: +- Be concise but complete +- Use clear, descriptive language +- Include code signatures for key APIs +- Focus on "what" and "why", not detailed "how" +- Reference related documentation when appropriate +- Use bullet points for readability + +### Template Structure: +```markdown +# [Module/File Name] + +## Purpose and Scope +[Clear description of responsibilities and role] + +## Structure Overview +[Directory structure for modules OR File organization for code files] + +## Key Components +### [Component/Class Name 1] +- Description: [Brief description] +- Responsibilities: [What it does] +- Key Methods: [Important methods if applicable] + +### [Component/Class Name 2] +... + +## Dependencies +### Internal Dependencies +- `[module/file path]` - [purpose] +- ... + +### External Dependencies +- `[library name]` - [purpose and usage] +- ... + +## Integration Points +### Public APIs +- `[API/function signature]` - [description] +- ... + +### Data Flow +[How data flows through this module/file] + +### Extension Points +[How this can be extended or customized] + +## Implementation Notes +### Design Patterns +- [Pattern name]: [Usage and rationale] + +### Technical Decisions +- [Decision]: [Rationale] + +### Configuration +- [Config item]: [Purpose and default] + +### Considerations +- Performance: [Any performance notes] +- Security: [Any security considerations] +- Limitations: [Known limitations] +``` + +### Content Restrictions (STRICTLY AVOID): +- Don't duplicate content from other CLAUDE.md files - reference them instead +- Avoid overly detailed code explanations (code should be self-documenting) +- Don't include complete code listings (use signatures and descriptions) +- Avoid version-specific implementation details unless critical +- Don't document every single function - focus on key components + +### Special Instructions: +- If analyzing a folder with existing CLAUDE.md files in subdirectories, reference them rather than duplicating their content +- For code files, prioritize exported/public APIs over internal implementation details +- Keep dependency lists focused on direct dependencies, not transitive ones +- Update existing CLAUDE.md files rather than creating new sections unnecessarily + +Remember: This template serves both folder-level module documentation and file-level implementation documentation. Adapt the sections based on what you're documenting. diff --git a/.claude/workflows/intelligent-tools-strategy.md b/.claude/workflows/intelligent-tools-strategy.md index 159c12eb..1ec19944 100644 --- a/.claude/workflows/intelligent-tools-strategy.md +++ b/.claude/workflows/intelligent-tools-strategy.md @@ -273,10 +273,7 @@ RULES: Focus on type safety and component composition | **Planning** | Gemini/Qwen | Task breakdown, migration planning | `planning/task-breakdown.txt` | | **Security** | Codex | Vulnerability assessment, fixes | `analysis/security.txt` | | **Refactoring** | Multiple | Gemini/Qwen for analysis, Codex for execution | `development/refactor.txt` | -| **Memory Layer 1** | Gemini (Qwen fallback) | Root-level project overview, tech stack, architecture principles | `memory/claude-layer1-root.txt` | -| **Memory Layer 2** | Gemini (Qwen fallback) | Domain-level architecture, responsibility boundaries | `memory/claude-layer2-domain.txt` | -| **Memory Layer 3** | Gemini (Qwen fallback) | Module-level implementation patterns, APIs | `memory/claude-layer3-module.txt` | -| **Memory Layer 4** | Gemini (Qwen fallback) | Submodule-level detailed implementation docs | `memory/claude-layer4-submodule.txt` | +| **Module Documentation** | Gemini (Qwen fallback) | Universal module/file documentation for all levels | `memory/claude-module-unified.txt` | | **Memory Hierarchy** | Gemini (Qwen fallback) | Project structure analysis for optimal doc hierarchy | `memory/hierarchy-analysis.txt` | ### Template System @@ -296,11 +293,8 @@ prompts/ │ ├── refactor.txt - Refactoring tasks │ └── testing.txt - Test generation ├── memory/ -│ ├── claude-layer1-root.txt - Root-level project documentation -│ ├── claude-layer2-domain.txt - Domain-level architecture docs -│ ├── claude-layer3-module.txt - Module-level implementation docs -│ ├── claude-layer4-submodule.txt - Submodule-level detailed docs -│ └── hierarchy-analysis.txt - Project structure analysis +│ ├── claude-module-unified.txt - Universal module/file documentation template +│ └── hierarchy-analysis.txt - Project structure analysis └── planning/ └── task-breakdown.txt - Task decomposition