[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7ADEBNHBG7X2Z88S162F5Z5":3,"skill-same:01M7ADEBNHBG7X2Z88S162F5Z5":49},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":27,"commitSha":28,"skillDirectory":29,"forksCount":30,"repositoryHtmlUrl":31,"repositoryHomepageUrl":32,"ownerHtmlUrl":33,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":34,"install":35,"resources":48},"01M7ADEBNHBG7X2Z88S162F5Z5","context-window-hygiene",null,"Use when a conversation is getting long and the agent seems to be forgetting earlier instructions, before adding MCP servers or rules files, when deciding whether to clear or compact the chat, or when context window budget feels tight. Covers lost-in-the-middle, clear-vs-compact, and lean-context hygiene.","Leostruka\u002Fdevin-bundle","Leostruka","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F81370685?v=4","01M7AD8MAK63VDNAWRDRRRW04N","leandro ostruka","01M7AD8MBS65YDS1KMMV7YPM07",0,"MIT","https:\u002F\u002Fgithub.com\u002FLeostruka\u002Fdevin-bundle\u002Fblob\u002Fmain\u002Fskills\u002Fcontext-window-hygiene\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: context-window-hygiene\ndescription: Use when a conversation is getting long and the agent seems to be forgetting earlier instructions, before adding MCP servers or rules files, when deciding whether to clear or compact the chat, or when context window budget feels tight. Covers lost-in-the-middle, clear-vs-compact, and lean-context hygiene.\ntriggers: [user, model]\n---\n\n# Context Window Hygiene\n\n## Core Facts\n\n- **Context window = input + output tokens the model sees at once.** Every\n  system prompt, rules file, MCP tool definition, message, and tool result\n  counts against a hard limit set by the model provider.\n- **Hard limit.** Each model has a fixed token ceiling (e.g. 200k, 2M). Hit it\n  and the provider errors, or output stops mid-generation.\n- **Smart zone vs dumb zone.** AI-coding workflow guides observe that output\n  quality drops once the active context passes roughly ~100k tokens, regardless\n  of the model's total window. Stay in the smart zone by sizing tasks so the\n  working context stays well below that marker.\n- **Bigger window ≠ better retrieval.** A 10M-token window that cannot find\n  the needle is worse than a 200k window that can. Evaluate retrieval quality,\n  not just size. (Llama 4 Scout: 10M window, severe lost-in-the-middle.)\n- **Lost in the middle.** In long contexts the attention mechanism\n  deprioritizes information in the *middle* of the conversation. Start\n  (primacy) and end (recency) dominate. Middle detail has weak impact.\n\n## When to Use\n\n- Conversation is long and the agent is drifting or ignoring early rules.\n- Deciding whether to `clear` or `compact`.\n- About to add an MCP server, a large rules file, or paste a huge document.\n- Choosing a model by context size.\n\n## When NOT to Use\n\n- Context is small and focused - direct work is cheaper.\n- You need dense access to early detail - use `context-folding` instead.\n\n## Clear vs Compact\n\n| Action | What it does | When |\n|---|---|---|\n| `clear` | Wipes history, blank slate | **Default.** Task is done or unrelated to prior chat. |\n| `compact` | Summarizes history into a small message | Preserve the *vibes*\u002Fintent of the current task while freeing space. Costs tokens + time to generate the summary. |\n\n**Default to `clear`.** Use `compact` only when continuing the same task and\nlosing the thread would hurt. Compaction drops detail - it preserves intent,\nnot facts. If dense access to early context is needed, use `context-folding`\n(offload to file, grep\u002Fread on demand) instead of compacting.\n\nCritique of compaction: summaries leave \"sediment\" (lossy residue that still\noccupies attention) and are a worse default than a clean `\u002Fclear` once the\nsession enters the dumb zone. Treat `\u002Fcompact` as an escape hatch, not a\nhygiene default.\n\n## Lean Context Rules\n\n1. **Clear chats between unrelated tasks.** Refreshes memory, removes\n   lost-in-the-middle noise. A fresh thread outperforms a bloated one.\n2. **Keep rules files small.** `.devin\u002Fglobal_rules.md` \u002F `.devin\u002Frules\u002F*.md` \u002F cursor rules \u002F claude rules are\n   loaded into *every* conversation. A 25k-token rules file is 12% of a 200k\n   window before you say a word. Compress, modularize into skills, reference\n   instead of inlining. See `writing-for-agents`.\n3. **Be paranoid about MCP servers.** Each server injects every tool\n   definition into the system prompt. Two servers can eat a third of the\n   window before the first message. Audit before adding - use\n   `mcp-context-audit`. Keep tool count per server under 10-15.\n4. **Don't paste huge documents into chat.** Write to a file with `write`,\n   then `read` with offset\u002Flimit or `grep` to pull only what's needed. This is\n   `context-folding` at its simplest.\n5. **Prefer subagents for parallel exploration.** Each subagent has its own\n   window; only the synthesis returns to the root. 50-100x context savings.\n   See `dispatching-parallel-agents`.\n6. **Watch the budget.** Run `context-budget.py` (SessionStart hook) to see\n   the token cost of `.devin\u002Fglobal_rules.md` + loaded rules before working.\n7. **Guard against context overflow.** If a `tokens-limit` or equivalent\n   guard is available, use it. If the active context approaches the threshold,\n   stop the current task, `clear` or `compact`, and restart with a leaner\n   context. Loops without a bound are a cost and correctness risk.\n\n## Anti-Patterns\n\n- **Keeping one long chat for the whole day.** Maximizes lost-in-the-middle.\n- **Adding MCP servers \"just in case.\"** Permanent context tax for unused tools.\n- **Writing giant rules files.** Self-defeating: the rules degrade retrieval\n  of everything else in context.\n- **Pasting a 500k log into chat.** Use a file + grep.\n- **Compacting when you need the original detail.** Compaction is lossy.\n- **Running unbounded loops.** Every iteration burns tokens; cap retries and\n  stop when the context threshold is reached.\n\n## Model Selection Heuristic\n\n| Need | Pick |\n|---|---|\n| Long chat, simple retrieval | Large window *with good needle-in-haystack benchmarks* |\n| Precision on early rules | Smaller window, clear often |\n| Huge document analysis | `context-folding` on any model; don't rely on window size alone |\n\n## Source\n\nDistilled from AI-coding workflow guides on context-window hygiene and\ncompaction trade-offs.\n\nKey claims verified against primary sources:\n- Lost-in-the-middle: Liu et al. (arXiv:2307.03172).\n- Window limits are provider-set and hard: models.dev model cards.\n- Compaction is lossy by design: see `context-folding` comparison table.\n\nIf the user asks for current context-window limits or model benchmarks, invoke `research` to fetch the latest model cards and papers.\n","# Context Window Hygiene\n\n## Core Facts\n\n- **Context window = input + output tokens the model sees at once.** Every\n  system prompt, rules file, MCP tool definition, message, and tool result\n  counts against a hard limit set by the model provider.\n- **Hard limit.** Each model has a fixed token ceiling (e.g. 200k, 2M). Hit it\n  and the provider errors, or output stops mid-generation.\n- **Smart zone vs dumb zone.** AI-coding workflow guides observe that output\n  quality drops once the active context passes roughly ~100k tokens, regardless\n  of the model's total window. Stay in the smart zone by sizing tasks so the\n  working context stays well below that marker.\n- **Bigger window ≠ better retrieval.** A 10M-token window that cannot find\n  the needle is worse than a 200k window that can. Evaluate retrieval quality,\n  not just size. (Llama 4 Scout: 10M window, severe lost-in-the-middle.)\n- **Lost in the middle.** In long contexts the attention mechanism\n  deprioritizes information in the *middle* of the conversation. Start\n  (primacy) and end (recency) dominate. Middle detail has weak impact.\n\n## When to Use\n\n- Conversation is long and the agent is drifting or ignoring early rules.\n- Deciding whether to `clear` or `compact`.\n- About to add an MCP server, a large rules file, or paste a huge document.\n- Choosing a model by context size.\n\n## When NOT to Use\n\n- Context is small and focused - direct work is cheaper.\n- You need dense access to early detail - use `context-folding` instead.\n\n## Clear vs Compact\n\n| Action | What it does | When |\n|---|---|---|\n| `clear` | Wipes history, blank slate | **Default.** Task is done or unrelated to prior chat. |\n| `compact` | Summarizes history into a small message | Preserve the *vibes*\u002Fintent of the current task while freeing space. Costs tokens + time to generate the summary. |\n\n**Default to `clear`.** Use `compact` only when continuing the same task and\nlosing the thread would hurt. Compaction drops detail - it preserves intent,\nnot facts. If dense access to early context is needed, use `context-folding`\n(offload to file, grep\u002Fread on demand) instead of compacting.\n\nCritique of compaction: summaries leave \"sediment\" (lossy residue that still\noccupies attention) and are a worse default than a clean `\u002Fclear` once the\nsession enters the dumb zone. Treat `\u002Fcompact` as an escape hatch, not a\nhygiene default.\n\n## Lean Context Rules\n\n1. **Clear chats between unrelated tasks.** Refreshes memory, removes\n   lost-in-the-middle noise. A fresh thread outperforms a bloated one.\n2. **Keep rules files small.** `.devin\u002Fglobal_rules.md` \u002F `.devin\u002Frules\u002F*.md` \u002F cursor rules \u002F claude rules are\n   loaded into *every* conversation. A 25k-token rules file is 12% of a 200k\n   window before you say a word. Compress, modularize into skills, reference\n   instead of inlining. See `writing-for-agents`.\n3. **Be paranoid about MCP servers.** Each server injects every tool\n   definition into the system prompt. Two servers can eat a third of the\n   window before the first message. Audit before adding - use\n   `mcp-context-audit`. Keep tool count per server under 10-15.\n4. **Don't paste huge documents into chat.** Write to a file with `write`,\n   then `read` with offset\u002Flimit or `grep` to pull only what's needed. This is\n   `context-folding` at its simplest.\n5. **Prefer subagents for parallel exploration.** Each subagent has its own\n   window; only the synthesis returns to the root. 50-100x context savings.\n   See `dispatching-parallel-agents`.\n6. **Watch the budget.** Run `context-budget.py` (SessionStart hook) to see\n   the token cost of `.devin\u002Fglobal_rules.md` + loaded rules before working.\n7. **Guard against context overflow.** If a `tokens-limit` or equivalent\n   guard is available, use it. If the active context approaches the threshold,\n   stop the current task, `clear` or `compact`, and restart with a leaner\n   context. Loops without a bound are a cost and correctness risk.\n\n## Anti-Patterns\n\n- **Keeping one long chat for the whole day.** Maximizes lost-in-the-middle.\n- **Adding MCP servers \"just in case.\"** Permanent context tax for unused tools.\n- **Writing giant rules files.** Self-defeating: the rules degrade retrieval\n  of everything else in context.\n- **Pasting a 500k log into chat.** Use a file + grep.\n- **Compacting when you need the original detail.** Compaction is lossy.\n- **Running unbounded loops.** Every iteration burns tokens; cap retries and\n  stop when the context threshold is reached.\n\n## Model Selection Heuristic\n\n| Need | Pick |\n|---|---|\n| Long chat, simple retrieval | Large window *with good needle-in-haystack benchmarks* |\n| Precision on early rules | Smaller window, clear often |\n| Huge document analysis | `context-folding` on any model; don't rely on window size alone |\n\n## Source\n\nDistilled from AI-coding workflow guides on context-window hygiene and\ncompaction trade-offs.\n\nKey claims verified against primary sources:\n- Lost-in-the-middle: Liu et al. (arXiv:2307.03172).\n- Window limits are provider-set and hard: models.dev model cards.\n- Compaction is lossy by design: see `context-folding` comparison table.\n\nIf the user asks for current context-window limits or model benchmarks, invoke `research` to fetch the latest model cards and papers.\n",{"name":5,"triggers":24,"description":7},[25,26],"user","model","main","02b95ddb62959a00b3c31442c2046aca0d19563c","skills\u002Fcontext-window-hygiene",1,"https:\u002F\u002Fgithub.com\u002FLeostruka\u002Fdevin-bundle","https:\u002F\u002Fleostruka.github.io\u002Fdevin-bundle\u002F","https:\u002F\u002Fgithub.com\u002FLeostruka","2026-11-15 05:19:58",{"source":8,"skillName":5,"commands":36,"prompt":46,"zipAvailable":47},[37,40,43],{"tool":38,"command":39},"npx","npx skills add Leostruka\u002Fdevin-bundle --skill context-window-hygiene",{"tool":41,"command":42},"bunx","bunx skills add Leostruka\u002Fdevin-bundle --skill context-window-hygiene",{"tool":44,"command":45},"pnpm","pnpm dlx skills add Leostruka\u002Fdevin-bundle --skill context-window-hygiene","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FLeostruka\u002Fdevin-bundle\u002Fblob\u002Fmain\u002Fskills\u002Fcontext-window-hygiene\u002FSKILL.md",true,[],[50,57,64,71,78,85],{"skillNo":51,"name":52,"nameZh":6,"description":53,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":54,"categories":55,"keywords":56,"publishedAt":19},"01M7E0K3MG2XC4FSRV0MK6SFR1","montador-de-ideias","Use when assembling, expanding, or elevating a raw project idea or initial prompt into an ultra-detailed, first-principles dossier and compiled master prompt with journalistic OSINT market research, Tech Lead and Staff Architect justifications, atomic and modular hardening\u002Foptimization, and high-impact contact surfaces.","https:\u002F\u002Fgithub.com\u002FLeostruka\u002Fdevin-bundle\u002Fblob\u002Fmain\u002Fskills\u002Fmontador-de-ideias\u002FSKILL.md",[],[],{"skillNo":58,"name":59,"nameZh":6,"description":60,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":61,"categories":62,"keywords":63,"publishedAt":19},"01M7E0J7JJWZ8QMK01RZ3B3C9Z","git-github-adaptive-engineering","Use when any task touches git history, GitHub issues\u002FPRs\u002Freleases\u002FCI, repo governance, or branch and merge decisions. Runs the Fase Zero situational-awareness battery, picks one of five delivery flows via the adaptive decision engine, and enforces commit\u002FPR information-density standards. Orchestrates the gh, git-workflows, github-actions, pr, and debug\u002Ffinish skills.","https:\u002F\u002Fgithub.com\u002FLeostruka\u002Fdevin-bundle\u002Fblob\u002Fmain\u002Fskills\u002Fgit-github-adaptive-engineering\u002FSKILL.md",[],[],{"skillNo":65,"name":66,"nameZh":6,"description":67,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":68,"categories":69,"keywords":70,"publishedAt":19},"01M7E0GJFRPFEVQQMXEM58EWDM","adaptive-agenda-calendar-routine-engine","Use when planning or executing work across hours, days, weeks, or sprints. Turns the calendar into a strict time-blocked agenda (HH:MM-HH:MM blocks carrying a routine profile, expected inputs, and a handoff output artifact), runs the 5-stage cognitive flow (Radar and Hunt -> Triage plus Steve Jobs conception -> workbench manifest -> >=32-cycle loop -> Close plus Open-Minded Scrum), and unfolds macro calendar milestones into micro agenda blocks through extensions\u002Fgcal\u002Fwrapper.py.","https:\u002F\u002Fgithub.com\u002FLeostruka\u002Fdevin-bundle\u002Fblob\u002Fmain\u002Fskills\u002Fadaptive-agenda-calendar-routine-engine\u002FSKILL.md",[],[],{"skillNo":72,"name":73,"nameZh":6,"description":74,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":75,"categories":76,"keywords":77,"publishedAt":19},"01M7AE2K9FTY0BVS48N0A9JFKF","demo","Use when demonstrating a skill in a fixture project.","https:\u002F\u002Fgithub.com\u002FLeostruka\u002Fdevin-bundle\u002Fblob\u002Fmain\u002Ftests\u002Ffixtures\u002Fdevin-config\u002Fproject\u002F.devin\u002Fskills\u002Fdemo\u002FSKILL.md",[],[],{"skillNo":79,"name":80,"nameZh":6,"description":81,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":82,"categories":83,"keywords":84,"publishedAt":19},"01M7AE2G3DP38PTV3B1N7MW5TS","duplicate-skill","Use when testing duplicate skill name detection.","https:\u002F\u002Fgithub.com\u002FLeostruka\u002Fdevin-bundle\u002Fblob\u002Fmain\u002Ftests\u002Ffixtures\u002Fdevin-config\u002Fproject\u002F.devin\u002Fskills\u002Fbeta\u002FSKILL.md",[],[],{"skillNo":86,"name":80,"nameZh":6,"description":81,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":87,"categories":88,"keywords":89,"publishedAt":19},"01M7AE2DBR8ZHT6T875MJ392GK","https:\u002F\u002Fgithub.com\u002FLeostruka\u002Fdevin-bundle\u002Fblob\u002Fmain\u002Ftests\u002Ffixtures\u002Fdevin-config\u002Fproject\u002F.devin\u002Fskills\u002Falpha\u002FSKILL.md",[],[]]