Claude Code hook

LSP Enforcement Kit

Hooks that steer Claude Code toward LSP-based navigation instead of grep to save tokens.

328 stars 31 forksHooks Source

Install

From source
git clone https://github.com/nesaminua/claude-code-lsp-enforcement-kit.git

From the README

LSP Enforcement Kit

  Physical enforcement of LSP-first navigation in Claude Code.

  Stop burning tokens on Grep. Make Claude navigate code like an IDE — 100% of the time.

  Quick Start •
  Why •
  Savings •
  Architecture •
  Hooks •
  Changelog

In Action

When Claude tries to Grep for a code symbol, the hook blocks with a copy-pasteable LSP command:

When Claude tries to Read a code file without warming up LSP, the progressive gate blocks:

No generic advice. Every block message is parametrized by the actual file Claude tried to touch.

⚡ Quick Start

Restart Claude Code. Done. The installer is idempotent — safe to re-run on upgrades.

Verify:

🎯 The Problem

Claude Code defaults to Grep + Read for code navigation. This works, but it's wasteful:

~40x fewer tokens. Same answer.

A rule in CLAUDE.md saying "use LSP" helps ~60% of the time. Hooks make it 100%.

💰 Token Savings: Grep vs LSP Per Operation

📊 Real-World Data: 1 Week, 2 Projects

Aggregate from a week of development across 2 TypeScript projects:

How the estimate works:
- Each blocked Grep saves ~1200 tokens of noisy output
- Each avoided Read saves ~1500 tokens of file content loaded into context
- 39 LSP calls cost ~4k tokens total (precise, compact results)
- Without LSP: ~120 Greps + ~180 Reads = ~315k tokens for the same navigation work
- With LSP: 39 nav calls + 53 targeted Reads = ~84k tokens

🔌 Works with any LSP MCP server

v2.1 introduces provider-aware block messages. The kit detects which LSP MCP server(s) you have installed and tailors its suggestions accordingly:

- cclsp — standalone MCP server or bundled via the typescript-lsp Claude Code plugin. Suggestions use mcpcclspfind_definition, find_references, find_workspace_symbols, etc.
- Serena — high-level…
Read the full README on GitHub

How hooks work

  • Hooks are shell commands Claude Code runs at fixed points: before or after a tool call, when you submit a prompt, when Claude stops, on notifications and at session start.
  • They are set in the hooks section of ~/.claude/settings.json (or .claude/settings.json for a project), or come bundled in a plugin.
  • A hook can block a tool call, add context, or run a formatter or test. Read the scripts before you install them: they run on your machine with your permissions.
Claude Code docs

Details

Type
Hooks
Language
JavaScript
License
MIT
Last updated
14 April 2026
Topics
claudeclaude-aiclaude-codeclaude-hookclaude-hooks

FAQ

What is LSP Enforcement Kit?

Hooks that steer Claude Code toward LSP-based navigation instead of grep to save tokens. It is a hook for Claude Code, from nesaminua/claude-code-lsp-enforcement-kit on GitHub.

How do I install LSP Enforcement Kit?

Clone nesaminua/claude-code-lsp-enforcement-kit from GitHub and follow the setup steps in its README.

Is LSP Enforcement Kit popular?

nesaminua/claude-code-lsp-enforcement-kit has 328 GitHub stars and 31 forks. It was last updated on 14 April 2026.

More hooks

Browse the most popular Claude Code mods, all hooks, or the skills and MCP server directories.