add agent-facing compact tool gated on context usage

This commit is contained in:
damocles 2026-07-23 10:08:34 +02:00 committed by mara
commit e9df5def02
6 changed files with 133 additions and 16 deletions

View file

@ -83,6 +83,14 @@ pub enum Request {
/// reminder-activity chart data (was `hive-core-agent-sock`'s
/// `ReminderRollup` against the broker; now served from the local store).
ReminderRollup { since_secs: u64 },
/// Agent self-service request to compact the current session, mirroring
/// the operator's `/compact` dashboard button. Gated server-side: only
/// honoured when the last completed turn's context usage is above 66%
/// of the effective context window — below that, `Response::Err`
/// explains why and takes no action. On a pass, queues the same
/// deferred `compact_pending` flag the operator's button sets (consumed
/// at the next turn boundary), so it never races a live claude process.
Compact,
}
/// A response on the in-agent socket. Serialised with a `kind` tag,