agentleFS
8b-is8b-is/smart-tree/CLAUDE.md

smart-tree

CLAUDE.md270 starsChanged 10 months agoMITView on GitHub

Smart Tree (st) is a fast, AI-friendly directory visualization tool written in Rust. It provides 30+ MCP tools for AI assistants and is 10-24x faster than traditional tree. Run ./scripts/manage.sh test before opening a PR — it is the canonical pre-commit gate. Async tests use #[tokio::test]; for verbose diagnostics use RUST_LOG=debug cargo test -- --nocapture. After rebuilding, if st --version hangs, run hash -r to clear your shell's binary cache. Thin-client + daemon model: The st CLI binary is a…

  • In this repositoryOne other file it gives its agents.

The file

We split this CLAUDE.md into the rules it gives an agent

4 rules. About 0 are common, 1 is distinctive, and 3 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 3

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  • could be automatic: a setting could enforce it
  1. Very specific:

    Run ./scripts/manage.sh test before opening a PR — it is the canonical pre-commit gate.

    line 24
  2. Very specific:

    After rebuilding, if st --version hangs, run hash -r to clear your shell's binary cache.

    line 26
  3. Very specific:

    Exclusive modes: run locally and exit: --mcp, --version, --completions, --man, --security-scan, --terminal, --dashboard, --http-daemon, …

    line 36
  4. Distinctive:

    Default features: none (minimal build)

    line 116

≈ “Common” is an estimate: at least 1 in 5 of the 12,729 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
CLAUDE.md

CLAUDE.md

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

Project Overview

Smart Tree (st) is a fast, AI-friendly directory visualization tool written in Rust. It provides 30+ MCP tools for AI assistants and is 10-24x faster than traditional tree.

Build & Development Commands

cargo build                    # Debug build
cargo build --release          # Release build (LTO enabled, stripped)
cargo test                     # Run all tests
cargo test --release           # Run performance tests
cargo test <test_name>         # Run a single test
cargo run --bin st -- --help   # Run locally without installing
cargo fmt                      # Format code
cargo clippy -- -D warnings    # Lint (zero-warning policy)
./scripts/manage.sh test       # Pre-commit bundle: test + clippy + fmt --check
./scripts/build-and-install.sh # Build and install locally (clears shell cache)

Run ./scripts/manage.sh test before opening a PR — it is the canonical pre-commit gate. Async tests use #[tokio::test]; for verbose diagnostics use RUST_LOG=debug cargo test -- --nocapture.

After rebuilding, if st --version hangs, run hash -r to clear your shell's binary cache.

Architecture

Thin-client + daemon model: The st CLI binary is a thin client that spawns an async daemon (std) for heavy lifting and persistent state. The daemon exposes an HTTP API on port 28428 (default).

CLI → Daemon Flow

Most st commands follow this path:

  1. main.rs parses CLI args, initializes logging
  2. Exclusive modes run locally and exit: --mcp, --version, --completions, --man, --security-scan, --terminal, --dashboard, --http-daemon, --guardian-daemon, daemon control flags
  3. Everything else (the common case): auto-starts daemon if needed, builds a CliScanRequest (defined in daemon_cli.rs), sends HTTP POST to /cli/scan, prints response

Daemon Communication

  • CLI ↔ Daemon: HTTP/JSON on port 28428, authenticated via Bearer token stored at ~/.st/daemon.token
  • Daemon ↔ Daemon: st-protocol binary wire protocol (6502-inspired opcodes) over Unix sockets — this is NOT used for CLI-daemon communication
  • Auto-spawn: DaemonClient::ensure_running() spawns daemon in background with setsid (Unix) or DETACHED_PROCESS (Windows), retries with exponential backoff (5 attempts, 100ms→1600ms)

MCP Integration (two modes)

  • Stdio (st --mcp): JSON-RPC 2.0 over stdin/stdout, used by Claude Desktop and other MCP clients. Entry: McpServer::run_stdio() in src/mcp/mod.rs
  • HTTP (via daemon): REST endpoints at /mcp/tools/list, /mcp/tools/call, etc. Entry: src/web_dashboard/mcp_http.rs
  • Tool consolidation: Config flag use_consolidated_tools reduces 50+ tools to ~15 grouped tools to save context tokens

Binaries (src/bin/)

  • st — Main CLI (thin client), entry point in src/main.rs
  • std — Always-on daemon service
  • mq — Marqant markdown compression tool
  • m8 — Memory management tool
  • n8x — Nexus Agent (tree orchestrator)
  • import-claude-memories — Memory import utility

Key Modules

DomainKey FilesPurpose
Scannerscanner.rs, scanner_interest.rs, scanner_safety.rs, scanner_state.rsFilesystem traversal, interest scoring, change detection
Formatterssrc/formatters/Output format handlers (classic, AI-optimized, quantum, markdown, JSON, CSV)
MCPmcp.rs, src/mcp/Model Context Protocol integration (30+ tools, stdio/HTTP)
Daemondaemon.rs, daemon_client.rs, daemon_cli.rsHTTP API server for AI context
Proxysrc/proxy/LLM proxy with OpenAI-compatible API
Memorymem8/, memory_manager.rs, mega_session_manager.rs, m8_*.rsWave-based memory system, session persistence
TUIspicy_tui_enhanced.rs, spicy_fuzzy.rs, src/terminal/Interactive terminal UIs
Websrc/web_dashboard/Browser-based dashboard with real PTY
Securitysecurity_scan.rs, ai_guardian.rsSupply chain scanning, prompt injection protection
Smart Toolssrc/smart/Context-aware AI tools
Collaborationsrc/collab/Multi-AI collaboration features
Compressioncompression_manager.rs, dynamic_tokenizer.rs, st_tokenizer.rsSmart compression, tokenization
CLIcli.rsclap-based argument parsing (60+ options)
Configconfig.rsConfiguration management

Workspace Members

  • st-protocol/ — Binary wire protocol (6502-inspired) for daemon-to-daemon communication only
  • expert_prompt_engineer/ — Prompt engineering workspace
  • marqant/ — Git submodule for markdown compression (excluded from workspace)

Configuration & Environment

Config files

  • ~/.st/config.toml — Main config (API keys, model preferences, daemon settings, safety)
  • ~/.st/daemon.token — Auth token (auto-generated on first daemon run)
  • .aye_consciousness.m8 — Per-directory consciousness state (persistent AI context)

Key environment variables

VariablePurposeDefault
ST_TOKEN_PATHOverride auth token file location~/.st/daemon.token
ST_DEFAULT_MODEDefault output formatsmart
ST_SESSION_AWAREEnable MCP session-aware initdisabled
MCP_DEBUGShow MCP startup messagesdisabled
RUST_LOGTracing log levelinfo

Systemd services

  • systemd/smart-tree-daemon@.service — User-level daemon (one per user)
  • systemd/smart-tree-daemon.service — System-level daemon
  • systemd/smart-tree-guardian.service — System-wide protection daemon

Code Conventions

  • Error handling: anyhow::Result<T> throughout; thiserror for typed errors
  • Async: tokio runtime with full features
  • HTTP: axum framework
  • Git ops: gix crate
  • Serialization: serde for all data structures
  • Terminal UI: ratatui + crossterm
  • Commit messages: type: short description (types: feat, fix, docs, style, refactor, test, chore)

Feature Flags

  • Default features: none (minimal build)
  • candle — Local LLM support
  • voice — Voice features
  • full — All features enabled

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.