BoilerPrompt

Context retrieval

Context retrieval is how an AI coding tool decides which parts of your codebase to read for a given request. Approaches range from you attaching files explicitly, to semantic search over an index, to an agent running grep and reading what it finds.

The three approaches fail differently. Explicit attachment fails when you attach the wrong thing. Semantic search fails when the relevant code does not resemble your wording. Agentic search fails slowly, by reading a lot of files and consuming context before it converges.

Most tools combine them, and the combination is usually invisible until output is wrong and you cannot tell what it actually looked at.

What this means in practice

When a result is wrong, ask what the tool read before rephrasing the request. Cursor's @ mentions and Claude Code's search traces both make this checkable, and the answer is usually that something obvious was never in scope.

Prompts for the tools this applies to

Related terms

  • Codebase indexing

    Codebase indexing is the process an AI editor uses to build a searchable representation of your repository, usually by splitting files into chunks and storing vector embeddings so it can retrieve code by meaning rather than exact text match..

  • Repo map

    A repo map is a compressed outline of a codebase — its files, key symbols, and how they relate — given to a model so it understands the shape of a project without reading every file.

  • Context engineering

    Context engineering is the practice of deciding what information an AI model sees for a given task — which files, which conventions, which prior results — and in what form.

  • Context window

    The context window is the maximum amount of text a model can consider at once, measured in tokens and covering everything in the request: system prompt, your instructions, the files supplied, prior conversation, and the response being generated..

All glossary terms