Commit Graph

1 Commits

Author SHA1 Message Date
s4na
3ae28c6ac3 feat(agents): add session_compact tool for agent-initiated context compaction
Add a tool that allows agents to programmatically trigger context
compaction without requiring user intervention via `/compact`.

Currently agents have no way to proactively manage their context window
before memory-intensive tasks, and automatic compaction doesn't allow
custom instructions for what to preserve in the summary.

- Add `session_compact` tool with optional `instructions` and `sessionKey` params
- Support cross-session compaction with A2A policy enforcement
- Disable `bashElevated` during compaction for safety
- Add 7 unit tests covering success, failure, and policy scenarios
2026-01-30 00:12:28 +09:00