Skip to main content

Module 2 — Context is the product

Tier 1 — for everyone (PMs, architects, engineers).
Prerequisites: Module 1 (Prompting as a design problem).


About a year ago, when I started exploring vibe-coding on larger projects, I tried porting a 100K-line C# trading bot I hadn't written to Node.js, modernizing the stack along the way. I didn't know the project at all, so I wanted Claude to extract the architecture, reason about a more modern approach, and then port it to JS with high fidelity. This was before planning mode, before multi-step plans, before Claude Code was generally available.

I was already treating sessions as disposable — new task, new session, or things would start going sideways. But I was splitting by section of the codebase, and working through each section was a 50+ message back-and-forth. By the end of every section I was running into the same wall: reminding the model of decisions we'd made earlier, re-correcting the same mistakes, flagging self-contradictions. Every session ended with a pile of "I apologize for the oversight" messages stacked up.

My workaround at the time was to generate markdown files with intermediate status, decisions, and open threads, then use those to resume in a fresh session. It mostly worked. Projects didn't exist yet. Neither did any real shared memory. The markdown was load-bearing by necessity.

Looking back, I'd been thinking about this wrong. I was treating the session as where the work happened, and when the session got saturated, I blamed the model for not keeping up. The actual shift was realizing the session wasn't where the state belonged. It was one contribution to a larger thing I needed to manage deliberately, and my job was managing that larger thing, not writing better prompts inside an overfilled window.

What this module covers​

By the end of this module, you'll be able to:

  1. Explain what the context window is and why it's the thing you're actually managing
  2. Identify the four layers of context and where each one comes from
  3. Recognize how long conversations degrade before they overflow
  4. Apply the "Claude forgot vs. Claude never had it" diagnostic and choose the right fix
  5. Use the failure-mode table to diagnose and fix context problems in one move
  6. Choose the right tool for managing context across conversations: projects, artifacts, attachments
  7. Recognize over-contextualizing and trim it
  8. Know when to close a conversation and start fresh

The lab is a 60-minute exercise on diagnosing a deliberately messy 50-turn conversation, fixing it three ways, and measuring which fix actually worked.

This module assumes Module 1. It extends the "prompts are specs" frame to "context is the product." If you skipped M1, the four-component diagnostic from there shows up here too.

The reframe​

Module 1 reframed prompt engineering from incantation to specification. That works at the scale of a single turn. Beyond that, the frame has to expand.

The thing you're managing across a real piece of work is not a prompt. It's everything the model can see when it generates the next response. That's the context window. Your prompt is one contribution to it, often a small one. The rest comes from the system prompt, the conversation history, any attached files, any project knowledge, any artifacts in scope.

When an output disappoints after turn 20, the prompt is rarely the problem. The context is.

A useful mental model: context is a workbench, not a memory. The model doesn't "know" anything about your project the way a teammate does. Between turns, nothing persists except what's literally in the context window for the next call. Whatever's on the workbench gets used. Whatever's off gets ignored, even if you put it there yourself an hour ago and still remember it.

That's the uncomfortable part. You, the human, are a stateful system. You remember what you said at turn 3. The model is stateless between calls. It reads the whole workbench fresh each time. If turn 3 is still on the bench, great. If it got shoved off, the model reads the next prompt without it and responds accordingly.

Most of the "Claude is being weird" moments are variations on this. The workbench doesn't match what you think is on it.

How context works​

The four layers of context​

Any message to the model gets assembled from four layers. Useful to keep them distinct, because they come from different places and have different lifecycles.

  1. System prompt. Instructions about who the model is, what it's for, what it should avoid. In the Claude app, this is set by Anthropic and mostly invisible. In the API, it's something you write. In Claude Code, it's Anthropic's system prompt plus your CLAUDE.md. This layer doesn't change within a conversation.

  2. Persistent context. Things in scope for the whole conversation by default: project files, CLAUDE.md, any memory features enabled. Set once, referenced implicitly.

  3. Conversation history. Every prior turn in the current conversation. Your prompts and the model's responses, in order, all the way back. This is the layer that grows.

  4. Just-in-time context. Attachments, pasted documents, images, anything added specifically for the current turn. Technically part of the user message, but worth thinking of separately because it's the layer you control directly, right now, every turn.

