Demo, all content is generated
Question

after /compact Claude forgot which files we already changed

Solved · 331 views · asked by bianca_f · edited

I was moving my app from local state to Supabase, like 15 files. Around halfway Claude Code said context was running low so I typed /compact. After that it started re-doing files that were already done and even reverted one to the old useState version.

Is compact supposed to lose that much? What do people do on long tasks?

What I’ve tried

Told it 'check git diff to see what you did' which helped a bit, but it still redid one file.

Comment
Did it compact automatically or did you run it yourself when it warned? abby_ops · edited
I ran it myself when the 'context low' message showed. bianca_f · edited

3 answers

Marked as helpful by the asker
sergio_ruiz · edited

Don't keep progress in the conversation, keep it in a file. For anything over ~5 files I start with:

Write a checklist of every file to migrate to MIGRATION.md. After each file, tick it off in that file. Before starting a file, read MIGRATION.md.

Now it doesn't matter whether you /compact, /clear or come back tomorrow: the state is on disk and in git. Commit after every 2–3 ticked files, so a bad revert is a git diff away from being spotted.

Nadia's instruction trick is good too, but a file survives things a summary doesn't.

Comment
The checklist file is so simple and it works. Did the rest of the migration with two /clear's in between and nothing got redone. bianca_f · edited
Agreed, file beats summary. I use both now. nadia_r · edited
+1, same trick works for long bugfix sessions: a NOTES.md with what we ruled out. zainab_a · edited
nadia_r · edited

Compact replaces the conversation with a summary. Summaries lose details like "file 7 of 15 is done", so that's expected, not a bug.

You can steer it: /compact takes instructions.

/compact keep the list of files already migrated and the ones still to do, and the rule that we use the server client in app/
Comment
abby_ops · edited

Also: compact yourself at a natural break (after a commit) instead of waiting for the warning. Auto-compact near the limit happens mid-task, which is the worst moment to summarize.

Comment