Install
|
Alternative package-manager paths:
Manual combined-bundle download with checksum and GPG verification:
version=0.13.0
base="https://github.com/Loctree/loctree-suite/releases/download/v"
# For private releases, export GITHUB_TOKEN first. For public releases, remove
# the Authorization header.
Maintainer macOS signing and notarization profile:
Source builds are contributor fallback only; see docs/dev/01_installation.md.
Quick Start
Artifacts are stored in your OS cache dir by default (override via LOCT_CACHE_DIR).
What It Does
loctree captures your project's real dependency graph in a single scan, then answers structural questions instantly from the snapshot. Designed for AI agents that need focused context without reading every file.
Core capabilities:
- Holographic Slice - extract file + dependencies + consumers in one call
- Cross-Match Search - find where multiple terms co-occur (not flat grep)
- Dead Export Detection - find unused exports across JS/TS, Python, Rust, Go, Dart, Shell, Make, Zig
- Circular Import Detection - Tarjan's SCC algorithm catches runtime bombs
- Handler Tracing - follow Tauri commands through the entire FE/BE pipeline
- Impact Analysis - see what breaks before you delete or refactor
- jq Queries - query snapshot data with jq syntax (
loct '.files | length')
Why loctree
| grep/rg | LSP | loctree | |
|---|---|---|---|
| Knows imports vs definitions | No | Per-file | Whole graph |
| Dead export detection | No | No | Yes (multi-lang) |
| Cross-file impact analysis | No | Limited | Full transitive |
| AI agent integration | No | No | MCP server + --for-ai |
| Speed on 1M LOC repo | Fast (text) | Slow (indexing) | ~3s (structural) |
| Setup | None | Per-editor | One binary |
MCP Server
loctree-mcp is an MCP server for AI agent integration:
10 tools: context, repo-view, focus, slice, find, impact, tree, follow, suppressions, prism. Each tool reads the same snapshot and accepts a project parameter — auto-scans on first use, caches snapshots in RAM. Project-agnostic: analyze any repo without configuration.
Signed release tarballs for direct download (loct, loctree, loctree-mcp, loctree-lsp, aicx, aicx-mcp) are mirrored through the loct.io releases CDN.
LSP Server
loctree-lsp is a Language Server Protocol server. Editors get live structural diagnostics — dead exports, cycles, twins, codelens importer counts — plus 15 snapshot-backed loctree/* custom requests for agent/editor context: contextAtlas, paginated contextPack, slice, impact, find, follow, body, symbolContext, diff, semantic, health, workspaces, refresh, read-only aicx, and the one live-AST request astQuery (JS/TS/TSX). Snapshot truth is the authority; live AST is an editor-time freshness layer. See docs/integrations/lsp-server.md.
Wire-up examples for VS Code, Neovim, JetBrains, and any generic LSP client live in docs/ide/ and editors/jetbrains. loctree-lsp ships as part of the single @loctree/loct npm install.
Language Support
Loctree uses regex parsers for shell, makefile, zig, dart, go and OXC for JS/TS. Tree-sitter provides Layer 1 extraction for C-family languages (Swift, Objective-C, C, C++) with heuristic provenance; deep mode is available as an opt-in.
The full language-support details live in docs/semantic-spec.md.
Auto-detects stack from Cargo.toml, tsconfig.json, pyproject.toml, pubspec.yaml, src-tauri/.
Holographic Slice
Extract 3-layer context for any file:
Slice for: src/App.tsx
Core (1 files, 150 LOC):
src/App.tsx (150 LOC, ts)
Deps (3 files, 420 LOC):
[d1] src/hooks/useAuth.ts (80 LOC)
[d2] src/contexts/AuthContext.tsx (200 LOC)
[d2] src/utils/api.ts (140 LOC)
Consumers (2 files, 180 LOC):
src/main.tsx (30 LOC)
src/routes/index.tsx (150 LOC)
Total: 6 files, 750 LOC
Cross-Match Search
Multi-term queries show where terms meet, not flat OR:
=== Cross-Match Files (9) ===
src/snapshot.rs: Snapshot(6), FileAnalysis(4)
src/slicer.rs: Snapshot(2), FileAnalysis(3)
...
=== Symbol Matches (222 in cross-match files) ===
src/snapshot.rs:20 - Snapshot [struct]
src/types.rs:15 - FileAnalysis [struct]
...
=== Parameter Matches (4 cross-matched) ===
src/slicer.rs:45 - snapshot: &Snapshot in build_slice(analyses: &[FileAnalysis])
jq Queries
Query snapshot data directly:
CI Integration
| &&
Crates
End users install prebuilt binaries (see Install). The crates table is for contributors and packagers.
| Crate | Description |
|---|---|
loctree |
Core analyzer + CLI binaries (loct, loctree) |
loctree-mcp (in-tree, publish = false) |
MCP server (loctree-mcp binary) for AI agents; ship via bundle/npm/Homebrew, not crates.io |
loctree-lsp (in-tree, publish = false) |
LSP server (loctree-lsp binary) for editors; ship via bundle/npm/editor packages, not crates.io |
report-leptos |
HTML report renderer (Leptos SSR) |
Development
For contributors building from source. End users should use the Install paths above instead.
Full contributor setup, workspace structure, and dependencies: docs/dev/01_installation.md.
Badge
[](https://crates.io/crates/loctree)
License
Business Source License 1.1 (BUSL-1.1). See LICENSE for the parameters (Licensor, Additional Use Grant, Change Date, Change License). Loctree converts to Apache License 2.0 on 2030-04-13.
For commercial / hosted-service licensing outside the Additional Use Grant,
contact loct@loct.io.
Marbles OS by VetCoders.