Insights

RAG, AGENTS.md and CLAUDE.md: how to give your AI the right context

23 Nov 2026
A grid of documents with two highlighted in blue, feeding through a connecting line into an AI panel.

In my last post I said you should induct your AI like a new starter: your values, your tone of voice, how you work, the lot. This one covers how, because the way you hand that information over matters as much as the information itself.

Get it wrong and you can pay more for no better an answer. There’s research on that further down.

Most AI mistakes are context mistakes

The LSE AI leadership programme I’m on spends a whole module on this, and its argument matches what I’ve seen. A lot of what we call AI getting it wrong is AI answering sensibly with half the picture. There are four kinds of information it usually can’t see:

  • How your organisation works: who matters, who reports to whom and how decisions really get made
  • What happened offline: the phone call last week that settled the problem still open in the email thread
  • What’s at stake: which routine-looking task carries regulatory or commercial risk
  • What’s changed: which document has been overtaken by events

The name for dealing with this is context engineering, a term Andrej Karpathy helped popularise in 2025. Anthropic, who make Claude, describe the goal as finding the smallest set of useful information that gets you the result you want. Smallest is the important word.

Three ways to give AI context

1. Standing instructions: AGENTS.md, CLAUDE.md and friends

This is your AI’s staff handbook. It’s a short brief the tool reads at the start of a session, so you stop explaining yourself every time.

Developers keep it in a plain text file. AGENTS.md is an open format used by over 60,000 open-source projects. CLAUDE.md does the same job for Claude Code. If you don’t write code, you’ve got the same idea in Claude Projects, ChatGPT’s custom instructions and Gemini’s Gems.

Put in what the AI can’t work out for itself: your role, your standards, your rules and what good looks like.

2. Documents you choose

For a contract, a set of board minutes or a handful of policies, give the AI the whole thing. With everything in front of it, it can compare documents and spot what’s missing, which is often the question you actually care about.

3. RAG: a search engine for your knowledge

RAG stands for retrieval-augmented generation. When your documents run to hundreds or thousands, they won’t all fit, so the system searches them first, pulls out the passages that look relevant and writes its answer from those. NotebookLM works in a similar way, and so do most “chat with your company data” products.

It helps, but it won’t make AI reliable on its own. A peer-reviewed, Stanford-led study of commercial legal research tools built on RAG found they still hallucinated between 17% and 33% of the time.

RAG also brings a failure that’s hard to spot. If the search misses the right passage, the answer can still read perfectly well, and you’ve no way of seeing what was never found. So when a vendor tells you their product is “grounded in your data”, ask how documents are split up, how relevance is decided and what happens to files it can’t read.

More context can make it worse

This is the bit most of the advice leaves out.

Two recent studies looked at AGENTS.md files and AI coding agents. One, covering 10 repositories and 124 pull requests, found that having a file was associated with agents running about 29% faster and using about 17% fewer output tokens, with similar task completion.

The other tested both AI-generated and human-written files. It found they didn’t generally improve success rates and pushed up running costs by more than 20% on average. Repository overviews, one of the most commonly recommended things to include, didn’t help.

Those are coding tasks, so don’t read too much across to your marketing team. The lesson still holds up: a short, specific brief can help, and a big dump of everything costs you. Anthropic’s own guidance is to keep each CLAUDE.md under 200 lines, because longer files use up context and get followed less closely.

So when I say give your AI the lot, I mean make it all available. Don’t make it read the whole filing cabinet before it answers an email. My own setup works that way: a short index lists what exists, with separate notes for each project that only get opened when they’re relevant.

Where to start

  • Write a one-page brief covering who you are, what good looks like and what the AI must never do
  • Keep reference documents separate and point to them
  • Give it whole documents when they fit, and use RAG when they don’t
  • Put a date and an owner on everything, because AI can’t tell a current policy from a dead one
  • Test it on a subject you know well, where you’ll spot what’s wrong
  • When it gets something wrong, add one line to the brief

What’s in your AI’s brief right now? If the answer is nothing, ping me a message.


Sources: Magesh et al., Hallucination-Free? Assessing the Reliability of Leading AI Legal Research Tools, Journal of Empirical Legal Studies, 2025. Lulla et al., On the Impact of AGENTS.md Files on the Efficiency of AI Coding Agents. Gloaguen et al., Evaluating AGENTS.md. Anthropic, Effective context engineering for AI agents. Claude Code documentation. AGENTS.md.

Share this insight

Related insights
A New Starter lanyard badge marked AI, beside four company documents on a cream background.

You’d induct a new starter. So why not your AI?

You wouldn’t give a new employee no induction, so why do it to your AI? What to give your AI tools and agents, what to hold back, and why it improves the results.
23 Nov 2026
Four pairs of bars on a cream ground: tall outlined bars for AI's potential beside much shorter blue bars for actual use.

Almost every B2B marketer uses AI now. Most are still dabbling.

New ON24 research shows 93% of B2B marketers are using or planning to use AI. The real story is the widening gap between teams using it properly and everyone else.
30 Oct 2026
Five outlined squares on a cream ground, each with a line running right. Four stop short of a dotted barrier; one blue line passes through to a blue target.

Your AI pilot worked. So why hasn’t anything changed?

Merkle’s new enterprise AI playbook sets out five patterns that separate businesses that scale AI from those stuck in pilots. Here’s what they mean in practice, and where we’d start.
29 Oct 2026

Let's grab a coffee.

If something's stuck, or you'd like a second opinion on a plan, tell me about it. No hard sell.