When a response goes wrong, it's worth asking which layer was responsible. The failure modes differ by layer, and so do the fixes.

How long conversations degrade​

"Context window is full" is the obvious failure mode. It's also not the most common one.

Well before you hit the context limit, longer conversations degrade in ways that are subtler:

  • Attention dilutes. The model's ability to attend to specific details doesn't stay constant as the conversation grows. Facts stated at turn 3 get less weight at turn 40 than facts stated at turn 38, even if both are technically in context.
  • Contradictions accumulate. Correct the model at turn 12 ("we're on Vue, not React"), and ten turns later it'll often default back to the first version. The correction is in context, but it's one line competing with surrounding discussion that kept referencing the wrong thing.
  • Recency bias dominates. The last few turns exert disproportionate influence on the next response. A detailed setup at the start gets outweighed by a tangential exchange at the end.
  • Signal-to-noise drops. Exploratory dead ends, false starts, retries, all of it stays in context. By turn 30, a conversation that started focused might be mostly noise with the signal buried.

None of this is a hard failure. The model doesn't throw an error. It just silently becomes less useful. That's what makes it hard to diagnose in the moment. The response looks plausible. You only notice something's off if you're paying close attention to whether it reflects what you established earlier.

A rough rule, not a law: past roughly 20-30 turns on a single topic, start watching for these patterns. Past 50, assume at least one of them is happening and plan accordingly.

Claude forgot vs. Claude never had it​

The single most useful diagnostic move in this module. When the model produces an output that misses something you thought was established, there are two very different things that could be happening, and they have opposite fixes.

Claude forgot. The information was in the conversation. Somewhere up there, you said it. The model isn't pulling it forward into the current response. This is a context-management problem: the information is present but not weighted enough to surface. The fix is to make it more present. Restate, summarize, or pull the key points into the current turn.

Claude never had it. The information was never actually in this conversation. You're thinking of a different chat, or a doc you have open but didn't paste, or something you know from your own work. The model has no access to it. This is an underspecification problem, same shape as M1's context test. The fix is to add the information, not restate it (there's nothing to restate).

What happens when the model notices the gap matters here. The default is to answer, not to stop and ask. When the context doesn't contain what it needs, the model falls back to training data, plausible-sounding defaults, or whatever it can piece together from adjacent context. You get a confident answer that's partly or entirely invented, delivered in the same tone as a correct one.

This happens at turn 1 as often as at turn 30. A question asked without enough context (your stack, your constraints, your conventions) gets answered against the model's best guess at what a typical version of your situation looks like. Sometimes that's right. Often it's close enough that you don't notice until later. Session boundaries make it worse. You summarized a prior conversation into a markdown file, started fresh with the summary, and the summary silently dropped a decision. The model has partial context, no way to know what's missing, and will cheerfully invent plausible fill for the gap. You won't notice unless you happen to check the answer against the original source.

This is where "never had it" gets harder to detect than "forgot." When the model forgets, it often contradicts something you can see earlier in the chat. The contradiction is the signal. When the model never had it, there's no contradiction. Just plausible fiction, presented with the same confidence as correct answers.

One countermeasure worth building into your default prompting: explicitly tell the model to ask clarifying questions before proceeding, rather than filling gaps itself. Something like "if any part of the scope is ambiguous or missing context you'd need, ask before you start." It won't catch everything. It catches the cases where the gap is obvious enough that the model would notice if it were looking for gaps instead of trying to be helpful.

The baseline diagnosis is still cheap: a 30-second scroll-back.

  • If you find the information in the current conversation: Claude forgot. Restate it.
  • If you can't find it: Claude never had it. Add it and move on.

The trap: you're sure you said it. So sure that you skip the scroll-back. Roughly half the time you'll be right. The other half, you're thinking of a parallel conversation, a doc, or a message from yesterday. The scroll-back is cheap. Skipping it wastes an hour.

Failure modes and the move that fixes each​

