compaction-prompts
Compaction prompts
Use this skill to inspect, design, and update compaction_settings.prompt for a Letta agent.
Compaction runs when message history grows too large for the context window. Letta replaces older messages with a summary while keeping recent messages in context. The summary appears before the remaining recent messages, so the prompt should preserve enough background for the later messages to make sense. The goal is continuity, not just factual compression.
Official docs: https://docs.letta.com/guides/core-concepts/messages/compaction
Compaction lifecycle
Think of compaction as a lifecycle contract, not just a prompt string:
- Message history approaches the context window limit.
- Letta selects messages to compact according to the mode and sliding-window settings.
- A summarizer reads the selected messages. If an existing summary is being evicted, the new summary must incorporate it.
- Letta reinserts the summary before the retained recent messages.
- The next model turn relies on the summary plus recent raw messages as continuation context.
The summary is not a reply to the user. It is context for the next turn. It should be readable before the retained recent messages and should not require access to the evicted transcript.