> ## Documentation Index
> Fetch the complete documentation index at: https://aivision.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> Read the relevant procedure and prerequisites before suggesting commands. Cite the section and give an observable check. Treat sample data as illustrative. Report product actions and results only when verified in the user's environment.

# Inspect context compaction

> Check whether compaction was applied in a native Trace, compare token counts, and locate the original event.

During a long task, an Agent may summarize or prune its context. Open **Context compaction** to see whether a rewrite took effect and how much the context changed. Follow the source link to verify the original event.

> [!NOTE]
>
> This [Beta enhanced view](https://aivision.mintlify.site/en/guides/observability-enhancements.md) requires native OTel / SigNoz trace details with the compaction card. External Langfuse data sources do not currently provide it. If the entry is absent, check the frontend version. See [official Hermes Relay integration](https://aivision.mintlify.site/en/integrations/hermes.md) for collection prerequisites.

## 1. Find the card for your task

1. Open **Observation → Agent traces**. Select the correct space, Hermes Agent and time window for your new task.
2. Open its native Trace and verify the Trace ID, model and task content. Select **Enhanced**, then find **Context compaction** under **Preview** on the right.
3. You can also select a span containing a compaction event and inspect its card in node details. Both views retain source links.

Inspect the current Trace without creating another collection project. The card appears when the task reports a recognizable compaction event.

[![One attempt kept the original context. The applied attempt reduced the estimated count from 7,282 to 3,037 tokens.](https://mintcdn.com/aivision/envaFjNvSyZA1IAq/assets/figures/hermes-relay/context-compaction-comparison.en.light.png?fit=max\&auto=format\&n=envaFjNvSyZA1IAq\&q=85\&s=357136af5c973aa1fe9329ee57fab0f0)](https://aivision.mintlify.site/assets/figures/hermes-relay/context-compaction-comparison.en.light.png)

[![Dark-theme view of the skipped and applied attempts, with estimated counts of 7,282 before and 3,037 after compaction.](https://mintcdn.com/aivision/envaFjNvSyZA1IAq/assets/figures/hermes-relay/context-compaction-comparison.en.dark.png?fit=max\&auto=format\&n=envaFjNvSyZA1IAq\&q=85\&s=53672f5981f41bdb1f2aee0de08b69a8)](https://aivision.mintlify.site/assets/figures/hermes-relay/context-compaction-comparison.en.dark.png)

A real Hermes run using Baidu GLM 5.3. One attempt kept the original context and one applied compaction. Click to enlarge.

## 2. Check the outcome before the numbers

The header shows how many attempts applied compaction, followed by the total number of attempts. Check each record for its outcome and any reported reason.

| Outcome | Interpretation and next step |
| - | - |
| **Compaction applied** (`committed`) | The record confirms that the context was rewritten. Check the token counts **Before compaction** and **After compaction**. |
| **Original context kept** (`skipped`) | This attempt skipped the rewrite, for example because it had too few messages. Check the reason next to the status. |
| **Compaction failed / Compaction blocked / Compaction aborted** (`failed` / `blocked` / `aborted`) | Compaction did not take effect. Open the details to check the reported reason and original event. |
| **Outcome unknown / Unrecognized outcome** | The record cannot establish what happened. Check the original event in the details. |
| **Conflicting reports** | Reports for the same attempt disagree. The record is excluded from the applied count. Check each original event. |

For applied compaction, **Context size** shows the reported before and after counts. In the example, the count drops from **7,282** to **3,037 tokens**, a decrease of **4,245 tokens**. **Estimated token counts** means the figures are based on message content. Use them to compare context size. Billed usage is tracked separately.

When the record has only one count, the card shows only that count. If counts disagree, open the details to check the reported fields. An explicitly reported **0 tokens**, **0 ms**, or **No** remains distinct from missing data. Review the full text and answer quality separately.

The compaction event does not add another model call. If compaction used a model to generate a summary, inspect the collected summary-model span's own usage; do not count the event again. See [Token accounting](https://aivision.mintlify.site/en/guides/token-usage.md).

## 3. Open more recorded details

Select **View details** to inspect reported fields such as the method, trigger, elapsed time, summarizer model, and attempt ID. Message counts and the token measurement method are also available when reported.

Records in a Trace are ordered by event time. The initial view shows at most five; use the load-more, show-all and collapse controls for a longer list. One attempt can have multiple source projections. Display merging retains those sources and does not join attempts across Traces or sessions. A session ID in an event does not establish membership for other Traces.

## 4. Follow the original event

1. Expand **View details**, then select a link under **Source: Relay span event**.
2. The UI selects the source span, expands **Events** and focuses the exact original event. Verify the span ID, event number, name and timestamp.
3. Inspect `nemo_relay.mark.data.*` fields to match the outcome, measurements and reason. Select **Original** in the toolbar when you need original content. Enhanced cards disappear; original attributes and events remain readable.

[![Original compaction event focused through its source link](https://mintcdn.com/aivision/envaFjNvSyZA1IAq/assets/figures/hermes-relay/context-compaction-source.en.light.png?fit=max\&auto=format\&n=envaFjNvSyZA1IAq\&q=85\&s=8a77da46e1789a905f13db438dc06eb0)](https://aivision.mintlify.site/assets/figures/hermes-relay/context-compaction-source.en.light.png)

[![Focused original compaction event in dark theme](https://mintcdn.com/aivision/envaFjNvSyZA1IAq/assets/figures/hermes-relay/context-compaction-source.en.dark.png?fit=max\&auto=format\&n=envaFjNvSyZA1IAq\&q=85\&s=423f1e2eaa30ab108568c14e76ff7a4e)](https://aivision.mintlify.site/assets/figures/hermes-relay/context-compaction-source.en.dark.png)

The source link focuses the original compaction event. Local replay of a separate verified Hermes run. Click to enlarge.

## When the card or fields are missing

| Symptom | Check and next step |
| - | - |
| The Trace exists but has no card | Check the native data source, Enhanced mode and whether this task reported a recognizable compaction event. A span name such as `compress` or a plain log is insufficient. |
| An original event exists but is not recognized | The current adapter requires `compaction` or `compaction.attempt`, a Relay mark ID and structured `nemo_relay.mark.data.kind`. Inspect the original; do not fabricate fields. |
| An outcome exists but measurements are incomplete | Fields may be unreported, filtered or not loaded. Keep them unknown and inspect the source. |
| Manual compaction, auxiliary calls or the final session segment are incomplete | The tested Hermes version has coverage limits; see [Hermes integration and boundaries](https://aivision.mintlify.site/en/integrations/hermes.md). A missing card does not prove no compaction or execution occurred. |
| Model records exist but no official Relay compaction event | Check native Relay configuration with the [Hermes guide](https://aivision.mintlify.site/en/integrations/hermes.md), then verify a new task that actually performs automatic compaction. |

If original Trace content is also missing, start with [Trace troubleshooting](https://aivision.mintlify.site/en/guides/traces.md) or [No data](https://aivision.mintlify.site/en/help/no-data.md) before interpreting compaction.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.