DEV Community

Naman Jain
Naman Jain

Posted on Originally published at getlockstep.dev

Best tools to give AI coding agents context (2026)

Originally published at getlockstep.dev.

An AI coding agent starts every session blank. It knows the language, the framework, and roughly how software works. It does not know that your team moved off styled-components in March, that money is always integer paise, or that the payments module is frozen until the audit clears. Every one of those gaps becomes a wrong assumption, and wrong assumptions at machine speed are expensive.

Humans have the same problem, and it already costs plenty: in Stack Overflow's 2024 developer survey, 53% of developers said waiting on answers to questions disrupts their workflow. Agents can't wait for answers. They guess.

So the question every team hits within a month of adopting agents: how do we give them our context? Below are the eight approaches that matter in 2026, ranked by fit for that job. One of them is ours; I've placed it where I honestly think it belongs, and said plainly what it doesn't do yet.

The 8 approaches compared

Approach What it carries Scope Staleness risk Cost
AGENTS.md / CLAUDE.md Constants: commands, invariants, map, boundaries Repo, shared via git High for anything that changes; only as fresh as the last commit Free
Claude Code memory Your instructions plus Claude's own notes across sessions CLAUDE.md shared; auto memory per user, per machine Medium; auto memory is pruned by Claude, not reviewed by the team Included with Claude Code
Cursor rules Scoped rules loaded by path, relevance, or always Project or org (Team Rules) High; static files, same as AGENTS.md Included with Cursor
Copilot instructions and Memory Instruction files plus repo facts Copilot learns Repo; Memory shared across users, Copilot only Medium; memories cite code and expire after 28 days unused Included with Copilot
MCP servers Live data: tickets, errors, docs, schemas Whatever the server exposes Low for live data; depends on the source Free protocol; servers vary
Lockstep (decision memory) Approved decisions with owner, rationale, status Team, across repos and agents Low; decisions are approved and replaced explicitly Open source, hosted or self-hosted
RAG over your docs Anything written in your wiki and docs Whatever you index High; retrieval can't tell current from outdated Build and maintain a pipeline
Swimm Code understanding, especially legacy systems Codebase Low for code facts; doesn't cover decisions outside code Commercial

The list

1. AGENTS.md and CLAUDE.md files

AGENTS.md is the baseline, and it's ranked first because everything else builds on it. It's a plain markdown file at the repository root, published as an open standard in August 2025 by a group including OpenAI, Google, Cursor, and Sourcegraph, and now stewarded under the Linux Foundation. Codex, Cursor, Copilot, Windsurf, and most other agents read it natively, and since v2.1.277 Claude Code does too, as long as there's no CLAUDE.md alongside it (if there is, an @AGENTS.md import in CLAUDE.md fixes it). It's free, version-controlled, and vendor-neutral, and it's the right home for constants: commands, invariants, directory maps, boundaries. Its limit is structural, not fixable by better writing: it's read once at session start, it can't notify anyone when it changes, and anything with a shelf life rots in it. I wrote a full guide to what belongs in an AGENTS.md and what doesn't. Write one this week if you haven't. Then keep reading, because it can't do the whole job.

2. Claude Code memory

Claude Code's memory system has two layers. The first is CLAUDE.md files you write (or an AGENTS.md it reads in their place), resolved hierarchically (organization, user, project) so personal preferences and team rules compose. The second, auto memory, is on by default in local sessions: Claude writes notes for itself as it works, things like build quirks, debugging insights, and corrections you made, and carries them across sessions without you writing anything. The first 200 lines (or 25KB) of its memory index load into every session. It's one of the most complete native memories of any coding agent today. The limits: it's Claude Code only, and auto memory is per-user. Your agent's hard-won knowledge about the codebase does not transfer to your teammate's agent. It solves "my agent keeps forgetting," not "my team's agents don't share a brain." (For the full picture of how these memory layers fit together, see AI coding agent memory: why agents forget, and the fix.)

3. Cursor rules

Cursor's rules system is the most fine-grained of the native options. Rules live as .mdc files in .cursor/rules with metadata controlling when each one loads (always, on matching paths, when the agent decides it's relevant, or only when @-mentioned), which keeps context spend proportional to the task. Cursor also reads AGENTS.md natively, including nested files in subdirectories, and Team Rules let an organization enforce rules across every project. What Cursor no longer has is an automatic memory layer: Memories, which extracted preferences from chats, was removed starting in version 2.1, with Cursor staff pointing users to export them into rules. So everything Cursor knows about your team is something a person wrote into a file. Precise and shareable; just as static as AGENTS.md.

4. GitHub Copilot instructions and Memory

Copilot's approach is pragmatic breadth. It reads several kinds of instruction files: repository-wide instructions in .github/copilot-instructions.md, path-specific .instructions.md files that only load for matching globs, and, sensibly, AGENTS.md and even CLAUDE.md, so it piggybacks on whatever you've already written. Instructions can target specific surfaces, so the coding agent and the code reviewer can get different rules. If your team lives in the GitHub ecosystem, this is well-integrated and low-effort. Copilot also now has a memory layer: Copilot Memory, in public preview, stores repository facts (conventions, build commands, architectural decisions) that are shared with everyone who has access to that repository, and user-level preferences that stay private. Memories carry citations to the code that supports them, are re-validated before use, and expire after 28 days unused. That's the closest any native tool gets to team memory. The limit: it lives inside Copilot (cloud agent, code review, CLI, agentic autofix), so your Claude Code and Cursor sessions don't see it, and a fact inferred from code is not the same as a decision someone approved.

