تجاوز إلى المحتوى
العربية
العودة إلى الـ Playbook

feature

Context & the window

The model only "sees" what's in its context window. Managing what's in it — and clearing it when it's stale — is the skill that separates good sessions from frustrating ones.

Everything Claude knows in a session lives in one finite **context window** — the files it read, the diffs it made, your messages, its own. It doesn't fill up gracefully: a long, wandering session quietly gets *worse*, not just slower. The fix is cheap once you know it — /clear to wipe the slate between unrelated tasks, /compact to summarize a long one, and a subagent for any big read you don't want clogging the main thread.

Here’s the mental model that makes everything else click: Claude has no memory of your session beyond what’s in the context window right now. Every file it opened, every command it ran, every message either of you sent — it’s all sitting in one finite buffer. There’s no database it quietly consults. When people say a long session “got dumber,” what actually happened is the window filled with noise — half-read files, a debugging detour you abandoned, three versions of a function — and the signal got buried. The model is doing its best to attend to all of it.

So the real skill isn’t a magic prompt. It’s hygiene — deciding what’s in the window and clearing it when it stops earning its place. Three moves cover almost everything:

/clear between unrelated tasks. This is the big one. You finish a refactor, then start on an unrelated bug — and drag the entire refactor’s context along for the ride. Now the model is weighing forty irrelevant files against your new question. /clear wipes the slate (your CLAUDE.md and project setup stay). New task, fresh window. If you take one habit from this page, take this one.

/compact within one long task. Sometimes a single job legitimately runs long — a migration, a deep debugging session — and you don’t want to lose the thread, just the bulk. /compact summarizes the conversation so far and continues from the summary: you keep the gist and trade away the verbatim history that was crowding things out.

A subagent for big reads. “Read these forty files and tell me where we validate tokens” is exactly the kind of question whose answer you want and whose forty files you don’t. Hand it to a subagent: it does the dig in its own window and reports back a paragraph, leaving your main context clean for the actual change.

The same logic runs the other way, into CLAUDE.md. Because it’s re-read on every single conversation, it’s the one piece of context you pay for continuously — so keep it short and true. A bloated memory file isn’t a convenience; it’s a standing tax on every window you’ll ever open. Lean context isn’t a constraint to work around. It’s the whole game.

لماذا يفيد Most 'Claude got dumber halfway through' moments are really 'the context filled up with noise.'

أمثلة

Wipe the slate between unrelated tasks
/clear
Summarize a long session to free up room
/compact
Check what you've spent
/cost

نصائح وأفضل الممارسات