#21547: feat: add compaction.announce config to notify users of compaction start/end
docs
agents
size: M
Cluster:
Compaction Enhancements and Features
## Summary
Add a new `agents.defaults.compaction.announce` (boolean) config option that sends user-visible messages when auto-compaction starts and ends, **independently of verbose mode**.
## Motivation
In multi-user setups (Discord servers, group chats), compaction can take 30+ seconds to several minutes. During this time, users see no response and may think the agent is broken or ignoring them. The existing compaction message only appears when verbose mode is enabled, which also enables other noisy output most users don't want.
This feature was inspired by a user comparing it to game servers announcing "World save in 2 minutes" — a simple status message that sets expectations.
## Changes
| File | Change |
|------|--------|
| `types.agent-defaults.ts` | Add `announce?: boolean` to `AgentCompactionConfig` |
| `zod-schema.agent-defaults.ts` | Add `announce` to Zod validation |
| `agent-runner-execution.ts` | Emit start message via `onBlockReply` when compaction begins |
| `agent-runner.ts` | Emit end message when `announce` is enabled (not just verbose) |
| `followup-runner.ts` | Same for followup runner path |
## Config
```json
{
"agents": {
"defaults": {
"compaction": {
"announce": true
}
}
}
}
```
## Behavior
- **Start**: `🧹 Compacting memory — back in a moment…` (sent mid-stream via block reply)
- **End**: `🧹 Auto-compaction complete (count N).` (prepended to final reply)
- Default: `false` (no behavior change for existing users)
- Works alongside verbose mode — if both are enabled, no duplicate messages
## Testing
- Existing `wired-hooks-compaction.test.ts` passes (3/3)
- Existing `agent-runner.runreplyagent.test.ts` "announces auto-compaction" test passes
- TypeScript compiles cleanly (no new errors)
- Zero impact when `announce` is not set (default `false`)
<!-- greptile_comment -->
<h3>Greptile Summary</h3>
This PR adds a new config option `agents.defaults.compaction.announce` that allows users to receive compaction status messages independently of verbose mode. This addresses a UX gap in multi-user environments where compaction can take 30+ seconds and users see no feedback.
**Key changes:**
- Adds `announce?: boolean` to `AgentCompactionConfig` type and Zod schema (defaults to `false` for backwards compatibility)
- Updates `agent-runner-execution.ts` to emit "🧹 Compacting memory — back in a moment…" via `onBlockReply` when compaction starts
- Updates `agent-runner.ts` and `followup-runner.ts` to prepend "🧹 Auto-compaction complete (count N)." to final payloads when compaction ends
The implementation correctly checks for the config flag and uses the existing `onBlockReply` mechanism for mid-stream notifications. The changes are minimal, focused, and follow existing patterns in the codebase.
<h3>Confidence Score: 3/5</h3>
- This PR is mostly safe to merge but has one implementation gap that should be addressed
- The config schema changes and agent-runner implementation are correct, but followup-runner is missing the compaction start announcement that agent-runner-execution has. This creates an inconsistency where some code paths will show the start message and others won't. The feature will partially work but not uniformly across all execution paths.
- Pay special attention to `src/auto-reply/reply/followup-runner.ts` which needs the start phase handling
<sub>Last reviewed commit: 79ccf46</sub>
<!-- greptile_other_comments_section -->
<sub>(4/5) You can add custom instructions or style guidelines for the agent [here](https://app.greptile.com/review/github)!</sub>
<!-- /greptile_comment -->
Most Similar PRs
#14887: feat(compaction): configurable auto-compaction notifications with o...
by seilk · 2026-02-12
84.7%
#19329: feat: add per-agent compaction and context pruning overrides
by curtismercier · 2026-02-17
81.2%
#10214: feat(compaction): Add Anthropic server-side compaction API support
by GodsBoy · 2026-02-06
81.2%
#8313: feat: auto-compaction support for spawned subagent sessions
by vishaltandale00 · 2026-02-03
81.1%
#11089: feat(compaction): support customInstructions and model override for...
by p697 · 2026-02-07
80.7%
#14021: feat(compaction): optional memory flush before manual /compact
by phenomenoner · 2026-02-11
79.7%
#19232: fix(compaction): preserve exact identifiers in summarization
by brandonwise · 2026-02-17
78.2%
#19923: feat: track held messages during compaction gate and split verifica...
by PrivacySmurf · 2026-02-18
77.9%
#20038: (fix): Compaction: preserve recent context and sync session memory ...
by rodrigouroz · 2026-02-18
77.9%
#15927: feat: add compaction.model override config option
by Shuai-DaiDai · 2026-02-14
77.5%