Skip to content
A guide to agent context

Which approach to agent context should you try first?

You want to stop telling your coding agents the same things over and over. Repeating the context in prompts isn’t cutting it.

You need a way for what you’ve already explained—and what your agents have learned—to carry into the next session or the next tool.

But which approach should you try? AGENTS.md, built-in memory, a knowledge vault, job-specific MCP servers, or a context layer?

Here’s how each works, where it helps, and where it reaches its limits, so you can choose what to try first.

Carry useful knowledge into the next task.

Your practical choices

Five approaches. Different jobs.

See what each approach handles, what it asks of you, and when to try it first.

  1. 01AGENTS.md
  2. 02Built-in memory
  3. 03Knowledge vaults
  4. 04Job-specific MCP servers
  5. 05Context layers
01 · AGENTS.md

AGENTS.md and repository instructions

The job

Tell agents how to work in this repository.

How it helps

An AGENTS.md file gives compatible agents a set of project instructions: how to run tests, which conventions to follow, and what to be careful with. You keep those instructions alongside the code, where you can review and update them.

It works well when you keep correcting agents on the same stable rules: use this test command, follow these conventions, leave generated files alone. Compatible agents can use the same instructions across sessions. Other tools may have their own instruction-file formats.

Where it reaches its limits

The catch is that the file only changes when you or an agent updates it. A decision made in yesterday’s session won’t appear there automatically. Tools also discover and load instructions according to their own rules, and the loaded text takes up space in the model’s context window.

You can record changing decisions and handoffs in repository files too. As that material grows, someone has to keep it current, and the agent needs a way to find the relevant parts without loading everything.

When to try it first

Try this first if your main frustration is repeating project rules. If you’re repeatedly explaining what happened and why, you’ll also need a way to preserve and retrieve that knowledge.

See the AGENTS.md format and supported tools.

02 · Built-in memory

Built-in memory

The job

Help your usual agent carry useful information between sessions.

How it helps

Built-in memory can remember preferences and project facts within a tool you already use. It can be a convenient starting point when most of your work stays in that tool.

Where it reaches its limits

The catch is visibility and control. The tool may choose what to remember and when to use it without making either obvious. Even if you can eventually inspect the stored memory, it may be hard to see which memories influenced a particular answer.

That matters because a mistaken assumption, an outdated decision, or a preference that only applied to one task can shape future work. You can end up repeatedly correcting behavior without realizing a saved memory is driving it.

Also check where the memory applies. Some tools separate it by project; others apply it more broadly across your work. Without clear boundaries, a decision from one project can influence another where it doesn’t belong.

These differences come from how the tool stores, scopes, and retrieves memories. They affect what the model receives in a future session.

When to try it first

Try this first if you mainly want continuity within one tool and can easily inspect, correct, remove, and scope its memories. If you work across tools, check whether those tools can access the memory too.

03 · Knowledge vaults

Knowledge vaults and second brains

The job

Keep a broader collection of project knowledge that you and your agents can use.

How it helps

A knowledge vault can hold decisions, research, meeting notes, experiments, and lessons in a system such as Obsidian or Notion. Links between notes can give it a relationship graph, helping both people and agents explore how the knowledge fits together.

A vault works best with deliberate curation: useful relationships, clear project boundaries, and a distinction between current decisions and earlier thinking.

Where it reaches its limits

The agent still has to navigate those relationships and judge what matters for its task. How much of that work falls to the model depends on the search and retrieval capabilities you connect. An agent may handle simple questions well, then struggle when an answer requires piecing together several notes or resolving conflicting conclusions.

There’s setup and maintenance work too. You need to organize the vault, connect the agent, establish how discoveries get added, and keep old decisions from looking current. That effort can be worthwhile when the vault also serves as a useful reference for people.

Control over hosting

One advantage is control over where the knowledge lives. Depending on the system you choose, you can keep it on your own machine or host it on a private server. Check the agent connection as well: locally stored notes may still be sent to a hosted model when it reads them.

When to try it first

Try this first if you want a curated knowledge base for yourself and your agents, and are willing to maintain it. Test whether your agent can use connected knowledge on a difficult task, beyond simply finding individual notes.

04 · MCP servers

Job-specific MCP servers

The job

Bring context from the work tools you already use into your agent’s workflow.

How it helps

Sometimes the information your agent needs already lives in tickets, documentation, a database, or another work system. A job-specific MCP server exposes tools that let a compatible agent query that source directly.

The advantage is access to context specific to the job, without copying everything into a separate knowledge base. If the answer lives in your issue tracker, the agent can look there.

Where it reaches its limits

The tradeoff is that each server can handle context differently. What it exposes, how you search it, what its responses contain, and whether it supports updates depend on the integration. Access to tickets does not automatically include the reasoning from a coding session unless someone recorded it there.

The agent also has to choose among the available tools. As you connect more systems, it may consult the wrong source or skip one you expected it to use. Tool descriptions and routing support help, but a connection alone doesn’t ensure the right context reaches the task.

When to try it first

Try this first if the knowledge you need already has a home and an integration can make it available. Check whether the agent consults the intended sources and can connect information across them.

05 · Context layers

Context layers

The job

Use dedicated infrastructure to keep useful knowledge available and retrieve it when it matters.

Start with the fit

Context layers come in different shapes, so start with what you need to carry forward. Some focus on one agent’s memory. Others organize knowledge around a user, a team, or a project.

What they have in common is dedicated infrastructure for capturing, organizing, and retrieving context. That may be a proprietary service or a system you host yourself. Done well, it takes more of the work of finding relevant knowledge off you and the model.

Fit matters. A general-purpose system can give you flexibility, but may require more work to shape around your workflow. A system designed for a particular kind of work can provide more of that structure up front, while fitting fewer use cases.

Where ContextStream fits

ContextStream is a project context layer focused on software engineering and development.

It brings together project decisions, constraints, lessons, and handoffs with searchable repository evidence, so supported agents can pick up both the implementation and the reasoning across sessions and tools.

Setup, cost, and data

The tradeoffs depend on the system: setup, ongoing cost, and where your data lives. ContextStream’s repository search indexes eligible source files on its servers. If those files need to stay within infrastructure you control, a local or privately hosted approach may fit better. See what gets indexed.

When to try it first

Try this first if you need project knowledge to carry across sessions and tools, and want infrastructure designed to handle more of the organization and retrieval for you.

Compare focus and performance

90.0%answer accuracy across the full 500-question LongMemEval-S evaluation

For differences in product focus, see ContextStream’s comparisons with Mem0 and supermemory. These are product-authored comparisons with links to the other vendors’ documentation.

For measured memory performance, see the published benchmarks and methodology. ContextStream reports 90.0% answer accuracy across the full 500-question LongMemEval-S evaluation, using a disclosed reader and judge. The page also explains the conditions and limits of comparisons with vendor-published results.

A useful next step

Try it on a real task.

The right approach is the one that supplies useful context for your work with an amount of upkeep you’re willing to own.

Check what a fresh agent can do

Try your chosen approach on a real task.

  1. 01

    Can a fresh agent find a relevant prior decision, explain why it matters, and use it correctly?

  2. 02

    Can you see where that context came from and correct it when the project changes?

  3. 03

    How much setup and ongoing maintenance does it leave with you?

When project context is the job

Explore ContextStream for software engineering and development.

If a software development project context layer fits your needs, install it with one command, or try it in your browser first.

curl -fsSL https://contextstream.io/scripts/mcp.sh | bash