{"slug": "treat-the-context-window-like-a-budget-not-a-junk-drawer", "title": "Treat the Context Window Like a Budget, Not a Junk Drawer", "summary": "A developer created a Context Engineering Framework that treats the AI context window as a budget rather than a junk drawer. The framework, hosted in the ai-assistant-dot-files repo, defines canonical agents, skills, and rules in a shared layer, then projects them into six AI coding tools including Claude Code, Cursor, and GitHub Copilot. A dedicated context-engineer agent produces a context-manifest.md before any serious work begins, scoping the bounded context and estimating token budget pressure to prevent context-window failures.", "body_md": "Most AI coding workflows treat context as something that happens accidentally.\n\nYou open a few files. Paste a stack trace. Ask the model to inspect a directory. Then another. Then the chat grows heavy, the model starts missing earlier instructions, and everyone pretends the problem is \"the model got weird.\"\n\nIn `ai-assistant-dot-files`\n\n(I probably need to rename this now as its grown into something else)\n\nI wanted to treat the context window as a budget.\n\nNot a vibe. Not a giant bucket. A budget.\n\nThe repo now ships a Context Engineering Framework that defines one canonical set of agents, skills, and rules in `shared/`\n\n, then projects them into six AI coding tools: Claude Code, Cursor, Windsurf, GitHub Copilot, Gemini/Antigravity, and OpenAI Codex. The current repo has 24 agents, 53 skills, 13 inter-agent\n\ncontracts, and 6 platform targets.\n\nThe core idea is simple: before an agent does serious work, another agent should decide what belongs in the room.\n\nThe framework has a dedicated `context-engineer`\n\nagent. Its job is not to implement anything.\n\nIts job is to produce a `context-manifest.md`\n\nbefore the rest of the pipeline starts.\n\nThat manifest scopes the bounded context, identifies relevant files, surfaces Knowledge Items and ADRs, notes prior related deliveries, and estimates token budget pressure for the downstream agents.\n\nThis matters because the feature-delivery pipeline is not one prompt. It is a sequence:\n\nIf the first few steps load the wrong material, every later agent pays for it.\n\nThe important design move is that the context manifest is itself a governed artifact. It has a contract in `shared/contracts/context-manifest-contract.md`\n\n, and the `validate-artifact`\n\nskill checks that required sections are present before the pipeline moves forward.\n\nContext is not just \"whatever the chat accumulated.\"\n\nIt is an explicit handoff.\n\nOne of the most useful distinctions in the repo lives in `docs/runbooks/context-engineering.md`\n\n:\n\nPeople often flatten all three into \"RAG.\"\n\nThat loses important design pressure.\n\n**Context** is a working set. It should be small, relevant, and current.\n\n**Memory** is a durable corpus. It should be curated, searchable, and allowed to expire.\n\n**Learning** is a loop. It should turn repeated delivery evidence into changed rules, changed prompts, or new Knowledge Items.\n\nThe `context-engineer`\n\nreads memory to build better context, but it does not automatically rewrite memory.\n\nThat separation keeps a bad or noisy run from polluting the durable layer.\n\nThe framework also uses \"context decay.\"\n\nAn artifact more than two pipeline phases old should be read as a summary, not in full. The target is a small gist, roughly 200 words, produced through the `summarize-artifact`\n\nskill.\n\nThat is an intentionally boring mechanism, and that is why I like it.\n\nMost context-window failures do not need a magic retrieval system. They need fewer stale artifacts loaded verbatim.\n\nIf the developer is five phases downstream from the analyst, they probably need the current acceptance criteria, edge cases, and constraints. They do not need every sentence of the analyst's intermediate reasoning still floating in the model's attention.\n\nThe repo does not pretend every AI coding tool has the same capabilities.\n\n`docs/ARCHITECTURE.md`\n\ndefines a capability tier system. Claude Code has full agent orchestration. Cursor\n\nnow has real `.cursor/agents/`\n\nand `.cursor/skills/`\n\nloading, but its rule files still need fully inlined\n\ncontent. Windsurf and Copilot get persona/rule projections. Gemini/Antigravity reads `AGENTS.md`\n\nand has\n\nconfirmed skill invocation. Codex gets an inlined `.openai.md`\n\n.\n\nThat means the framework has to distinguish \"agent\" from \"persona.\"\n\nAn agent can have tool access and participate in a multi-step process. A persona is a context frame: useful,\n\nbut not autonomous.\n\nThe practical result is a `shared/`\n\ncanonical layer, plus generation and parity checks for each platform.\n\n`scripts/check-parity.sh`\n\nexists because hand-copying instructions across tools is how drift wins.\n\nIf you do not need a 24-agent framework, I would still steal these ideas:\n\nThe context window is not just a bigger prompt.\n\nIt is a scarce design surface.\n\nUse it like one.\n\n`README.md`\n\n— canonical `shared/`\n\nlayer, 24-agent roster, 53-skill catalog, six platform targets.`docs/ARCHITECTURE.md`\n\n— capability tiers, platform projection model, and context flow.`docs/runbooks/context-engineering.md`\n\n— Context/Memory/Learning distinction, context decay, manifest role.`docs/AGENT_REFERENCE.md`\n\n— `context-engineer`\n\nrole and counterbalances.`docs/features/context-engineering-framework/TODO.md`\n\n— Epic 5 contract work and Epic 23 contract closure.", "url": "https://wpnews.pro/news/treat-the-context-window-like-a-budget-not-a-junk-drawer", "canonical_source": "https://dev.to/orieken/treat-the-context-window-like-a-budget-not-a-junk-drawer-5602", "published_at": "2026-07-07 23:54:12+00:00", "updated_at": "2026-07-08 00:29:09.390768+00:00", "lang": "en", "topics": ["developer-tools", "artificial-intelligence", "large-language-models", "ai-agents", "ai-infrastructure"], "entities": ["Claude Code", "Cursor", "Windsurf", "GitHub Copilot", "Gemini", "OpenAI Codex", "ai-assistant-dot-files"], "alternates": {"html": "https://wpnews.pro/news/treat-the-context-window-like-a-budget-not-a-junk-drawer", "markdown": "https://wpnews.pro/news/treat-the-context-window-like-a-budget-not-a-junk-drawer.md", "text": "https://wpnews.pro/news/treat-the-context-window-like-a-budget-not-a-junk-drawer.txt", "jsonld": "https://wpnews.pro/news/treat-the-context-window-like-a-budget-not-a-junk-drawer.jsonld"}}