Yes, it's better to compact before it gets out of cache. I think new versions of Claude Code can do that automatically. It can be cheaper if you switch to Haiku or something