Skip to main content
Module 1: Foundations

Context is everything

Why the context window is the root constraint — and how tools feed it.

Almost every good and bad outcome with AI coding traces back to one root constraint, and Anthropic states it plainly in its Claude Code guidance: the context window fills fast, and model performance degrades as it fills. The model can only reason about what's in its context, and cramming in irrelevant material actively makes it worse. Understand this and most best practices become obvious.

How the tools manage codebase context (the mechanism will evolve, but the shapes are durable):

  • Indexing + retrieval (RAG for code). AI-native IDEs index your repo: they chunk files (often with a structure-aware parser), embed the chunks, store them in a vector index, and retrieve the most relevant pieces per query. Cursor, for example, chunks locally, embeds server-side, and stores vectors in a per-repo namespace — notably keeping only embeddings and masked paths in the cloud, not raw source — and re-embeds only changed chunks via a change-detection tree. It keeps both a semantic index (for natural-language queries) and a keyword/regex index. (Yes — this is RAG, the subject of a sibling course, applied to your codebase.)
  • Agentic read-on-demand. Terminal agents like Claude Code often don't pre-index into a vector DB. They navigate the repo like a developer — grep, glob, open files — driven by your prompt. Fresher and more precise, but every file read consumes context, which is why these tools lean hard on sub-agents and context resets.

Either way, bigger context windows are not a substitute for good context management — quality degrades well before the nominal limit.

**What you should do**, and this is the actionable core:

  • Reference exact files and symbols (@file, function names), not vague descriptions. Point the model at the relevant slice; don't make it guess.
  • **Feed the relevant slice, not the whole repo.** For a large codebase, narrowing scope yourself is often the single biggest quality lever.
  • Reset context between unrelated tasks. A session that accumulated the context of three prior tasks will reason worse about the fourth. Clear it.
  • Delegate noisy research to sub-agents (where supported) so exploration doesn't pollute your main context.
  • Use rules files for persistent context (next module) instead of re-explaining your conventions every time.

The mental model to carry through the whole course: you are the context manager. The model's output quality is largely a function of what you put in front of it and what you keep out. Master that and everything else — better results, fewer hallucinations, cleaner reviews — follows.

Try it

On your next AI coding task, deliberately curate context: reference the exact files, exclude the irrelevant, and reset before an unrelated task. Note whether the output quality changes.

Stay in the loop

Enjoying the free lessons? Get an email when we publish new courses and updates — no spam, unsubscribe anytime.

Discussion (0)

Ask a question or share what worked for you. Comments are reviewed before they appear.

Log in to join the discussion and ask questions about this lesson.

No comments yet. Be the first to start the discussion!