SymptomDiagnosisFix
Contradicts something established earlier in the conversationClaude forgot (attention dilution)Summarize the key decisions in the current turn, then ask the question
Ignores a specific constraint you establishedForgot or never had it. Scroll back to checkIf in chat: restate. If not: add it
Feels "generic," less informed than earlier responsesSignal-to-noise droppedStart a new conversation with a distilled summary
Loops back to an approach you already rejectedRecency bias, correction buriedLead the next prompt with the rejected approaches, explicitly out of scope
Defaults to the wrong language, framework, or conventionCorrection stated once, not reinforcedPut the correct version in a project file or at the top of the conversation
Can't reference a file you "shared"Never had it. You pasted in a different chatAttach or paste again in this conversation
Confidently answers, but the answer is subtly wrong or inventedNever had the grounding. Context didn't cover it, model filled the gap from training dataAsk the model to flag gaps before answering; check against the original source
Quality drops sharply after a long document pasteAttachment displaced earlier contextSummarize the attachment's relevance explicitly, or move it to a project file
Model apologizes, retries, produces the same wrong thingContext problem, not prompt problemStop rewording the prompt. Fix the context or start fresh

The meta-move is the same as M1's: before blaming the prompt, check the context. The failure-mode table front-loads the checks you'd otherwise spend minutes rediscovering live.

Managing context​

Tools for managing context across conversations​

A single conversation is one unit of context. Real work spans many. The tools below manage context at that larger scale, where conversations come and go but the underlying project persists.

Projects (Claude app). A shared context bundle (project instructions plus project files) automatically in scope for every conversation inside the project. Useful when you have stable knowledge relevant across many conversations: a repo structure, a style guide, standing decisions about a codebase. Put things here when the answer to "should this be in every chat on this topic" is yes.

Artifacts (Claude app). A workspace for canonical versions of outputs the model is iterating on. The artifact is the stable thing; the conversation around it is scaffolding. If the model produces a document you'll keep refining, the artifact is where it lives. The advantage over copy-pasting is that subsequent turns can reference "the artifact" without you re-pasting its contents.

Attachments. Documents, images, code files added to a specific message. Scoped to that message and onward in the same conversation. Good for one-off context that isn't worth promoting to project level.

CLAUDE.md (Claude Code). Covered in depth in M4. Functionally parallel to project instructions: persistent context loaded into every Claude Code session in a given directory. Teased here because the mental model carries over.

Memory features (Claude app). The Claude app remembers some facts across chat sessions. Useful in limited ways; not a substitute for explicit project files. If something is load-bearing for a project, put it in project files, not chat memory. Memory in this shape is for preferences, not for specs.

The progression when something starts to matter: paste it into the current turn, then attach it as a file, then promote it to project files, then codify it in CLAUDE.md if it's code-level. Each step makes it more durably available, at the cost of a little more setup.

Over-contextualizing​

There's an opposite failure mode to the one we've been discussing. If the context is bloated with things the current turn doesn't need, the model's attention is spent parsing noise. Scale M1's over-specifying pattern up from prompt to context, and this is what you get.

Symptoms:

  • Project files grow past the point where you can skim them in one sitting
  • Attachments pasted into every conversation "just in case"
  • Conversations carrying 20 turns of setup before the first real question
  • Quality drops noticeably after adding a large document, even though the document is relevant
  • You find yourself scrolling back through 50 turns to find the one useful exchange

The same test from M1 applies, adapted: remove a piece of context and see if it matters. Pull one file out of the project. Delete a redundant section. Start a fresh conversation without the accumulated history. If the quality is the same or better without it, it was noise.

Everything in context costs attention, even when it's free in tokens. "It fit in the window" is not the same as "it helped." Attention is a budget too, and the budget is finite even when the token count isn't.

The same pattern scales up. In multi-step automated workflows, over-contextualizing a single step is an easy trap — routing the full project context to a stage that only needs a fraction of it. The check is the same: remove a piece of context, see if that step's output degrades. But that's a later-module problem. The chat equivalent applies directly: pull files out of project context once they're no longer pulling their weight, even if they felt essential the day you added them.

When to close the conversation and start fresh​

Starting a new conversation feels like losing context. In long-running work, it's usually a net gain.

