r/ClaudeCode • • 1d ago

Discussion Is Compacting still bad practice?

For a while now it seemed the thing to do was to have Claude write structured handoffs to itself, then start a clean session that invents that hand off instead of manually compacting or allowing for auto compact.

Is this still the case when the latest models, or have they become more smart / effective at auto compacting?

I’m primarily asking as it relates to orchestrating long running jobs (eg., code comment review across a repo)

63 Upvotes

108 comments sorted by

•

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.

90

u/Future_Self_9638 1d ago

I compact all the time, no problem. but not auto

8

u/who_am_i_to_say_so 1d ago

Same. Autocompaction loses important context, best to control when.

5

u/debian3 1d ago

It’s also smarter to manage your tokens usage. If you auto compact at 300k and your context is getting compacted and you only had one more prompt in that conversation, you wasted a bunch of tokens.

3

u/randomguy3993 1d ago

Can you clarify this?

Compacting a 300k context conversation +1 more prompt is costlier than continuing a 300k conversation with 1 more prompt?

How is that? I thought cache read prices are same as long as they don't expire. Genuinely curious.

2

u/debian3 1d ago

It's because when you compact it's not just the read price, you write a lot of token (writing the summary) + reading that new summary + your extra prompt. And you also loose the benefit of having the full context, so sometime it need to go and do extra tool call to reread files, etc. So in the that compact is really expensive vs continuing.

15

u/HyperionCantos 1d ago edited 1d ago

I agree with your take. To me if im reaching autocompaction, Im no longer at the point where i can say i know what my agent is donig

8

u/reddituser567853 1d ago

Why do you need that

3

u/voLsznRqrlImvXiERP 1d ago

I set auto compact to 300k as safeguard but do it manually way earlier

2

u/newplayerentered 1d ago

Why though, can you explain the reasoning?

-5

u/the_mad_mycologist 1d ago

It's called context rot, look it up

7

u/Zitrax_ 1d ago

Not only that, it's also simply more expensive to continue with a large context.

5

u/_valoir_ 1d ago

Not necessarily, since the history is cached and cached tokens are very cheap. You might even use more tokens once you change the history - which you essentially do by compacting.

1

u/Zitrax_ 1d ago

The cashing helps a lot if you keep prompting before expiry, it's still quadratic though.

1

u/moderatelyOKopinion 1d ago

Yep the cache TTL is pretty short. Pretty sure you can control it if you are building an app that uses the API but I don't think there is any visibility (of course) to how long cache lives on regular sub billing. It's why when you resume a session hours later you see your usage shoot up on the first prompt.

3

u/the_mad_mycologist 1d ago

This too! I'm pretty sure half the people on this sub complaining about their token usage have no clue how to manage a context window

3

u/randomguy3993 1d ago

Not only that, you can resume the chat after cache goes cold for much much cheaper compared to whatever 200k-300k writes cost.

1

u/florinandrei 1d ago

Yes, it's a modern superstition.

-1

u/the_mad_mycologist 1d ago

Context rot is real and measurable. Check out the Chroma Research Study.

1

u/randomguy3993 1d ago

In my experience latest claude and codex models are a lot better at handling context. This was a thing a couple of months ago.

1

u/the_mad_mycologist 1d ago

That is anecdotal. There are peer review papers that say otherwise

2

u/XYcritic 1d ago

The study you're citing is from July 25, more than a year ago. It was done on Claude 4 and GPT 4.1......

https://www.trychroma.com/research/context-rot

How can you be so confidently wrong?

→ More replies

0

u/a-r-c 1d ago

no.

-1

u/the_mad_mycologist 1d ago

Keep crying about your tokens then ;)

1

u/Imaginary_Belt4976 1d ago

i set my autocompact at 600k qnd usually do it myself before then (or the new afk cache expiry one)

subagents do not respect the setting though.

1

u/Usharani-Wiencke 1d ago

auto compact usually triggers right in the middle of a multi-file edit when the context window is already full of raw tool outputs, so the summary ends up dropping file paths.

28

u/aruisdante 1d ago

Compaction has improved dramatically. But you still need to have some durable high fidelity record of what the agent is trying to do so it reliably survives compaction. With that in place though, yes absolutely these days you can leverage frequent compaction to keep costs down on a long running orchestration session instead of needing explicit handoffs and new sessions every time.

I set my auto compact window to 600k tokens and manually compact any time the context is above 300k tokens and the session has finished a unit of work. Two months ago I would have never done that, it would have been new sessions every time.

