Have you noticed that after 40 minutes of good work Claude starts contradicting a decision you made at the start? Imagine a meeting where your colleague suddenly forgets the first hour but remembers the last ten minutes. That is a full context window.
What the context is
Everything in the conversation (CLAUDE.md, your messages, files Claude read, command output, its own replies) is sent to the model on every turn. The window has a fixed size; /context shows how full it is and what is taking space. As it fills up, the earliest details get less attention, and when it is full Claude Code compacts the conversation into a summary.
This course was written in one very long session. It ran out of context more than once and continued from a summary. What survived each time were the standing rules written explicitly in the summary (reply in Vietnamese, placeholders only, never commit unless asked). Details that were never written down had to be found again.
Habits that keep it under control
- One task per conversation. When a task is done,
/clearand start the next one fresh. CLAUDE.md is loaded again automatically. - Compact with instructions when you must continue:
/compact keep the file list, the open bugs and the owner's rules. - Let sub-agents do the reading. A search through 40 files belongs in an agent's context, not yours.
- Point at files, do not paste them.
@site/modmaps.jsis better than pasting 700 lines. - Shrink images before attaching them; a 4 MB screenshot is mostly wasted tokens.
Plan mode: three rounds before building
Press Shift+Tab until you see plan mode. Claude can read and think but cannot edit. We use three rounds for anything bigger than a small fix:
- Describe the goal and constraints. "Make the Claude course bilingual with a language switch; only this track; keep the other tracks as they are."
- Read the plan and push back at least once. Which files will change? What happens to existing progress? What will you check at the end?
- Approve and build. The plan is now in the context and the edits follow it.
Five minutes of plan review regularly saves an hour of undoing a wrong approach. It also gives the next session something concrete to read if this one runs out of context.
When to stop and restart
If Claude keeps making the same mistake after you corrected it twice, the context is probably working against you. Write down what you learned (in CLAUDE.md or the work log), /clear, and start again with a better first message. A fresh session with a good brief beats a tired session with a long history.