context-degradation

Diagnose and mitigate context degradation patterns in LLM agent systems.

Updated Jan 31, 2026
One-click install
npx skills add https://github.com/adrianasiam19/ATLAS --skill context-degradation-adrianasiam19
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: context-degradation
Source: https://github.com/adrianasiam19/ATLAS/tree/main/.agent/skills/context-degradation
Command: npx skills add https://github.com/adrianasiam19/ATLAS --skill context-degradation-adrianasiam19

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve? LLM agents degrade unpredictably as context grows: critical instructions get lost in the middle of long prompts, hallucinated facts poison downstream reasoning, and contradictory retrieved documents silently corrupt outputs. This Skill provides detection patterns, mitigation frameworks, and Python tooling to identify and fix these failures before they cascade. ## Core Features & Use Cases - Five Degradation Patterns: Recognize and mitigate lost-in-middle, context poisoning, distraction, confusion, and clash with pattern-specific detection signals and recovery procedures. - Health Analysis Toolkit: Run composite context health checks combining attention distribution, poisoning detection, and utilization metrics via the included Python scripts. - Four-Bucket Mitigation Framework: Apply Write, Select, Compress, and Isolate strategies matched to the active degradation pattern. - Use Case: An agent's output quality drops after 40K tokens of conversation. Use the ContextHealthAnalyzer to score the session, detect that critical instructions sit in the attention-degraded middle region, and restructure the prompt to place key information at the edges. ## Quick Start Ask the agent to analyze the current conversation context for degradation symptoms and recommend mitigation strategies based on the detected pattern.

Frequently Asked Questions about context-degradation

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I detect lost-in-middle problems in LLM prompts?▼

Lost-in-middle detection maps attention weight across context positions and flags critical information sitting in the degraded middle region. The detect_lost_in_middle function compares critical token positions against the attention distribution and returns at-risk items with repositioning recommendations.

What is context poisoning in AI agents?▼

Context poisoning occurs when a hallucination, tool error, or incorrect retrieved fact enters context and compounds through repeated self-reference. Recovery requires truncating to before the poisoning point or restarting with verified-only context, since layering corrections over poisoned content rarely works.

At what context length does LLM performance degrade?▼

Degradation typically begins at 60-70% of the advertised context window for complex retrieval tasks, with meaningful decline often starting at 8K-16K tokens. The curve is non-linear with a cliff edge, so benchmark your specific workload rather than trusting published thresholds.

Why does my agent ignore instructions in long conversations?▼

Instructions placed in the middle of long contexts suffer 10-40% reduced recall due to the U-shaped attention curve. Move critical instructions to the beginning or end of the prompt, add explicit section headers as attention anchors, and trigger compaction before utilization exceeds 70%.

How do I handle contradictory documents in RAG retrieval?▼

Contradictory retrieved documents cause context clash, where the model silently picks one source without signaling the conflict. Implement contradiction detection in the retrieval layer, establish source priority rules, and filter outdated versions before documents enter context.

When should I split tasks across sub-agents instead of using larger context?▼

Split tasks when a single context must maintain quality across dozens of independent objectives, since this creates degradation that more context cannot solve. Isolation is the most aggressive mitigation strategy but often the most effective for complex multi-task systems.