HHandover
All guides

Context engineering

Context engineering for AI agents: memory vs shared context

Context engineering for AI agents is the practice of selecting, structuring, and delivering the information an agent needs for the current task. Use prompt context for immediate instructions, runtime memory for local recall, shared context for accountable work that crosses people or agents, and source artifacts for evidence. Production systems usually need all four layers, with clear rules for what enters each one.

Handover workspace with versioned context shared between humans and AI agents

Continue from evidence

Try the workflow before setup

Inspect a complete no-account handover, then carry its exact state into your first workspace or connect an agent.

What is context engineering for AI agents?

Context engineering is the deliberate design of what information reaches an AI agent, when it arrives, how it is structured, and where it persists. The goal is not to maximize tokens. It is to give the model the smallest trustworthy context that supports the next decision while keeping durable state and evidence available outside the active context window.

  • Instructions define the role, constraints, tools, and output contract.
  • Working context contains the current objective, recent observations, and relevant tool results.
  • Runtime memory recalls preferences or facts useful to the same application across turns or sessions.
  • Shared context preserves accountable work that another person, model, or tool must inspect and continue.
  • Source artifacts preserve the files, data, and evidence behind summaries and decisions.
Context engineering layer map separating instructions, working context, runtime memory, shared context, and source artifacts, with placement questions for need, actors, evidence, access boundary, and lifetime.
Choose the smallest context layer that satisfies the task, then publish a shared record when another authenticated actor must verify or continue the work.

What is agent memory?

Agent memory is information retained by an agent runtime across turns or sessions. It can improve local continuity by recalling preferences, prior interactions, entities, or thread state. Its visibility, lifecycle, authorship, and portability still depend on the runtime and storage system that own it.

What is shared context for AI agents?

Shared context is an access-controlled operating record that several authenticated people and agents can inspect, review, and continue. It moves durable state outside one model session and preserves the objective, current status, decisions, source artifacts, unresolved feedback, next action, ownership, and revision history.

When should a team use shared context instead of memory?

Use shared context when work crosses identity, model, tool, or organizational boundaries, or when a human must review the evidence. Use runtime memory for preferences and local conversational continuity that do not need a shared audit trail.

  • The task may move from Claude, ChatGPT, Gemini, Cursor, or Codex to another tool.
  • A teammate needs to verify or annotate the work before it continues.
  • Files, SQL, HTML, images, or reports must travel with the summary.
  • The company needs authorship, access control, revisions, or retention policy.

How is shared context different from vector memory?

Vector memory retrieves semantically similar chunks; shared context preserves an explicit, attributable work record. Similarity search is useful for finding potentially relevant material, but it does not by itself establish which revision is canonical, who changed it, whether a reviewer approved the evidence, or what action is owned next. A shared context system can use vector retrieval while keeping those collaboration rules in a structured record.

Need                         Prefer
Current instructions         Prompt or working context
Personal preference recall   Runtime memory
Semantic discovery           Vector or hybrid retrieval
Cross-agent continuation     Shared, versioned context
Human verification           Immutable artifacts + annotations
Company accountability       Identity, access policy, and history

Can MCP provide shared context?

MCP gives agent hosts a standard way to discover and call servers that expose context, resources, and tools. A shared context platform can use MCP so different hosts retrieve and publish the same records, but the protocol does not decide how those records are versioned, authorized, reviewed, retained, or made canonical. Those policies belong to the server and its data model.

How do memory and shared context work together?

Keep transient reasoning and preferences in the runtime, then publish durable outcomes and evidence to shared context at meaningful checkpoints. The next agent can retrieve the canonical record through MCP or HTTP and seed its own local working memory from verified state.

What should move into durable shared context?

Publish information that another accountable actor would otherwise have to reconstruct from chat history. Keep hidden reasoning, copied credentials, irrelevant transcripts, and disposable intermediate output out of the record. The durable layer should be concise at the top and deep in its attached evidence.

  • The current objective, scope, acceptance criteria, and constraints.
  • What is complete, in progress, blocked, uncertain, or awaiting review.
  • Decisions already made and the evidence or tradeoffs behind them.
  • The exact Markdown, SQL, HTML, images, code, data, or reports needed to verify the work.
  • Open annotations, the next concrete action, and its responsible owner.

How should teams secure context used by AI agents?

Apply authorization before search, retrieval, and publication. Each person should use an interactive identity and each unattended agent should use a named, scoped service identity. The server should derive company, workspace, role, and authorship from the accepted credential, keep private records tenant-isolated, and require an explicit publication action before anything becomes public.

How do you test a context engineering workflow?

Test continuity with two separately authenticated actors and no shared chat. The first actor publishes a uniquely marked record with an attached source file and reads it back. The second receives only the stable link or search marker, retrieves the exact revision and artifact, reproduces one material fact, and appends a new revision using the current revision ID. Also test a denied identity and a stale write so continuity does not weaken access control or overwrite protection.

Primary references

Sources and further reading