Protocol

Retrieve code before sending code

The cheapest token is the irrelevant file you never send.

About 1 min read

Before you use it

Use when
  • A coding assistant repeatedly receives large repository dumps or oversized file context to answer narrow questions.

Keep this limit in mind

  • Repository structure matters. Retrieval that works on one codebase can miss generated code, dynamic links or cross-cutting configuration elsewhere.

An idea to explore.

Try this idea.

Inspect the example, try the idea in your situation, then check your next move.

Keep reading

Why it matters

Build a local or privacy-appropriate code retrieval layer that combines complementary search signals, rejects weak matches and supplies only likely relevant fragments. Measure recall on known tasks before relying on the savings; a tiny context that omits the dependency is not efficient.

Steps

  1. Create a benchmark of code questions with known relevant files or symbols.
  2. Combine lexical and semantic search when they cover different misses.
  3. Reject low-relevance candidates instead of filling the context quota.
  4. Measure retrieval recall, task success and total context cost together.

An example

For a failing API endpoint, retrieve the route, service and referenced model instead of uploading the whole repository tree to every coding turn.

Check your result

Known-task benchmarks show that the reduced context still retrieves the dependencies needed for correct answers.

Save and practise this idea

My learning

Read. Recall. Repeat.

Save this idea and return to it on any device.

Use email
Keep exploring

Connected ideas

You are readingRetrieve code before sending code

Evidence and sources
Supports

A local code-retrieval layer can select relevant repository fragments before model inference instead of repeatedly sending broad code context.

Retrieval can miss dependencies or return plausible irrelevant code. The reported headline token reduction is case-specific and is not a universal expectation.

We Cut 94% of Our AI Coding Tokens With a Local Code Index. Here's the Architecture. · Architecture sections on local retrieval, complementary searches, relevance rejection and benchmark comparison

All sources (1)
Edition and review

Version 0.1.0

No review details are supplied for this edition.

Read this idea as JSON · Release details