What problem does it solve? Long-running LLM agents silently degrade as context grows: critical instructions get lost in the middle of the prompt, hallucinated or erroneous content poisons downstream reasoning, and contradictory retrieved documents cause unpredictable outputs. This Skill provides a systematic framework and detection tooling to identify which degradation pattern is active and apply the correct mitigation before failures cascade. ## Core Features & Use Cases - Pattern Diagnosis: Distinguish five degradation patterns — lost-in-middle, context poisoning, distraction, confusion, and clash — each with specific detection signals and recovery procedures. - Detection Scripts: Run Python utilities to measure attention distribution, flag critical information in low-attention regions, detect poisoning indicators, and compute a composite context health score. - Mitigation Framework: Apply the Write/Select/Compress/Isolate strategies matched to the active failure pattern, with empirical thresholds for when to trigger compaction. - Use Case: An agent that answered correctly at turn 5 starts citing a wrong API endpoint at turn 30. Use this Skill to trace the poisoning entry point, truncate context to before the bad claim, and reload only verified sources. ## Quick Start Ask the agent to analyze the current conversation context for degradation symptoms and recommend whether to compact, truncate, or restructure the context.