pub fn execute_manual_compaction<F>(
session: &mut SessionManager,
keep_recent_groups: usize,
generate_summary: F,
) -> Result<Option<CompactionResult>>Expand description
Execute a manual compaction on the current branch of a session.
This is the main entry point for /compact. It:
- Prepares the history via the safe deterministic pipeline.
- Generates a structured summary of the older prefix.
- Persists a
SessionEntry::Compactionthat partitions the branch.
The generate_summary closure receives the serialized summarization
prompt and returns the LLM-generated summary text. This keeps the
compaction module independent of specific LLM wiring.
Returns None if there is not enough history to compact.