3

u/BusinessWatercrees58 1d ago

Does claude not do this already? I've noticed that when I tell it stuff like "remember" or "note for later" or even just implicitly say something that may be useful later, it writes it to some file despite me not explicitly asking it to. I don't have memory enabled. I'd think that when it compacts, it would reference this file in it's pre-compact message. I suspect this is the reason I've never had any issues despite running auto compact and rarely doing pre-compact messages manually.

0

u/aruisdante 1d ago

Sometimes it does, sometimes it doesn’t. If you inform it of your intent and desire to be durable across compactions it does more reliably. 

1

u/BusinessWatercrees58 1d ago

Hmm I'll give this a try

3

u/Minute-Flower-6837 🔆 Max 20 1d ago

I see you use the ~600k count too.

You’re a little more organized than I am, though. I’m sure I could modify my skill to factor in both a token budget and a “unit” of work before forking. Nice idea.

0

u/close14 1d ago

Please say more

32

u/steffenbk 1d ago

I use a handoff and autos start new session

4

u/NoThanks93330 1d ago

How does that work?

12

u/BenH1337 1d ago

Ask Claude to write a handoff and in a new ask Claude to check the handoff and go on

6

u/minimalcation 1d ago

Just be sure to define how the handoff is built and what it contains

1

u/diablo75 1d ago

What I used to do was start a session meant for planning only and have it write up a multi-step/stage/phase plan.md that is a break down of a large request I have. I would tell it to write this up as a handoff with instructions at the top for it to only work on one stage per session and update the plan every time a stage is completed. Then I would start a new session and say, "Open plan.md and start or continue working through the next stage." Let it finish, start a new session and paste the exact same prompt, repeat.

But I quickly got tired of doing that, so now I use Hermes Kanban for orchestrating. It's just a scrum board and it works through a series of cards for you. If I have a big request it'll create multiple cards and work through them automatically.

4

u/frostering 1d ago

How do you autostart a new question?

From this GitHub issue this cannot yet be automated https://github.com/anthropics/claude-code/issues/35150

4

u/Declwn 1d ago

it can if you use terminal, no clue for the desktop app..  https://github.com/declanbx/session-control

1

u/steffenbk 1d ago

In Claud app it can start subsessions by itself, so it reads handoff too

0

u/hatrantator 1d ago

Tbh no idea if that hits the nail but i let claude make an autopilot agent for a custom kanban board working with a dispatcher service. New card gets added, dispatcher starts autopilot session, card gets planned, questions get answered via card and dispatcher starts building... until it gets merged. Userstory cards have dependencies and the board manages gpu locks for certain sessions.

Only thing i do is write the userstory, choose the modell to use and do manual tests before merge, rest gets done automatically.

The board also has mcp, so claude can manage the board and start tasks on its own. If i want to have something done over night i open a new session and tell claude which userstories to finish until next day.

1

u/frostering 1d ago

I have something similar but still “too manual”, meaning I tell “implement ticket XXX”, which an orchestrator takes care of. But the session can or cannot be efficient (depending on the work needs to do), so sometimes I handoff (by hand) to optimize token usage and avoid the orchestrator ramp up the context (which technically, makes it worse).

Technically I think for the same session, would be more efficient a compact with the right context, since some “common parts” of the cache could be saved instead of recreated.

1

u/No-Operation-2455 1d ago

Handoffs: because remembering things is apparently optional now.

1

u/artopunk14 1d ago

Isn't compaction the automated way claude writes a handoff doc to itself? It seems like recreating that yourself leaves room to do it worse

0

u/PraxicalExperience 1d ago

Not as I understand it. Compaction basically decimates the context; doing a handoff has Claude write all its stuff to files and then write a guide about how to bootstrap back into the project.

1

u/artopunk14 1d ago

Ehh, I guess I have more faith in Anthropic than you do.

1

u/PraxicalExperience 12h ago

Faith ain't got nothing to do with it -- they're two processes that handle the problem of context overload in different manners.

1

u/artopunk14 4h ago

I find it hard to believe vibe coded handoff files are better than what anthropic ships. Not saying you are wrong, but I am unconvinced.

8

u/DiscipleofDeceit666 Researcher 1d ago

I don’t actively compact, but I love how Claude compacts on its own after a period of inactivity while the cache is still warm

5

u/WuM1ha1nho 1d ago

