Build Your Own Automated Options Trading System · Concept

Context management — Claude's working memory,
and how to spend it well.

Every file Claude reads, every command it runs, every message you send takes space in the context window. That window is finite. The difference between a session that feels sharp at hour three and one that feels confused at hour one is almost entirely about what you let into the context — and what you take out.

Concept lesson
/compact · /clear · /context
Be specific. Delegate the journey.
This lesson, in one glance

Same five beats. The working-memory file.

1
Idea
Context is Claude's working memory. It fills up as the session runs — prompts, file reads, tool results, MCP tool lists, everything.
2
Outcome
A session that stays sharp: compact when continuing, clear when switching, and never load what you won't use.
3
Vocabulary
context window · compaction · /clear · /context · skill · subagent · the "be-specific" paradox
4
Hands-on
Run /context. Read the breakdown. Spot what's eating space. Try /compact mid-feature, /clear between features.
5
War story
A session that asked "find where authentication lives" — and burned 40% of its context exploring. The fix: send a subagent.
1 · The idea

Context is working memory. It's finite. Everything you do fills it.

Think of the context window as the amount of space Claude can hold in its head at one time. Every prompt you send, every file Claude reads, every tool call it makes, every tool result it gets back — all of it lands in that window. Once the window is full, something has to give: details get summarized away, or you start a new conversation.

A typical mid-session context window — what's actually in there:
system
CLAUDE.md
tools (MCP)
file reads
messages
free
System prompt — Claude Code's own instructions
CLAUDE.md — your project handbook, loaded every session
Tool definitions — every MCP server you've enabled
File reads + tool results — what Claude has fetched so far
Messages — your prompts and Claude's replies
Free space — room for the rest of the conversation
Two things matter from this picture: the tool band and the file-reads band are the ones that swell unboundedly if you don't pay attention. The other bands are roughly fixed.
2 · What happens when the window fills up

Auto-compaction. Helpful — but lossy.

[1]  Context window approaches its limit.
        Free space ≈ 0. Something has to give.
        
        
[2]  Claude Code triggers automatic compaction.
        - Important details get summarized
        - Old tool-call results get discarded
        - Free space is reclaimed
        
        
[3]  Session continues — but with a summary
        in place of the raw history.
        // Subtle facts can be lost: a number you mentioned,
        // a file path Claude read earlier, a corner-case
        // you discussed three turns ago.
        
        
[4]  If the auto-summary loses something important,
        you'll notice later — as a confused response
        or a forgotten constraint. By then it's expensive
        to recover the detail.
Auto-compaction is a safety net, not a strategy. It keeps the session alive past the limit — but you don't choose what survives the summary. The cure is to manage context before it gets to the brink.
3 · The three commands you'll actually use

Look. Compact. Clear.

/context
first — diagnose
Shows your current context size, the categories eating the most space, and a graphic of the whole window. The number alone isn't useful — the breakdown is.
Run this any time the session starts to feel slow or scattered.
/compact
when continuing the same work
Manually summarizes everything so far. Keeps a memory of what you've been doing — just a much shorter one. Good for: long debugging sessions, multi-step refactors where context matters but raw history doesn't.
Same loss as auto-compaction: details may be summarized away.
/clear
when switching to a new feature
Wipes everything. Starts from scratch with no memory of the previous conversation. Good for: starting an unrelated task where the old chat would only bias the new one.
Irreversible. If you needed something from the old chat, save it first.
The rule: compact when continuing the same feature past the limit. Clear when starting a new feature so the old conversation doesn't bias the new work. Context is the meter you check before either.
4 · The counter-intuitive rule

A shorter prompt often uses more context.

Vague — costs more in the long run

  • Prompt: "fix the bug"
  • Claude must look around the codebase to figure out which bug, where the file is, what the function does, what the call site looks like.
  • Every exploratory grep, read, and ls lands in your context window.
  • By the time Claude has enough to act, you've burned 5,000+ tokens just orienting it.

Specific — pays for itself instantly

  • Prompt: "in core/framework/sl_manager.py:142, the SL-buffer is hardcoded to 5%. Make it configurable via STRATEGY_CONFIG['sl_buffer_pct']."
  • Claude opens one file. Makes one edit. Done.
  • One sentence of extra typing → kilobytes of saved context.
  • The session stays focused. You stay in flow.
The irony: the laziest-feeling prompt ("just fix it") is the most expensive. Two extra sentences with the file path and the intent saves the entire exploration phase — and keeps the window clean for the work that actually matters.
5 · Three tool surfaces · three different context costs

MCP servers. Skills. Subagents. Pick the cheapest one that fits.

MCP servers

  • Cost: ALL tool definitions load into context at session start.
  • Five MCP servers × ten tools each = 50 tool schemas, every session.
  • Useful when you actually use them. Pure overhead when you don't.
  • Rule: turn off MCPs that aren't relevant to the current project.

Skills

  • Cost: only the skill names + descriptions load up front.
  • The body is fetched only when invoked.
  • Like MCP, but pay-per-use instead of pay-on-startup.
  • Rule: prefer a skill over an MCP server when both can do the job.

Subagents

  • Cost: their context is separate. Your main window stays clean.
  • You see only the summary they return — not the journey.
  • Perfect for: "where is authentication located?" — answer-without-journey questions.
  • Rule: if you only need the answer, send a subagent.
