7 min read
Inside Claude's Memory: AutoCompact and the Context Hierarchy
Why AI Context Is Already Crowded Before You Type

Hello Curious Coders,

You open a fresh Claude session. Blank screen, cursor blinking, nothing said yet. It feels like the whole context window is yours to fill.

It isn’t. By the time you type your first word, a good chunk of that window is already spoken for. The system prompt is there. So are tool definitions, agent configuration, project rules, skills, and components. All of it loaded before the conversation starts, and all of it competing for the same budget your actual work will need later.

That’s the idea most people miss. We talk about “the context” as if it were only the chat. But the chat is the last slice. In the last post, we made the case for Elixir as a good language for AI-assisted development. Before we add an accelerator like Tidewave, we need to get the model’s memory in order, because better tools cannot rescue a context that is already falling off the conveyor belt.

The Memory Is Partitioned

Run /context in Claude and you can inspect what is actually filling the window. It is not one undivided pool of words. There is a hierarchy.

At the top is the system prompt. That part is not yours to edit. Under it are the configurations for tools and agents. Then come rules, skills, and components. Only after all of that comes the conversation itself, the conveyor belt of words carrying the work forward.

That layout changes how you think about setup. Every rule you add has a cost. Every skill you load has a cost. Every component description, every agent definition, every tool schema, all of it takes room. Some of that room is well spent, but it is still spent.

So context management is not only about writing shorter prompts. It is about knowing what is already in memory before the prompt begins.

The AutoCompact Trade

Now scroll toward the bottom of /context and look for the AutoCompact buffer. That is where Claude shows the summary space used when a conversation gets long. Then open /config and verify that AutoCompact is set to true. It is a good default for general programming work, but it is worth checking instead of assuming.

AutoCompact exists because the conveyor belt has a limit. A model can compress a surprising amount of detail into the active context, but long conversations eventually carry too many specifics. The model may still need the arc of the work: what you are building, what decisions were made, what direction the session is moving. It does not necessarily need every intermediate sentence that got you there.

Bruce explains the tradeoff this way:

“As conversations get long, there’s too much explicit detail to encapsulate the whole conveyor belt of words. We lose the overarching flow. AutoCompact is about a better long-term memory — at the expense of details in short-term memory.”

– Bruce Tate

That is the key. AutoCompact is not making memory free. It is exchanging one kind of memory for another. You preserve the long-term arc, but you lose some short-term detail. For most programming sessions, that is the right trade. You would rather Claude remember the direction of the work than hold onto every false start, every intermediate patch, and every sentence you typed along the way.

But it is still a trade. If a detail matters, do not assume AutoCompact will preserve it with the same precision. Put durable decisions somewhere the model can reread them: a project note, a rule, a plan, or a source file.

🎯 Join Groxio's Newsletter

Weekly lessons on Elixir, system design, and AI-assisted development — plus stories from our training and mentoring sessions.

We respect your privacy. No spam, unsubscribe anytime.

When Accuracy Starts to Drift

This also reframes hallucination. We often talk about hallucination as if the model suddenly became careless or irrational. Sometimes the simpler explanation is that memory is not behaving the way you think it is.

Bruce puts it plainly:

“When any agent goes off the rails, it’s usually hallucinating or losing accuracy because its memory is not functioning the way you expect.”

– Bruce Tate

Read the symptom that way and the next move becomes more practical. If Claude starts inventing modules, losing a constraint, repeating work, or taking too long on a simple task, do not only rewrite the prompt. Open /context and inspect the memory.

You are looking for one of three problems. There may not be enough conversational room for the task. You may have loaded too much setup before the conversation even started. Or the problem may be too large for the current organization of the work.

Once you see which one it is, you have three levers. You can make more conversational room, usually by compacting, clearing, or removing unnecessary setup. You can prune the work by breaking it into smaller tasks, which is usually the highest-return move. Or you can spend more money on a larger model or larger window.

The first two are engineering habits. The third is a budget decision.

Practice Without the Safety Net

There is a reason Bruce does not treat AutoCompact as magic. If it is always saving you quietly, you never build the skill of working inside a smaller memory.

His recommendation is deliberate practice:

“Practice on Haiku sometimes so you can practice context management. Turn AutoCompact off for significant stretches, break problems down, and be more careful about what you put in the context in the first place.”

– Bruce Tate

Haiku gives you less room, which makes the constraint visible sooner. Turning AutoCompact off makes the boundary even clearer. You can feel when the task is too broad, when the prompt is carrying noise, and when the setup has become heavier than the work deserves.

That practice changes how you collaborate with the model. You stop dumping the whole project into memory because it feels safer. You start asking, “What does this task actually need to know?” You stop treating rules and skills as free additions. You start treating them as part of the same budget as the conversation.

That is the real habit: become careful about what enters context in the first place.

Memory Before Acceleration

Most “the AI got confused” moments are not mysterious once you inspect the hierarchy. The memory is partitioned. The setup is spending tokens. The conversation is moving on a conveyor belt. AutoCompact preserves the arc, but it does not preserve every detail.

Once you can see that, you stop being surprised by drift and start managing it.

Now that the memory is tuned, we can add the accelerator Bruce made us wait for. In the next post, we install Tidewave.


🤖 Manage AI Memory With Structured Oversight

This comes from Bruce's AI Agents course — the anti-vibe-coding curriculum. Learn the Ask → Plan → Agent framework for managing context, AutoCompact, and long sessions without losing architecture decisions or letting AI become a crutch. Available via monthly subscription — try it for one month.

— Paulo & Bruce

Bruce Tate's avatar
Bruce Tate
System architecture expert and author of 10+ Elixir books.
Paulo Valim's avatar
Paulo Valim
Full-stack Elixir developer and educator teaching modern Elixir and AI-assisted development.