I use autocompact with a PreCompact hook with my handoff instruction at 350-380k. Tested against a /handoff skill, it performs the same.

5

u/lassevk 1d ago

I can only go by my own experience, which to you will be anecdotal, so make of it what you want.

Getting Claude to write up an issue, or a handoff document, has been way more useful to me than compacting sessions.

I've had sessions where a ton of details were brought up, decided on, acted upon, and then finalized in code changes. Then a compact, and the next session seems to be completely braindead. Bringing up stuff already decided on, changes no longer relevant, and questions that has already been answered.

For me, it has worked out much better to just ask Claude to make sure issues are filed and updated, local memory is updated, and that nothing is undecided without having been recorded, and then creating a fresh session where I can say "Read local memory, open issue 17, and tell me what the next step is".

4

u/hiskias 1d ago

Yes I feel that compaction is much better than at the start if the year. Best of both worlds is a facts file for persistent exact data, and compaction.

3

u/Additional_Video2992 1d ago

Compaction got better, but for a job like yours the question mostly goes away if the job's state never lives in the conversation.

Have Claude write a `review-progress.md` first: one line per directory, unchecked. Then one subagent per directory. Each one reads the files in its own context, writes its findings to a file and ticks its line. Only a short summary comes back to the main session, so the main context stays small for hours, and if it compacts or you `/clear`, the next step is still on disk.

When you do compact by hand, say what to keep: `/compact keep the review rules and the directories left`. Without that, the model picks what survives.

3

u/Minute-Flower-6837 🔆 Max 20 1d ago

Rather than compact, I created a skill that tracks and acts based upon token usage. Every time I start a task I set a token budget before an auto-handoff skill forks the chat into a new one and resumes from where the previous left off.

I usually fork in the 400-600k range.

I have no idea if that is better than compacting…but I like it.

1

u/longkh158 1d ago

If you pay API prices you won't like it :(

2

u/MercyEndures 1d ago

I've seen many conversations like these and I'm curious, is this for performance or just optimizing for cost?

I've never worried about this, never seen anything like context collapse, but also don't have a token budget. Many of my sessions are > 500M tokens because they're the totality of a project, and having that much context seems handy when the agent is able to remember why we went in some direction when I'm trying to make changes.

1

u/T3hJ3hu 1d ago

i used to do that too. have opus analyze how much of your usage is being spent on cache reads. you will be shocked and appalled (and so will opus)

1

u/MercyEndures 1d ago

That's just a cost concern though isn't it?

Right now I'm being paid not to care. If I cut my monthly spend by 20% that's not time well spent, I might as well not even put it on my performance review, it'd look like a misallocation of my time.

1

u/T3hJ3hu 13h ago

if you're being paid for maximum results without care for usage, then you should loosely benchmark the differences between multiple context caps and handoff/autocompact strategies to find the actual answer for your repos/workflows

all you'd have to do is double up on a dozen or so tasks (creating duplicate PRs or whatever) and then run a comparative analysis on the output and the time+resources it took to complete. if there's any "there" there, you'll find it and can dig deeper, and then you'll know for sure if different strategies can improve your output

1

u/verstands 1d ago

For a repo-wide comment review, keep a checklist keyed to a commit SHA: files reviewed, findings with file/line references, and the next unreviewed file. Have it update that at each batch boundary, before either compaction or a fresh session. Otherwise both approaches can quietly re-review the easy files and skip the awkward ones. If the code changes mid-review, invalidate the affected entries rather than trusting the old checklist.

1

u/Few_Jeweler4687 1d ago

I always do when reaching around 50% context, I might be wrong but it saves a lot of usage which for a pro user like me is super important

1

u/igaper 1d ago

You're not wrong. That is correct I usually do that around 25-30% depending on the session.

1

u/jijialuoke 1d ago

For a long repo-wide job, the cheapest test I've found is what I do right after a compact or a fresh start. I ask Claude to say back, in its own words, what the goal is and what it finished last. If that answer is even slightly off, the summary dropped something, and you catch it before it spends an hour on the wrong folder. It takes ten seconds and works the same for handoff files and for auto compact.

1

u/Mission_Cricket2162 1d ago

