WhoBuilt

We Cut 94% of AI Coding Tokens With a Local Code Index

Jun 28, 2026· 11 min· 21K views·Watch on YouTube

Speaker

Rajkumar Sakthivel of Tesco explains how he and his friend Foss built a local code index to reduce context sent to AI coding tools.

Why AI coding costs rose

Rajkumar says he and Foss saw their AI bill jump despite using the same project and tools. They found that much of the cost came from sending irrelevant code as context: one query included 45,000 tokens, though about 5,000 were useful.

Reduce input, not just output

Shorter prompts and model setting changes did not reduce the input already sent. Output compression cut generated tokens by 75%, but output was only about 10% of total cost. Rajkumar estimates that cutting input by 94% could save about 61% overall.

How the local index works

The index breaks code into functions, classes, and methods, then combines meaning-based and keyword search. It can trim results to names and descriptions, map calls between functions, and filter out low-scoring matches. Rajkumar says the search runs locally without sending code to the cloud.

Results and limits

Rajkumar describes a relevance score combining meaning, keyword, and code-recency scores; it runs in 0.4 milliseconds without another AI call. On a 53-file FastAPI project, the index reduced context from 83,000 to 4,900 tokens per question, with the right code found 90% of the time. He notes that 94% compares against reading full files, real savings may be lower, and recall fell on large, mixed codebases.

Shared context across tools

The team connected multiple AI coding tools to one shared index so they could use the same search results. They also added memory so project knowledge could carry across sessions and tools. On one project, 247 queries saved 12.4 million tokens, nearly $186; 84% of the savings came from search.

Takeaways

  • Measure how much context your coding tools send before changing models or output settings.
  • Prioritize reducing input, since it can account for most AI coding costs.
  • Combining semantic and exact-keyword search can cover gaps in either method alone.
  • Check retrieval quality on your own codebase; mixed, multi-purpose files may reduce recall.
  • A shared local index can preserve project context across coding tools and sessions.

Mentioned in this talk

Search inside this talk

What was claimed 10

  • works at
    Senior Backend Engineer
    “Rajkumar Sakthivel, Tesco”
    YouTube
    Verified2 sources· Talk, Web· archived
  • feature
    CCE: Combines meaning-based and exact-word searches
    “we run two searches at the same time”
    YouTube
    Unverified1 source· Talk
  • feature
    CCE: Runs locally; searches indexed code and returns relevant snippets rather than whole files
    “It sits between your codebase and the AI. Instead of sending whole files, the AI searches the index”
    YouTube
    Unverified1 source· Talk
  • metric
    CCE: 523 tokens per question with extra compression
    “With extra compression on top, it’s 523 tokens per question.”
    YouTube
    Unverified1 source· Talk
  • metric
    CCE: 90% accuracy in finding the right code
    “the accuracy still finds the right code 90% of the time”
    YouTube
    Unverified1 source· Talk
  • metric
    CCE: 94% fewer tokens per question than the full-file baseline: 4.9K versus 83K
    “Without using our tool, it took 83K tokens per question. With our tool, 4.9K tokens per question. That’s 94% less.”
    YouTube
    Unverified1 source· Talk
  • feature
    CCE: Keeps project knowledge available across tools and sessions
    “When one tool learns something about your project, that knowledge stays”
    YouTube
    Unverified1 source· Talk
  • metric
    CCE: 84% of savings came from the search layer; the remainder came from compression
    “Most of the savings, 84%, came from the search layer. The rest came from compression.”
    YouTube
    Unverified1 source· Talk
Show all 10 facts

Related talks