-
-
Notifications
You must be signed in to change notification settings - Fork 40.3k
Closed
Labels
enhancementNew feature or requestNew feature or request
Description
Currently there's no way for hooks to act before a session is compacted, resulting in permanent context loss.
Problem:
When a session reaches context limit and is compacted, all conversation history is lost. The agent must manually reconstruct context by re-reading memory files.
Proposed solution:
Add new event: session:pre-compact
Trigger: Before context compression begins
Use cases:
- Save conversation summary before compaction
- Export important decisions/context to memory
- Alert user that context will be lost
- Allow memory-autosave hook to capture final state
Example hook:
// hooks/bundled/pre-compact-save/handler.ts
const handler: HookHandler = async (event) => {
// 1. Extract current context
// 2. Summarize with LLM
// 3. Save to memory/YYYY-MM/DD-{channel}.md
// 4. Optionally keep "hot" context for re-injection
};Related: This would solve the context recovery problem and enable better memory continuity.
Priority: 🟠 High
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request