# Hermes Context Compression

> How Hermes shrinks a long chat. It sums up old turns at half the window.

**Field:** Artificial Intelligence  
**Category:** Hermes Agent  
**Also known as:** Hermes /compress, Hermes compression threshold, Hermes context summary

## Think of it like

It is like telling a long story again in a few lines. Then there is room to talk.

## Definition

Context compression is how Hermes stops a long chat from overflowing the model's context window. When the chat fills half the window, Hermes asks a model to sum up the older turns. The summary takes their place, and the most recent turns stay word for word. Before that, it saves anything worth keeping to memory. You can also run it yourself with /compress.

## Example

Sara's chat with Hermes runs all afternoon. At half the window, the morning's turns become one short summary, and the chat keeps going.

## Example code

```yaml
compression:
  enabled: true
  threshold: 0.50
  protect_last_n: 20
```

Summarise at half the window, and keep the last 20 messages as they are.

## Why it matters

Without it, a long chat hits the window limit and fails. With it, a session can run for hours.

## Common mistake

Trusting a detail from early in a long chat. After a summary, the exact words may be gone.

## Three principles

- **Half full.** The default trigger is 50 percent.
- **Recent stays.** The last turns are kept word for word.
- **Memory first.** Facts are saved before the summary.

## Related terms

- [Context Window](https://learn.benibix.com/term/ai/context-window)
- [Context Rot](https://learn.benibix.com/term/ai/context-rot)
- [Hermes MEMORY.md](https://learn.benibix.com/term/ai/hermes-memory-md)
- [session_search Tool](https://learn.benibix.com/term/ai/hermes-session-search)
- [Auto-Compact](https://learn.benibix.com/term/ai/auto-compact)
- [Context Compaction](https://learn.benibix.com/term/ai/context-compaction)

![A long bar shows the context window. On the left sit the built-in memory files and one memory provider. In the middle, old turns are squeezed into one short summary once the bar is half full. On the right, the last turns stay as they are.](https://learn.benibix.com/diagrams/ai8-hermes-context.svg)

---

Source: https://learn.benibix.com/term/ai/hermes-context-compression
Author: Behnia Zarei (a developer in Vienna, Austria, who builds and teaches data, AI and business intelligence at BENIBIX)
Publisher: BENIBIX Learn (https://learn.benibix.com/)
Last updated: 2026-11-17
Licence: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Quote freely with attribution.
