# Context Engineering Starts With the Notes You Keep

> Context engineering means giving an AI model the right information for each step. Learn where the term came from, the four parts, and how notes become one.

Updated 20 Nov 2026 by Atharva Shah. Canonical page: https://brainfeed.atharvashah.com/blog/context-engineering/

## The Short Version

- Context engineering is the work of filling a model's context window with the right information for the next step.
- Tobi Lutke proposed the term in June 2025, and Andrej Karpathy spread it a week later.
- A context has four parts: instructions, memory, retrieved notes and tools.
- More context is not better. Anthropic reports that recall falls as the context grows.
- A folder of short, well-named notes is the cheapest context source you can own.

Context engineering is the work of giving an AI model the right information for each step of a task. That information has four parts: instructions, memory, retrieved notes and tools. The term replaced "prompt engineering" in mid 2025. For a person, the cheapest source of good context is a folder of your own notes.

I build Brainfeed, a tool that feeds newsletter ideas into a notes repo. So I read the main writing on this term to see where personal notes fit.

## The Term Came From Two Posts in One Week of June 2025

Shopify CEO Tobi Lutke proposed the term on X in June 2025. He [wrote](https://x.com/tobi/status/1935533422589399127) that he liked "context engineering" better than prompt engineering. He described it as providing all the context a model needs to solve a task.

Andrej Karpathy [agreed on 25 June 2025](https://x.com/karpathy/status/1937902205765607626). He said people link the word "prompt" to the short task you type into a chat. Real apps do more. His list of what goes into the window: task descriptions, examples, retrieved data, tools, state, history and compacting.

The term then spread in a few days.

- **22 June 2025.** Drew Breunig's blog listed [four ways long contexts fail](https://www.dbreunig.com/2025/06/22/how-contexts-fail-and-how-to-fix-them.html).
- **23 June 2025.** Harrison Chase of LangChain [defined it](https://www.langchain.com/blog/the-rise-of-context-engineering) as building systems that give the model the right information and tools in the right format.
- **27 June 2025.** Simon Willison [wrote it up](https://simonwillison.net/2025/Jun/27/context-engineering/) and credited Lutke and Karpathy.
- **29 September 2025.** Anthropic published [Effective context engineering for AI agents](https://www.anthropic.com/engineering/effective-context-engineering-for-ai-agents).

## A Prompt Is One Message and a Context Is Everything the Model Sees

Prompt engineering asks how to word a request. Context engineering asks what else should sit beside that request.

Anthropic calls context engineering "the natural progression of prompt engineering". Its guide says the curation happens again each time you decide what to pass to the model. So a context is never written once. It is picked again for every step of an agent's work.

The pain shows up as uneven output. One builder [put it plainly on X](https://x.com/i/status/2121668543729307671): agent output is only as good as the context you feed it. Scattered context means the agent sees only part of the picture.

## Every Context Has Four Parts You Can Shape

LangChain and Anthropic list the same building blocks. I group them into four parts.

| Part | What it holds | Where it lives for a person |
|---|---|---|
| Instructions | Who you are, the rules, the format you want | An instruction file at the top of your notes, such as `CLAUDE.md` |
| Memory | Past decisions, preferences, lessons | Decision notes and a running log |
| Retrieved notes | The few notes that match this task | Your notes folder, found by search |
| Tools | Actions the model can take, such as reading a file | Access you grant, read-only by default |

**Instructions** set the frame. Anthropic advises clear instructions at the "right altitude". That means specific enough to guide the model, and loose enough to leave room for judgment.

**Memory** carries what happened before. LangChain splits it into short-term memory, such as a running summary of a long chat, and long-term memory, such as a preference from last month.

**Retrieved notes** bring in facts for this task only. The model gets them just before it answers.

**Tools** let the model fetch more when it needs to. Anthropic advises tools that are small, distinct and clear about when to use each one.

## More Context Makes the Model Worse After a Point

Adding everything feels safe, but past a point it lowers the quality of the answer.

Anthropic reports "context rot". As the number of tokens in the window grows, the model recalls information from it less well. The guide says this happens across all models, at different rates.

Drew Breunig named four ways a long context fails.

1. **Poisoning.** An error gets into the context and the model keeps citing it.
2. **Distraction.** The context grows so long that the model leans on its history over its training.
3. **Confusion.** Extra material, such as tools the task does not need, pulls the answer off course.
4. **Clash.** Information added over time contradicts other information already there.

Each failure has a cause in your notes too. A stale note poisons the context. A folder dump distracts the model. Ten notes on the same topic can make it pick the wrong one. Two notes that disagree, with no link between them, clash.

## Context Engineering Includes RAG and Adds Three More Jobs

RAG, retrieval-augmented generation, is one job inside context engineering. RAG finds text and puts it in front of the model. Context engineering also decides what to save for later, what to shrink and what to keep apart.

The LangChain team named four strategies in a [July 2025 post](https://www.langchain.com/blog/context-engineering-for-agents): write, select, compress and isolate. RAG covers only the select strategy. Each strategy has a plain version for a person with a notes folder.

| Strategy | What it means | The notes version |
|---|---|---|
| Write | Save information outside the window for later | A decision log or a session summary note |
| Select | Pull the right information into the window | Search that returns 3 notes, not 30 |
| Compress | Keep only the tokens the task needs | A one-line description at the top of each note |
| Isolate | Split the work across separate windows | One chat per project, each with its own folder |

People already build the write strategy by hand. One builder [listed a "hot cache" on X](https://x.com/i/status/2047013785857302550), so each new session starts with a summary of the last one. That is a note the agent writes for its future self.

## Name Three Files Before You Blame the Prompt

When an agent gives a weak answer to a task you repeat, the prompt is rarely the cause. Use the three-file rule to find the real one.

Write down the 3 files the right answer depends on. Then check each one.

- **You cannot name 3 files.** The knowledge lives in your head. Write the missing note first.
- **The files exist but the agent never opened them.** The names or descriptions hide them. Rename each file to its claim.
- **The agent opened them and still missed.** The notes disagree or are stale. Fix the notes, then rerun.

The common mistake is the folder dump. You attach the whole vault and hope the model finds the 3 notes that matter. Breunig's distraction and confusion failures above both start there. The fix is selection: a short index note that lists your 10 most used notes, each with one line on when to use it.

I hit the same limit when I built Brainfeed. Before a model reads a newsletter issue, code ranks the notes by the words they share with it. The 40 closest notes go into the prompt with their headings. The next 40 go in as titles only, and the rest stay out. A conflict check then opens one note at a time. A big notes folder never fills the prompt, because selection happens before the model runs.

## Agents Now Fetch Context Just in Time

Older systems loaded the context before the model ran. Newer agents keep a light list of where things are and read the files they need while they work.

Anthropic calls this just-in-time retrieval. The agent holds file paths or saved queries and opens the file when the task calls for it. The guide names Claude Code as an agent that works this way.

This changes what good notes look like. An agent that fetches on demand reads file names and the first lines of a note before it opens the whole file. So a clear name and a one-line description do more work than a long note body. The guide to [frontmatter for AI agents](https://brainfeed.atharvashah.com/blog/markdown-frontmatter-for-ai-agents/) shows the fields that help.

## Long Tasks Need the Agent to Write Notes Too

An agent on a long task fills its window. Anthropic describes three ways to keep going.

- **Compaction.** The agent summarizes a nearly full window and starts fresh from the summary.
- **Structured note-taking.** The agent writes notes outside the window, such as a to-do list or a `NOTES.md` file, and reads them back later.
- **Sub-agents.** Small agents do focused jobs in clean windows. Each returns a short summary, often 1,000 to 2,000 tokens.

Research points the same way. The [Agentic Context Engineering paper](https://arxiv.org/abs/2510.04618), first posted in October 2025, treats the context as a playbook that grows. The agent reviews each run and adds what it learned. The authors report gains of 10.6% on agent benchmarks and 8.6% on finance tasks over strong baselines.

The lesson for a person: an agent's best memory is a set of notes. The question is who writes them and who checks them.

## Your Notes Repo Is the Context Source You Own

Chat apps keep memory inside their own product. A folder of Markdown notes works with any agent that can read files.

People who build agents already work this way. One AI researcher [wrote on X](https://x.com/i/status/2039844072748204246) that building a personal knowledge base for his agents takes more and more of his time. He keeps it as Markdown vaults in Obsidian.

To turn a notes folder into good context, do five things.

1. **Write an instruction file.** Put a short `CLAUDE.md` or `AGENTS.md` at the top of the folder. Say what the folder holds, which notes to read first and the rules for answers. The free [AGENTS.md generator](https://brainfeed.atharvashah.com/tools/agents-md-generator/) writes a first draft for you.
2. **Keep one idea per note.** A note on one claim retrieves cleanly. A note on six topics drags five of them into every task.
3. **Name files by their claim.** A file called "raise prices before adding seats" is easy to find. A file called "notes 3" is not.
4. **Mark decisions as decisions.** Keep a log of what you decided, when and why. That log is the memory part of every future context.
5. **Give read access first.** Let the agent read your notes. Make it propose any change for you to approve. The guide to [connecting notes to an agent through MCP](https://brainfeed.atharvashah.com/blog/connect-notes-to-agent-mcp/) shows how to keep the access read-only.

## Four Notes Turn a Generic Reply Into a Useful One

**Example.** This is demo content, not a logged run.

You ask an agent: "Draft a reply to the client who asked for a discount."

| Context part | Without your notes | With your notes |
|---|---|---|
| Instructions | None. The agent writes a polite, generic reply. | `CLAUDE.md` says: short replies, plain words, never promise dates. |
| Memory | None. | `decisions/pricing.md` says you stopped giving discounts in September, and why. |
| Retrieved notes | None. | `clients/acme.md` says the client renews in January and cares about support hours. |
| Tools | None. | Read-only access to the notes folder, so the agent can open both files. |
| Result | "We would be happy to discuss a discount." | A reply that declines the discount, offers extra support hours and mentions the January renewal. |

The model is the same in both columns. The second reply is better because four notes reached the window. Nobody changed the prompt.

## Context You Never Wrote Down Cannot Reach the Model

Context engineering works only with what exists in your notes. An idea you read last month and kept nowhere is invisible to every agent you run.

Most people read more than they keep. Newsletters are a common case. You read a good argument, agree with it, and it never reaches your notes. Brainfeed targets that gap. It compares each newsletter idea with your notes, labels it new, builds on or conflicts, and adds only the ideas you accept to your repo.

The same rule holds whatever tool you use. Write the claim in your own words. Link it to a related note. Then an agent can find it next time.

## Context Engineering Is Overkill for One-Off Questions

You do not need any of this for a quick question about a public fact. A plain chat answers that fine.

Context engineering pays off in two cases.

- **You repeat a task.** Weekly reports, client replies or research briefs all reuse the same background.
- **The answer depends on your own facts.** Your prices, your clients or your past decisions live only in your notes.

## Find What Your Notes Are Missing

Start with the instruction file. Write five lines today: what your notes folder holds, which notes to read first and three rules for answers.

Then check which sources fit the notes you have. The [free Brainfeed scan](https://brainfeed.atharvashah.com/#try) reads up to 40 notes from a GitHub repo in your browser and ranks 41 newsletters against them.

From there, Brainfeed turns those newsletters into a short weekly queue. You accept or reject each card, and accepted ideas arrive as one pull request you merge. The first pull request is free. Paid plans cost $9 for your first month, then $19, at [brainfeed.atharvashah.com/#join](https://brainfeed.atharvashah.com/#join).

## Questions and Answers

### What is context engineering?

Context engineering is the work of giving an AI model everything it needs for one task, and nothing it does not. Andrej Karpathy described it as filling the context window with just the right information for the next step. That information includes instructions, examples, retrieved documents, tools, history and saved memory.

### How is context engineering different from prompt engineering?

Prompt engineering is about the wording of one request. Context engineering is about everything else the model sees with that request: the instruction file, the memory of past decisions, the notes it retrieves and the tools it can call. Anthropic calls context engineering the natural progression of prompt engineering.

### Who coined the term context engineering?

Shopify CEO Tobi Lutke put the term forward on X in June 2025. Andrej Karpathy endorsed it on 25 June 2025. Harrison Chase of LangChain and Simon Willison wrote about it within days. Anthropic published its engineering guide on the topic on 29 September 2025.

### Can more context make an AI model worse?

Yes. Anthropic reports that a model recalls information less well as the token count in its context grows. Drew Breunig named four ways long contexts fail: poisoning, distraction, confusion and clash. So the goal is the smallest set of useful information, picked again for each step.

### What is the difference between context engineering and RAG?

RAG, retrieval-augmented generation, finds text and places it in front of the model. Context engineering is the wider job. It also decides what to save for later, what to shorten and what to keep in separate windows. The LangChain team calls these write, select, compress and isolate. RAG covers only select.

### How do my notes become context for an agent?

An agent reads your notes when it runs in your notes folder or connects to it through an MCP server. It works best when each note holds one idea, carries a one-line description and has a clear file name. A short instruction file at the top tells the agent where to look.

## Read Next

- [Connect Your Notes to an Agent Through MCP](https://brainfeed.atharvashah.com/blog/connect-notes-to-agent-mcp/)
- [How to Give Claude Code Memory From Your Notes Repo](https://brainfeed.atharvashah.com/blog/claude-code-memory-from-notes-repo/)
- [Markdown Frontmatter That Agents Can Use](https://brainfeed.atharvashah.com/blog/markdown-frontmatter-for-ai-agents/)
- [/tools/agents-md-generator/](https://brainfeed.atharvashah.com/tools/agents-md-generator/)
- [Second Brain in a GitHub Repo: Setup and Trade-Offs](https://brainfeed.atharvashah.com/blog/second-brain-in-github-repo/)

## Try Brainfeed

Scan your notes free at https://brainfeed.atharvashah.com/#try. Your first pull request is free, and plans start at $9 for your first month, then $19, at https://brainfeed.atharvashah.com/#join.
