How They Use AI  |  Newest

<< Home  |  Tech

Saves ~80% tokens per code search

AreaTech
AI usedClaude Code
Sourcer/AI_Agents
Posted2026-04-14

The move

Configure Claude Code to use Language Server Protocol (LSP) instead of Grep for code navigation.

Steps

  1. Ensure Claude Code is updated to the latest version.
  2. Identify the configuration file for your Claude Code environment.
  3. Add hooks to prioritize LSP over Grep for navigation tasks.
  4. Verify the agent is using LSP by checking the token usage logs.

Prompt for your AI

Configure your search behavior to prioritize Language Server Protocol (LSP) for all 'Go to Definition' and 'Find References' tasks. Avoid using Grep for code navigation to minimize token consumption.

What happened

Claude Code typically uses Grep for file searching, which often reads unnecessary files and consumes excessive tokens. By forcing the agent to use LSP, it retrieves precise code references instead of broad text matches. This change reduces context usage from approximately 6,500 tokens to 600 tokens per search.

Watch out

Older versions of Claude Code may not support these hooks correctly. Incorrect configuration could lead to failed code lookups.

Give it to your agent

Read https://howtheyuse.ai/p/saves-80-tokens-per-code-search.md and help me do this.

Sources



Last updated November 26, 2026.