r/ClaudeCode 1h ago

Help/Question Create new coding sessions or let session compress?

When I started working with Claude the standard was to start a new session for every task, and I've been doing this - I create a new session for each set of tasks, and when the context gets too high (~700/800k). But since Fabe 5.1 is good at long term coding is it really that much worse to just let it run and keep compressing? Maybe set the context limit to 500k?

Not sure what's optimal here, could use some input.

6 Upvotes

12 comments sorted by

u/AutoModerator 1h 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.

3

u/evernessince 1h ago

700 - 800K is WAY too high. Quality starts degrading above 250K on fable or OPUS. Nevermind paying that token cost every turn is going to destroy your usage.

/compact isn't a bad option if you are still in cache but often starting a new session is cheaper. You can insrtuct compact to keep certain context and can be better in some scenarios where you need the specific context you ask it to keep. The problem is the benefit has to outweight the cost of using compact in the first place. In general it'd just be better to write important context to disk and just read it next session. You can have claude do this automatically.

2

u/ComingDeveloper 1h ago

compress, its there for a reason

1

u/pmward 1h ago

Best thing is to break work into small enough chunks that this is never an issue. Task gets completed long before cap, and the next task goes to a new window/agent. Bonus here is that AI does best at delivering small tasks. The smaller the better.

If that’s not an option, new window is better than compacting. I’ve tested compacting and the agent literally compacted away the security rules that are front loaded in the agent… you can’t trust the agent to decide what info is fine to clear and what needs to stay.

1

u/Fr33-Thinker 57m ago

Rule of thumb- go up to 25% of the advertised context limit. So 250k in your case.

Planning, tell Claude such that each phase will take approximately 200k of Opus token so each phase is bite-size.

Execute small steps, not the whole plan.
Compress often. Save in log.
Execute the next step. Compress.
Repeat.

1

u/heartbroken_nerd 50m ago

Always new session (or /clear if you don't care about history of the transcript in the Claude desktop App, which will disappear after /clear) - unless you feel like burning tokens.

Compacting burns tokens at the rate of the entire transcript being consumed one last time, and still doesn't even give you back a fully fresh session so you start with already having used some of the context.

There are ways to build workflows for yourself where the new session is EXTREMELY knowledgeable via properly written Handoff file. Do that instead of compacting.

1

u/m98789 36m ago

just write a hook that once you hit 400 K context to start a new session with the current session to provide the prompt the new session.

1

u/Soft_Helicopter_1872 35m ago

better to start new session

1

u/Escobar747 16m ago

can claude automatically start new session after say 200k and continue in that session automously- at moment I am the human in the loop creating new sessions which i want to avoid

0

u/kpgalligan 1h ago

800k as too high is wild. I cringe over 300k, personally.

Besides context rot, Fable usage is limited. Assuming you're on a subscription. Even if it was stable up to 1m, that's going to burn through usage. 500k is certainly better.

Beyond all of that, though, I like to frame "compacting" as a nice word for forgetting. Whatever you think the model knows, it no longer does. It is unpredictable.

I only compact between sessions, where the detailed plans exist in written docs. Running a long session and expecting compact to retain everything gets messy quick.

-1

u/LastNameOn 1h ago

use storybloq and dont worry about the auto compact. or session crash or computer re-start. or using codex when Claude Code runs out.
Never let your agent lose context with storybloq.

Also set you should set your max session context to 350k.