Initial implementation of `/compact` command for conversation summarization
Create the core functionality for the /compact command that allows users to explicitly request conversation summarization. This includes command parsing, summary generation logic, and conversation state management. The implementation will focus on a straightforward approach where the history is cleared and replaced with an AI-generated summary of the previous conversation.
Ideally, we should auto-compact as we progress, including in the background whilst waiting for the next human prompt.
Compaction should include both LLM and robotic reduction of context size.
Reductions could include:
- Deduplication of read/write/read loops to have one latest copy of an object in context (perhaps with an LLM summarized history?) - files, profile contexts, other object types.
- Latest version only of directory tree information
- Summarization of Debug Loops, at the end of any debug cycle, or when output from a tool is more than X big, always summarize it early, once the first action has been performed on the output.
- Summarization of a series of human prompts into an intent and history of tasks / Journal . <"Hey Q, what have I done so far?" could use the journal information>
Manual use of /compact could be the equivalent of "Remember all this and give me a summary". Most of the time, manual use of this command should be treated as an indicator of a bug.