
Context Degradation Diagnostics
Diagnose and fix agent failures caused by bloated or conflicting context
- Stars
- 18,282
- Licence
- MIT
- Files
- 3 files
What it does
When an AI agent starts giving worse answers in long conversations, ignoring information it was given, or mixing up conflicting facts, this skill gives it a framework for diagnosing why. It names five failure patterns (lost-in-middle, poisoning, distraction, confusion, and clash) and suggests specific fixes such as moving key facts to the start or end of context, removing bad content rather than correcting over it, and separating unrelated tasks. It also includes a Python helper script that simulates degradation metrics for demonstration.
Great for
- Engineers building long-running or production AI agents who see unexplained quality drops
- Teams evaluating how they structure prompts, retrieved documents, or tool outputs
- People debugging agents that ignore instructions given earlier in a long prompt
Skip it if
- Simple one-off chats where context is short; the guidance adds little there
- Production monitoring of real model attention: the script's attention numbers are simulated, not read from the model, so they should not be treated as measurements of a real system
- Non-technical users looking for a finished tool; it is a set of engineering guidelines and a demo script
Try asking
- “My agent gets worse after about 50 turns of conversation. Help me diagnose whether this is context degradation.”
- “Review how I order the documents I pass into my agent's prompt and suggest where critical facts should go.”
- “Our agent keeps citing an outdated API version alongside the new one. Diagnose the context clash and propose source priority rules.”
- “Run the context health analyzer on this agent session transcript and summarise the risk factors.”
Install in 3 steps
- 1
Download the skill
The ZIP contains the 3 original files, the MIT licence and an attribution note.
context-degradation.zip - 2
Add it to your agent
Claude Code (all projects)
mkdir -p ~/.claude/skills && unzip context-degradation.zip -d ~/.claude/skills/Claude Code / Agent SDK (this project only)
mkdir -p .claude/skills && unzip context-degradation.zip -d .claude/skills/Claude apps (web/desktop): Settings → Capabilities → Skills → Upload skill, and choose the ZIP.
- 3
Ask for the task
No special command needed — the agent reads the skill's description and loads it when your request matches. Try one of the prompts above.
Get better results
- Treat the script's attention and token figures as illustrative; use model-specific tokenizers and real attention tools for production decisions.
- Ask the agent to name which of the five patterns matches your symptoms before applying fixes, so you do not over-engineer.
- Review the script before running it on sensitive session data, since it processes whatever context you pass in.
What's inside
- references/patterns.md
- scripts/degradation_detector.py
- SKILL.md
Redistributed unmodified from muratcankoylan/Agent-Skills-for-Context-Engineering under the MIT licence. The assessment was drafted with AI from the skill's files on 2026-10-29. Skills can instruct your agent to run code — read SKILL.md and any scripts before installing.