⌜ Loctree ⌟
Semantic code intelligence for Claude Code.
When Claude searches, loctree understands.
Overview
Loctree automatically augments Claude Code's search results with semantic context. No manual commands needed — just
search normally and receive symbol definitions, dependency graphs, dead code status, and impact analysis alongside your
grep results.
Status: v1.0.0 — Production release with Grep, Read, and Edit hooks.
Source of truth: This repository is the published mirror of the canonical
plugin, which is developed in-suite at
loctree-suite/loctree-plugin/.
Contribute there; releases are published here by the operator.
The Problem
Claude Code's built-in search tools find text matches. But you need code understanding:
- Where is
MyComponent defined?
- What imports this file?
- What would break if I change this?
- Is this code actually used?
The Solution
| Claude Searches | Claude Receives |
|---|
grep "UserService" | 10 text matches |
grep "UserService" + loctree | 10 text matches + symbol definitions + usages + dead code status |
Zero friction. No manual commands. Just search normally.
Features
- Search Augmentation: Symbol definitions, semantic matches, dead code status
- File Context: Dependencies and impact analysis when reading files
- Edit Warnings: Alerts when modifying high-impact files (10+ consumers)
- Smart Pattern Recognition: PascalCase, camelCase, snake_case, React hooks
- Multi-term Search:
useAuth|useSession finds both symbols
- Auto-caching: First search creates snapshot (~15s), subsequent searches use cache (~0.3s)
- Live Logging: All hook activity logged to
~/.claude/logs/loct-hook.log
Tech Stack
| Component | Technology | Purpose |
|---|
| Core CLI | loctree | Code map engine |
| Hook System | Bash + jq | PostToolUse integration |
| Languages | TypeScript, Rust, Python, Go, Vue, Svelte | Supported codebases |
| Caching | .loctree/ snapshot | Fast subsequent queries |
Installation
Quick Install (recommended)
Install via curl command (it will install both loctree cli and hook scripts)
curl -fsSL https://raw.githubusercontent.com/Loctree/loctree-plugin/main/install.sh | bash
Manual Install
Click to expand manual installation steps
Prerequisites
- loctree CLI v0.8.0+
- jq (JSON processor)
- Claude Code v1.0.0+
1. Install loctree CLI
curl -fsSL https://loct.io/install.sh | bash
2. Install hook scripts
# Clone the plugin
git clone https://github.com/VetCoders/loctree-plugin.git
cd loctree-plugin
# Copy hooks to Claude config
mkdir -p ~/.claude/hooks ~/.claude/logs
cp hooks/*.sh ~/.claude/hooks/
chmod +x ~/.claude/hooks/loct-*.sh
3. Configure Claude Code
Add to ~/.claude/settings.json:
{
"hooks": {
"PostToolUse": [
{
"matcher": "Grep",
"hooks": [
{
"type": "command",
"command": "bash ~/.claude/hooks/loct-grep-augment.sh"
}
]
},
{
"matcher": "Bash",
"hooks": [
{
"type": "command",
"command": "bash ~/.claude/hooks/loct-grep-augment.sh --bash-filter"
}
]
},
{
"matcher": "Read",
"hooks": [
{
"type": "command",
"command": "bash ~/.claude/hooks/loct-read-context.sh"
}
]
},
{
"matcher": "Edit",
"hooks": [
{
"type": "command",
"command": "bash ~/.claude/hooks/loct-edit-warning.sh"
}
]
}
]
}
}
4. Verify installation
bash scripts/verify-install.sh
After Installation
Restart Claude Code (run /clear or restart the app).
Quick Start
# Open Claude Code in your project
cd your-project
# Search for a symbol - loctree augments automatically
# (First search takes ~15s to scan, subsequent searches ~0.3s)
Watch the log to see what's happening:
tail -f ~/.claude/logs/loct-hook.log
How It Works