Loctree - Codebase Intelligence Skill (Codex)
Loctree provides AST-aware codebase understanding. Unlike text search (grep/rg), loct understands symbols, imports, exports, dependencies, and dead code.
When to use
Trigger when the user asks for:
- •“find where this is defined/used”
- •“what breaks if I change this file”
- •“show minimal context for this file”
- •“health/dead code/cycles/duplicates”
- •onboarding to a new repo
First-shot flow
- •
loct --for-ai(overview + priorities) - •
loct find <symbol>(definitions + semantic matches) - •
loct slice <file>(minimal context) - •
loct impact <file>(blast radius) - •
loct health(dead code, cycles, duplicates)
Explicit commands
loct find <symbol|pattern>
Search for symbol definitions across the codebase.
code
loct find "MyComponent" loct find "SymbolA|SymbolB"
loct impact <file>
Analyze what would break if you change a file.
code
loct impact src/utils/helpers.ts
loct slice <file>
Get the minimal dependency slice for a file.
code
loct slice src/components/Button.tsx
loct health
Codebase health report: dead code, cycles, duplicates, health score.
code
loct health
loct focus <dir>
Analyze a specific directory's structure.
code
loct focus src/api/
loct --for-ai
Comprehensive overview optimized for agents.
code
loct --for-ai
Best practices
- •Start with
loct --for-aiwhen entering a new repo. - •Prefer
loct findover raw rg/grep for symbol discovery. - •Use
loct impactbefore refactors. - •Use
loct slicefor quick context when editing.
Prerequisites
Install loctree CLI:
code
cargo install loctree # or brew install loctree
Initialize in your project (creates .loctree/ cache):
code
loct scan