Progressive file disclosure for AI agents and developers
pip install reveal-cli
reveal src/ # directory β tree
reveal app.py # file β structure
reveal app.py load_config # element β codeZero config. 18 languages built-in. 50+ via tree-sitter.
This README is structured for both humans and AI agents. Progressive disclosure starts at the top with quick examples.
Using reveal CLI? Get usage patterns and optimization techniques:
reveal --agent-help # Quick strategic guide (414 lines)
reveal --agent-help-full # Comprehensive patterns (1044 lines)Token efficiency: Structure view = 50 tokens vs 7,500 for reading full file. Validated 7-150x reduction in production.
Auto-detects what you need:
# Directory β tree view
$ reveal src/
π src/
βββ app.py (247 lines, Python)
βββ database.py (189 lines, Python)
βββ models/
βββ user.py (156 lines, Python)
βββ post.py (203 lines, Python)
# File β structure (imports, functions, classes)
$ reveal app.py
π app.py
Imports (3):
app.py:1 import os, sys
app.py:2 from typing import Dict
Functions (5):
app.py:15 load_config(path: str) -> Dict
app.py:28 setup_logging(level: str) -> None
Classes (2):
app.py:95 Database
app.py:145 RequestHandler
# Element β extract function/class
$ reveal app.py load_config
app.py:15-27 | load_config
15 def load_config(path: str) -> Dict:
16 """Load configuration from JSON file."""
17 if not os.path.exists(path):
18 raise FileNotFoundError(f"Config not found: {path}")
19 with open(path) as f:
20 return json.load(f)All output is filename:line format - works with vim, git, grep.
# Get comprehensive agent guide
reveal --agent-help # Decision trees, workflows, anti-patterns
# Typical exploration pattern
reveal src/ # Orient: what exists?
reveal src/app.py # Navigate: see structure
reveal src/app.py Database # Focus: get implementationToken efficiency: Structure view = 50 tokens vs 7,500 for full file read.
reveal app.py --check # Find issues (bugs, security, complexity)
reveal app.py --check --select B,S # Only bugs + security
reveal --rules # List all rules
reveal --explain B001 # Explain specific ruleBuilt-in rules: Bare except (B001), :latest tags (S701), complexity (C901), line length (E501), HTTP URLs (U501)
Extensible: Drop custom rules in ~/.reveal/rules/ - auto-discovered
reveal app.py --outline
UserManager (app.py:1)
ββ create_user(self, username) [3 lines, depth:0] (line 4)
ββ delete_user(self, user_id) [3 lines, depth:0] (line 8)
ββ UserValidator (nested class, line 12)
ββ validate_email(self, email) [2 lines, depth:0] (line 15)# Changed files in git
git diff --name-only | reveal --stdin --outline
# Find complex functions
find src/ -name "*.py" | reveal --stdin --format=json | jq '.functions[] | select(.line_count > 100)'
# CI/CD quality gate
git diff --name-only origin/main | grep "\.py$" | reveal --stdin --check --format=grepExplore ANY resource - files, environment, code queries:
# Discover what's available
reveal help:// # List all help topics
reveal help://ast # Learn about ast:// queries
# Environment variables
reveal env:// # All environment variables
reveal env://DATABASE_URL # Specific variable
# Query code as a database (v0.15.0+)
reveal 'ast://./src?complexity>10' # Find complex functions
reveal 'ast://app.py?lines>50' # Find long functions
reveal 'ast://.?lines>30&complexity<5' # Long but simple
reveal 'ast://src?type=function' --format=json # JSON outputSelf-documenting: Every adapter exposes help via reveal help://<scheme>
reveal app.py # text (default)
reveal app.py --format=json # structured data
reveal app.py --format=grep # grep-compatible
reveal app.py --meta # metadata onlyBuilt-in (18): Python, Rust, Go, JavaScript, TypeScript, GDScript, Bash, Jupyter, Markdown, JSON, YAML, TOML, Nginx, Dockerfile, + more
Via tree-sitter (50+): C, C++, C#, Java, PHP, Swift, Kotlin, Ruby, etc.
Shebang detection: Extensionless scripts auto-detected (#!/usr/bin/env python3)
| Flag | Purpose |
|---|---|
--outline |
Hierarchical structure view |
--check |
Code quality analysis |
--stdin |
Read file paths from stdin |
--depth N |
Directory tree depth |
--max-entries N |
Limit directory entries (default: 200, 0=unlimited) |
--fast |
Fast mode: skip line counting (~6x faster) |
--agent-help |
AI agent usage guide |
--list-supported |
Show all file types |
from reveal import TreeSitterAnalyzer, register
@register('.go', name='Go', icon='π·')
class GoAnalyzer(TreeSitterAnalyzer):
language = 'go'Done. Full Go support with structure + extraction.
from reveal import FileAnalyzer, register
@register('.md', name='Markdown', icon='π')
class MarkdownAnalyzer(FileAnalyzer):
def get_structure(self):
headings = []
for i, line in enumerate(self.lines, 1):
if line.startswith('#'):
headings.append({'line': i, 'name': line.strip('# ')})
return {'headings': headings}Custom rules: Drop in ~/.reveal/rules/ - zero config.
reveal/
βββ base.py # Core (~380 lines)
βββ main.py # CLI (~920 lines)
βββ treesitter.py # 50+ languages (~345 lines)
βββ analyzers/ # 18 file types (10-300 lines each)
βββ adapters/ # URI support (help://, env://, ast://)
Total: ~3,400 lines. Most analyzers < 25 lines.
Deep dive: docs/ARCHITECTURE.md
Add new languages in 10-50 lines. See analyzers/ for examples.
Most wanted: TypeScript, Java, Swift, better extraction logic, bug reports.
reveal is production infrastructure from SIL - building the semantic substrate for intelligent systems.
Role: Layer 5 (Human Interfaces) - progressive disclosure of structure Principles: Clarity, Simplicity, Composability, Correctness, Verifiability
SIL Manifesto β’ Architecture β’ Projects