The only problem is that this loss is permanent! As far as I can tell, there's no way to go back to the old conversation after a `/clear`.
I had one session last week where Claude Code seemed to have become amazingly capable and was implementing entire new features and fixing bugs in one-shot, and then I ran `/clear` (by accident no less) and it suddenly became very dumb.
You can ask it to store its current context to a file, review the file, ask it to emphasize or de-emphasize things based on your review, and then use `/clear`.
Then, you can edit the file at your leisure if you want to.
And when you want to load that context back in, ask it to read the file.
Works better than `/compact`, and is a lot cheaper.
Edit: It so happens I had a Claude Code session open in my Terminal, so I asked it:
Save your current context to a file.
Claude produced a 91 line md file... surely that's not the whole of its context? This was a reasonably lengthy conversation in which the AI implemented a new feature.
Apologies for the late reply. My kids demanded my attention yesterday.
It doesn't seem to have included any points on style or workflow in the context. Most of my context documents end up including the following information:
1. I want the agent to treat git commits as checkpoints so that we can revert really silly changes it makes.
2. I want it to keep on running build/tests on the code to be sure it isn't just going completely off the rails.
3. I want it to refrain from adding low signal comments to the code. And not use emojis.
4. I want it to be honest in its dealings with me.
It goes on a bit from there. I suspect the reason that the models end up including that information in the context documents they dump in our sessions is that I give them such strong (and strongly worded) feedback on these topics.
As an alternative, I wonder what would happen if you just told it what was missing from the context and asked it to re-dump the context to file.
But none of this is really Claude Code's internal context, right? It's a summary. I could see using it as an alternative to /compact but not to undo a /clear.
Whatever the internal state is of Claude Code, it's lost as soon as you /clear or close the Terminal window. You can't even experiment with a different prompt and then--if you don't like the prompt--go back to the original conversation, because pressing esc to branch the conversation looses the original branch.
I'm excited for the improvements they've had recently but I have better luck with Cline in regular vs code, as well as cursor.
I've tried Claude code this week and I really didn't like it - Claude did an okay job but was insistent on deleting some shit and hard coding a check instead of an actual conditional. It got the feature done in about $3, but I didn't really like the user experience and it didn't feel any better than using 3.7 in cursor.
The only problem is that this loss is permanent! As far as I can tell, there's no way to go back to the old conversation after a `/clear`.
I had one session last week where Claude Code seemed to have become amazingly capable and was implementing entire new features and fixing bugs in one-shot, and then I ran `/clear` (by accident no less) and it suddenly became very dumb.