{
  "id": "recipe:context-engineering",
  "kind": "recipe",
  "title": "My agent's context decides its quality and I do not know what to put in it each turn",
  "job": "Builders put it to us in their own words: \"My agent's context is the thing that decides its quality and I do not know what to put in it each turn.\"\n\nThe live argument inside that question is whether the answer is more curation or less. The Anthropic engineering blog reports that for the Claude 5 generation, over 80 percent of Claude Code's system prompt was removed with no measurable loss on its coding evaluations (https://claude.com/blog/the-new-rules-of-context-engineering-for-claude-5-generation-models). That is the direct opposite of the 2024-era advice to write longer, more specific, example-heavy prompts, and any recipe for this job has to survive it.\n\nRecipe state is `curated`, not `tested`, in `site/recipes/schema.json`. We have not run anything in this recipe end to end. Versions, licences and dates are as of 2026-10-14.\n\nSibling recipes this one is deliberately scoped against: tool use and function calling, retrieval and RAG, adding memory to an agent, evaluating agent quality, multi-agent orchestration. See Scope.",
  "approach": "### Recommended: smallest sufficient context, assembled per turn, disclosure deferred, clearing automated\n\nTreat context as a budget you spend on purpose, not a container you fill. Four parts that compose.\n\nFirst, cut the always-on block to what actually changes behavior. The 80 percent removal result is the evidence that the always-on prefix is usually over-provisioned. Second, defer what you can: keep lightweight identifiers (file paths, stored queries, links, tool names) in context and let the agent pull the body in with a tool when it needs it. This is progressive disclosure, the shift from pre-inference embedding retrieval to just-in-time context. Third, automate the relief valve: use the provider's server-side compaction or context editing rather than maintaining your own summarizer. Fourth, measure the budget: explicit token ceilings per section, and the ratio of signal to plastic tracked per turn.\n\nWhy this one:\n\n- It is the only approach that survives the strongest counterevidence. Context Rot measured degradation across 18 models as input grows, so \"more context\" is not a safe default, and the 80 percent removal result shows the large prefix was mostly cost.\n- It matches where the shipped automation actually is. Compaction and context editing exist as server-side beta features, so the relief valve is configuration rather than a subsystem.\n- Its failure mode is bounded. Defer too much and the agent makes an extra tool call. Stuff too much and you pay context rot on every turn, invisibly.\n- It degrades gracefully across models. The per-turn assembly loop does not depend on any one provider's compaction API.\n\nSwitch condition: if your prefix is genuinely stable across requests (fixed agent, fixed toolset), keep the definitions and add prompt caching rather than trimming further. The two compose. Caching is what makes a stable prefix cheap, not an argument for a large one.\n\n### Alternative not chosen as the default: assemble everything relevant up front, summarize when it fills\n\nThe 2024-era default and still the most common shape in the wild: one large system prompt with every rule and example, every tool definition at the front, retrieved documents pasted in, full message history, and a summarizer that fires when the window is nearly full.\n\nNot the default for three reasons. Context Rot measured degradation across 18 models as input length grows, so a bigger prompt is not a safer prompt at any tier. The 80 percent removal result means the large prefix was mostly cost. And a summarizer-only relief valve is lossy at exactly the moment it matters: the Anthropic engineering post warns that \"overly aggressive compaction can result in the loss of subtle but critical context whose importance only becomes apparent later\", and its recommended tuning is to maximize recall first, then iterate on precision.\n\nKeep it for the subset of cases where the context is genuinely small and never grows: a fixed classification or extraction task, a single-turn transform. Below that floor, assembling everything is fine and simpler.\n\n### Alternative not chosen as the default: treat it as a retrieval problem, top-k it back\n\nRetrieve top-k chunks each turn from an embedding index, or hand state to a memory service such as mem0 or Letta and pull relevant memories back, and consider the context job done.\n\nThis is the strongest approach when the hard part really is that the relevant facts live in a corpus you cannot fit. It is not the default for general agent work because retrieval is one input to context, not the whole of it, and the other inputs are where the failures are: the tool block, the system prompt, the accumulated `tool_result` blocks, the ordering of what is already in the window, and the lifetime of each piece of state are all context decisions top-k does not touch. The Claude docs ship four separate mechanisms for exactly this reason, because they are four different sources of pressure. Context Rot's finding is also about distractors and position, not about retrieval recall: plausible but irrelevant retrieved text makes a model worse, so a retrieval layer tuned for recall can actively degrade the context it feeds.\n\nAdopt retrieval for the corpus problem, and still do the four things above.",
  "components": [
    {
      "name": "Claude server-side compaction (on demand and threshold)",
      "version": "Beta. On-demand beta header `compact-2026-09-04`, top-level `compaction` parameter",
      "license": "not applicable, provider feature",
      "url": "https://platform.claude.com/docs/en/build-with-claude/compaction"
    },
    {
      "name": "Compaction on demand",
      "version": "Beta header `compact-2026-09-04`. Available on Claude API, Claude Platform on AWS, Google Cloud, Microsoft Foundry",
      "license": "not applicable",
      "url": "https://platform.claude.com/docs/en/build-with-claude/compaction-on-demand"
    },
    {
      "name": "Compaction at a token threshold",
      "version": "Beta; exact identifier unconfirmed (page listed in the docs index, not fetched)",
      "license": "not applicable",
      "url": "https://platform.claude.com/docs/en/build-with-claude/compaction-threshold"
    },
    {
      "name": "Compaction in the background",
      "version": "Beta; identifier unconfirmed (listed in index, not fetched)",
      "license": "not applicable",
      "url": "https://platform.claude.com/docs/en/build-with-claude/compaction-background"
    },
    {
      "name": "Compaction that keeps recent turns",
      "version": "Beta; identifier unconfirmed (listed in index, not fetched)",
      "license": "not applicable",
      "url": "https://platform.claude.com/docs/en/build-with-claude/compaction-keep-recent-turns"
    },
    {
      "name": "Compaction and preserved thinking",
      "version": "Beta; identifier unconfirmed (listed in index, not fetched)",
      "license": "not applicable",
      "url": "https://platform.claude.com/docs/en/build-with-claude/compaction-thinking-blocks"
    },
    {
      "name": "Claude context editing (tool result clearing, thinking block clearing)",
      "version": "Beta header `context-management-2025-06-27`. Strategies `clear_tool_uses_20250919` and `clear_thinking_20251015`",
      "license": "not applicable",
      "url": "https://platform.claude.com/docs/en/build-with-claude/context-editing"
    },
    {
      "name": "Manage tool context (four-way comparison: tool search, programmatic tool calling, prompt caching, context editing)",
      "version": "n/a, documentation page",
      "license": "not applicable",
      "url": "https://platform.claude.com/docs/en/agents-and-tools/tool-use/manage-tool-context"
    },
    {
      "name": "Tool search tool (deferred tool loading)",
      "version": "n/a, documentation page",
      "license": "not applicable",
      "url": "https://platform.claude.com/docs/en/agents-and-tools/tool-use/tool-search-tool"
    },
    {
      "name": "Programmatic tool calling",
      "version": "n/a, documentation page",
      "license": "not applicable",
      "url": "https://platform.claude.com/docs/en/agents-and-tools/tool-use/programmatic-tool-calling"
    },
    {
      "name": "Claude prompt caching",
      "version": "`cache_control` with `{\"type\": \"ephemeral\"}`. 5-minute TTL by default, 1-hour TTL at additional cost",
      "license": "not applicable",
      "url": "https://platform.claude.com/docs/en/build-with-claude/prompt-caching"
    },
    {
      "name": "Claude context windows",
      "version": "n/a, documentation page (listed in index, not fetched)",
      "license": "not applicable",
      "url": "https://platform.claude.com/docs/en/build-with-claude/context-windows"
    },
    {
      "name": "Claude memory tool",
      "version": "n/a, documentation page (listed in index, not fetched)",
      "license": "not applicable",
      "url": "https://platform.claude.com/docs/en/agents-and-tools/tool-use/memory-tool"
    },
    {
      "name": "Claude cache diagnostics",
      "version": "n/a, documentation page (listed in index, not fetched)",
      "license": "not applicable",
      "url": "https://platform.claude.com/docs/en/build-with-claude/cache-diagnostics"
    },
    {
      "name": "Claude docs index (cheapest way to see which context features exist)",
      "version": "n/a",
      "license": "not applicable",
      "url": "https://platform.claude.com/docs/llms.txt"
    },
    {
      "name": "tiktoken",
      "version": "0.14.0, uploaded 2026-08-17",
      "license": "MIT (PyPI classifier `License :: OSI Approved :: MIT License`)",
      "url": "https://github.com/openai/tiktoken"
    },
    {
      "name": "Anthropic Python SDK",
      "version": "1.14.0, uploaded 2026-10-14; GitHub tag `v1.14.0`, 2026-10-14",
      "license": "MIT (PyPI metadata)",
      "url": "https://github.com/anthropics/anthropic-sdk-python"
    },
    {
      "name": "Anthropic TypeScript SDK",
      "version": "0.134.0 (npm `latest`), published 2026-10-14",
      "license": "MIT (npm metadata)",
      "url": "https://github.com/anthropics/anthropic-sdk-typescript"
    },
    {
      "name": "OpenAI Python SDK",
      "version": "3.31.0, uploaded 2026-10-14",
      "license": "Apache-2.0 (PyPI `license_expression`)",
      "url": "https://github.com/openai/openai-python"
    },
    {
      "name": "OpenAI Agents SDK, Python",
      "version": "0.23.1, uploaded 2026-10-02",
      "license": "MIT (PyPI metadata)",
      "url": "https://github.com/openai/openai-agents-python"
    },
    {
      "name": "OpenAI Agents SDK, TypeScript (`@openai/agents`)",
      "version": "0.20.0 (npm `latest`), published 2026-10-08",
      "license": "MIT (npm metadata)",
      "url": "https://github.com/openai/openai-agents-js"
    },
    {
      "name": "LangChain",
      "version": "1.4.6, uploaded 2026-10-14",
      "license": "MIT (PyPI metadata)",
      "url": "https://github.com/langchain-ai/langchain"
    },
    {
      "name": "LangGraph, Python (`langgraph`)",
      "version": "1.2.15, uploaded 2026-10-12. Sibling packages `langgraph-cli==0.4.35` and `langgraph-checkpoint-postgres==3.2.0`, both 2026-10-14",
      "license": "MIT (PyPI `license_expression`)",
      "url": "https://github.com/langchain-ai/langgraph"
    },
    {
      "name": "LangGraph, TypeScript (`@langchain/langgraph`)",
      "version": "1.5.0 (npm `latest`), published 2026-10-12. Separate version line from the Python package",
      "license": "MIT (npm metadata)",
      "url": "https://www.npmjs.com/package/@langchain/langgraph"
    },
    {
      "name": "Pydantic AI",
      "version": "2.56.0, uploaded 2026-10-13; GitHub tag `v2.56.0`, 2026-10-13",
      "license": "MIT (PyPI `license_expression`)",
      "url": "https://github.com/pydantic/pydantic-ai"
    },
    {
      "name": "DSPy",
      "version": "3.4.1, uploaded 2026-10-12; GitHub tag `3.4.1`, 2026-10-12",
      "license": "MIT (PyPI metadata)",
      "url": "https://github.com/stanfordnlp/dspy"
    },
    {
      "name": "Vercel AI SDK (`ai`)",
      "version": "7.0.140 (npm `latest`), published 2026-10-14",
      "license": "Apache-2.0 (npm metadata)",
      "url": "https://github.com/vercel/ai"
    },
    {
      "name": "LiteLLM",
      "version": "1.105.1, uploaded 2026-10-14",
      "license": "MIT (PyPI `license_expression`)",
      "url": "https://github.com/BerriAI/litellm"
    },
    {
      "name": "Instructor",
      "version": "1.17.0, uploaded 2026-09-09",
      "license": "MIT (PyPI metadata)",
      "url": "https://github.com/567-labs/instructor"
    },
    {
      "name": "MCP TypeScript SDK",
      "version": "1.32.1 (npm `latest`), published 2026-10-05",
      "license": "MIT (npm metadata)",
      "url": "https://github.com/modelcontextprotocol/typescript-sdk"
    },
    {
      "name": "LlamaIndex",
      "version": "0.14.25, uploaded 2026-09-21; GitHub tag `v0.14.25`, 2026-09-21",
      "license": "MIT (PyPI `license_expression`)",
      "url": "https://github.com/run-llama/llama_index"
    },
    {
      "name": "Chroma",
      "version": "1.5.9, uploaded 2026-05-05. GitHub org moved from `trychroma` to `chroma-core`",
      "license": "Apache-2.0 (raw `LICENSE` on `raw.githubusercontent.com/chroma-core/chroma/HEAD/LICENSE`)",
      "url": "https://github.com/chroma-core/chroma"
    },
    {
      "name": "mem0, Python SDK",
      "version": "2.2.1, 2026-09-25 (PyPI `mem0ai`)",
      "license": "Apache-2.0 (PyPI `license_expression`)",
      "url": "https://github.com/mem0ai/mem0"
    },
    {
      "name": "mem0, Node SDK",
      "version": "3.3.1, 2026-09-25. Separate version line from the Python SDK",
      "license": "Apache-2.0 (PyPI `license_expression` for the project)",
      "url": "https://github.com/mem0ai/mem0"
    },
    {
      "name": "Letta",
      "version": "0.34.12, uploaded 2026-10-12 (PyPI, version of record). Latest GitHub tag `v0.16.8`, 2026-05-14, lags badly",
      "license": "Apache-2.0 (PyPI `license_expression`)",
      "url": "https://github.com/letta-ai/letta"
    },
    {
      "name": "Graphiti",
      "version": "Latest GitHub tag `v0.30.2`, 2026-09-08. Not confirmed as published to PyPI under this name",
      "license": "Apache-2.0 (raw `LICENSE` on `raw.githubusercontent.com/getzep/graphiti/HEAD/LICENSE`)",
      "url": "https://github.com/getzep/graphiti"
    },
    {
      "name": "Claude Code",
      "version": "Latest tag `v2.1.300`, 2026-10-14",
      "license": "NOT open source. `LICENSE.md` reads \"© Anthropic PBC. All rights reserved.\" Cite as a behaviour reference, never as a component to vendor",
      "url": "https://github.com/anthropics/claude-code"
    },
    {
      "name": "advanced-context-engineering-for-coding-agents",
      "version": "unconfirmed",
      "license": "unconfirmed. Fetches of `LICENSE`, `LICENSE.md`, `LICENSE.txt` and `COPYING` returned nothing",
      "url": "https://github.com/humanlayer/advanced-context-engineering-for-coding-agents"
    }
  ],
  "steps": [
    "**Write down a context budget before writing any prompt.** Name an explicit token ceiling for each of: system prompt, tool definitions, retrieved material, recent turns, free space for reasoning. The target framing is the smallest set of high-signal tokens that maximizes the likelihood of the desired outcome. Without a number per section you cannot distinguish trimming from cutting into muscle.",
    "**Count tokens with the tokenizer the model actually uses.** Do not estimate from characters. tiktoken (0.14.0, MIT) covers the OpenAI family. The Anthropic tokenizer is not tiktoken, so use the provider's own counting for Claude. Re-measure after every material prompt change.",
    "**Cut the system prompt to what changes behavior, then prove the cut.** Move rules to judgement, single-source any instruction that appears twice, replace examples with better interfaces where the model supports it. The test is the same one used in the source result: remove a section, run your evaluation, keep the cut only if the eval does not move. Their measured result was over 80 percent removed with no measurable loss on coding evaluations; your number will differ, the method does not.",
    "**Decide examples versus interfaces by model capability, and record the decision.** For the newest models, examples constrain the exploration space and interface design is the stronger lever: expressive parameters on the tool, script or file rather than a demonstration. For weaker or older models, keep diverse canonical examples. The two sources disagree by model generation, so make this a deliberate per-model choice with a written reason, not a silent one.",
    "**Move tool definitions out of the front of every request.** Two mechanisms. Deferred loading, where the agent searches for a tool's full definition before use. Prompt caching, where a stable prefix is cached rather than trimmed. Pick by where the tokens are going: tool search for large toolsets where most tools are unused per turn, programmatic tool calling for chains of `tool_result` roundtrips, prompt caching for stable definitions, context editing for old results.",
    "**Keep identifiers in context and bodies out.** Store paths, queries, links and handles; fetch the payload with a tool when needed. The named tradeoff is real: runtime exploration is slower than pre-computed retrieval, so use just-in-time where the material is dynamic and pre-compute where it is not. The hybrid reference is CLAUDE.md files up front, glob and grep on demand.",
    "**Move durable state out of the prompt entirely.** Session objectives, decisions, open questions, known failures and next actions belong in a file or store the agent reads and writes, not in a growing transcript. A NOTES.md the agent maintains, or a to-do list, pulled back in when relevant, is the documented pattern.",
    "**Turn on the server-side relief valve, and know which one you turned on.** Compaction replaces older turns with a server-written summary (beta header `compact-2026-09-04`). Context editing clears by rule instead of summarizing (beta header `context-management-2025-06-27`, `clear_tool_uses_20250919` and `clear_thinking_20251015`). Do not enable both on one request; the docs state they cannot be combined. Clear tool results and old thinking first, because that is the cheapest and least lossy cut, then compact.",
    "**Tune the summarizer against real traces, recall first.** Maximize recall so the compaction captures every relevant piece of the trace, then iterate on precision to remove superfluous content. Keep the parts of the history that are still live: on-demand compaction can keep recent turns word for word and can run in the background so the conversation does not pause.",
    "**Measure the ratio, not just the total, and watch the cache.** Track tokens per section per turn and the signal-to-plastic ratio, so bloat is visible before it appears on a bill. Check the prompt cache hit rate alongside it, because a compaction or a context edit rewrites the prefix and the default 5-minute TTL leaves little slack. If edits keep busting the cache, move them earlier in the prefix or batch them at a turn boundary."
  ],
  "traps": [
    "**Mistake:** adding material to the window on the theory that extra context cannot hurt.",
    "**Why agents make it:** the 2024-era default treats the window as a container to fill, and the cost of over-stuffing is invisible in the output.",
    "**Fix:** treat every token as spent. Context Rot tested 18 models including GPT-4.1, Claude 4, Gemini 2.5 and Qwen3 and found performance grows less reliable as input length grows, on simple tasks as well as hard ones. Start by trying to remove rather than add. ### Trap 2: Writing an ever-longer system prompt to fix each failure",
    "**Mistake:** every failure adds a rule, and the rules accumulate into contradictory instructions from different layers, such as \"leave documentation as appropriate\" alongside \"DO NOT add comments\".",
    "**Why agents make it:** adding a rule is the locally cheapest action and its effect on other rules is not measured.",
    "**Fix:** cut first and measure, the same way the source result was produced. Prefer judgement over hardcoded rules on capable models. Re-run the eval after every removal so the cut is evidence, not opinion. ### Trap 3: Carrying the whole transcript because it fits",
    "**Mistake:** keeping every turn because the window has room.",
    "**Why agents make it:** fitting is used as the bar for whether to keep something.",
    "**Fix:** fitting is not the bar. Context Rot's findings on distractors and position mean a plausible but irrelevant turn degrades the answer even when there is room. Clear old `tool_result` blocks by rule and keep a typed state object for what still matters. ### Trap 4: Compacting too aggressively and losing the thing that mattered",
    "**Mistake:** a summarizer that rewrites the whole history loses subtle context whose importance only becomes apparent later, and the loss is silent.",
    "**Why agents make it:** compaction is tuned for size, because size is the visible metric.",
    "**Fix:** tune recall first on real traces, then precision. Keep recent turns word for word rather than folding them into the summary. ### Trap 5: Destroying the prompt cache between turns without noticing",
    "**Mistake:** a compaction or context edit between turns invalidates the cached prefix, and the default 5-minute TTL is tighter than it looks because the clock runs from request start and generation time counts against it.",
    "**Why agents make it:** cache behaviour is not visible in the response text, only in the hit rate and the bill.",
    "**Fix:** batch context edits at a turn boundary, keep the stable prefix at a fixed position, and monitor the hit rate rather than assuming it. The docs' worked example: a response streaming for 4 minutes leaves roughly 1 minute for the follow-up to still hit the cache. ### Trap 6: Turning on compaction and context management together",
    "**Mistake:** enabling both and expecting them to compose into a cheaper prompt.",
    "**Why agents make it:** both are documented as the fix for long conversations, so they look complementary.",
    "**Fix:** the on-demand compaction page states they cannot be combined on one request. Clear by rule first, compact second, never in the same call. ### Trap 7: Loading every tool definition on every request",
    "**Mistake:** a large MCP toolset pays its full schema cost before the agent has done any work.",
    "**Why agents make it:** tool schemas are declared statically at setup and rarely revisited.",
    "**Fix:** deferred loading via tool search for the large unused tail, prompt caching for the stable used set. This is the complaint behind the 315 KB to 5.4 KB Show HN. ### Trap 8: Assuming examples are always the cheap way to steer",
    "**Mistake:** shipping canonical examples to every model tier.",
    "**Why agents make it:** examples were the correct 2024 answer and the habit outlived the model generation it was correct for.",
    "**Fix:** for the newest models, examples constrain the exploration space and interface design is the fix. For older models, canonical examples are still recommended. Make this a deliberate per-model decision and record which one you chose and why. ### Trap 9: Treating context engineering as retrieval and stopping there",
    "**Mistake:** wiring top-k retrieval and declaring the context problem solved.",
    "**Why agents make it:** retrieval is the most legible of the pressures, and the one with a library attached.",
    "**Fix:** budget the sections independently. The system prompt, the tool block, the accumulated results, their ordering and their lifetimes are separate pressures with separate fixes, which is exactly why the provider ships four mechanisms and not one. ### Trap 10: Mirroring server-side edits in client state",
    "**Mistake:** building local bookkeeping to track what the server cleared.",
    "**Why agents make it:** it seems unsafe not to know what the model actually saw.",
    "**Fix:** context editing is applied server-side and the client keeps the unmodified history. Do not try to sync; you will diverge from what the model actually saw. ### Trap 11: Trusting a licence you did not read",
    "**Mistake:** assuming a repository is open source because it looks like one.",
    "**Why agents make it:** the package index and the repository page both look normal for `anthropics/claude-code`, which reads \"© Anthropic PBC. All rights reserved.\"",
    "**Fix:** read the `LICENSE` file itself. The same rule is what catches SDK licences differing between languages. ### Trap 12: Thinking the job is solved",
    "**Mistake:** presenting context engineering as finished once compaction is switched on.",
    "**Why agents make it:** the feature exists and the API returns 200.",
    "**Fix:** compaction quality is an unsolved tuning problem, the practice is called an emerging art by its own vendor, and the just-in-time tradeoff (slower than pre-computed retrieval) is real and unresolved."
  ],
  "scope": "### Covers\n\n- Setting and measuring a context budget.\n- Token accounting with the right tokenizer for the model in use.\n- Cutting the always-on system prompt on evidence.\n- The model-capability decision between examples and interfaces.\n- Deferring tool definitions and clearing old tool results.\n- Just-in-time retrieval by identifier, otherwise known as progressive disclosure.\n- Moving durable state out of the prompt into notes or a store.\n- Server-side compaction and context editing as the relief valve, and how to choose between them.\n- Keeping the prompt cache valid across edits.\n- Monitoring the per-section ratio rather than the total.\n\n### Does not cover\n\n- Tool schema authoring, tool selection and tool-call error handling. That is the sibling recipe for tool use and function calling.\n- Retrieval index design, chunking, embedding choice and vector store operation. That is the sibling recipe for retrieval and RAG. This recipe says when retrieval is the wrong whole answer, not how to build the index.\n- Memory as a product, its decay policy and its write policy. That is the sibling recipe for adding memory to an agent. This recipe covers only the boundary where memory state enters and leaves the context window.\n- Evaluations and scoring. That is the sibling recipe for evaluating agent quality. This recipe says what to count; it does not say how to grade.\n- Assigning context across multiple agents and roles, and what each sub-agent gets. That is the sibling recipe for multi-agent orchestration.\n- Any claim about which model has the best long-context behaviour, and any provider pricing.\n- Fine-tuning, distillation or any change to the weights. This is entirely a runtime concern.\n- A finished compaction prompt. The sources say the tuning is the work and is ongoing. This recipe hands the builder a method and a measurement, not a prompt to copy.",
  "use_case": "context-engineering",
  "sources": [
    "https://www.anthropic.com/engineering/effective-context-engineering-for-ai-agents (published 2025-09-29)",
    "https://claude.com/blog/the-new-rules-of-context-engineering-for-claude-5-generation-models (published 2026-07-24)",
    "https://platform.claude.com/docs/llms.txt",
    "https://platform.claude.com/docs/en/build-with-claude/compaction",
    "https://platform.claude.com/docs/en/build-with-claude/compaction-on-demand",
    "https://platform.claude.com/docs/en/build-with-claude/context-editing",
    "https://platform.claude.com/docs/en/build-with-claude/prompt-caching",
    "https://platform.claude.com/docs/en/agents-and-tools/tool-use/manage-tool-context",
    "https://research.trychroma.com/context-rot (2025-07-14)",
    "http://arxiv.org/abs/2307.03172v3 (\"Lost in the Middle\", first posted 2023-07-06)",
    "http://arxiv.org/abs/2609.27354v1 (constraint-driven context engineering, 2026-09-23)",
    "http://arxiv.org/abs/2609.11728v1 (context engineering at the scale of a codebase, 2026-09-10)",
    "http://arxiv.org/abs/2608.09153v1 (trajectory attribution for automated context engineering, 2026-08-10)",
    "http://arxiv.org/abs/2608.01269v2 (agentic context engineering for hierarchical GraphRAG, 2026-08-02)",
    "https://news.ycombinator.com/item?id=44427757 (915 points, 2025-06-30, 518 comments)",
    "https://news.ycombinator.com/item?id=45347532 (517 points, 2025-09-23, 418 comments)",
    "https://news.ycombinator.com/item?id=47417804 (473 points, 2026-03-17, 253 comments)",
    "https://news.ycombinator.com/item?id=49051361 (463 points, 2026-07-25, 403 comments)",
    "https://news.ycombinator.com/item?id=49023019 (394 points, 2026-07-23, 272 comments)",
    "https://news.ycombinator.com/item?id=44564248 (260 points, 2025-07-14, 59 comments)",
    "https://news.ycombinator.com/item?id=45418251 (148 points, 2025-09-29, 32 comments)",
    "https://news.ycombinator.com/item?id=45352901 (120 points, 2025-09-23, 4 comments)",
    "https://news.ycombinator.com/item?id=44432596 (117 points, 2025-07-01, 35 comments)",
    "https://news.ycombinator.com/item?id=47367526 (97 points, 2026-03-13, 64 comments)",
    "https://news.ycombinator.com/item?id=47148025 (84 points, 2026-02-25)",
    "https://www.philschmid.de/context-engineering",
    "https://github.com/humanlayer/advanced-context-engineering-for-coding-agents",
    "https://manus.im/blog/Context-Engineering-for-AI-Agents-Lessons-from-Building-Manus Hacker News points, dates and comment counts above are attributed to the source brief's 2026-10-14 Algolia reads. They were not re-queried for this recipe, so no page text rests on them as independently confirmed this pass. Not cited: Reddit. Every fetch returned HTTP 403 on 2026-10-14, with and without a browser user agent, so no Reddit thread appears above even though it is where the question is asked most informally. Also not cited: `zeli.app` and `hackernews.betacat.io`, which are aggregators rather than originals."
  ],
  "status": "curated",
  "superseded_by": null,
  "citation": "My agent's context decides its quality and I do not know what to put in it each turn. Recipe by alexndr.ai. https://alexndr.ai/recipes/context-engineering",
  "human_page": "https://alexndr.ai/recipes/context-engineering"
}