Letting Claude Code auto-summarize a long session is fine. Telling it what to keep is better.
/compact frees up context by summarizing the conversation so far, and it takes optional focus instructions.
/compact keep the failing test names and the decision to use SQLite
Run /context first if you want to see where the space went. It draws your context usage as a colored grid and suggests what to trim. Between the two, you can decide whether to compact, to /clear and start over, or to leave things alone. /clear starts a fresh conversation and can label the old one so you find it in /resume.
I would compact at a natural pause: after a feature works, before the next one starts. A summary written while the goal is clear is a better summary than one squeezed out at the limit.
The caveat: a summary is lossy by definition. Anything you did not name may get squeezed out, and compacting does not shrink your CLAUDE.md, which is loaded again. If one detail must survive, say it in the instruction or put it in a file.
Further reading: Commands – Claude Code docs, On this site: ask Claude Code a /btw question and keep your context clean