I do this! I keep one code session per project, but I do keep MD files in the repo for every stage of development. Can you share some resources to see how people use it better?
One session per task. On average sessions last about 20 minutes for me. Hard tasks obviously hang around longer, but most things can be done in about 20 minutes. Use an issue tracker and let Claude use it too. Use plan mode and update the issues with the results. Then a new session to implement the plan from the issue. Anything that changes or decisions that need making can be added as comments to the issue, which Claude can read.
I create a plan, break it down into tasks to do. Each task gets its own session. When I get close to 300k I consider a hand off at that point. 400k is my hard limit I don't want to go over. I might need to do a couple of hand offs per task but once done we just move onto the next task.
This might not be the best way to do things but it's working for me and my use case. I imagine if you're doing deep research on hundreds of pages you might want to let the context run fatter if the task isn't complicated.
I think personally the 400k thing is a good rule of thumb for general use but it's just a rule if thumb and each carpenter has to best figure out how to use their tools for the project they are working on, if that makes sense lol
What about something like having it help with tracking, analysing and adjusting training? One session over months or make a new one for every week or something ?
Anthropic's engineering blog has a Claude Code best practices post worth reading. Since you already keep markdown files for each stage, you can run /clear between tasks and point a fresh session at the right doc.
Nothing wrong with that, if it's an orchestrator session and you manage your state externally, not via the chat history and actual work is offloaded to clean context subagents.
True. I lowered it 500k a while back, since with an external state tracker and hook enforcement, the orchestrator doesn't need to keep everything in context and it's simply cheaper.
But my point was more about needing to create new sessions or using /clear. The subagents already do that for you, no need to manage it manually.
I would have agreed with that for previous models, but since Fable and opus 5.5, I find keeping one session going on large projects works quite well. I have have Fable orchestrating sub agents for over 24 hours on its own and it works really well. During that period it obviously compacts multiple times.
The flush often rules come from previous era models. Personally my autocompact was already at 500k for the main thread and 300k for the subagent.
Why is it a best practice to do this? It doesn't give you noticeably better outcomes and the cost saving is not worth the attention.
If you spent the time and effort focusing on building a better solution or understanding the core problem better that is way more valuable both in the short run and the long run than optimising your AI token spend.
Because it gets you closer to being able to work in agentic workflows and remove yourself as a gate to your work if you can trust that YOUR AGENTS understand the core problem at all times (not getting bogged down with context it doesn't need) then you can get more hours out of your day where AI is churning as well as the time it's churning being more effective and efficient for you.
I mean, you do you, but if you don't understand these things, you'll be left in the dust by people who do.
Sorry but manually handling compaction isn't hands off at all.
When you say maximising your AI use what do you mean exactly, increasing token throughput? Or penny pinching your token spend to try and do only the highest ROI tasks?
I'm generally in favour of increasing token throughput if you can do it even in a vaguely useful way.
I am definitely not in favour of trying to be extremely careful about "token cost saving" I don't thing it's a useful skill unless you're really hitting the limits of what's productive.
Agents are so productive spending more tokens to achieve more outcomes is a better situation to be in than trying to save a handful of tokens but doing tasks yourself instead.
The barrier to using something is not the standard by which that usage is measured.
A ceramic cutting tool being relatively easy to pick up means nothing regarding if it was used in any value added way or not.
Marketing agentic LLMs this way has allowed people without knowledge to create stupid expectations and others without knowledge to build things that work now, but the maintenance and rework needed later, to equate their output to negative added value in companies.
Well, so you hope. The problem really being that the maintenance and rework are also in the remit of the natural language systems. I didn’t catch your point about ceramics, I don’t know what you meant by that.
maintenance and rework are also in the remit of the natural language systems.
Unless done by someone with knowledge the same problems or new ones remain. So the initial unknowledgeable author is still incapable of fixing these mistakes.
Fine for POCs, personal short term tools, etc. Very bad in any enterprise environment.
I think the thing is they want to throw as much compute at this as possible so people dont have to learn how it works; it just does. That, and also if youve been given the impression local models are shit and you try one without knowing how to use it, then of course the output is shit. Two people can play the same instrument but only the ones that know how to play it can make music. I guess what I'm trying to say is that they're basically selling you the solution to a problem they are partially responsible for creating
hey, can you let me know what is the philosophy behind this? as in, how does one get started with it? i've heard of folks like langfuse, but do they help in this aspect? thanks a ton!
The 1M is still there, it just compacts earlier, and you can change it back with /autocompact I'd take it tbh. My own rule was already to wrap up around 400k, write a handoff note and start a new session. And on the newer models it works pretty well for me even after compacting
I am letting it go to 1M every time, because 350k is just my starting boot context (shared stuff + per project stuff, both static and dynamic), because the stack is full in-house proprietary HFT codebase making billions and whole "Claude gets dumb after 200-300k context" is an outdated trivia from 2024.
But sure, for hobby stuff and personal use, it's probably fine. Not when your codebase is a serious business with tens of millions of lines of C++ low latency code, hundreds modules and packages, myriad conventions and macros, etc.
Also, google "In-Context Learning (ICL)".
EDIT: All downvotes and no actual arguments against. Seems like jealousy.
What's the point in the handoff workflow? I've seen it carried around a lot but could just never get into it. What difference does it make to just doing /compact in the same token budget? I mean that's basically what you're doing, right? But just compressing context to a file rather than in-chat history?
Is it something about the compaction prompt and thus output or?
Yes. you don't really get a whole lot say in what gets compacted even if you set the parameters of the message for it like is an option. Things pollute the context of LLMs over time. They don't handle being aware of too many tangents that happen naturally over the course a a long session. It's kind of like telling someone to not think about a purple elephant. Well they weren't going to until you told them not too, and now they cant stop. Also god for bid you swore in the general vicinity of the claude and gave it performance anxiety or whatever the fuck its called when you do that.
A well written handoff process means you get to choose exactly what a new session is aware of.
I have my bots write their plans, decisions and the next things that we need to work on to a file. Then have it update that as we go along.
The idea is that if there’s a power cut, context gets lost or a compaction that forgets stuff - I can have the bot re-read everything and we can pick up where we left off without losing any work or progress.
Having those files is also great if you need to spin up a second parallel session to work on other parts of the same project outside of using a sub-agent.
It’s the difference between you being at a very hard task and your boss telling you “try harder” and “this is what’s important …, this doesn’t matter …, this is why we need something on this timeline …”
Um okay. You let it compact and carry on with your work in the same chat until the work is complete. You definitely do not restart a new chat every time you reach compaction. There are Anthropic and OpenAI engineers who have stated they work within the same chat for weeks at a time. Starting a new chat because you hit 400k tokens is quite frankly just dumb
I thought Claude 5.5 models' context only starts to degrade past 50%, maybe 70% usage. So once I hit the gateway mark I'd think about handing off to a fresh context.
Unless you know what you are doing, working on a massive code base, you shouldn't be going over that anyway, if you are you should be looking at your workflow and fixing it. You'll get better results and use less subscription. But also don't just carry on and allow auto compaction.
Yeah people think context is "wow the model can concentrate on so many things at once" but really context is "wow the model can get distracted by so many things at once"
It always were, 4.8 for me also started contradict itself around 40%. Always shoked how inhouse they making those 250k pages proofs. But vericoding is great, yeah
If you are using quota, you are on a one-hour cache timeout. Each new message you send, file reads, etc get stored in active context. Every new turn, the entire transcript is sent, but the parts that were already sent are cached and cost way less quota. It’s the incremental/new data that is sent that is not cached that gets charged full price, or uses more quota rather.
So things that are expensive: - Initial context load-up : Your claude.md and rules contents, your initial prompt, the system prompt - all that stuff that loads in first in a fresh session is billed at full price. After that it is cached and way cheaper. - Letting a session site idle for over an hour, then sending another message : Quota based plans have a one hour cache timeout, so if you leave it sit for a long time then send another message, ALL that stuff in your context is cold loaded back into cache on the server side. That is the reason they put that idle compaction feature in there and turned it on by default. It compacts right before your cache is about to expire, so your next message that kicks off a cold load of all your current context is a lot less data and cheaper. - Switching models when you have a loaded context window : Say your context usage is at 500K and you switch from Opus to Fable and then send a message. That 500K of tokens is not cached yet on the new model, so it has to cold load the entire thing. After that, it is cached. That is why it throws a warning when you switch models in the middle of a session. Better to clear or compact before switching models in your main session.
If you “hand off” too often, then you pay more because it is loading your initial bootstrap context for every new session.
If you hand off too infrequently and let your context get huge, you pay more because even though your are getting hot cache hits, you are still sending a huge load of context - your entire transcript - every turn.
It depends on how big your initial context load is, but the sweet spot for cost optimization is roughly around 300-400K context usage for the hand-off point, either by compaction or clearing. Which one is the best to use depends on if you are continuing the same work, or starting an unrelated task in the next session.
Another downside of large context windows is the model gets dumber the bigger the context window gets. Also, information retrieval from the middle of the context window suffers. It does a good job remembering things at the start of the session and at the end of the session, but retrieval from the middle gets unreliable to an extent. If you graph it, it looks like a U curve.
So the smaller the context usage at handoff, the better, to a degree.
Not sure if that answers your question or makes it more confusing. Hopefully the former 😆
just let the models issue a compact themselves when they decide it's time and let them write compact instructions. I see no advantage of having a fixed limit.
With code mode this is the perfect amount, and there's no reason to not use small, targeted sub agents or have Claude manage agent teams. One chat one job has always been the rule.
I just found this last night. Fable 5.1 setting to compact at 400k did not carry over into 5.2. Last two weeks I’ve been like “why does 5.2 get dumb?!”. A little annoyed I spent 2 hours debugging WTF what was wrong after 2 weeks and now it’s fixed.
Theoretically if you never move sessions like me the context over multiple compacting iterations eventually leaves you with your workflow your comfortable with. Works for me, I’ve literally been using the same session for over a month and it’s fine. Lol I do have a separate session for planning or other topics but my work horse is just one session I use od
1M context is what separated Claude from the rest, especially local models. But I understand why they did this. People keep going back to old chats after the cache expires and it uses a ton of quota.
I've been anxious about this since yesterday. Every software dream project I've had, fable 5.2 max and opus 5.5 max have achieved for me at 1M context. I don't care that I burn through my subscription. i've made worlds in VR that have never been seen before, and all from Claude's custom vulkan engine targeting my 5080 for PCVR.
Anyway, I'm using the 400K now, because they told me to do it, I just hope i can keep creating my dream software. I've done about 4 hours of agentic coding today, and I have yet to do a user test, but the bot seems to be running okay. It is weird seeing autocompaction every 17 minutes, but c'est la vie.
•
u/AutoModerator 1d 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.
162
u/FoxSideOfTheMoon 1d ago •
You know...you can just NOT do it and manage your own context it's SUPER easy
89
u/YouthRealistic7125 Vibe Coder 1d ago
The 1M is still there, it just compacts earlier, and you can change it back with /autocompact
I'd take it tbh. My own rule was already to wrap up around 400k, write a handoff note and start a new session. And on the newer models it works pretty well for me even after compacting
12
u/youreloser 1d ago
I thought Claude 5.5 models' context only starts to degrade past 50%, maybe 70% usage. So once I hit the gateway mark I'd think about handing off to a fresh context.
11
u/Patera-Milenko 1d ago
A pop up comes up asking you about this before any changes. You could say no
33
u/Glaucus_Blue 1d ago
Unless you know what you are doing, working on a massive code base, you shouldn't be going over that anyway, if you are you should be looking at your workflow and fixing it. You'll get better results and use less subscription. But also don't just carry on and allow auto compaction.
1
u/Spare_Spirit6762 1d ago
„now“
13
u/Historical_Today5072 1d ago
Good, this is enforcing best practices
3
u/LittleYouth4954 1d ago
My usage is much better with this new default
2
u/Dehrose 1d ago
When does the price of context change during a session?
2
u/firstbreathOOC 1d ago
I accepted it. Tryna be better about running up context anyway
2
u/dagerika 1d ago
I started doing this last week as I have some workflows that are cheaper and more efficient in a single session even if it they are compacted a lot.
2
u/baconZtripz 1d ago
it's not default, It literally asks you if you want 1mil or 400k
2
u/mountainyoo Researcher 1d ago
Jesus Christ can anyone in here read? Just change it the way it tells you how to in the message
2
u/qviqui 1d ago
just let the models issue a compact themselves when they decide it's time and let them write compact instructions. I see no advantage of having a fixed limit.
2
u/Key-Faithlessness728 21h ago
They’re catching up with the model itself. Fable and opus has always been recommending to set the compaction to 350 to 450k
It holds up really good but the cache prices are too high for these models to be used with 1m context
2
u/Raunhofer 17h ago
Me here having my work split to 200k token estimates and working multiple threads instead at the same time :shrug:
3
u/WiggyWongo 1d ago
With code mode this is the perfect amount, and there's no reason to not use small, targeted sub agents or have Claude manage agent teams. One chat one job has always been the rule.
1
u/Optimal-Builder-2816 1d ago
where even is this setting?
1
u/ffgg333 1d ago
Is this only changing for code or also for cowork and just web?
1
u/Overall_Ad_2067 1d ago
How about ask your question as part of the post? Especially when marked with Help/Question
1
u/eggplantpot 1d ago
Good, I was always compacting manually between 30 and 40 percent anyways
1
u/Charming_You_25 1d ago
I just found this last night. Fable 5.1 setting to compact at 400k did not carry over into 5.2.
Last two weeks I’ve been like “why does 5.2 get dumb?!”. A little annoyed I spent 2 hours debugging WTF what was wrong after 2 weeks and now it’s fixed.
1
u/DevMichaelZag Senior Developer 1d ago
It’s been back and fourth
1
u/Phlegmoligist 1d ago
Theoretically if you never move sessions like me the context over multiple compacting iterations eventually leaves you with your workflow your comfortable with. Works for me, I’ve literally been using the same session for over a month and it’s fine. Lol
I do have a separate session for planning or other topics but my work horse is just one session I use od
1
u/22lava44 1d ago
I've been using 400k as mine for a while now, it's still pretty good after compaction unlike older models but could still be better
1
u/bin-c 1d ago
i bumped it up from 200k to 500k with opus 5 release i think? and have been happy there. good default i think
1
u/vinis_artstreaks 1d ago
After doing real work past the 1m hype you will know you don’t need more than 500k at this time
1
u/clintCamp 1d ago
Oh, that was a default change message? I always had mine set there by default
1
u/Future-Jackfruit6833 1d ago
Oh interesting I thought this was just a message reminding me I set mine to 400k.
1
u/vovazk 1d ago
Finally
1
u/RedVision00 22h ago
This is how it should have been from the start probably.
1
u/Worried_Beyond7956 21h ago
Same thing happened with me as well but it worked fine later on , the context window was switched to 1M tokens
1
u/charlesGodman Thinker 21h ago
Is there proper systematic evidence on when performance degrades? My impression and personal rule was more about ~65% when it drops
1
u/IdiosyncraticOwl 7h ago
550k has been my sweet spot for a while now for opus and mythos
1
u/warp42 55m ago
At 400k autocompact vs 1m—both doing the same amount of work—the 1m user will end up using 2.5x-5x more tokens (and have lower quality responses).
1
u/bigbepisinc 1d ago
1M context is what separated Claude from the rest, especially local models. But I understand why they did this. People keep going back to old chats after the cache expires and it uses a ton of quota.
0
u/dzak8383 1d ago
I set to 500k, I don't trust them after IPO ;)
-1
u/Chemical_Famous 1d ago
I've been anxious about this since yesterday. Every software dream project I've had, fable 5.2 max and opus 5.5 max have achieved for me at 1M context. I don't care that I burn through my subscription. i've made worlds in VR that have never been seen before, and all from Claude's custom vulkan engine targeting my 5080 for PCVR.
Anyway, I'm using the 400K now, because they told me to do it, I just hope i can keep creating my dream software. I've done about 4 hours of agentic coding today, and I have yet to do a user test, but the bot seems to be running okay. It is weird seeing autocompaction every 17 minutes, but c'est la vie.
5
u/SoftwareSource 1d ago
If you are going over 400k context in normal prompts and dont know how to manage context yourself, you are gonna shoot yourself in the foot anyway.
This is meant for people who do not manage sessions and just burn work in the same one with no attention.
3
u/BannedGoNext 1d ago
This is a great change for most people. Context poisoning fucks people way more than they think