All three are tools that act for Claude. The difference is what they cost your context. MCPs are eager-loaded. Skills are lazy-loaded. Subagents run in their own window entirely.
6 · The single biggest context win

Subagents = a fresh context window, on loan.

YOU"Find where the SL-modification cap is enforced
            across all strategies. Just tell me the file paths
            and line numbers — I don't need the rationale."
        
        
MAIN AGENT  →  spawns Explore subagent
        ╭───────────────────────────────────────────────╮
        │  Subagent — separate context window           │
        │  - greps the repo                             │
        │  - opens 6 files                              │
        │  - reads 2,400 lines of source                │
        │  - inspects sl_manager + state.py + tests     │
        │  - costs ~30,000 tokens IN ITS OWN WINDOW     │
        ╰───────────────────────────────────────────────╯
        
        
SUBAGENT RETURNS"sl_manager.py:88 (cap check)
         state.py:201 (counter)
         test_sl_manager.py:340 (assert)"
        
        
MAIN AGENT  →  receives ~80 tokens of summary
        // The 30,000-token journey lives and dies in the subagent.
        // Your main window only paid for the 80-token answer.
Use this any time the journey would clutter your main session. "Find X." "Audit Y for safety." "Summarize the test failures." The subagent does the spelunking; you keep the clean window for thinking.
7 · For things you'd hate to re-explain next session

Don't compact it. Persist it.

If the lesson is… Right home Why this saves context
Architecture, file paths, where things live .claude/CLAUDE.md Loaded every session as routing. Claude never re-discovers it from scratch.
A correction you gave Claude ("never X, always Y") MEMORY.md → feedback_*.md Description in the index, body on demand. Past lesson available without bloating start-of-session.
Project state ("this strategy lots are 5/5/5/6 right now") MEMORY.md → project_*.md Captures the why behind a decision the code alone wouldn't explain.
Pointer to a server, dashboard, or doc MEMORY.md → reference_*.md Cheap to keep, surfaced exactly when relevant.
A multi-step procedure you'll do again A skill — body fetched only when invoked Zero context cost until you trigger it; full recipe when you need it.
An exploration you do once and never repeat A subagent — answer-only return The 30,000-token journey never enters your main window.
Compaction summarizes. Persistence remembers. If a lesson should outlive this session, write it where the next session will find it — not where this session will lose it.
8 · By the end of this lesson

You spend context deliberately, not by accident.

You understand that context is a finite shared resource — and that everything from MCP tool definitions to old file reads is competing for the same window.
You run /context when a session feels off, read the breakdown, and act on the biggest band instead of guessing.
You pick the right command: /compact to continue the same feature, /clear to switch — knowing both cost details and choosing intentionally.
You write specific prompts: file paths, line numbers, intent — accepting that an extra sentence up front saves a kilobyte of exploration later.
You delegate the journey: subagents for "find X" questions, skills over MCP for procedural work, and CLAUDE.md / MEMORY.md for anything worth keeping past the session.
Context management isn't a tax on your workflow. It's the workflow. The sessions that stay sharp are the sessions where someone is paying attention to what's in the window.
9 · New vocabulary

Five words. Five different tools in the toolkit.

context window
The finite amount of text Claude can hold in working memory at once. Everything — prompts, files, tool results — competes for the same space.
/context
compaction
Summarizing the conversation so far to free space. Auto-fires near the limit; manual via /compact. Lossy by design.
/compact
eager vs lazy load
MCP servers load every tool definition at session start (eager). Skills only load when invoked (lazy). Same job, different bill.
MCP vs Skill
subagent
A second Claude with its own context window. Does the exploration, returns only the answer. The main window stays clean.
Agent tool
be-specific paradox
Shorter prompts feel cheaper but cost more — Claude must explore to fill the gaps. One specific sentence beats five vague ones.
file:line + intent
The toolkit isn't five separate tricks. They're five answers to one question: "what is in my context window right now, and does it deserve to be?"
10 · The hands-on bit · your task

Measure. Cut. Persist.

Step 1 · Run /context

  • Open any active Claude Code session and run /context
  • Read the breakdown — note which band is biggest
  • Ask yourself: am I actively using the MCP servers that band represents?

Step 2 · Test the rule

  • Take a task you'd normally start with "fix the bug"
  • Rewrite the prompt with a file path, a line number, and the intent
  • Watch the session go straight to the edit — no exploration

Step 3 · Delegate the journey

  • Next time you ask "find where X is" or "summarize the test failures" — say "use a subagent"
  • Notice how your main window stays at the same size after the answer comes back
  • Compare to what would've happened without it
Three habits. Each one takes ten seconds. Together they extend the useful life of every session you run.
Concept lesson · takeaway

The context window is a budget.
Spending it well is the work.

Compact to continue. Clear to switch. Be specific so Claude doesn't have to guess. Delegate exploration to subagents. Persist what should outlive the session in CLAUDE.md and MEMORY.md. Do all five — and the session you're in at hour three feels exactly as sharp as the one you started at hour zero.

End of Context Management

Next: CLAUDE.md and MEMORY.md — the two persistent layers.

source: youtube.com/@claude · "Context Management in Claude Code" · /context · /compact · /clear
← → navigate · F fullscreen · click to advance
1 / 14