// 32 tips tagged "context-window"
When Claude starts referencing files you've since deleted, remembering old code you've already changed, or getting confused by contradictory instructions from a long session — type /clear to wipe the slate clean. Unlike /compact which preserves context, /clear gives you a true fresh start without restarting the CLI.
Long sessions eat through your context window as conversation history piles up. Type /compact to summarize the conversation so far and reclaim space — keeping Claude's understanding of what you're working on while freeing up room for more work.
Type /cost at any point to see how many tokens you've used in the current session, how much it's costing, and which operations are consuming the most context — so you can make informed decisions about when to /compact, /clear, or switch models.
When you've finished one task and want to start a completely different one, run /clear to reset the conversation — Claude forgets the previous context so stale decisions, old file reads, and irrelevant discussion don't pollute your next task.
When your Claude Code session gets long and responses slow down, run /compact to summarize the conversation history and free up context window space — keeping your session alive without losing important context.
Configure ignorePatterns in settings to exclude node_modules, dist, vendor, and other large directories from Claude's file scanning — so it searches faster, reads less noise, and never wastes time on generated or third-party code.
Before closing a long session, ask Claude to write a progress file summarizing what's done, what's in progress, and what's next — so the next session (or a teammate) can pick up exactly where things left off without rereading the whole conversation.
Use Esc+Esc and choose "Summarize from here" to compress only the noisy middle of a session while keeping your original context and instructions intact.
Start a new Claude Code session for each task rather than running 200-message threads — your context stays cleaner, your output stays consistent, and your rate limits stretch further.
Split your dev docs into three focused files (plan, context, tasks) so Claude can re-orient instantly after a context reset without wading through a single bloated plan.md.
When a long session accumulates baggage from failed attempts or abandoned approaches, /clear wipes the conversation history so Claude can focus on the current task without old noise.
Set autoMemoryEnabled to false in settings.json to stop Claude Code silently writing memory files, without losing any context already captured.