Zum Inhalt springen

The Desk Analogy

Your Workspace in Your Mind

Imagine you have a large desk. In the morning, it is empty and tidy. You place your current project on it, the relevant documents, a notepad. You work focused and efficiently.

Now imagine you never clean up anything all day. By the afternoon, documents from five different projects are piling up. Old notes mix with new ones. You are constantly searching for things and losing your overview. That is exactly what happens in Claude's context window when you do not actively manage it.

A tidy desk = clear mind = better results.

Understanding the Context Window

Claude Code works with a context window of up to 1 million tokens (with Opus 5 and Sonnet 5). Sounds like a lot -- but how much is it really?

  • One token is roughly 0.75 words (or 3-4 characters)
  • 1M tokens is approximately 750,000 words -- several thick books
  • A typical TypeScript file with 200 lines uses about 2,000-3,000 tokens
  • A long terminal output can easily cost 5,000-10,000 tokens

iIn Practice

Even 1M tokens fill up in a productive coding session where Claude reads dozens of files, executes commands, and generates code. Active context management remains important -- once the context is heavily loaded, you will notice that responses become less accurate.

Try It Yourself

Click the actions and observe how the desk and context usage change:

Context Window Visualizer

Context usage11%
src/app.tsx
Chat-Nachricht
CLAUDE.md
git status
package.json

The Most Important Tools

/clear -- Wipe the Desk Clean

The most important command for good context management. /clear deletes the entire conversation history and gives you a fresh, empty desk.

When to use?

  • When you start a new, independent task
  • When Claude starts giving confused or inconsistent responses
  • After completing a larger task
> /clear

That simple. Do not worry -- your code and files are of course preserved. Only the conversation history in Claude's "notebook" is cleared.

*Rule of Thumb

New task? /clear. Always. It costs you two seconds and saves you minutes of worse results.

/compact -- Everything on One Note

Sometimes you do not want to throw everything away, but the context is slowly getting full. /compact summarizes the conversation so far -- like writing everything important on a single note and clearing the rest off the desk.

> /compact

Claude creates a compact summary of the conversation so far. You lose the details but keep the thread. Especially useful in the middle of a longer task when you notice the context is getting full but you do not want to lose the context entirely.

You can also provide custom instructions:

> /compact Focus on the database changes and open TODOs

/btw -- Quick Side Question

You know the feeling? You are working focused on a task and suddenly a quick question pops into your head that has nothing to do with it. Normally, the question would "pollute" your context -- bringing irrelevant information into the conversation history.

/btw is like quickly asking a colleague without messing up your desk:

> /btw What was the syntax for a TypeScript enum again?

The answer comes, but the exchange does not burden your main context. Perfect for knowledge questions in between.

iWhen to Use /btw?

Ideal for quick knowledge questions, syntax questions, or fast checks that have nothing to do with your current task. Not suitable for questions about the current file state -- for those, Claude needs the full context.

Esc -- Interrupt

Sometimes you immediately realize that Claude is heading in the wrong direction. Maybe it is editing the wrong file or generating an unnecessarily long response. Press Esc to stop the current action.

Important: The previous context is fully preserved. You only interrupt the current response -- like stopping someone mid-sentence. Everything discussed before is still there.

Esc + Esc -- Jump Back to Checkpoint

Double Escape is more powerful: It jumps back to the last checkpoint. The last exchange is removed from the context as if it never happened.

This is like the "undo" function for your conversation history. Especially useful when:

  • Claude went in a completely wrong direction
  • The last response was huge and consumed unnecessary context
  • You want to rephrase a prompt without keeping the old attempt in the context

!Checkpoints vs. Files

Esc+Esc undoes changes to the context, but not to files. If Claude has already written code, the file changes remain. You need to undo them separately with git checkout if needed.

Tool Summary

CommandDesk AnalogyContext Effect
/clearClear the desk completelyEverything deleted
/compactImportant stuff on one note, rest goesSummary preserved
/btwQuickly ask a colleagueNo effect on main context
Esc"Stop, wait a moment"Context up to this point stays
Esc+EscCrumple up the last noteLast exchange removed