context-degradation

Diagnose and mitigate context degradation patterns in LLM agent systems.

Updated Jul 10, 2026
One-click install
npx skills add https://github.com/CodeCrafterAdi2006/Ink-and-Code --skill context-degradation-codecrafteradi2006
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: context-degradation
Source: https://github.com/CodeCrafterAdi2006/Ink-and-Code/tree/main/Skills/Context_Degradation
Command: npx skills add https://github.com/CodeCrafterAdi2006/Ink-and-Code --skill context-degradation-codecrafteradi2006

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 accumulates: critical instructions get lost in the middle of long prompts, hallucinated claims poison downstream reasoning, irrelevant documents dilute attention, and contradictory sources produce unpredictable outputs. This Skill provides a systematic framework to detect, diagnose, and fix these failures before they cascade. ## Core Features & Use Cases - Five-Pattern Diagnosis: Identify lost-in-middle, context poisoning, distraction, confusion, and clash failures with specific detection signals for each. - Health Analysis Toolkit: Python utilities to measure attention distribution, detect poisoning indicators, and compute a composite context health score with actionable recommendations. - Mitigation Framework: Apply the Write/Select/Compress/Isolate strategies matched to the active degradation pattern, with compaction triggers set before degradation cliffs. - Use Case: An agent's output quality drops after 40 conversation turns. Run the health analyzer to find utilization at 85% with poisoning indicators, then truncate to before the poisoning point and reload only verified context. ## Quick Start Ask the agent to analyze the current conversation context for degradation symptoms and recommend whether to compact, truncate, or isolate the context.

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?

Measure attention distribution across context positions and check whether critical information falls in the middle region, where recall drops 10-40%. Place key instructions and findings at the beginning or end of the context instead.

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 self-reference. Fix it by truncating to before the poisoning point and restarting with verified-only context, not by 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. Benchmark your specific workload rather than trusting published thresholds, since they shift with model updates.

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. Move critical constraints to the start or end, add explicit section headers as attention anchors, and trigger compaction before utilization exceeds 70%.

When should I split tasks across sub-agents instead of using a bigger context window?

Split tasks when a single context must handle multiple independent objectives, since larger windows delay but do not eliminate degradation. Sub-agent isolation prevents context confusion and clash, and avoids the exponential cost of very large contexts.