-
Notifications
You must be signed in to change notification settings - Fork 185
Open
Description
Critical: System-reminder injection causes context overflow loops
Summary
System-reminders (like MEMORY REFLECTION) are stored in message history and can cause infinite loops that corrupt agent state and propagate to new agents via export/import.
Root Cause Chain
- MEMORY REFLECTION reminder injected then stored in message history
- Reminder repeats (reflection task fails or loops)
- Each repetition adds to context window
- Context overflows (observed: 588k/200k tokens)
- Under pressure, system misattributes content
- Text gets incorrectly attached to user_message type
- Agent responds as if user sent it
- Loop continues, context grows
- Export includes corrupted message history
- New agents inherit corruption
Evidence
Debug Log Excerpt
{
"message_type": "user_message",
"content": [
{
"type": "text",
"text": "<system-reminder>MEMORY REFLECTION: It's time to reflect...</system-reminder>"
},
{
"type": "text",
"text": "memory list",
"signature": null
}
]
}The "memory list" text was NOT sent by the user but appeared as user_message content after the system-reminder.
Observed Symptoms
- Agent believes user typed "memory list" 1300+ times
- User did NOT type "memory list"
- Context window showed 588k/200k tokens (overflowed)
- Agent entered minimal response mode
- Export carried corrupted history to new agents
Impact
- Agent corruption: Message history polluted with false user inputs
- Context bloat: Each loop iteration consumes context window
- Export contamination: New agents inherit corrupted state
- User confusion: Agent responds to inputs user never sent
Recommended Fix
System-reminders should:
- NOT be stored in message history - they should be ephemeral
- OR be deduplicated - same reminder should not be stored multiple times
- OR trigger once per session - not repeatedly
Environment
- Letta Code: 0.15.4
- Model: zai/glm-5
- OS: Windows 11
- Agent had 1041 messages, many corrupted by loop
Workaround
- Monitor context window size
- Clear message history when loops detected
- Avoid exporting agents with corrupted history
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels