AI GLOSSARY · PROMPTS AND INSTRUCTIONS

Context engineering

Markdown version · Wikidata Q137916163

Definition

Context engineering is usually described as the practice of choosing and maintaining the information a language model sees at each step, including instructions, tools, examples, message history and retrieved data, not only the wording of the prompt.

Also called: context engineering for AI agents, context engineering AI, context engineering vs prompt engineering, agent context management.

In plain language

Context engineering is deciding what goes on the model's desk before it answers. Alongside knowledge learned during training, a model uses the context supplied for that request: selected instructions, tool descriptions, earlier messages and files or search results. Think of briefing a new colleague: a good brief is short, current and has the right documents, while a pile of everything makes them miss the point. For an AI agent that works for hours, the job can include selecting, trimming and refreshing that pile as it grows. The limit is that the space is finite, so adding text can push out other text and can make results worse. Resending a large retained context can increase token usage; allowance and billing effects depend on the provider, plan and caching.

Technical definition

The term covers managing the whole token budget of a request: system prompt, tool definitions, examples, conversation history, tool results and retrieved documents. Anthropic's engineering article calls it the natural progression of prompt engineering, and lists techniques for long tasks. Compaction summarises a conversation near the context limit and continues in a fresh window. Structured note-taking has the agent write notes to storage outside the window and reload them later. Sub-agents handle focused work in clean windows and return condensed summaries. Just-in-time retrieval keeps lightweight references such as file paths and loads data through tools only when needed.

Worked examples in this catalogue

Catalogue examples point at a skill, guide or coding tool listed on this site, with what to run and what you see. An example marked illustrative describes the item from its own documentation; it was not executed for this page. Platform Scores are our assessment under a published method, not a safety guarantee.

  1. Skill by Skill Almanac · Illustrative, not executed

    context-window-packer 56/100 · Provisional, not yet measuredScored · Method v0.2 · How we score

    What you see
    A record of which files were kept, shrunk or dropped to fit one prompt's token budget, and the reason for each choice.
    Why it exercises the concept
    It is context engineering done by hand and written down: a limited budget, a set of candidates and an explicit decision about what earns a place.
  2. Skill by Skill Almanac · Illustrative, not executed

    session-handoff-notes 63/100 · grade CScored · Method v0.2 · How we score

    What you see
    A handoff note the next coding-agent session can act on, checked for evidence, paths and vague items.
    Why it exercises the concept
    It matches the note-taking technique in Anthropic's article: state is saved outside the window so a fresh session can continue without carrying the old history.
  3. Coding tool · Illustrative, not executed

    Claude Code

    What to try
    /compact
    What you see
    Claude Code summarises the conversation so far and continues from the summary. The costs page shows adding instructions after the command, such as focusing on code samples and API usage, to say what to keep. The same page says /context shows what is using space.
    Why it exercises the concept
    Compaction is one of the techniques the article names, and this is the command that performs it in a coding session.

How it shows up when you use agents

In a coding-agent session, context is the information actually supplied for a model request. It can include a system prompt, loaded project instructions, selected tool definitions, retained messages and tool results. It need not include every historical command output or every available tool: compaction, clearing and deferred loading can change what is retained. The context window is the ceiling on all of it together. Context engineering is the habit of managing that pile on purpose.

What breaks when it is misunderstood: people keep rewriting the prompt when the real problem is the pile. A session that has run for hours carries stale tool output and old dead ends, and the agent can lose the thread or repeat itself. Claude Code documents compaction, context management and deferred tool definitions. The retained context, caching and provider or plan determine the usage and billing effects; historical raw output need not all be resent.

Next action: when a session drifts, check what is occupying space before rewording anything. In Claude Code, /context shows it. Use /compact with a note about what to keep, or /clear between unrelated tasks. Write down what the next session needs, as in a handoff note, rather than hoping the old history survives. For work that splits cleanly, an agent can delegate to a subagent so the noisy detail stays out of the main window.

Common confusions

  • Context engineering versus prompt engineering. Prompt engineering is mainly about writing the instructions. Context engineering, per Anthropic's article, also covers tools, examples, message history and external data. See Prompt engineering.
  • Context window versus context. The window is the maximum size. The context is what you actually put in it.
  • Context versus memory. Context is what the model sees for this request. Agent memory is stored information that may be loaded into context later.
  • Myth. More context gives better answers. The space is finite, and extra text competes with the text that matters.
Show all 15 related terms

Terms that mention Context engineering

3 terms mention this one

More in Prompts and instructions

Next steps

  1. context-window-packer A skill that exercises it.
  2. Agent memory Related term.
  3. System prompt Related term.
  4. All glossary terms A to Z and by family.

Sources

Definitions are written by Skill Almanac from these sources and were checked against them on 2026-11-25. Wikipedia is never the only source.

Review record

Last verified

Drafted by Claude (original draft) and OpenAI Codex (targeted revisions); sources and example targets checked by Independent automated source review (OpenAI Codex); not human peer review on 2026-11-25. Last verified .

Change log (5)
  • : Independent automated factual/example review completed. Cached US query estimate aligned to receipt; no traffic promise. Final technical gate recorded separately; publication disabled.
  • : Targeted batch-04 source repairs; qualified scope and illustration claims. Independent affected review pending; no publication approval.
  • : First version.
  • : Verifier pass: aligned Anthropic framing and dropped unsourced definition claim.
  • : Automated review completed; approved for the staged public release. Search indexing is controlled by the release configuration.