context-degradation

Detect and diagnose context-degradation patterns in agent systems.

4|Updated Dec 23, 2025
One-click install
npx skills add https://github.com/ken-cavanagh-glean/fieldkit --skill context-degradation-ken-cavanagh-glean
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: context-degradation
Source: https://github.com/ken-cavanagh-glean/fieldkit/tree/main/plugins/context-engineering/skills/context-engineering/context-degradation
Command: npx skills add https://github.com/ken-cavanagh-glean/fieldkit --skill context-degradation-ken-cavanagh-glean

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve?

Recognize, diagnose, and mitigate patterns of context degradation in agent systems to maintain reliable performance as context size grows.

Core Features & Use Cases

  • Detects and quantifies context degradation patterns such as Lost-in-Middle, Context Poisoning, and Distraction.
  • Provides actionable guidance and recovery strategies (compaction, masking, and isolation) to keep long-context conversations productive.
  • Useful for debugging production agents, benchmarking context maintenance, and designing robust architectures for large-context tasks.

Quick Start

Analyze a running agent session by feeding the current context into the context health analyzer and review the health score, degradation metrics, and recommended mitigations. Example: call analyze_agent_context(your_context_string) and inspect results for remediation steps.

Frequently Asked Questions about context-degradation

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

FAQPage Schema
What is context degradation and how does it affect agent performance?

Context degradation occurs when agent performance declines as context grows, manifesting as lost-in-middle effects, poisoning, or distraction. It reduces attention to relevant information and compounds in long conversations, debugging outputs, and production systems handling large contexts, requiring detection and mitigation strategies.

How do I detect context degradation patterns in my agent system?

Use the degradation_detector.py script to analyze your agent's context by calling analyze_agent_context() with your context string. The tool measures attention distribution, quantifies degradation metrics like lost-in-middle and poisoning patterns, and returns a health score with recommended recovery steps.

What recovery strategies can mitigate context degradation?

Context degradation mitigation includes compaction to reduce noise, masking to isolate critical information, and isolation to separate poisoned or distracting content. The Skill provides actionable guidance on which strategy fits your degradation pattern and conversation state.

When should I monitor context health in production agents?

Monitor context health continuously in production agents handling long-running conversations or large contexts to catch degradation early. Degradation typically worsens over time, so regular benchmarking preserves performance before reliability issues compound.

Can I use this with existing agent frameworks and long-context applications?

Yes, the Skill applies to any agent system working with long contexts. It requires only numpy and your agent's current context string, making it compatible with debugging workflows, benchmarking pipelines, and existing large-context architectures without framework-specific modifications.