r/ClaudeCode • u/yadtk • 3h ago
Tips & Workflows PSA: Auto-compaction is a huge source of Claude gaslighting you
Idle compaction silently drops any constraints and guidelines you spent establishing over the course of the chat/project then Claude carries on confidently as if it still knows the assignment and bulldozes you. If you’ve ever been gaslit by an Anthropic model is this why. Disable this “feature” if you find yourself constantly arguing with the model.
53
Upvotes
•
u/AutoModerator 3h 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.
28
u/muhuhaha 2h ago edited 1h ago
As others mentioned the goal, for me at least, is to avoid compacting all together, and also avoid the cache expiring (for newer users, basically if you reply quickly it uses a lot less tokens, if you don't reply for roughly an hour or more, it uses
10x the tokenssame amount of tokens but equivalent of 10x more against your usage limit).My limiting factor to how many sessions i open at once is if I can reply to them in time before cache expires basically. If they get long or im leaving for a while or I'm just worn out, I just ask them to "prep handoff so we can continue in fresh session". Then just start a fresh one and say "lets pickup where we left off". Happy to answer questions for any newer users, I can no longer tell whats obvious or confusing anymore, I promise not to tell you quit claude code and kill yourself hah
9
u/Inner_Storage_3374 2h ago
what helps is keeping the rules in CLAUDE.md instead of the chat. afaik that file gets loaded again after compaction, while stuff you agreed on 2 hours ago in the conversation is a summary line at best. so whenever you catch yourself repeating a constraint, thats the moment to move it into the file
4
u/Dorbank_Justt 2h ago
Per the docs, what gets lost is anything you only said in chat. On compaction the conversation is summarized, but the project-root CLAUDE.md is re-read from disk and re-injected. Nested CLAUDE.md files and rules with paths: frontmatter get summarized away too, and load again when Claude next reads, writes or edits their trigger file. So constraints you can't afford to lose belong in the root CLAUDE.md. To stop the idle pass itself, set "idleCompaction": false in settings or change the Idle compaction row in /config.
2
u/fschwiet 1h ago
Are you also setting your autocompact to 1 million? It was recently changed to 400k.
2
u/momentum77 16m ago
I keep an orchestrator running long term by asking it for a clean compaction prompt. I do this around 400k and 500k context usage. All the sessions it manages are fresh as needed for each task, be they builders or qas or reviewers or planners or documentaries or roadmap maintainers. All those specialists get recycled, but my Prime holds it together tightly
9
u/jd52wtf 3h ago
If your sessions are compacting you aren't properly chunking your projects.
2
u/hi_im_leffe 3h ago
So setup a hook that uses /compact keep: and have Claude identify what should he kept in context as he's working at what token level you want, I recommend 300k.
Have fun.
1
u/Suitable_Cicada_3336 26m ago
Even you don't use auto compacted, claude still cheat at auto missions. 3rd party llm check and fight is necessary.
0
u/akienm 1h ago
Huh. Is that an observation or is that documented somewhere? Because I would say that my observations are the opposite. When we got all of the state data out of the context and onto the disk, the problem went away. And the auto compact now has no effect on the operations.
0
u/EndlessZone123 41m ago
Why is your constraints or guidelines not in a Agents or claude.md? Compaction and chat history is for context. User messages are usually quoted verbatim in the compaction and agents can search compacted history when needed. Seems like user error for me. Or Te your agent to always remember these and write them in the instruction file.
0
u/tehfrod 22m ago
This word you keep using... I do not think it means what you think it means.
-9
u/pceimpulsive 3h ago
My question for those impacted by this is why are you leaving sessions open long enough to need an auto compact... Stop being shit and learn to manage the context better.