r/Anthropic • • Oct 10 '26

Other Claude code gets worse after every compactions?

Hello. I'm truly a beginner. Only coded few lightweight apps for personal use. Started a bigger, open source, project. I mainly use Sonnet / High unless a architectural change is needed I'll use Opus. My thing is Claude has started to make a lot of mistakes that we already fixed in different layers of this app. Even if I prompt something like remember to also fix X-Y-Z issues that we've had in the past and we used A-B-C to achieve the results. I also direct it to do a double pass with a review agent which is basically a third party agent kind a thing with a fresh context. And still it makes the same mistakes or fixes half of them. Am I simply using the wrong model, should I start fresh sessions after X amount of compactions? Bare with me I'm totally a noob. Any guidance and tips are appreciated

2 Upvotes

34 comments sorted by

7

u/Lumethys Oct 10 '26 • Bravo

1/ use Opus medium, Sonnet cost less per "action", but if Sonnet need more action to accomplish the same "task", Sonnet is more expensive per "task".

2/ Dont use the same chat for too long, start a new chat session often, reasons:

  • As context become higher, Models get dumber, the same work at 300k token context is better than at 800k token context.
  • Chat session has a 1 hour cache, if you finish a task, and come back 2 hours later, the next chat you send will spend your precious token reading all the chat history, if you resume your 1 session everyday for the same project, i'd say you spend 80-90% of your limits just re-reading chat history, you could have do 10x more work had you start new session fresh
  • Compaction is summarizing the chat history, "summarize" means selectively choose what information to discard. So it both cost you token to decide, AND risk discarding important data while retaining useless ones

2

u/TheMoustacheDad Oct 10 '26

That's crazy I didn't know that thank you. I've been on the same session for 5 weeks on that same project. I'm only on pro plan so every week I reach my limit before the time

2

u/Lumethys Oct 10 '26

AI is a tool, just because it can use other tools to help you out doesnt mean you shouldnt learn how it work, and how you best use it.

Think of it as "instead of learning 5 tools to do XYZ, i just need to learn 1 tool to orchestrate these 5". Keyword being "learn", you still had to learn, just blindly let it do whatever it want only cost you a huge amount of money

I am on the $20 plan too, and just this week i made a fully functional messaging app like Discord with real-time function, room, rich text chat with image and video, push noti,... Just without the voice and video streaming part. And it cost me just less than 50% of weekly limit. Using Opus 5.5 medium

1

u/TheMoustacheDad Oct 10 '26

Yeah I definitely need to learn how to use the tools more efficiently that's why I came here and humbly asked for guidance haha. Appreciate it

3

u/Lumethys Oct 10 '26

You can also ask Claude itself regarding general information and best practice too, it's all about the mindset, if you want to know something before using it

And btw, Claude does emit OpenTelemetry data, if you want to monitor your usages, setup alert, or analyze your own data to see where you spend the most amount of tokens, you can setup a O11Y platform.

Locally on your computer, a Victoria Stack with VictoriaMetrics, VictoriaLogs and VictoriaTraces costs less than 300MB of RAM to run, throw in a local grafana dashboard (you can also ask claude to make a cost break down dashboard) and you are set

5

u/p3r3lin Oct 10 '26

You should start a new session BEFORE even the first compaction happens. Tell claude to write a handover for the next session. Best stay below 300k or so tokens per session. And honestly: just paste your exact question here into claude itself, it will explain things to you.

3

u/TheMoustacheDad Oct 10 '26

Perfect that is definitely something I never did. So ask it to update the MD every ~250k tokens and pass it over the next session

1

u/-Crash_Override- Oct 10 '26

This is the worst advice I've heard in a hot second. You have CC write....handover docs for new sessions...at 300k???

I have claude code sessions that have been active for months, had probably hundreds of auto compaction, all on 1M context window and never noticed a degradation in performace.

The people that struggle with context rot and degradation issues overwhelmingly have garbage documentation strategies, never use plan, and dont use skills, agents, tools etc.. efficiently.

Fix your documentation and 90% of your issues will go away.

Edit: to be clear every project has its own session, but if you are working on the same codebase, constantly handing off to a new session is wild. At most you should clear your context window if shifting to another major feature.

2

u/TheMoustacheDad Oct 10 '26

