context-degradation

Diagnose and mitigate context degradation patterns in LLM agent systems.

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

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, and irrelevant documents dilute attention. 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 specific detection signals and recovery procedures for each. - Health Analysis Toolkit: Run composite context health checks combining attention distribution, poisoning detection, and utilization metrics via the included Python script. - 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 this Skill to measure attention distribution, detect that key instructions sit in the degraded middle region, and restructure context so critical information sits at attention-favored positions. ## Quick Start Ask the agent to analyze the current conversation context for degradation symptoms and recommend mitigation strategies using the context-degradation skill.

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

Measure attention distribution across context positions and check whether critical information falls in the middle region, which suffers 10-40% reduced recall. The included degradation_detector.py script flags critical tokens in attention-degraded positions and recommends repositioning them to the beginning or end.

What is context poisoning and how do I fix it?▼

Context poisoning occurs when a hallucination, tool error, or incorrect retrieved fact enters context and compounds through repeated self-reference. Recover by truncating to before the poisoning point or restarting with verified-only context rather than layering corrections on top.

At what context length does LLM performance degrade?▼

Degradation typically begins at 60-70% of the advertised context window for complex retrieval tasks, and the decline is non-linear with a cliff edge rather than gradual. Benchmarks like RULER found only 50% of models claiming 32K+ context maintain satisfactory performance at that length.

Does a larger context window solve long-context problems?▼

No. Larger windows delay but do not eliminate U-shaped attention degradation, and processing cost grows non-linearly with token count. Splitting tasks across sub-agents or compacting context before the degradation threshold is often more effective.

Why does my agent ignore instructions given earlier in the conversation?▼

Instructions placed in the middle of a long context receive reduced attention due to the U-shaped attention curve. Move critical instructions to the beginning or end of context, add explicit section headers as attention anchors, and trigger compaction before utilization exceeds roughly 70%.

How accurate is the attention measurement in degradation_detector.py?▼

The script simulates U-shaped attention curves for demonstration and uses heuristic token counting. Production systems should extract actual attention weights via tools like TransformerLens and use model-specific tokenizers for accurate measurements.