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

@ -110,6 +110,19 @@ at_unix_timestamp?)`, `request_next_turn()`.
`homeserver`); omitted for agents with no matrix provisioning. Omit
`name` to query self.
**Always-on, no tool group** (like `set_status`): `compact()`.
- `compact` — agent self-service equivalent of the operator dashboard's
`/compact` button. No args. Gated server-side on the last completed
turn's context usage: refused (with an explanation, no side effect)
unless usage is above 66% of the effective context window. On a
pass, queues the same deferred `compact_pending` flag the dashboard
button sets — consumed at the end of the current turn, so it never
races a live claude process, and the usual pre-compaction
notes-checkpoint turn still fires first. Dispatched through the
in-agent socket (`hive-agent-sock::Request::Compact`), not the
broker — see `hive-agent/src/todo_server.rs`.
## Privileged tools (by tool group)
- **Bash execution** (`execution`) — background shell tasks. See