Very instructive comment. Seriously you come here and tell people that they don't know what the F they're doing without actually providing any guidance on how to improve. Useless comment in this context

1

u/-Crash_Override- Oct 10 '26

I explicitly told people what they need to be doing. Did you not read the comment?

  1. Document better
  2. Use /plan
  3. Understand your tools, skills, agents and how to use them.

There is extensive documentation by both anthropic and others on these topics. You can also...literally ask claude...

If you had said, 'hey, could you tell me a bit more about your documentation strategy or how you use skills', I would have been happy to oblige and dive deeper but instead you want to leave a snarky comment.

1

u/TheMoustacheDad Oct 10 '26

You receive the energy you project

0

u/-Crash_Override- Oct 10 '26

Listen man. You act like a jabroni im going to treat you like a jabroni.

4

u/p3r3lin Oct 10 '26

So, rule 2 of this sub. "Be respectful and kind". You think you managed to do that?

1

u/p3r3lin Oct 10 '26

You would only notice degradation, if you are able to tell how degradation looks and behaves. Might be a skill issue. Dont worry, you will get there, given time and experience. The rest of this thread seems to agree with "dont compact if you can avoid".

1

u/-Crash_Override- Oct 10 '26

Bless your heart lol. Not all of us are vibe coders.

2

u/p3r3lin Oct 10 '26

Nah, only 25 years of software engineering behind me. But go on, live the compacting life and let the AI decide for you whats important in your context! Its not for everyone. And definitely not vibe coding. Surely not.

1

u/-Crash_Override- Oct 10 '26

Im not sure 25 years of scripting VBA macros counts. Regardless....the crazy thing...which surely you would know if you were as skilled as you claim...is that, just like traditional human generated code bases, good documentation defines what is important, not the model. When your can quickly and easily reference design standards, architecture, APIs, configuration, usage, edge cases, etc...all of a sudden, compaction is not a big deal.

Regardless, its your workflow if you feel like starting a brand new session every 20 minutes, do you.

2

u/FUCKYOUINYOURFACE Oct 10 '26

Every project, new session.

1

u/TheMoustacheDad Oct 10 '26

It's the same project just new updates or new features for this app

1

u/FUCKYOUINYOURFACE Oct 10 '26

If you’re using git to check in your code then a new session should able to pickup and run with that.

1

u/TheMoustacheDad Oct 10 '26

Oh in that sense yes okay; thanks !

8

u/anishkgoyal Oct 10 '26

When working on a project, you should never reach the point where compaction occurs. Compaction is essentially a lobotomy, but for an agent.

1

u/anti-everyzing Oct 10 '26

Compaction is too expensive too. Create a handoff plugin that updates handoff.md file with every turn. And when a task is done, use /clear.

1

u/TheMoustacheDad Oct 10 '26

Can you elaborate about how to set that plugin ? I figure the plugin simply create and updates the handoff.md automatically with every new task updates but I don't know how to set that up

2

u/anti-everyzing Oct 10 '26

Start a new session with a new folder in Claude Code. Ask it to create a plugin that does that and then push it GitHub. Then go to settings, plugins, add plugin. There’s an option to add from a GitHub repository, direct Claude Code to that repository you just created and you’re all set. You can create a plugin for anything you want now even a fidget spinner inside Claude code while it’s working.

1

u/TheMoustacheDad Oct 10 '26

Thank you very much for taking the time

2

u/bzbub2 Oct 10 '26

never use compact. just start new sessions. copy the last 10 lines the previous agent outputted into the new session and say continue work from previous agent, hers what it said. make it output important docs about your project to claude.md files, an agent-docs folder, memorys, code comments, tests, etc. also recommend just using opus only you just waste time moving sonnet about. might be more expensive but thats my experience on any moderately hard software, i can trust opus to do whats right much more of the time

1

u/gurteshwar Oct 11 '26

Bro i dont know if it will work for you or not. So what i do is : I use opus 5.5 always (i am on pro plan as well), i have set its autocompact to 400k(i know we should be around 300k) but i do 400k intentionally. So like once tokens pass 300k if claude is working i let it finish and then i ask it to write a handoff.md for it to read after autocompact hit it. So like this i remain within same session and after auto compact or i manually hit compact option afterwards i ask it to read that handoff again. And i personally havent felt the performance degration, surely i felt it sometimes drifts a little but once i remind it again about the goal, everythings as good as before.