Sponsored byOutsenseAI that finds your next clients
SponsorGROUOutbound, LinkedIn content and leads for B2B teamsSponsorOutsenseAI that finds your next clientsAd+Your tool hereSeen by people installing AI tools@Weekly picksThe best new tools, one email a week

context-degradation

Skill by muratcankoylan

Diagnoses and mitigates context degradation in AI agents, including lost-in-middle failures, context poisoning, confusion, and clashing sources. It is aimed at developers debugging agent failures or designing systems that handle large contexts.

  • Score 94
  • 18k stars
  • MIT
  • Updated
Works withClaude CodeClaude apps Antigravity CLI

Install context-degradation

Built from the published package, never by AI.

git clone --depth 1 https://github.com/muratcankoylan/Agent-Skills-for-Context-Engineering /tmp/Agent-Skills-for-Context-Engineering && mkdir -p ~/.claude/skills && cp -r /tmp/Agent-Skills-for-Context-Engineering/skills/context-degradation ~/.claude/skills/context-degradation

Run in your terminal. Claude Code loads skills from ~/.claude/skills automatically.

Step-by-step: install context-degradation in Claude Code

Skills can run scripts on your machine. Some need an API key: check the README.

About

context-degradation is an agent skill for diagnosing and fixing context failures in AI assistants. It describes five patterns: lost-in-middle, poisoning, distraction, confusion, and clash. For each pattern it lists detection signals and mitigation strategies. It also sets out a four-bucket framework of write, select, compress, and isolate.

The skill treats degradation as an engineering problem with measurable thresholds. It covers placing critical information at the start and end of context, recovering from poisoned context by removing it, isolating task contexts, and resolving conflicts with source priority rules. It is aimed at developers debugging agent failures or designing systems that must handle large contexts. The source says thresholds should be benchmarked against the user's own workload.

Written from the project's SKILL.md and checked against it.

What it can do

  • Lost-in-middle diagnosisExplains how placement of critical information in long context affects recall, and how to place it at the start and end.
  • Context poisoning recoveryDescribes detecting poisoned context and recovering by truncating or restarting with verified information only.
  • Distraction controlAdvises filtering irrelevant documents and preferring tool-call access over pre-loading reference material.
  • Task isolationRecommends separate context windows per task to prevent constraints from one task leaking into another.
  • Clash resolutionRecommends marking contradictions explicitly and setting source precedence rules before conflicts arise.
  • Four-bucket mitigationProvides write, select, compress, and isolate strategies matched to the active degradation pattern.

Try asking

  • Why does my agent ignore instructions given early in a long prompt?
  • Help me find where a bad fact entered my agent's context.
  • Review my retrieval setup for distractors and conflicting sources.

Good to know

  • Published thresholds are design guidance, not universal truths.
  • Model-specific thresholds go stale with each model update.
  • Does not cover basic context mechanics or compression design, which other skills handle.

Security check

A

No download-and-run commands, hidden instructions or signs of sending keys out were found.

Checked automatically: skills/context-degradation/SKILL.md, skills/context-degradation/scripts/degradation_detector.py. This looks for known risky patterns and is not a full audit. How grades work

Inside the skill

  • SKILL.md19 KB
  • references/patterns.md10 KB
  • scripts/degradation_detector.py22 KB

Alternatives to context-degradation

All alternatives →

Compare with agent-reproduce-align, google_contacts or m06-error-handling

context-degradation: common questions

What context degradation patterns does it cover?

The source names five patterns: lost-in-middle, context poisoning, distraction, confusion, and clash. Each has detection signals and mitigation strategies.

Does it give fixed token limits for when quality drops?

No. The source says degradation onset varies by model and task, and that thresholds should be benchmarked with your own workload rather than relying on published numbers.

Is this skill for reducing token usage?

Not directly. The source says token-efficiency tactics belong to a separate context-optimization skill and should be applied after the failure pattern is known.

How do I install context-degradation?

Run the command above to copy the skill into ~/.claude/skills/. Claude Code picks it up automatically.

Is context-degradation free?

The code is published under the MIT licence. The service it connects to may have its own pricing.

Is context-degradation safe to use?

It scores 94 of 100. Grades: maintenance A, licence A, quality A. Security check: grade A, no risky patterns found in the files checked. Review the code before you install. How grades work.

What are alternatives to context-degradation?

Similar skills: agent-reproduce-align, google_contacts, m06-error-handling, caveman.

context-degradation Install

Add to stack

Loading.