stump

Token-efficient directory tree

Zig File System GitHub

High-performance directory tree visualization optimized for LLM consumption. 50%+ token reduction over standard tree tools through compact JSON format.

Features

  • 50%+ token reduction vs tree command
  • Configurable depth and smart filtering
  • Include/exclude by extension or glob pattern
  • Symlink detection with optional cycle-safe following
  • Large directory safeguards
  • Dual output: stdout with token limits or file mode
  • Optional performance metrics

Install

zig build -Doptimize=ReleaseFast

The Problem: tree output is verbose and token-heavy

$ tree src/
src/
├── main.zig
├── lib
│   ├── util.zig
│   ├── config.zig
│   └── types.zig
├── test
│   ├── unit
│   │   ├── test_util.zig
│   │   └── test_config.zig
│   └── integration
│       └── test_e2e.zig
└── build.zig

4 directories, 7 files

# ASCII art connectors, repeated indentation,
# summary line  - all waste tokens for an LLM.

Solution

$ stump src/ -d 3

Output

{"root":"src","depth":3,"stats":{"dirs":4,"files":7,"filtered":0,"symlinks":0},"tree":[{"path":"main.zig","type":"f","size":1024},{"path":"lib","type":"d"},{"path":"lib/util.zig","type":"f","size":512},{"path":"lib/config.zig","type":"f","size":384},{"path":"lib/types.zig","type":"f","size":256},{"path":"test","type":"d"},{"path":"test/unit","type":"d"},{"path":"test/unit/test_util.zig","type":"f","size":768},{"path":"test/unit/test_config.zig","type":"f","size":640},{"path":"test/integration","type":"d"},{"path":"test/integration/test_e2e.zig","type":"f","size":1280},{"path":"build.zig","type":"f","size":4096}]}

Comparison

MetricValue
Token reduction (small projects, ~100 files)60%
Token reduction (medium projects, ~1K files)55%
Token reduction (large projects, 10K+ files)50%+
Traversal speed (10K files)< 1 second