domains / agent-tooling / context-degradation / context-degradation
The two copies cover the same five degradation patterns but diverge on scope and actionable constraints. The muratcankoylan copy is a diagnostic and mitigation procedure with specific activation boundaries (explicitly excluding adjacent skills like context-fundamentals and context-optimization) and detailed recovery steps (e.g., truncating to before the poisoning point). The sickn33 copy is a broader educational overview that includes a sixth pattern (Context Confusion) and architectural mitigation strategies (compaction, masking, partitioning) that the first copy lacks. Because the first copy omits the confusion pattern and the second lacks the specific skill-routing and recovery constraints, crowning one would hide a real alternative approach to handling context failures.
| Repository | Path |
|---|---|
| muratcankoylan/Agent-Skills-for-Context-Engineering | skills/context-degradation/SKILL.md |
| sickn33/agentic-awesome-skills | plugins/agentic-awesome-skills-claude/skills/context-degradation/SKILL.md |
| Role | Repository | Path |
|---|---|---|
| peer | muratcankoylan/Agent-Skills-for-Context-Engineering | skills/context-degradation/SKILL.md |
| peer | sickn33/agentic-awesome-skills | plugins/agentic-awesome-skills-claude/skills/context-degradation/SKILL.md |
| adapter | sickn33/agentic-awesome-skills | plugins/agentic-awesome-skills/skills/context-degradation/SKILL.md |
| adapter | sickn33/agentic-awesome-skills | skills/context-degradation/SKILL.md |
--- name: context-degradation description: "Diagnose and mitigate context degradation patterns including lost-in-middle, poisoning, distraction, confusion, and clash." --- # Context Degradation Patterns Diagnose and fix context failures before they cascade. Context degradation is a continuum manifesting through five distinct patterns: lost-in-middle, poisoning, distraction, confusion, and clash. ## When to Activate Activate this skill when: - Agent performance degrades unexpectedly during long conversations. - Debugging cases where agents produce incorrect or irrelevant outputs. - Designing systems that must handle large contexts reliably. - Investigating "lost in middle" phenomena or context-related failures. Do not activate for: - Explaining foundational context mechanics without an active failure. - Applying token-efficiency tactics after the failure pattern is known. - Designing compression or handoff summary strategies. ## Core Patterns and Mitigations ### 1. Lost-in-Middle - **Signal:** Correct information exists in context but is ignored; responses contradict provided data. - **Cause:** U-shaped attention curve; middle positions suffer 10-40% reduced recall due to attention sinks (e.g., BOS token). - **Mitigation:** Place critical information at the beginning and end. Use explicit section headers and summary structures to create attention anchors. ### 2. Context Poisoning - **Signal:** Degraded output quality on previously successful tasks; tool misalignment; persistent hallucinations. - **Cause:** Unverified claims (from tools, retrieval, or summaries) enter context and compound through self-reference. - **Mitigation:** Validate external inputs. Recover by truncating to before the poisoning point or restarting with verified-only context. Do not layer corrections over poisoned content. ### 3. Context Distraction - **Signal:** Performance drops when irrelevant documents are present, even if clearly marked as irrelevant. - **Cause:** Models must attend to all provided context; irrelevant content competes for attention budget. - **Mitigation:** Curate aggressively. Use relevance filtering before loading. Move non-immediate information behind tool calls rather than pre-loading. ### 4. Context Confusion - **Signal:** Model incorporates constraints from the wrong task or blends requirements from multiple sources. - **Cause:** Multiple task types or objectives in a single context window. - **Mitigation:** Isolate task contexts. Use explicit task segmentation and separate context windows to prevent cross-contamination. ### 5. Context Clash - **Signal:** Model fails to determine which of multiple correct-but-contradictory sources applies. - **Cause:** Version conflicts or multi-source retrieval without precedence rules. - **Mitigation:** Establish source precedence. Mark contradictions explicitly. Filter outdated versions before they enter context. ## Architectural Strategies - **Compaction:** Summarize long histories to reduce token count while preserving key state. - **Masking:** Hide irrelevant sections from the model's attention when possible. - **Partitioning:** Split large contexts into manageable chunks with clear boundaries. - **Isolation:** Use separate context windows for distinct tasks or objectives.