Module 4: Memory Fundamentals•Lesson 7 of 8
Observe Compaction Behavior
Observe Compaction Behavior
Let's actually see how compaction works.
Exercise 1: Fill Your Context
Have a long conversation with your agent:
- Discuss multiple topics
- Share specific details (numbers, names, dates)
- Make decisions together
- Create some files
Keep going until you see context warnings or notice summarization.
Exercise 2: Test Memory Before Compaction
Before the long conversation ends, note:
- 3 specific facts discussed
- 2 decisions made
- 1 file created
Exercise 3: Start a New Session
End the session and start fresh. Ask about:
- The specific facts
- The decisions
- The file
What You'll Notice
Without proper memory:
- Agent forgets the facts
- Doesn't know about decisions
- May or may not remember the file (depends on if it's in the filesystem)
With proper memory:
- Facts are in daily log or detail files
- Decisions are logged with [E] tag
- File creation is noted
The Pre-Compaction Flush
In a future long conversation, when you notice context getting large:
- Tell your agent: "Before we continue, let's save important context"
- Have it write a summary of key points to daily log
- Update WORKING.md with current state
- Continue the conversation
Then test if the information survives compaction.
Validation
After this exercise, you should understand:
- How context fills up over long conversations
- What happens when context gets compacted
- Why explicit memory saves are necessary
- The pattern for preserving important information