#14128: config: add readable durable/off mode for pre-compaction memory flush
docs
gateway
stale
Cluster:
Memory Management Enhancements
## Summary
- add a readable `agents.defaults.compaction.memoryFlush.mode` switch with `durable | off`
- keep legacy `memoryFlush.enabled` behavior for backward compatibility
- make `mode` take precedence over `enabled` when both are set
- document the new switch in compaction/configuration docs and update examples
## Why
`memoryFlush.enabled` works but is hard to read in configs and discussions. A named mode makes intent clearer while keeping old configs working.
## Testing
- `pnpm vitest run src/auto-reply/reply/memory-flush.test.ts src/config/config.compaction-settings.test.ts`
- `pnpm check`
- `pnpm build`
- local agent smoke run (`openclaw agent --local --agent main ...`) after rebase on latest `origin/main`
<!-- greptile_comment -->
<h2>Greptile Overview</h2>
<h3>Greptile Summary</h3>
Added a readable `mode` field (`durable` | `off`) to `agents.defaults.compaction.memoryFlush` configuration, replacing the less clear `enabled` boolean while maintaining full backward compatibility. When `mode` is set, it takes precedence over the legacy `enabled` field.
<h3>Confidence Score: 5/5</h3>
- This PR is safe to merge with minimal risk
- The implementation is clean, well-tested, and maintains complete backward compatibility. The logic correctly prioritizes the new `mode` field over the legacy `enabled` field. Tests verify both the new behavior and backward compatibility. Documentation is comprehensive with only minor wording improvements suggested.
- No files require special attention
<!-- greptile_other_comments_section -->
<sub>(3/5) Reply to the agent's comments like "Can you suggest a fix for this @greptileai?" or ask follow-up questions!</sub>
<!-- /greptile_comment -->
Most Similar PRs
#14021: feat(compaction): optional memory flush before manual /compact
by phenomenoner · 2026-02-11
81.7%
#10644: feat: add runDuringHeartbeats option for memory flush (AI Assisted)
by tripphillips · 2026-02-06
80.3%
#15945: fix(memory-flush): only write memoryFlushCompactionCount when compa...
by aldoeliacim · 2026-02-14
77.4%
#19329: feat: add per-agent compaction and context pruning overrides
by curtismercier · 2026-02-17
77.3%
#8900: fix: improve default memory flush prompts with urgency and specifics
by joetomasone · 2026-02-04
77.1%
#8919: Pr/memory flush improvements
by shortbus · 2026-02-04
77.1%
#14887: feat(compaction): configurable auto-compaction notifications with o...
by seilk · 2026-02-12
76.6%
#12760: fix(memory-flush): fire on every compaction cycle instead of skippi...
by lailoo · 2026-02-09
75.8%
#20713: fix(compaction): trigger memory flush after missed compaction cycles
by zerone0x · 2026-02-19
75.7%
#18663: feat: progressive compaction escalation and mechanical flush fallback
by Adamya05 · 2026-02-16
74.7%