Heuristics:

  • New topic, long conversation. Pivoting to something substantially different and the conversation is past 20 turns? Start fresh. The old context is more likely to mislead than to help.
  • Repeated correction loops. Corrected the same misunderstanding more than twice? Context is working against you. Start fresh with the correction baked into the first message.
  • You'd need to scroll back to summarize it. If you couldn't tell a new person what this conversation has established without re-reading it, the context isn't serving you. Distill the established facts, put them in a fresh conversation.
  • You want to preserve progress. Starting fresh doesn't mean losing work. Summarize what matters, paste into a new chat or add to project files.

The transition cost is real but small. A distilled summary of a 40-turn conversation is typically three paragraphs. Three paragraphs of fresh signal usually beats 40 turns of accumulated noise.

One caveat the opening showed: the summary is only as good as what you remember to put in it. The "never had it" failure mode described above often starts as a fresh-conversation move that dropped a decision. If you're going to distill, distill against the original, not against what you remember of the original. Scroll back to the key turns. Quote them into the summary verbatim where it matters. The extra minute saves the hour you'd spend hunting a decision that silently fell out two sessions back.

Bridge to Module 3​

So far, everything here has assumed the chat interface: conversations, projects, artifacts, attachments. That's where most people start and where many stay. It's also not where Claude does its most interesting work.

When the work shifts from "help me think through this" to "go do this thing in my codebase," the chat interface starts to strain. File paths get pasted in and out. Diffs get copied, edited, copied back. The context window fills with ceremony: here's the file, here's what I changed, here's what broke. Module 3 is about the transition from chat to Claude Code, and what happens when the terminal becomes the interface and the filesystem becomes part of the context.

The context principles from this module carry over directly. What changes is the mechanics.

TL;DR​

info
  1. Context is the product, not the prompt. What you're managing across real work is the whole context window, not just the latest message.
  2. Four layers of context: system prompt, persistent, conversation history, just-in-time. Different failure modes per layer, different fixes.
  3. Long conversations degrade before they overflow. Attention dilutes, contradictions accumulate, recency bias dominates, signal-to-noise drops. Expect it past 20-30 turns.
  4. "Claude forgot vs. Claude never had it" is the key diagnostic. Same symptom, opposite fixes. Scroll-back decides which. The tricky version is when the model fills a gap it didn't flag, most often at turn 1 with underspecified scope, or at session boundaries where a handoff silently dropped context. Detect it by asking the model to flag gaps before answering.
  5. Project files, artifacts, and attachments are tiers of durable context. Promote things up the tiers as they start to matter across conversations.
  6. Over-contextualizing is the other failure mode. Everything in context costs attention, even when it's free in tokens.
  7. Start fresh when the conversation is more noise than signal. Distill against the original, not against what you remember. The summary is only as good as what you put in it.

Lab handoff​

The lab hands you a deliberately messy 50-turn conversation with several planted failure modes. You diagnose three of them, propose a single-move fix for each, and measure whether the fix worked. The "Claude forgot vs. Claude never had it" distinction is the diagnostic to build. The lab is at ./lab/.


References​

  • Anthropic's long-context guidance. Practical notes from Anthropic on how Claude handles long conversations and documents, including when to use projects. Useful for mechanical details like effective context length and attachment handling.
  • "Lost in the Middle" (Liu et al., 2023). The canonical paper on attention degradation in long contexts. Finding: models attend best to the start and end of a long context, worst to the middle. Helps explain why correction-loop failures look the way they do.
  • "How to Fix Your Context" (Willison). Names the four context-rot failure modes: poisoning, distraction, confusion, clash. Maps directly to the "Claude forgot vs. never had it" framing.
  • "if you are redlining the LLM, you aren't headlining" (Huntley). Concrete numbers behind the degradation curve: quality drops well before the advertised 200k window fills. Practitioner counterweight to "Lost in the Middle."
  • "Needle in a haystack" benchmarks. A family of evaluations measuring how well models retrieve specific facts from long contexts. Useful intuition-builder; less useful as a direct predictor of real-conversation performance.
  • Anthropic docs on projects and memory. Product docs for the tools referenced in the module. Lookup reference, not reading material.