context-degradation
できること
このスキルは、AIのコンテキストが悪くなる一般的な方法を説明します。たとえば、途中の情報が無視されたり、誤った詳細が広がったりすることです。長いセッションで悪化するエージェントをデバッグする人向けです。
使う場面
- ✓長い会話が続くほど、エージェントの回答が悪くなるとき。
- ✓エージェントが、長い入力の途中に置かれた詳細を無視するとき。
- ✓コンテキスト内の矛盾や誤った情報が、悪い出力につながるとき。
スキルのリンク
https://github.com/muratcankoylan/Agent-Skills-for-Context-Engineering/blob/main/skills/context-degradation/SKILL.mdコピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。
使い方
いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。
貼り付け用メッセージ
Claude Code、Codex、Cursorの場合:プロジェクトのフォルダで実行するとスキルがインストールされます。
SKILL.mdをダウンロードして、エージェントのスキル用フォルダに入れてください。
AIへの頼み方の例
“私のAIエージェントは長いセッションの後に混乱し、前に伝えたことを見落とします。原因を突き止める手伝いをしてください。”
毎週5つの新しいスキル。1分で読めます。
仕組み
スキルは5つのパターン、たとえば途中での喪失、汚染、衝突などを挙げ、それぞれの兆候と対策を示すので、問題を対処法に結び付けられます。
技術的な内容(元のSKILL.md)
作者による元のテキスト(英語)をGitHubからそのまま表示しています。
Context Degradation Patterns
Diagnose and fix context failures before they cascade. Context degradation is not binary — it is a continuum that manifests through five distinct, predictable patterns: lost-in-middle, poisoning, distraction, confusion, and clash. Each pattern has specific detection signals and mitigation strategies. Treat degradation as an engineering problem with measurable thresholds, not an unpredictable failure mode.
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
- Evaluating context engineering choices for production systems
- Investigating "lost in middle" phenomena in agent outputs
- Analyzing context-related failures in agent behavior
Do not activate this skill for adjacent work owned by other skills:
- Explaining foundational context mechanics without an active failure:
context-fundamentals. - Applying token-efficiency tactics after the failure pattern is known:
context-optimization. - Designing a compression or handoff summary strategy:
context-compression. - Persisting large outputs, logs, or scratch state outside the prompt:
filesystem-context.
Core Concepts
Structure context placement around the attention U-curve: beginning and end positions receive reliable attention, while middle positions suffer materially reduced recall accuracy in long-context experiments (claim-context-degradation-lost-middle-ruler). This is not a model bug but a consequence of attention mechanics — the first token (often BOS) acts as an "attention sink" that absorbs disproportionate attention budget, leaving middle tokens under-attended as context grows.
Treat context poisoning as a circuit breaker problem. Once a hallucination, tool error, or incorrect retrieved fact enters context, it compounds through repeated self-reference. A poisoned goals section causes every downstream decision to reinforce incorrect assumptions. Detection requires tracking claim provenance; recovery requires truncating to before the poisoning point or restarting with verified-only context.
Filter aggressively before loading context — even a single irrelevant document measurably degrades performance on relevant tasks. Models cannot "skip" irrelevant context; they must attend to everything provided, creating attention competition between relevant and irrelevant content. Move information that might be needed but is not immediately relevant behind tool calls instead of pre-loading it.
Isolate task contexts to prevent confusion. When context contains multiple task types or switches between objectives, models incorporate constraints from the wrong task, call tools appropriate for a different context, or blend requirements from multiple sources. Explicit task segmentation with separate context windows eliminates cross-contamination.
Resolve context clash through priority rules, not accumulation. When multiple correct-but-contradictory sources appear in context (version conflicts, perspective conflicts, multi-source retrieval), models cannot determine which applies. Mark contradictions explicitly, establish source precedence, and filter outdated versions before they enter context.
Detailed Topics
Lost-in-Middle: Detection and Placement Strategy
Place critical information at the beginning and end of context, never in the middle. The U-shaped attention curve means middle-positioned information suffers 10-40% reduced recall accuracy. For contexts over 4K tokens, this effect becomes significant.
Use summary structures that surface key findings at attention-favored positions. Add explicit section headers and structural markers — these help models navigate long contexts by creating attention anchors. When a document must be included in full, prepend a summary of its key points and append the critical conclusions.
Monitor for lost-in-middle symptoms: correct information exists in context but the model ignores it, responses contradict provided data, or the model "forgets" instructions given earlier in a long prompt.
Context Poisoning: Prevention and Recovery
Validate all external inputs before they enter context. Tool outputs, retrieved documents, and model-generated summaries are the three primary poisoning vectors. Each introduces unverified claims that subsequent reasoning treats as ground truth.
Detect poisoning throu
よくある質問
途中での喪失とは何ですか?
長い入力の中央に置かれた情報に、モデルがあまり注意を払わなくなる現象です。
コンテキストの汚染はどう違いますか?
誤りがコンテキストに入り込み、繰り返し使われ続けて、後の回答を悪くすることで起こります。
重要な指示はどこに置くべきですか?
スキルは、重要な情報を先頭か末尾の近くに置くことを勧めています。そこが注意を最も引きやすいからです。
詳細
作者による元の説明
This skill should be used for diagnosing and mitigating context degradation: lost-in-middle failures, context poisoning, context clash, context confusion, attention-pattern issues, and agent performance degradation caused by accumulated or conflicting context.
人気
- GitHubのスター
- 18k
- ランキング
- #10638
- ライセンス
- MIT
- 更新日
- 2026/10/11
コメント
- …
このリポジトリの他のスキル
context-engineering-collection
18kエージェントが、AIモデルのコンテキストウィンドウに何を入れるかを管理するよう支援します。メモリやツールから、マルチエージェントの構成、評価までを扱います。
advanced-evaluation
18kエージェントが、スコアリング、並べての比較、バイアスの確認を使って、別のAIによりAIの回答を判定する方法を教えます。
bdi-mental-states
18kエージェントが、BDIの方法を使って信念、目標、計画をモデル化するよう教えます。そのため、各決定を追跡して説明できます。
context-compression
18kエージェントが、長いAIのセッションを、決定、ファイル、リスク、次のステップを残した要約に短縮するよう支援します。
似ているスキル
add-model-provider
394k安全なセットアップコマンドで新しいAIモデルプロバイダーをOpenClawに接続し、APIキーを平文で残さず、ライブテストを行うようエージェントを支援します。
acp-router
394kClaude CodeやCursorなどのコーディングアシスタントに、OpenClaw経由でタスクを渡し、その作業がそのツール内で行われるようエージェントを支援します。
browser-automation
394kログイン、タブ、応答しなくなったページからの復旧を含め、Webページを段階的に操作するようエージェントに教えます。