ccat - CLAUDE.md Context Analyzer
A comprehensive command-line tool for analyzing and managing Claude Code memory files (CLAUDE.md).
Features
- 🔍 Smart File Discovery: Automatically finds CLAUDE.md files in user, project, and subdirectory locations
- 📊 Multiple Output Formats: Text, JSON, Tree view, and raw output
- 🔗 Import Resolution: Tracks and validates import chains between memory files
- 🏥 Diagnostics: Detects issues like circular imports, missing files, and large contexts
- 🔎 Context Search: Search within memory files with regex support
- 📦 Export Capabilities: Export contexts to various formats (Markdown, JSON, HTML, PDF)
- 🔧 Claude Code Integration: Direct integration with Claude Code for automated fixes
Installation
Usage
Basic Commands
# Show memory files in current directory
# Show memory files with tree view
# Include subdirectories
# Show only specific types
# Run diagnostics
# Search for patterns
# Initialize new CLAUDE.md
Advanced Usage
# Show with metadata
# Export to JSON
# Watch for changes
# Validate with strict rules
Command Reference
show - Display memory files (default)
)
diagnose - Run diagnostics
search - Search within contexts
Memory File Types
- Project Memory (
./CLAUDE.md): Project-specific context - User Memory (
~/.claude/CLAUDE.md): Global user settings - Local Memory (
./CLAUDE.local.md): Deprecated local overrides - Subdirectory Memory: CLAUDE.md files in subdirectories
Diagnostics
The tool can detect:
- ❌ Circular imports
- ❌ Missing import files
- ⚠️ Large files (>1MB)
- ⚠️ Deep import chains
- ⚠️ Duplicate imports
- 🔒 Security issues (API keys, passwords)
Claude Code Integration
# Fix issues with Claude
|
# Generate optimized CLAUDE.md
|
# Analyze team patterns
|
Configuration
Configuration file at ~/.config/ccat/config.toml:
[]
= "tree"
= "auto"
= false
[]
= false
= false
= ["default"]
[]
= true
= "100MB"
Development
# Run tests
# Run benchmarks
# Lint
# Format
Performance
- Parallel file scanning with rayon
- LRU caching for parsed files
- Incremental import resolution
- Optimized for large codebases
License
MIT