All video notes
Video notes · Claude Code memory

Context Management in Claude Code

Video by Claude on YouTube · 4 min · uploaded May 2026

Notes and analysis by BrainTube, written from the video. Not affiliated with Claude. Watch on YouTube

In short

Anthropic's short guide treats the context window as Claude Code's working memory and gives a handful of habits: compact when continuing a feature, clear when starting a new one, check usage with /context, put lasting facts in CLAUDE.md, write specific prompts, disable unrelated MCP servers and use subagents for lookups. The advice is correct and worth following. It is thin on the main risk it names, that compaction can drop details, and on what to do before that happens.

The argument

The video's argument is that everything in a Claude Code session, prompts, file reads, commands and tool results, competes for one finite context window, so managing that space is part of using the tool well. Claude Code compacts automatically near the limit, summarizing and dropping old tool output, and you can trigger it yourself. The decision rule is simple: compact to keep going on the same work, clear to avoid old conversation biasing new work. Anything that should outlive a session goes in CLAUDE.md. Beyond that, you save space by being explicit, loading fewer tools and sending exploratory questions to subagents that return only an answer.

Key ideas, with timestamps

  1. 0:03

    Context is working memory

    Every prompt, file read, command and tool result is appended to the context window, and the window has a fixed size. The framing is the same one IBM and others use: context is the RAM of the session, and it does not survive on its own.

  2. 0:39

    Automatic and manual compaction

    Near the limit, Claude Code compacts the session, summarizing important details and removing old tool results. The video warns that this can lose details from earlier in the conversation. Running /compact yourself does the same thing at a moment you choose, keeping a summary of the work so far.

  3. 1:11

    /clear and /context

    /clear wipes the session so you start with no memory of previous work. /context shows how full the window is, which categories take the most space and a graphic of the breakdown. Checking it before a long task is a cheap habit.

  4. 1:35

    Compact to continue, clear to switch

    If you are mid-feature and near the limit, compact so the relevant context carries on. If you finished a plan and are starting a new feature, clear, so the old conversation does not bias the new work. Facts Claude should know in every session belong in CLAUDE.md so it does not rediscover them.

  5. 2:08

    Short prompts can cost more

    A vague prompt forces Claude to search the codebase and reason its way to what you meant, which fills the window faster than one or two extra sentences of direction would. Naming the file, function or goal is a context optimization, not just a clarity one.

  6. 2:26

    MCP tools, skills and subagents

    MCP servers load all their tool definitions into context by default, so servers unrelated to the project are worth turning off. Skills load only when needed. Subagents run with their own separate context, so a question like where the authentication endpoints live can be answered without the search filling the main session.

What it gets right

The compact-or-clear rule is the right default. Many people never clear, and long sessions drift: an approach Claude tried and abandoned an hour ago still shapes its next suggestion. Clearing between features is the simplest fix for that, and the video states it plainly.

Specific prompts save context. This is the least obvious tip and the most useful. A one-line request that sends Claude grepping through a repository can cost far more tokens than a three-line request that names the file. Every unnecessary file read stays in the window until the next compaction.

Subagents for answers without the journey. Delegating lookups keeps the main session focused on the change you are making. The rule of thumb works well: if you only need the conclusion, delegate; if you need to watch the reasoning, keep it in the main thread.

What it leaves out

What to do before compaction. The video says compaction may lose details but gives no remedy. Two habits help. First, write decisions and open threads into a file before compacting, such as a short handoff note or a CLAUDE.md update, so they survive in full rather than as a summary. Second, /compact accepts instructions, so you can tell it what to keep, for example the failing test names and the chosen approach.

CLAUDE.md has a cost too. It is loaded at the start of every session, so it takes context every time. Keep it to stable facts like build commands, conventions and known pitfalls, and move long reference material into separate files Claude reads when needed.

Tool loading changes over time. The claim that MCP servers load every tool definition up front describes the default as of the video's May 2026 upload. Claude Code's handling of large tool lists has been changing, so check /context to see what your setup actually loads rather than assuming.

Memory beyond the project. Everything here is about one session and one repository. Knowledge you need across projects, such as research, docs you have read or decisions from other work, has no home in this model except copying it into each CLAUDE.md.

How this applies to memory across AI tools

The video's advice amounts to keeping the window small and pulling in only what the task needs. The same principle applies to knowledge outside the codebase: rather than pasting reference material into a session, keep it in a store the agent can search and fetch from on demand, the way subagents fetch answers.

An MCP server is the usual way to do that. BrainTube is one option: it saves YouTube videos with their transcripts, articles, PDFs and podcasts into one compiled knowledge base and exposes it as an MCP server, so Claude, ChatGPT, Cursor and other MCP clients (including Claude Code) can search it. Following the video's own advice, enable it in the projects where you need it.

For other ways to give Claude Code memory, see Claude Code memory tools. For the difference between session context and stored memory, see persistent memory versus the context window.

Who should watch it

Watch it if you use Claude Code and have never run /context or /clear; it takes three and a half minutes and the decision rule at 1:35 alone is worth it. Pay attention to 2:08 on prompt specificity and 2:26 on MCP servers and subagents. Skip it if you already manage sessions deliberately, since it has no advanced techniques, no numbers on context sizes and nothing on preserving detail through compaction.

Frequently asked

What is the difference between /compact and /clear in Claude Code?
/compact summarizes the session so far and drops old tool output, so you keep a memory of the work while freeing space. /clear removes the whole conversation and starts fresh. Compact when continuing the same task, and clear when starting new work so old context does not bias it.
How do I see what is using my Claude Code context?
Run the /context command. It shows how large your context is, which categories take up the most space, such as messages, files, tools and memory files, and a visual breakdown. It is the quickest way to find unused MCP servers or oversized files.
Does compaction in Claude Code lose information?
It can. Compaction replaces the detailed history with a summary, so specifics from earlier in the session may be lost. Write important decisions into a file or CLAUDE.md first, and give /compact instructions about what to keep.

Keep videos like this one searchable

BrainTube saves YouTube videos with their transcripts into one compiled knowledge base that Claude, ChatGPT, Cursor and other MCP clients can search.

Start free

Go deeper

More video notes

Are you the creator and want this page changed or removed? Contact us and we will act within 48 hours.