[Feature] Add "compact" as executable task
I use some /project commands, and i would really like it to be able to be explicitly say "compact after each task"
Or, since the /compact command supports what to focus on, i would really like it to be able to have in my prompt "when compacting, focus on ...". So we have a bit more control when compacting happens, and it doesnt wait for the last possible second to do it.
By the way, sometimes its too late for compacting, as it exceeds the limit.
Although a different approach and not as beneficial for interactive sessions, you could use the SDK and with the following to do programmatically:
- claude -p "/project-command"
- Capture session ID
- claude -p "/compact" -r "<session_id_from_above>"
Alternatively you could have the /project-command write our the summary for a markdown then start a new session immediately after your prior and then read the markdown as your context bootstrapper. If you ware building enough around your project to build custom commands you could write this to a local SQLite table as well.
But yes having more control around the active memory/context would be very powerful. If that was the case though just being able to call /compact on demand would be too much of a sledge hammer.
Also what kind of prompts are your storing in the /project commands and how many of them do you have? are you storing them in git?
This issue has been inactive for 30 days. If the issue is still occurring, please comment to let us know. Otherwise, this issue will be automatically closed in 30 days for housekeeping purposes.