Skip to content

Commit cc5125c

Browse files
committed
⚡ Compress CLAUDE.md from 289 to 90 lines!
- TOKEN AWARE: Optimized for <25k tokens - Removed redundant sections (289→90 lines = 69% reduction!) - Applied Smart Tree's own compression philosophy - Essential commands only - no fluff - Smart Tree should practice what it preaches! 🎸 Smaller, faster, better - The Smart Tree way!
1 parent d7aabfe commit cc5125c

File tree

1 file changed

+57
-254
lines changed

1 file changed

+57
-254
lines changed

CLAUDE.md

Lines changed: 57 additions & 254 deletions
Original file line numberDiff line numberDiff line change
@@ -2,287 +2,90 @@
22

33
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
44

5-
## Project Overview
5+
⚠️ **TOKEN AWARE**: This file is optimized for <25k tokens. Use `st --mode quantum` for massive contexts!
66

7-
Smart Tree (`st`) is a blazingly fast, AI-friendly directory visualization tool written in Rust. It's designed as an intelligent alternative to the traditional `tree` command, optimized for both human readability and AI token efficiency.
7+
## Project: Smart Tree v4.8.8
8+
Lightning-fast directory visualization, 10-24x faster than `tree`. MCP server with 30+ tools.
89

9-
**Current Version**: v4.8.8
10+
## Essential Commands
1011

11-
### Key Features
12-
- **10-24x faster** than traditional tree commands
13-
- **30+ output formats** including AI-optimized and quantum compression modes
14-
- **MCP server** with 30+ tools for AI assistants
15-
- **File history tracking** for complete audit trail of AI operations
16-
- **SSE support** for real-time directory monitoring
17-
18-
## Development Commands
19-
20-
### Building
21-
```bash
22-
cargo build --release # Optimized release build (recommended)
23-
cargo build # Debug build
24-
25-
# Using manage script (preferred - includes format and lint checks)
26-
./scripts/manage.sh build
27-
```
28-
29-
### Testing
3012
```bash
31-
# Run all tests with output
32-
cargo test -- --nocapture
33-
34-
# Run specific module tests
35-
cargo test scanner
36-
cargo test formatters
37-
cargo test mcp
38-
cargo test quantum
39-
cargo test semantic
40-
41-
# Run single test by exact name
42-
cargo test test_quantum_compression -- --exact
43-
44-
# Using manage script (runs tests + clippy + format check)
45-
./scripts/manage.sh test
46-
47-
# Run comprehensive test suite
48-
cd tests && ./run_all_tests.sh
13+
# Build & Test
14+
cargo build --release # Always use release (10x faster)
15+
cargo test -- --nocapture # Test with output
16+
./scripts/manage.sh test # Full test suite + clippy + fmt
17+
18+
# Running
19+
st # Classic tree
20+
st --mode ai --compress # AI-optimized (80% smaller!)
21+
st --mode quantum src/ # Maximum compression (100x)
22+
st --mcp # MCP server mode
23+
24+
# Before commits
25+
cargo fmt && cargo clippy -- -D warnings && cargo test
4926
```
5027

51-
### Linting and Formatting
52-
```bash
53-
# Format code
54-
cargo fmt
55-
56-
# Check formatting without modifying
57-
cargo fmt -- --check
28+
## Architecture (Key Files Only)
5829

59-
# Run clippy linter
60-
cargo clippy -- -D warnings
61-
62-
# Using manage script
63-
./scripts/manage.sh format
64-
./scripts/manage.sh lint
6530
```
66-
67-
### Running
68-
```bash
69-
# Run compiled binary
70-
./target/release/st
71-
72-
# Run with cargo
73-
cargo run --release -- [args]
74-
75-
# Common usage examples
76-
st # Classic tree view
77-
st --mode ai --compress # AI-optimized compressed
78-
st --mode quantum src/ # Quantum compression
79-
st --search "TODO" # Search in files
80-
st --mcp # Run as MCP server
31+
src/
32+
├── main.rs # CLI entry (clap 4.5)
33+
├── scanner.rs # Directory traversal (handles permissions with *)
34+
├── formatters/ # 25+ output formats
35+
│ ├── quantum.rs # MEM|8 compression (8-10x)
36+
│ └── ai.rs # Token-efficient
37+
├── mcp/
38+
│ └── tools.rs # 30+ MCP tools (139KB!)
39+
└── tree_sitter_quantum.rs # AST-aware compression
8140
```
8241