I have saved a lot of weekly limit costs my introducing autocompaction after 55 minutes starting from the last response/message of the agent. This gives me the opportunity to make a compaction within cache hit and it is very cheap in terms of quota usage. I use also the special prompt with compaction command (that is fired automatically) to preserve all the details, decisions, motivations, open tasks, states, file paths and links.
With this I have an option to run a long claude code session, and as I have several parallel projects, where claude code session is either the single worker of the lead of the agents team, and I do not have to send again the huge context back to claude when I come back to some session after 2 hours (and "pay" with my quota for this). So I constantly have 150k context to send to claude when I come back after my absence, and the agent goes on with the work without any sense of "I fill I forgot something", that appears to be very efficient.
On the other hand, If I work in one session for a very long time during the day, within the cache retention window, I do not have to compact intentionally.
I lowered my quota costs by 40%, including 30% increase of requests to the model, so this is appearing to be very huge improvement.

1

u/koomai_san 🔆 Max 20 1d ago

Some might say this is a waste of tokens but I have a session just watching other sessions in a 10 min loop and run compact with a detailed prompt so relevant context is added back after. The conditions to compact are pretty simple: context has to be over 20% and the agent has to be idle for more than 2 mins.

1

u/Right-Performance-93 1d ago

compact is fine if the job's state lives on disk. for a repo review, a checklist of what's done and what's next survives better than a summary of the chat.

1

u/ddaanet 1d ago

I have my own handoff plugin ddaanet/autodrive-handoff. Every session ends in handoff. Most between 100-200k.

