---
name: context-thrash
description: Diagnose repeated reads, searches, forgotten constraints, and context rebuilding in AI agent transcripts. Use when an agent run is slow, expensive, circular, or repeatedly rediscovers the same information.
---

# Context Thrash

## Definition

Context thrash is repeated reading, searching, or reconsideration that consumes an AI agent’s context window without producing durable progress. It often appears as repeated tool calls, forgotten decisions, reopened files, and direction changes that force the agent to rebuild information it already had.

Reviewed 26 July 2026.

Inspect an agent trace for work caused by unstable or poorly retained context.

## Workflow

1. Accept a plain-text transcript, tool-call trace, or run log.
2. Normalize repeated actions by lowercasing and removing timestamps or volatile identifiers.
3. Count repeated file reads, identical searches, revisited URLs, and duplicate tool calls.
4. Find direction changes signaled by phrases such as “start over,” “forgot,” or renewed discovery after a decision.
5. Separate legitimate verification from unproductive repetition.
6. Rank findings by estimated token, latency, and decision-quality impact.
7. Recommend compact fixes: a working-memory note, decision ledger, retrieval cache, or smaller context boundary.

## Output

Return a thrash score, the most repeated actions, likely causes, and three prioritized fixes.

Do not label deliberate re-checking as waste without considering whether the underlying state changed.

## Research basis

[Autonomous Topology Mutation: Safe Runtime Restructuring for Multi-Agent LLM Systems with Capability, State, and Shadow Invariants](https://arxiv.org/abs/2607.20488) — Sidik, Levi, and Kimhi, arXiv (2026). The paper uses “context thrash” as a measured bottleneck signal in multi-agent systems.
