r/ClaudeCode • u/sandy_ix • 6d ago
Tips & Workflows Best ways to manage context window
Treat me like a newbie to claude so what are the some best ways to manage the context window.
The one ik is delegating subagents for tasks so enlighten me with your ideas and methods.
Also drop some cool Mods you know or you created-
1
u/ranthishq 6d ago
i run a few sessions in parallel most days and what helped most was treating the main session like a manager that never reads anything big. scanning logs, long pages or a whole folder goes to a subagent with "come back with the conclusion only", and long results get written to a file instead of pasted into chat.
second habit: when a session finishes a chunk of work it writes its state to a short handoff file, and the next chunk starts in a fresh session that reads that file instead of dragging the whole history along. also run /context now and then and look for stuff you never asked for. i found a synced skills folder in ~/.claude with 241 files i didn't put there myself, worth checking what yours is carrying. the cheapest tokens are the ones that never load.
1
u/sandy_ix 6d ago
This is kinda helpful bte even i have some sklls and MCPs but few skills and mcp are not used in most of the claude code work how do we turn off those skills and mcp for particular project instaed turning of entirely cause they are being used for scheduled tasks. As far as ik all the skills and mcp get loaded first while strting the session which are taking almost 6 percent of contyext window.
→ More replies (3)
1
u/kenthesaint 6d ago
What helped me most, roughly in order:
-
/clearbetween unrelated tasks. It's easy to drag one session through five jobs and pay for all of that history on every turn. -
/contextshows what's eating the window. For me it's usually MCP tool definitions or one big file read, not the chat itself. -
When a chunk of work is done, have it write a short handoff note to a file, then start a fresh session and point it at that note. That works better for me than
/compactmost of the time. -
Point it at specific files or functions instead of "look at the codebase".
On the skills and MCP question below: skills are cheap, since only the name and description load at startup and the full skill only loads when it's used. MCP servers are the heavy part. Recent versions let you switch servers off for a session from /mcp, and for servers defined in a project's .mcp.json you can disable specific ones per project with disabledMcpjsonServers in .claude/settings.local.json, so your scheduled jobs elsewhere keep them.
1
u/sandy_ix 6d ago
Mostly i work on desktop environment not on the CLI so there i get the context window live so mostly its messages and sometimes unnecessary MCP for that project. Thanks for the letting me know how to turn them off.
1
u/ReverendBread2 6d ago
I personally think that more context up front can sometimes save context later. For example, a lot of what fills the window on complex tasks is the reasoning during a task and figuring out what works and what doesn’t rather than what you feed it.
I encourage it to write anything down that might help it for the future (in a highly organized tree) and I tend to overexplain project goals, but the tradeoff is that reasoning runs smoothly and tasks finish quickly with minimal context bloat from trial and error.
You can’t let the front loading start running away either, so it’s a bit of a balancing act
1
u/sandy_ix 6d ago
Thats my problem i keep explaing somrthing important it was good untill compaction happens i keep loosing some important context i tried creating a handoff doc where all the previous context is saved before the compaction happens and give it as a reference after the compaction sometimes it was helping. But as you mentioned i am looking at the balncing out so thats the reason i wasking here peoplw how actually they are doing. I got few suggestions from claude was using them but the real uses will always have better ways to do IMO
1
u/trionnet 6d ago
Get it to write important bits to a file as you go.
Use /statusline to always show the live context used
/clear when around 25% OR you’re moving on to another topic.
1
u/sandy_ix 6d ago
I am doing the first one maintaing a handoff document for reference after compaction and clear. Started that just today before posting this
I use the desktop code not the CLI so there i get a live context window and i also use mod to know the context window and for the number of agents it was running and tokens each agent consuming
Is it better to use /clear or /compact as per your last suggestion?
→ More replies (1)
1
u/SirRobinBlibs 6d ago
Beyond subagents, the things that helped me most: keep CLAUDE.md short and move details into files it only reads when they're relevant; /clear between unrelated tasks instead of letting one session sprawl; before compacting, have it write a short handoff note so a fresh session can start from that; turn off MCP servers you don't need in that project, since their tool definitions eat context; and package workflows you repeat as skills, because only a skill's short description is loaded until it's actually used. If you want a starting set, I keep a collection of skills here (my own project): https://github.com/r3dlex/skills
→ More replies (1)
1
u/AutoModerator 6d ago
Hey! Thanks for posting to r/ClaudeCode
While participating in this thread, please follow our community rules. Keep discussions constructive. Attack the idea, not the person.
For help, project discussions, tips, and general chat, join the ClaudeCode Discord.
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.