Expand description
Microcompact — lightweight tool result aging without full compaction. Microcompact — lightweight tool result aging without full compaction.
Replaces old tool result content with a stub ([Old tool result content cleared])
directly in the database. No LLM call, no API cost — just a SQL UPDATE.
Time-based trigger: only fires when the gap since the last assistant message exceeds a threshold (default 5 minutes). This prevents aggressive clearing during active tool use and matches Claude Code’s pattern where microcompact only runs when the prompt cache has gone cold.
Inspired by Claude Code’s microCompact.ts.
Structs§
- Microcompact
Result - Result of a microcompact pass.
Constants§
- CLEARED_
MESSAGE - Stub text that replaces cleared tool results.
Functions§
- diagnosis
- Identifies the best candidates for microcompact using context analysis.
- microcompact_
session - Run microcompact on a session — clear old compactable tool results.