All articles

What is a context layer for AI agents?

A plain definition, how it differs from RAG, agent memory and data catalogues, why agents need one, and how to tell whether you need one yet.

Euan Cox

Co-founder, Pensieve

6 min read

On this page

A context layer for AI agents is a maintained, cited account of a company's people, customers, projects and decisions, built from its tools and served to agents, usually over MCP, so every agent starts from the same current picture.

We make Pensieve, a context layer, so read this as a vendor's view; we have kept the definitions general. “Company brain” is used for the same idea, and we define that term in What is a company brain?

What a context layer holds

It is called a layer because it sits between the tools a company works in and the agents that work for it. It holds four things.

  • Pages. A written account of one subject each: a customer, a project, a person, a process, a decision.
  • Citations. A link from each claim to the source passage behind it, so the claim can be checked.
  • The sources. The documents, messages and records the pages were written from, searchable for exact questions such as a date or a clause.
  • A structure. Pages organised from a company overview down to its parts, with links between related subjects, so an agent knows where to start.

Two things stay outside it. Live records, such as a current balance, still come from the system that owns them. Personal preferences, such as how you like a summary written, stay in your own assistant's memory.

Context layer, RAG, agent memory and data catalogues: the differences

The four do different jobs, and a team can use more than one.

What it holdsWhen the work is doneWhose knowledgeBest for
Context layerWritten, cited pages about the business, with the sources behind them.Ahead of time, and again whenever a source changes.The whole company, shared by every agent.Longer work that depends on how things connect and what was decided.
RAGAn index of passages from your documents.At question time: passages are retrieved and added to the prompt.Whatever was indexed.Finding the relevant passage in a large body of text.
Agent memoryNotes an agent saved from earlier sessions.As the agent works.One user or one agent.Preferences and continuity between sessions.
Data catalogueMetadata about data assets: tables, dashboards, owners and lineage.Curated by data teams and their tooling.The company's data estate.Helping analysts and agents find and query data correctly.
A context layer beside three things it is often confused with. Products vary, and many combine more than one.

RAG stands for retrieval-augmented generation. The 2020 paper that named it describes models that “combine pre-trained parametric and non-parametric memory for language generation” (Lewis et al.). In practice that means finding passages relevant to a question and handing them to the model with the prompt. A context layer usually uses retrieval too, but something has already read the sources and written down what they add up to. Our guide to embedding search as a company brain covers where RAG works and where it runs out.

Agent memory is what one agent keeps between sessions. Anthropic's memory tool, for example, “lets Claude store and retrieve information across conversations in a directory of memory files” (memory tool). Memory belongs to one agent or one person. A context layer is shared by every agent connected to it. We set the two beside enterprise search in company brain vs enterprise search vs agent memory.

Data catalogues bring a second meaning of the phrase. Atlan, whose products include a data catalogue, defines a context layer as “the infrastructure that delivers governed, semantically enriched context to AI agents at inference time”, drawing on catalogue metadata such as glossary, lineage and ownership (Atlan). That is context about data assets, and it helps an agent query data correctly. Zep, an agent memory vendor, also describes itself as “the unified context layer for enterprise data” (Zep). This article is about context on the business itself. Check which one a vendor means.

Why agents need one

An agent starts every session knowing nothing about your company. The Claude Code documentation puts it plainly: “Each Claude Code session begins with a fresh context window.” Whatever it needs, it has to be given or go and find.

It cannot simply be given everything. Anthropic's page on context windows puts Claude's at “up to 1M tokens, depending on the model”, and warns: “As token count grows, accuracy and recall degrade, a phenomenon known as context rot.” A company's written knowledge can be far larger. The public GitLab handbook, as pinned for our benchmark, runs to roughly 9.2 million tokens (benchmark).

So agents search. Without a prepared account, each session finds the same background again before the real work begins, and two agents may piece it together differently. Anthropic's engineers draw the general lesson: “Context, therefore, must be treated as a finite resource with diminishing marginal returns.”

A context layer does that reading once and keeps the result current. Pensieve is one example, and we have measured the effect: on five work briefs over the public GitLab handbook (4,161 files), an agent reading Pensieve used 28% fewer input tokens, 46% fewer searches and 32% fewer tool calls than the same agent searching the same data. The work was graded to the same standard in both cases and quality held level (benchmark). The method and the corpus are published with it.

The second reason is consistency. Agents connected to the same layer read the same account, so a correction made once reaches all of them. See our guide to keeping AI agents up to date with company decisions.

How to tell whether you need one yet

You probably need one if several of these are true:

  • You or your colleagues explain the same company background to an AI more than once a week.
  • Agents do work that takes many steps, such as planning a launch or preparing a customer review.
  • The knowledge is spread across several tools and no single one tells the whole story.
  • Two people's agents have given different answers about the same customer or decision.
  • Your team uses more than one AI tool.

You probably do not need one yet if:

  • You are a small team working mostly in one tool, with a good context file such as CLAUDE.md or AGENTS.md that someone keeps current.
  • Most of what you ask is a lookup. Search, or connecting the agent directly to your tools, will do.
  • The business changes slowly enough that a wiki kept by hand stays true.

A fair test either way: run one real task that normally needs several rounds of explanation, and count how often you have to correct the agent's picture of the business.

Frequently asked questions

Is a context layer the same as RAG?

No. RAG retrieves passages from your documents at the moment a question is asked. A context layer prepares a written, cited account of the business ahead of time and keeps it current. Most context layers still use retrieval to find the right page or source.

Is a context layer the same as a company brain?

Yes, when the subject is AI agents. Both terms mean a maintained account of the company that agents read before they work. Our article What is a company brain? compares it with enterprise search, agent memory and a wiki.

What is the difference between a context layer and agent memory?

Agent memory holds what one agent, or one person's assistant, has learned across its own sessions. A context layer holds what the company knows and is shared by every agent connected to it.

How do AI agents connect to a context layer?

Usually over the Model Context Protocol, which its documentation describes as “an open-source standard for connecting AI applications to external systems” (What is MCP?). The agent calls the layer's tools to search it and read pages. Pensieve's documentation shows how an agent reads a context layer over MCP.

Can I build a context layer myself?

Yes. Our step-by-step guide to building a company brain sets out the problems any build has to solve, and our guide to the options compares building, starting from open source and buying a product.

Sources

Every external page was checked on 16 November 2026. Products and standards change, so check the current documentation before relying on a detail here.

  1. What is the Model Context Protocol (MCP)?, Model Context Protocol documentation
  2. Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks (Lewis et al., 2020), arXiv
  3. Memory tool, Claude Platform documentation, Anthropic
  4. How Claude remembers your project, Claude Code documentation, Anthropic
  5. Context windows, Claude Platform documentation, Anthropic
  6. Effective context engineering for AI agents (29 September 2025), Anthropic Engineering
  7. Data catalog vs context layer, Atlan
  8. Zep documentation, Zep
  9. Benchmark, Pensieve documentation
  10. The context layer, Pensieve documentation
  11. How MCP works, Pensieve documentation