83-
## Architecture Overview
84-
85-
### Core Modules
86-
- **main.rs**: CLI entry point using clap 4.5
87-
- **lib.rs**: Library entry point, exports public API
88-
- **scanner.rs**: Directory traversal engine using walkdir
89-
- Handles permission errors gracefully (marks with `*`)
90-
- Supports streaming for large directories (>100k files)
91-
92-
### Formatters (src/formatters/)
93-
25+ output formats including:
94-
- **classic.rs**: Traditional tree view (O(n) optimized)
95-
- **hex.rs**: Fixed-width hexadecimal (AI-optimized)
96-
- **quantum.rs**: MEM|8 quantum compression (8-10x reduction)
97-
- **ai.rs**, **summary_ai.rs**: Token-efficient formats
98-
- **mermaid.rs**: Diagram generation
99-
- **marqant.rs**: Quantum-compressed markdown (.mq files)
100-
101-
### MCP Server (src/mcp/)
102-
- **mod.rs**: Main server logic
103-
- **tools.rs**: 30+ MCP tools implementation
104-
- **cache.rs**: Result caching
105-
- **sse.rs**: Real-time monitoring
106-
107-
### Advanced Features (src/)
108-
- **mem8/**: Wave-based memory architecture
109-
- **file_history/**: AI operation tracking
110-
- **smart/**: Git integration, NLP, unified search
111-
- **tree_sitter_quantum.rs**: AST-aware compression
112-
- **convergence/**: Optimal format detection
113-
114-
### Binary Tools (src/bin/)
115-
- **mq.rs**: Marqant compression utility
116-
- **tree.rs**: Alternative tree binary
117-
- **m8.rs**: MEM8 memory tool
118-
119-
## Testing Strategy
120-
121-
### Unit Tests
122-
- Test files alongside source in module directories
123-
- Use `#[cfg(test)]` modules
124-
- Run with `cargo test module_name`
42+
## Testing
12543

126-
### Integration Tests
12744
```bash
128-
# MCP protocol tests
129-
./tests/test_mcp_integration.sh
130-
131-
# Core functionality
132-
./tests/test_integration.sh
133-
134-
# Feature-specific tests
135-
./tests/test_v3_features.sh
45+
cargo test scanner # Test specific module
46+
cargo test test_quantum -- --exact # Single test
47+
./tests/run_all_tests.sh # Full suite
13648
```
13749

138-
### CI/CD Requirements
139-
Tests must pass:
140-
1. `cargo fmt -- --check` (formatting)
141-
2. `cargo clippy -- -D warnings` (linting)
142-
3. `cargo test` (all unit tests)
143-
144-
## Performance Considerations
145-
146-
- Uses **rayon** for parallel operations
147-
- **Streaming mode** (`--stream`) for directories >100k files
148-
- Classic formatter optimized from O(n²) to O(n)
149-
- Default depth auto-selected per format (ls=1, classic=3, ai=5)
150-
- Binary formats (quantum) use compression for 100x reduction
50+
## MCP Setup
15151

152-
## MCP Server Development
153-
154-
### Setup for Claude Desktop
15552
```bash
156-
# Show configuration
157-
st --mcp-config
158-
159-
# Add to Claude Desktop config
16053
st --mcp-config >> ~/Library/Application\ Support/Claude/claude_desktop_config.json
54+
RUST_LOG=debug st --mcp # Debug mode
16155
```
16256

163-
### Testing MCP Tools
164-
```bash
165-
# Run MCP server
166-
st --mcp
57+
## Performance Tips
16758

168-
# Debug mode
169-
RUST_LOG=debug st --mcp
59+
- Use `--stream` for dirs >100k files
60+
- Quantum modes output binary (redirect: `st --mode quantum > out.mem8`)
61+
- Default depths: ls=1, classic=3, ai=5
17062

171-
# List available tools
172-
st --mcp-tools
63+
## Project Patterns
17364

174-
# Test specific MCP functionality
175-
cargo test mcp::tools
176-
```
65+
- Uses `anyhow` for errors
66+
- Marks inaccessible dirs with `*`
67+
- File history in `~/.mem8/.filehistory/`
68+
- Humorous "Cheet" persona in comments
69+
- Focus: "smallest and fastest"
17770

178-
## Common Workflows
179-
180-
### After Making Changes
181-
```bash
182-
./scripts/manage.sh format && ./scripts/manage.sh test
183-
```
184-
185-
### Before Committing
186-
```bash
187-
# Check formatting
188-
cargo fmt -- --check
189-
190-
# Run clippy
191-
cargo clippy -- -D warnings
192-
193-
# Run tests
194-
cargo test
195-
```
196-
197-
### Release Process
198-
```bash
199-
./scripts/manage.sh release v4.8.8 "Release notes here"
200-
```
201-
202-
## Environment Variables
203-
204-
- `ST_DEFAULT_MODE`: Default output format
205-
- `NO_COLOR=1`: Disable colored output
206-
- `NO_EMOJI=1`: Disable emoji output
207-
- `RUST_LOG`: Logging verbosity (debug, info, warn, error)
208-
- `SMART_TREE_NO_UPDATE_CHECK=1`: Disable update checks
209-
210-
## Project-Specific Patterns
211-
212-
### Error Handling
213-
- Uses `anyhow` for error propagation
214-
- Scanner gracefully handles permission errors
215-
- Marks inaccessible directories with `*`
216-
217-
### Memory Management
218-
- Streaming mode keeps memory constant for large dirs
219-
- Quantum formats use token dictionaries for compression
220-
- File history stored in `~/.mem8/.filehistory/`
221-
222-
### Code Style Notes
223-
- Includes humorous "The Cheet" persona comments
224-
- Rock/musical theme in comments
225-
- Focus on efficiency: "smallest and fastest"
226-
- Performance critical - benchmark large directories
227-
228-
## Debugging Tips
229-
230-
### Large Directory Issues
231-
```bash
232-
st --stream --depth 3 /large/dir
233-
st --mode summary-ai /large/dir
234-
```
235-
236-
### Permission Errors
237-
Check scanner.rs:72 for permission handling
238-
239-
### MCP Communication
240-
```bash
241-
RUST_LOG=debug cargo run -- --mcp
242-
```
71+
## manage.sh Commands
24372

244-
### Binary Output Issues
245-
Quantum modes output binary - use redirection:
24673
```bash
247-
st --mode quantum > output.mem8
74+
build [release|debug] # Build project
75+
test # Test + clippy + fmt
76+
mcp-run # Run as MCP server
77+
install [dir] # Install binary
78+
release <ver> [notes] # GitHub release
24879
```
24980

250-
## manage.sh Commands
251-
252-
Core operations:
253-
- `build [debug|release]` - Build project
254-
- `test` - Run tests, clippy, format check
255-
- `run [args]` - Run with arguments
256-
- `clean` - Clean artifacts
257-
- `format`/`fmt` - Format code
258-
- `lint` - Run clippy
259-
- `bench` - Run benchmarks
260-
261-
MCP operations:
262-
- `mcp-run` - Run as MCP server
263-
- `mcp-config` - Show Claude Desktop config
264-
- `mcp-tools` - List available tools
265-
266-
Installation:
267-
- `install [dir]` - Install binary
268-
- `release <version> [notes]` - Create GitHub release
269-
270-
Use `-n` or `--non-interactive` for automation.
81+
Use `-n` for non-interactive mode.
27182

272-
## Contributing New Features
83+
## Adding Features
27384

274-
### Adding a Formatter
275-
1. Create file in `src/formatters/`
276-
2. Implement `Formatter` trait (required)
277-
3. Implement `StreamingFormatter` (optional)
278-
4. Add to `FormatterType` enum in main.rs
279-
5. Add tests in module
280-
6. Update CLI help text
281-
7. Benchmark against existing formatters
85+
1. New formatter: implement `Formatter` trait in `src/formatters/`
86+
2. Add to `FormatterType` enum in main.rs
87+
3. Test with dirs >100k files
88+
4. Run `./scripts/manage.sh test`
28289

283-
### Testing Requirements
284-
- Include unit tests with `#[test]`
285-
- Test with directories >100k files
286-
- Verify streaming mode works
287-
- Check token efficiency for AI modes
288-
- Run `./scripts/manage.sh test` before committing
90+
---
91+
*Full docs: README.md | Tests: tests/*.rs | MCP: src/mcp/tools.rs*

0 commit comments

Comments
 (0)