Thariq, an engineer at Anthropic, shares a practical guide to session management in Claude Code with the one-million-token context window. His observations come from recent conversations with Claude Code users.
The context window is everything the model can see simultaneously: system prompt, conversation, tool calls, and files read. Context rot refers to the performance degradation that occurs as context grows, with attention diluting across too many tokens. For the 1M model, this degradation typically begins around 300-400k tokens, depending on the task. Compaction is the summarization mechanism that replaces history with a synthesis when approaching the limit.
At the end of each turn, the user has five options: continue in the same session, rewind (return to a previous message), /clear (clean session), /compact (summarize and continue), or subagents (delegate with a clean context). The general rule is to start a new session for each new task, with a gray area for related tasks.
Rewind is identified as the best context-management habit. Rather than correcting by accumulating noise ("that didn't work, try X"), it is better to go back to the point right after the file reads and re-prompt with the lessons learned: "Don't use approach A, the foo module doesn't expose it — go straight to B." The "summarize from here" function makes it possible to create a handoff message, like a message from Claude's future self to its past self.
The difference between /compact and /clear is significant. Compact is automatic and potentially more exhaustive but lossy — the model is trusted to decide what to keep. Clear requires the user to articulate what matters and starts fresh. Compact can be guided with specific instructions. Poor compactions occur when the model cannot anticipate the direction of the work, which is particularly problematic since it is at its least intelligent point at the moment of compacting.
Subagents are a context-management tool for work blocks that generate a lot of intermediate output. The mental test: "will I need this output, or just the conclusion?" Claude can be explicitly asked to delegate to a subagent to verify a result, read another codebase, or write documentation. The author concludes that these mechanisms will eventually be handled automatically by Claude, but for now session management remains a key user skill.