Claude Code Session Commands: Beat Context Rot with Smart Session Management
Bart Slodyczka explains every Claude Code session command and when to use each, based on Anthropic research showing context rot — measurable performance degradation — begins at 300–400K tokens. The fix isn't shorter tasks; it's deliberate session hygiene using /clear, /compact, and mid-session checkpoints.
"Every Claude Code Session Command Explained (& When to Use Each)" by Bart Slodyczka — Watch on YouTube →
Key Takeaways
- Context rot begins at roughly 300,000–400,000 tokens — not because the window is full, but because older tokens dilute attention on the current task. Anthropic's own user research confirmed this threshold.
- The 1M token context window is a double-edged sword: longer autonomous sessions are possible, but unmanaged sessions degrade silently — Claude produces confident but increasingly off-target responses.
/clearresets the session entirely: fastest and cheapest option, best when moving to an unrelated task or after a major error./compactsummarizes the current context into a compressed form, preserving what matters while shedding noise.- Checkpoints let you save session state mid-task. When you restart from a checkpoint, Claude has focused context instead of an empty slate — critical for long multi-stage projects.
- The deliberate session hygiene pattern: use
/compactevery 200K tokens on long tasks,/clearbetween major context shifts, and checkpoints before risky operations (large refactors, destructive changes).
What Context Pollution Actually Looks Like
Bart demos the degradation pattern live: a session that starts with crisp, accurate responses begins producing responses that reference earlier (now-irrelevant) context, re-explaining things already established, or making decisions that contradict earlier conclusions. The model isn't broken — it's attending to too many signals at once.
Anthropic's internal finding: the degradation is highly task-dependent. Simple tasks (file edits, grep, one-shot code generation) are barely affected even at 800K tokens. Complex tasks (architectural decisions, multi-file refactors, debugging subtle logic) degrade noticeably at 300K.
Session Command Reference
- /clear — Wipes the entire session context. Free to use. Best between unrelated tasks or after hitting a wall.
- /compact — Summarizes current context into a condensed form. Costs a small amount of tokens to generate the summary, but typically reduces context size by 60–80%.
- Checkpoint (save) — Snapshots the current session state. Use before destructive operations or at natural task milestones.
- Checkpoint (restore) — Returns to a saved state. Useful if a long agentic run goes off the rails and you need to rewind without starting from zero.
Related on OpenClawDatabase
- Claude Cowork Setup Guide — getting started with Claude's broader environment
- OpenClaw Configuration — context management strategies across agent platforms
← Back to News digest · See also: Claude Cowork guide