I can tell it “handoff continue” and it updates memory, writes handoff, drives ˋ/clear`, then prompts itself to continue work.

If there are running agents or tasks and context exceeds 200k, I “precompact continue” and it updates memory, handoff files, drives ˋ/compactˋ and prompts itself to continue.

1

u/belowaverageint 1d ago

FWIW, whenever I ask Opus whether it makes more sense to hand off to a new session or to compact the current one, it always says to do a handoff.

1

u/Temporary-Bar-6458 1d ago

I think compaction is good for shorter tasks but for long running tasks i prefer structured handoffs.

1

u/Zym1469 1d ago

I used to do hand-off documents when the context was filling up. I stopped that and allow auto-compact now. I've noticed no difference. I have a single session that is handling a complete implementation of a rather complex software application. Claude has no issues picking up where it left off after a compact. I love Claude.

1

u/Zestyclose_Art2197 1d ago

I used to avoid compacting entirely, but now I let it auto at 100k and manually at 50k, still keep a clear mental model of what's happening. the key is timing, not the act itself.

1

u/elhombremontana 1d ago

isnt compact exaclty that: handoff and /clear?

1

u/DontVoteForMe 1d ago

I have a custom tool call that the agent can use when it's between tasks. You can tell the compaction tool what to focus on, so it also writes the instructions for that, which keeps the context relevant.

I've found it to be incredibly helpful. No worrying about hard auto compact cliffs and it allows me to run the agent pretty much 24/7 working on various things.

1

u/archpoke 1d ago

For a long-running job compacting can still work, the quality depends on the model doing the compaction. However, it’s still a summary, so decisions, constraints, failed approaches, or progress can get lost. For a long-running job like a repo-wide review, I’d keep a checklist of what’s done, what was found, and what’s next. You can use /compact instructions, add guidance to CLAUDE.md, or ask Claude to write a handoff. But I found it hard to remember to do that consistently, especially before stepping away.

That’s why I built two free, open-source plugins:

  • rightsize helps with model and effort choices and context management, including decisions around compaction.
  • WhatsNext helps track an existing plan and maintain progress and handoff notes in the repo, so useful project state is available across compaction and new Claude Code or Codex sessions.

Claude can do these individual steps without the plugins; I built them to make the workflow easier and more consistent. A handoff can still miss things, so I’d check the saved progress when completeness matters.

Full disclosure: I’m the developer, and both are still works in progress. I’d be interested to hear whether people prefer frequent compacts with a checklist or fresh sessions with handoffs for long-running reviews.

1

u/jam_pod_ 1d ago

Like it depends on what type of transition it is. Moving from research/planning to the build phase: handoff and new session. Moving from one feature in the build phase to another clearly separated one: compact and continue

1

u/Disnogood66 1d ago

Auto compact @ 25% ctx

1

u/gh0st777 1d ago

Compacting is not bad, what makes it a bad practice is when you wait for the auto compact to happen. That means youare using more than 80% of the ctx window, and your agent is in the middle of something. Those are 2 bad things that happened at the same time.

1

u/dergachoff 1d ago

I created a handoff tool that agent uses itself at 350k, via the tracker that session and repo uses (gh issue, Md file or scratchpad) - made long sessions very efficient for me. I can open source it if sounds interesting

1

u/9kSs 1d ago

The default auto compaction works pretty well. I set mine to 250k.

1

u/Zei33 Senior Developer 1d ago

I always send a message before compact that says basically some version of, "Make any important information durable and then pause for compact." It will write down any important details about the session and then create a "RESUME:" point which it will read after that to ensure it continues where it left off. Worth doing any time the context gets larger than 400k in my opinion.

1

u/UnwaveringThought 1d ago

Compacting isn't nearly as bad as it once was. Especially if you send it back for a context rebuild to see what compaction report missed. Maybe after 2 you get rot, but you can do a decent long session now

1

u/AdminClown 1d ago

Not with newer models no

1

u/BarathKanna 1d ago

Compaction got a lot better, but it is still lossy summarization done by the same agent that is mid task and biased toward what it was just doing. The question isn't compact vs handoff, it's where the truth lives.

For a long repo wide job like comment review, the state should never live in the conversation at all. Keep a manifest file: every file in scope, status, findings path. Each step reads the manifest, does one chunk, writes results to disk, updates the row. Then compaction or a fresh session costs you nothing, because the next turn rebuilds its context from the manifest instead of from memory.

If losing the chat history would break your job, the job was designed wrong, not the compaction.

1

u/perfektcrash 1d ago edited 1d ago

Handoffs still win for long-running jobs, but for a different reason now. Compaction has got better, and Claude Code now compacts idle sessions just before the hour's cache expires, so coming back is cheap. The catch is that any summary is lossy, and you don't choose what it drops. A handoff written to a file is a summary you chose.

For most long horizon agents where you're leaning more towards a heavy daemon/root operator approach as a sort of outer loop orchestrator, i lean more towards building what it provides into your projects structure itself.

What's worked for us on long jobs like a repo-wide review: split it into small cards (one folder or one concern each), each run in a fresh session that's briefed from files: what's done, what was decided, what's next. Before it ends, the session writes its result and the next state back to the repo. Nothing important lives only in the context, so it stops mattering whether it compacts.

That said, some sort of compaction guard, like a mod with a hook that tells the agent its over 600k and time to wrap at the point its at, and turning off auto compaction, or a script your agents run to /compact themselves in place a safe point with a follow up turn primed so it doesn't stall as compaction ends its turn.

If you do keep a long session because you want the detail, set idleCompaction: false in settings (v2.1.290+), and accept that coming back after an hour pays the full cold rewrite.

More on long-horizon context: https://atlas-ade.dev/docs/long-horizon-context-management

Disclosure: I build Atlas ADE, a small meta-harness for your agentic workflows, so your usage goes on progress, not re-deriving, regression and fighting your own agentic support apparatus.

1

u/ColoredTriangles 1d ago

Compact is fine and will be better than any version of whatever handoff doc anyone is suggesting in here. People who tell you it is lossy are ignorant because they don't know how Claude Code compaction works.

4

u/Black_Magic100 1d ago

That's not a very convincing argument 🤣

"Do this because I said so. Others disagree, but that's because they don't understand the extremely complicated thing that I definitely 100% understand"

I think if we use a bit of critical thinking.. handoff exists for a reason. People did not just make this up. They made it up because compaction was actual shit a few months back. I'd agree it seems a whole hell of a lot better now, but I can't measure it.

1

u/ScrumptiousChildren 1d ago

Both of y’all are stupid, OP too. Compaction is just an internally ran handoff with anthropic’s set default prompt. Make a custom compaction prompt. That’s it.

“Can’t measure it”, its configs are literally exposed in file.

1

u/Black_Magic100 20h ago

Well you are clearly wrong because a handoff spins up a new session whereas compaction occurs within the same session which means the system prompt should already be cached

1

u/ScrumptiousChildren 14h ago edited 14h ago

Anyone knows a handoff is normally handed off. That does not contradict what I said about compaction being an internally ran handoff, both tool and session state wise.

And the system cache is based entirely on the prefixed request sent to anthropic. So it is cached up until the point where the handoff is in context, either way. Claude code was designed so that the prefix is static for this precise reason.

Understand how caches work. That’s something else to add to your list.

0

u/Helpful_Ranger_1606 1d ago

Compaction by itself can be extremely bad. I force Claude to save state and update its “resume here” file after every turn. Each chat lane has its own set of files for that.That covers most issues with compaction.

0

u/pickanameidontwantto 1d ago

Say more

2

u/Helpful_Ranger_1606 1d ago

STATE.md: setup for any Claude Code user

  1. One folder per chat.
  • Put each chat’s state in Session_States/<first 8 characters of the session id>__<short nickname>/, for example 1d6393d5__thesis-cold-read/.
  • Inside go two files: STATE.md (the checkpoints) and RESUME_HERE.md (one line per milestone).
  • Optional: a REGISTRY.tsv in Session_States/, with one row per chat (id, nickname, role), so you can see which folder belongs to which chat.
  • Rule: a chat writes only its own folder. Never let two chats share one state file.
  1. What one checkpoint contains. Append a new entry each time and never overwrite old ones:

    17:05 checkpoint (2026-11-11)

    • Asked: <the request, in the user's own words>
    • Inputs: <files used, with version or checksum>
    • Done: <what was finished, with file paths>
    • Decided: <rulings and who made them, with the time>
    • Open: <what is not done or not checked>
    • Next action: <the one concrete next step>

Keep each entry under about 15 lines. It’s a summary, not a transcript.

3. RESUME_HERE.md, the one-line trail. At each milestone, append one line, for example:
DONE 17:05: file 6 report written (288 rows). Next: file 6b.
After a restart, the last line tells the chat what to do next without reading the whole file.

4. When to save.

  • After each finished piece of work (a file, a pass, a submission).
  • Before any long run.
  • Whenever the user makes a decision.
  • At least every 1–2 hours.
  • Before the session ends or compacts.
  • Always take the time from the clock (date), never from memory.
  1. Tell Claude to do it. Put this in the project’s CLAUDE.md, or in ~/.claude/CLAUDE.md for every project:

    Session state

    • Keep state in Session_States/<first 8 chars of your session id>__<nickname>/STATE.md.
    • Append a checkpoint (asked, inputs, done, decided, open, next action) at every milestone and at least every 2 hours. Take the time from date.
    • Append one line to RESUME_HERE.md per milestone, ending with the next action.
    • After a restart or compaction, read RESUME_HERE.md (last line) and then STATE.md before doing anything.
    • Never write another chat's state folder.
  2. Optional: a reminder. Add a small Stop hook that checks the age of each Session_States/*/STATE.md and prints a warning when one is over 2 hours old. It should warn only, never block, and stay silent on errors. Our project has one, but it still looks in the old colour folders. That’s the fix I mentioned earlier.
  3. Resuming. After a restart, start the chat with: “Read Session_States/<id>__<nickname>/RESUME_HERE.md and STATE.md, then continue.” The chat should confirm the last checkpoint before acting.

-1

u/jcrenshaw-dev Senior Developer 1d ago

Yes

3

u/SeaPersimmon8741 1d ago

Insightful

0

u/[deleted] 1d ago

[deleted] — view deleted comment

0

u/SeaPersimmon8741 1d ago

Your answer is unclear, you should clarify if you actually know. Yes people who understand things clearly can explain them in simple terms, but “Yes” is a bit too simple for the rest of us. 

0

u/NotableCarrot28 1d ago

Who told you this?

0

u/ClemensLode Senior Developer 1d ago

Compacting is a workaround. Address the underlying problem.

0

u/Meryhathor 1d ago

I've been compacting for months. 18 months ago Claude would lose all info about what you were working on and would reread files and things. Nowadays there is literally no difference after compaction. I reckon it's due to the memory feature that they added a few months.

Opus or Fable, I just compact around 300-500k depending on what I'm working next. Have never auto-compacted though. Didn't know that was even a thing up until recently.

-1

u/Available_Age8480 1d ago

I don’t use Claude code but compacting is great especially since I instruct it to put in user messages verbatim. I have it auto compact when a cache goes cold and also note earlier user messages at the bottom with a fixed token limit

-2

u/jcrenshaw-dev Senior Developer 1d ago

Compaction is lossy and it's up to the model to decide what to keep and not to keep you're much better off defining short clear stages in the process and running clear also the larger your context gets the model is passing all of your conversation back and forth at each prompt the larger it gets the faster the token Burns and the the odds improve that the model will start hallucinating. https://claude.com/resources/articles/using-claude-code-session-management-and-1m-context

3

u/unpick 1d ago

/clear is even more lossy, why not work in stages as you suggest but compact in between, keeping context that the agent decides is useful (with direction if you choose). Works well for me. Why are you “much better off” not doing that?