context-degradation

Diagnose context degradation failure modes in LLM agent sessions.

1|Updated May 16, 2026
One-click install
npx skills add https://github.com/enigmaicon-eng/AI-Enterprise-OS --skill context-degradation-enigmaicon-eng
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: context-degradation
Source: https://github.com/enigmaicon-eng/AI-Enterprise-OS/tree/main/examples/agent-skills/skills/context-degradation
Command: npx skills add https://github.com/enigmaicon-eng/AI-Enterprise-OS --skill context-degradation-enigmaicon-eng

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve?

This Skill helps you detect when LLM agents degrade due to long-context issues and recover reliably before failures cascade into incorrect or irrelevant outputs.

Core Features & Use Cases

  • Pattern-based diagnosis: Identifies lost-in-middle, context poisoning, distraction, confusion, and clash failure modes to target the real cause.
  • Attention-aware guidance: Flags whether critical information is likely buried in attention-degraded regions and recommends edge placement.
  • Poisoning indicators detection: Surfaces error accumulation, contradictions, and hallucination-leaning markers so you can truncate or restart with verified context.
  • Operational health scoring: Combines utilization, lost-in-middle risk, and poisoning signals into a composite health score with actionable recommendations.
  • Production-oriented mitigations: Recommends write/select/compress/isolate strategies and resilience patterns like just-in-time context loading and observation masking.

Quick Start

Ask the AI to diagnose a suspected long-context failure in your agent by analyzing the current context and returning the most likely degradation pattern plus concrete mitigation steps.

Frequently Asked Questions about context-degradation

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

FAQPage Schema
How do I diagnose long-context LLM agent failures and lost-in-middle degradation?

Diagnose long-context LLM agent failures by analyzing context structure and estimating attention distribution to identify lost-in-middle, distraction, confusion, clash, and poisoning failure modes. This produces actionable recommendations and a composite health score to prevent cascading errors.

What causes context poisoning in LLM retrieval and how can I detect it?

Context poisoning in LLM retrieval is caused by error accumulation, contradictions, and hallucination-leaning markers. Detect poisoning risk by running specific heuristics over the agent session context, allowing you to truncate or restart with verified context before failures cascade.

How do I monitor LLM agent context windows for degradation in production?

Monitor LLM agent context windows in production by building automated monitoring that calculates a composite health score from utilization, lost-in-middle risk, and poisoning signals. This score triggers automated mitigation strategies like context compaction or isolation when degradation is detected.

What is the best way to fix LLM context assembly issues when critical information is buried?

Fix LLM context assembly issues by applying attention-aware guidance that flags critical information buried in attention-degraded regions. The recommended mitigation is edge placement, alongside write, select, compress, or isolate strategies to ensure critical data maintains model attention.

Can I use this to debug long conversations without external dependencies?

Yes, you can debug long conversations without external dependencies. The skill requires no dependencies and operates by analyzing the existing context structure of your LLM agent sessions to identify specific failure patterns and return concrete mitigation steps.

When should I apply context compaction or isolation for LLM agents?

Apply context compaction or isolation for LLM agents when automated monitoring detects high lost-in-middle risk, context poisoning indicators, or a low composite health score. These resilience patterns prevent long-context failures from cascading into incorrect or irrelevant outputs.