What problem does it solve? Agents degrade as their context window fills: they loop, repeat actions, chase nonexistent files or endpoints, pick the wrong tool, and contradict themselves over long runs. This Skill provides a framework for diagnosing those failures and deciding exactly which tokens earn a place in the window at each step. ## Core Features & Use Cases - Failure-mode diagnosis: Classify agent misbehavior into the four standard modes — poisoning, distraction, confusion, and clash — each with distinct mitigations. - Context budgeting and reclamation: Plan working budgets as a fraction of the rated window, and apply the raw → compaction → summarization preference ordering with correct trigger placement around 70–75% of budget. - System prompt, retrieval, and memory design: Guidance on what belongs in a system prompt, when agentic search beats embeddings, the four memory tiers (working, episodic, semantic, procedural), and subagent context isolation. - Use Case: An agent loops on the same failed tool call after 40 turns. Use this Skill to identify distraction as the failure mode, cap history, add a no-progress detector, and compact earlier turns while keeping recent tool calls raw. ## Quick Start Ask the agent to diagnose why my long-running agent keeps repeating itself and to propose a context budget and compaction strategy for it.