5. MCP servers

MCP changes the mechanic from push to pull. Instead of front-loading context into a file the agent may or may not need, an MCP server lets the agent query for context mid-session: fetch this ticket, check that error, read the current schema. The protocol is now the industry default: donated to the Linux Foundation in December 2025, with Anthropic's ecosystem update that month counting more than 10,000 active public servers. For team context specifically, MCP is the transport, not the answer: a filesystem or docs server gives your agent access to raw material, and raw material still has the RAG problem. Nothing marks what's current, decided, or binding. What MCP genuinely solves is freshness and reach. What you point it at determines everything else.

6. Lockstep

Lockstep is ours, so read this entry with that in mind. It attacks one slice of the context problem: decisions. It captures decision-shaped statements from where they actually happen (Slack is the most mature path; Notion, Jira, Confluence, and Google Docs connectors are newer), plus pull requests, and routes each to its owner for one-click approval. Claude Code is briefed on the relevant decisions at session start, and any MCP-capable agent, Cursor included, can call get_product_context for the approved decisions relevant to what it is touching. A PR check flags changes that may conflict with approved decisions; it warns by default, and blocking is opt-in. Honest limits: automatic session capture works in Claude Code only today, and Lockstep is early stage. We're onboarding design partners, not running at thousand-team scale. It's Apache-2.0, hosted or self-hosted. If your pain is stale files and agents shipping against last month's decisions, the pattern we call decision drift, this is the purpose-built option. If your pain is anything else on this list, it isn't.

7. RAG over your docs

The DIY route: embed your wiki, docs, and ADRs into a vector store, and let the agent search semantically, either through a homegrown pipeline or a docs MCP server. When your documentation is good and current, this works, and it handles fuzzy questions ("how do we do auth?") better than any keyword search. The failure mode is the one that matters: retrieval returns whatever was written, with no signal for whether it's still true, was ever approved, or has been superseded. A stale runbook and a current one embed equally well. You also own the pipeline forever: chunking, reindexing, permissions. I've written a longer comparison of MCP and RAG for agent context; the short version is that RAG answers "what did we write?" when the question you need answered is "what do we currently believe?"

8. Swimm

Swimm is last on this list only because the query is team context for agents, and that's not quite Swimm's job. Swimm started as code-coupled documentation and now positions itself as "agentic modernization": building verified understanding of legacy systems, which coding agents can query through an MCP portal. For teams modernizing a large legacy codebase, that's a genuinely strong choice. But it documents the code, and the context agents most often lack lives outside the code: the decisions, freezes, and trade-offs made in Slack and PRDs. We keep an honest side-by-side at Lockstep vs Swimm; the two barely overlap.

Tools for current docs and web context

A large share of wrong agent code comes from stale knowledge of libraries and APIs, not from missing team context. These hosted MCP servers give an agent current documentation and the live web. Details are from each vendor's documentation, checked on 4 November 2026.

Tool What it gives the agent Auth Claude Code install
Context7 Version-specific library docs and examples API key optional claude mcp add --transport http context7 https://mcp.context7.com/mcp
Exa Web search and page fetch; an agent tool when signed in Keyless at free limits, OAuth, or API key claude plugin install exa@claude-plugins-official
Tavily Search, extract, crawl, map, and multi-source research OAuth or API key; search and extract work keyless claude mcp add tavily --transport http https://mcp.tavily.com/mcp/
Firecrawl Scrape, crawl, map, search, and extract from websites Keyless with daily limits, OAuth, or API key Remote or local; see its docs

Pick Context7 when the problem is library APIs. Pick Exa or Tavily when the agent needs to search the web. Pick Firecrawl when it needs whole sites as clean content. Treat anything fetched from the web as untrusted input: a page can contain instructions aimed at the agent.

Codebase search across many repositories

Inside one repository, the agent's own file search is usually enough. Across dozens of repositories it isn't, because the agent can't search code that isn't checked out. Sourcegraph's official MCP server exposes code search, go-to-definition, find-references, and commit history across everything Sourcegraph indexes, with OAuth or access tokens. It is available on Enterprise plans.

Code search answers how the code works today. It does not answer why it was built that way, or whether that is still the plan.

For UI work, design context is its own stack: see how to give AI coding agents design context.

How to choose

Don't pick one. The tools above do three different jobs, and a sane 2026 setup layers them.

Everyone starts with an AGENTS.md. It costs an afternoon, every agent reads it, and it's the right container for constants. Keep it brutally short.

If you're one person, your agent's native memory (Claude Code auto memory, Copilot Memory) covers the rest; on Cursor, write it into rules. Let it accumulate; promote anything important into the shared file.

If you're a team, the per-user, per-tool memory silo is your problem, and files alone won't fix it, because files can't carry things that change weekly. Add MCP for live context: start with your issue tracker and error tracking, then current library docs with Context7, and web search if agents need it. I keep a ranked list of the best MCP servers for engineering teams, and a separate one for MCP memory servers. And if decisions specifically are what keep getting lost (made in Slack on Tuesday, violated by an agent on Thursday), that's the slice Lockstep was built for.

The test for whether your setup works is simple: when a decision changes at 2pm, how does the agent session that starts at 2:05 find out? If the answer is "someone edits a file and hopes," you have a handbook and no standup. Get both.

Top comments (0)