context-degradation

Diagnose and mitigate context degradation patterns in LLM agent systems.

Updated Apr 17, 2026
One-click install
npx skills add https://github.com/Syedyasir001/RVULibPass --skill context-degradation-syedyasir001
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: context-degradation
Source: https://github.com/Syedyasir001/RVULibPass/tree/main/.agent/skills/library/context-degradation
Command: npx skills add https://github.com/Syedyasir001/RVULibPass --skill context-degradation-syedyasir001

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve? Long-running LLM agents silently degrade as context grows: critical instructions get lost in the middle of the window, hallucinated facts poison downstream reasoning, irrelevant documents dilute attention, and contradictory sources produce unpredictable outputs. This Skill provides detection signals, thresholds, and mitigation strategies for these failure modes. ## Core Features & Use Cases - Five Degradation Patterns: Recognize and address lost-in-middle, context poisoning, distraction, confusion, and clash with pattern-specific detection signals and recovery procedures. - Detection Scripts: Run the included Python module to measure attention distribution, detect lost-in-middle placement, flag poisoning indicators, and compute a composite context health score. - Mitigation Framework: Apply the Write/Select/Compress/Isolate strategies based on which degradation pattern is active, with empirical thresholds for when to trigger compaction. - Use Case: An agent's output quality drops after 40K tokens of conversation. Use this Skill to diagnose whether critical instructions sit in the attention-degraded middle region, then restructure context placement or trigger compaction before the degradation cliff. ## Quick Start Analyze my agent's conversation context for degradation symptoms and recommend whether to compact, truncate, or restructure it.

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 context?▼

Detect lost-in-middle by checking whether critical information sits in the middle 80% of context positions, where recall accuracy drops 10-40%. The included degradation_detector.py script maps attention distribution across positions and flags critical content in degraded regions.

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, not layering corrections on top.

At what context length does LLM performance degrade?▼

Degradation typically begins at 60-70% of the advertised context window, often around 8K-16K tokens for complex tasks even on models claiming much larger windows. The decline is non-linear with a cliff edge, so set compaction triggers near 70% of the known onset threshold.

Why does my agent ignore instructions in long conversations?▼

Instructions placed in the middle of long contexts suffer reduced attention due to the U-shaped attention curve, where beginning and end positions receive reliable focus. Move critical instructions to the start or end of context and add explicit structural markers as attention anchors.

Does a bigger context window fix degradation issues?▼

No. Larger windows delay but do not eliminate degradation, since U-shaped attention curves persist at any size and costs grow non-linearly. Splitting tasks across sub-agents with isolated contexts is often more effective than expanding a single context.