-
-
Notifications
You must be signed in to change notification settings - Fork 39.8k
Description
Problem
When conversation context gets too long, Clawdbot compacts it automatically. If the summary generation fails (or is incomplete), critical context is lost permanently.
Currently there's no warning before compaction happens, so the agent can't proactively save important information.
Proposed Solution
Add a pre-compaction hook that fires before context compaction begins:
- Clawdbot detects context approaching limit
- Fires a hook/event:
pre-compaction(or calls a configured script/prompt) - Agent has opportunity to:
- Dump key decisions to files
- Save action items
- Update memory/context files
- Confirm readiness
- Compaction proceeds
- Critical context is preserved in external files
Alternatives Considered
- Manual discipline: Agent writes to memory files in real-time (current workaround, error-prone)
- More frequent scheduled syncs: Still can miss fast-moving conversations
- Larger context windows: Expensive, doesn't solve the fundamental problem
Use Case
Late-night planning session with important decisions. Scheduled memory sync ran at 21:00, conversation continued until 23:00 with key decisions. Context compacted overnight, summary failed, decisions lost.
With pre-compaction hook: Agent would have saved the decisions before compaction.
Additional Context
This would make Clawdbot agents significantly more reliable for long-running conversations and reduce the "amnesia" problem that frustrates users.