# AGENTS.md for a Second Brain: What to Put in It

> What to put in AGENTS.md for a second brain: a folder map, trust levels, note format, write rules an agent can check, answer rules, and an access key per agent.

Updated 20 Nov 2026 by Atharva Shah. Canonical page: https://brainfeed.atharvashah.com/blog/agents-md-for-second-brain/

## The Short Version

- AGENTS.md is plain Markdown with no schema, and about 20 agent tools read it.
- Claude Code reads AGENTS.md only when no CLAUDE.md exists, so add one line to CLAUDE.md that imports it.
- Give each folder a trust level so agents answer from reviewed notes before raw clippings.
- Let agents create files in INBOX/ only, and never let them delete.
- List simple checks an agent runs after it writes, such as finding notes with no source.

Your AI assistant treats a half-read clipping like a note you rewrote three times. The agents md second brain fix is one file, AGENTS.md, with short house rules every assistant reads before it touches your notes.

A clipping from last week carries the same weight as your best note. Then the assistant writes a new file somewhere you never asked, and you spend the evening cleaning up. Put six things in AGENTS.md: a map of your folders with how far to trust each one, the files to read first, how a note looks, where assistants may write, how to answer from your notes, and a few checks they run after they write. Keep it short, and link to longer files.

[AGENTS.md](https://agents.md/) started as a file for software projects. The same file works for a folder of notes, and it serves every assistant at once. I use Claude Code and Codex on the same notes, and one file keeps them on the same rules.

## AGENTS.md Is a Plain Page That Many Assistants Read

AGENTS.md has no required format. The agents.md site says it is just standard Markdown. You pick the headings, and the assistant reads the text like a note.

The site lists about 20 tools that read it. The list includes OpenAI Codex, Cursor, Gemini CLI, GitHub Copilot's coding agent, Aider, Zed, Warp and Windsurf. Aider and Gemini CLI need one settings change to find the file. The [AGENTS.md explainer](https://brainfeed.atharvashah.com/blog/agents-md/) covers each tool.

Claude Code reads AGENTS.md from version 2.1.277, with one condition. By default it reads AGENTS.md only when you have no CLAUDE.md file. If you keep both, add one line to CLAUDE.md that points at AGENTS.md. The [Claude Code memory docs](https://code.claude.com/docs/en/memory) show the exact line. The guide to [Claude Code memory from a notes repo](https://brainfeed.atharvashah.com/blog/claude-code-memory-from-notes-repo/) walks through that setup.

That condition is the most common reason a file never loads. The X user shtse8 [checked five vendors' docs in October 2026](https://x.com/shtse8/status/2109983383405355416) and found five different rules for the same file name. So test it once. Open a new session and ask the assistant which instruction files it loaded, then compare the answer to the files you wrote.

## A Notes Folder Needs Different Sections Than a Software Project

The agents.md site suggests sections for software: an overview, how to build and test, code style and security. A notes folder has no build. It asks the same questions in different words.

| Software project section | Second brain section |
|---|---|
| Project overview | What the folder is for, in two lines |
| Code layout | Folder map with a trust level per folder |
| Code style | Note format and the fields at the top of each note |
| Build and test commands | Checks that find broken notes |
| Security considerations | Private folders and what needs approval |

Add two sections a software project rarely needs: rules for answering from your notes, and a list of past mistakes. The checklist at the end of this post has all eight.

## The Folder Map Tells Assistants What to Trust

Name each folder and say how far to trust it. A typical map has four lines:

- **Inbox:** new material nobody reviewed. Treat it as unverified.
- **Library:** notes you reviewed. Answer from these first.
- **Projects:** one folder per project, each with a status note that holds the current state.
- **Archive:** finished work. Use it for history only.

This one section changes answers more than any other. The assistant now cites a reviewed note before a raw clipping.

## Write Rules Decide What an Assistant Can Change

One wrong note spreads. Every assistant that reads it after repeats the mistake. So say where assistants may write, in plain rules:

1. Assistants create new files in the inbox only.
2. Assistants never edit your reviewed notes or your about-me files without asking.
3. When an assistant adds to a note you wrote, it writes inside a clearly marked block at the end.
4. Assistants never delete. They move files to the archive.

Rule 3 matters most. A marked block lets you find and remove every assistant edit with one search.

## An AGENTS.md Second Brain File Works Only With Rules an Agent Can Check

A vague rule reads well and changes nothing. "Be careful with my notes" gives the assistant no line it can test before it acts. Rewrite each rule until the assistant could answer yes or no about its own work.

| Vague rule | Rule an agent can check |
|---|---|
| Be careful with my notes | Create new files in the inbox only |
| Keep notes tidy | One idea per note, with a title that states the idea |
| Cite sources | Every library note has a source line at the top |
| Do not make things up | If no note answers, say "my notes do not cover this" first |

Use one test for every line. Could you check it yourself in under a minute, with a search?

**Example.** This is demo content. An assistant runs every evening and fills in missing tags on your notes, a setup the X user BHolmesDev [shared in April 2026](https://x.com/BHolmesDev/status/2042361921857356270). A vague rule lets it retag your best notes. A checkable rule reads "Add tags only to notes that have none, and never change an existing tag." One search for changed tags then proves whether it obeyed.

I ask five questions of any tool that writes to notes:

1. Can it change a note you wrote?
2. Do you approve each idea before it lands?
3. Does a conflict come with evidence?
4. Can you undo it in one step?
5. Does a "no" teach it anything?

The post on [human-in-the-loop knowledge capture](https://brainfeed.atharvashah.com/blog/human-in-the-loop-knowledge-capture/) works through each one.

## A Rule Is Advice, and the Access Key Is the Lock

AGENTS.md is an instruction, and an assistant can ignore it. So back the most important rule with a permission.

If your notes live in a GitHub repo, give each assistant its own key. GitHub's [fine-grained personal access tokens](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens) can be limited to specific repositories, and the Contents permission can be set to read only. An assistant that only answers questions needs nothing more.

Give each assistant the smallest key its job needs:

- **Answers from your notes:** read-only key.
- **Drafts new notes:** a key that can write, but only through a branch and a pull request you merge.
- **Edits your reviewed notes on its own:** no key. Keep that job yours.

The guide to [keeping a second brain in a GitHub repo](https://brainfeed.atharvashah.com/blog/second-brain-in-github-repo/) shows how pull requests make every assistant edit reversible in one step.

## Checks Give Assistants a Way to Catch Their Own Mistakes

The agents.md site says agents run the tests you list and fix failures before they finish. Notes can use the same habit. List two or three checks in plain words, for example:

- Find every reviewed note that has no source.
- Find every inbox file that waited more than 7 days.

An assistant that just wrote a note runs the first check and fills its own gap. The second check tells you a review is due.

## Answer Rules Stop Confident Guesses

An assistant with notes still answers from general knowledge when it finds nothing. It rarely says so. Three rules fix most of that:

1. Answer from my notes first, and name each note you used.
2. If my notes lack the answer, say so before you use general knowledge.
3. If a note looks out of date, flag it.

Rule 1 also lets you check the answer. A named note is a file you can open.

## The Stranger Test Tells You When the File Is Done

The template I hand out at workshops uses this one: a stranger with no history opens the folder, reads the file, and can keep the system running for two weeks without asking you a question.

Run it on your draft. Read the file as if you had never seen the folder. Each question you would have to ask is a missing line. Each line that answers a question nobody would ask is a line to cut.

Grow the file from real failures after that. Add one line to the mistakes section only when the same thing goes wrong twice. Two of the same slip show a gap the file must close.

## Leave Out Anything That Lives in Your Notes

AGENTS.md holds rules, so keep facts in the notes themselves. Your biography belongs in an about-me note. Project status belongs in each project's status note. Point to those files by name instead of copying them.

A copy goes stale the first time you edit the original. Long style guides follow the same rule. Link to them, and let the assistant open one when a task needs it.

Watch the length too. Every line loads in every session. The [Claude Code memory docs](https://code.claude.com/docs/en/memory) set a target of under 200 lines for CLAUDE.md. The same limit makes sense here.

Codex adds a hard cap. Its [AGENTS.md guide](https://learn.chatgpt.com/docs/agent-configuration/agents-md) says Codex joins the files from the project root down to the current folder. It stops adding files once the combined size reaches 32 KiB by default. A bloated root file can therefore crowd out the small file in a client folder, which holds the rules that matter most there.

## A Second AGENTS.md Can Govern One Folder

Some rules apply to one project. A client folder may forbid copying notes into any outside tool. Put a small AGENTS.md inside that folder.

The agents.md site gives the rule: agents read the nearest file, so the closest one wins. Your own chat message overrides every file. Keep the folder file small, and add only what differs from the main one.

## Audit the File Every Few Months

Rules written for last year's model can slow down this year's. Morgan B shared [a prompt that asks an agent to audit its own instruction files](https://x.com/morganb/status/2110445187344535685). It asks for findings first and changes nothing until you approve. Run something like it each quarter, then delete each rule the assistant already follows without being told.

## Your File Needs Eight Short Sections

You can write the file by hand, or fill in a short form in the free [AGENTS.md generator](https://brainfeed.atharvashah.com/tools/agents-md-generator/) and copy the result. For a Codex setup on the same notes, see the [Codex AGENTS.md use case](https://brainfeed.atharvashah.com/use-cases/codex-agents-md-context/). Either way, cover these eight sections:

1. **What this folder is:** two lines on what your notes hold.
2. **Folders and trust:** the map above.
3. **Read first:** your about-me note and the status note of the current project.
4. **Note format:** one idea per note, a title that states the idea, and a source, status and date at the top.
5. **Where assistants may write:** the four write rules.
6. **How to answer:** the three answer rules.
7. **Checks:** the two checks above.
8. **Private areas and past mistakes:** folders never to copy, plus one line each time something goes wrong twice.

## AGENTS.md Is the Wrong Tool in Two Cases

A rules file helps only when assistants read your notes. Skip it in these cases.

- **You never point an assistant at the notes.** A notes app you read by hand gains nothing from these rules.
- **You use one tool and already keep its file.** If you use only Claude Code and keep a CLAUDE.md, a second file adds upkeep and no new rule.

## Example: One Newsletter Idea Lands Under the Write Rules

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

- **Input:** a newsletter issue argues that agent rule files should stay under one screen.
- **Card:** labeled **builds on**, linked to your note on agent rules.
- **You swipe:** accept.
- **Result:** a new note on keeping agent rules short appears in the brainfeed folder, added in one pull request you merge. Your own note stays unchanged.

## Give Your Assistants New Notes Worth Reading

AGENTS.md tells assistants how to use your notes. The notes still decide what they know. Brainfeed follows the same write rules. It adds new notes only in its own brainfeed folder, edits your files only inside a marked block, and sends every change as one pull request you merge.

Run the [free Brainfeed scan](https://brainfeed.atharvashah.com/#try) to see which newsletters match your notes. It reads up to 40 notes from a GitHub repo in your browser.

When the matches fit, let Brainfeed read those newsletters every week. Each idea arrives as a card labeled new, builds on or conflicts, and conflict cards quote your own note as evidence. Your first pull request is free. Paid plans start at $9 for your first month, then $19, at [brainfeed.atharvashah.com/#join](https://brainfeed.atharvashah.com/#join).

## Questions and Answers

### What is AGENTS.md?

AGENTS.md is a plain Markdown file of instructions for coding agents. The agents.md site calls it a README for agents. It has no required fields. Codex, Cursor, Gemini CLI, GitHub Copilot's coding agent and about 20 other tools read it, so one file serves every agent you use.

### Does Claude Code read AGENTS.md?

Yes, from version 2.1.277. By default Claude Code reads AGENTS.md only when no CLAUDE.md or CLAUDE.local.md exists in the working directory or above it. If you keep both, add one import line to your CLAUDE.md that points at AGENTS.md, and Claude reads the shared file too.

### What should a second brain AGENTS.md include?

Include a folder map with a trust level per folder, the files to read first, the note format, the rules for where agents may write, the rules for answering from notes, and a few checks agents run after they write, such as finding notes with no source. Link to long documents instead of copying them in.

### Can I have more than one AGENTS.md in a notes repo?

Yes. Put one in a subfolder, such as a client project folder, for rules that apply only there. The agents.md site says agents read the nearest file in the directory tree, so the closest one takes precedence. Your own prompt in the chat overrides every file.

### What should I leave out of AGENTS.md?

Leave out facts that live in your notes, such as project status or your biography. Link to those files instead, because a copy goes stale. Leave out long style guides too. Every line in AGENTS.md costs context in every session, so keep only rules agents need on most tasks.

### Should I use AGENTS.md or CLAUDE.md for my notes?

Use AGENTS.md if more than one assistant reads your notes, because Codex, Cursor and about 20 other tools read it. Keep a short CLAUDE.md that imports it if you also use Claude Code. If Claude Code is your only assistant, a CLAUDE.md alone is enough and saves one file of upkeep.

## Read Next

- [How to Give Claude Code Memory From Your Notes Repo](https://brainfeed.atharvashah.com/blog/claude-code-memory-from-notes-repo/)
- [Human-in-the-Loop Knowledge Capture: Why Accept Matters](https://brainfeed.atharvashah.com/blog/human-in-the-loop-knowledge-capture/)
- [Second Brain in a GitHub Repo: Setup and Trade-Offs](https://brainfeed.atharvashah.com/blog/second-brain-in-github-repo/)
- [Codex and AGENTS.md Context That Stays Current](https://brainfeed.atharvashah.com/use-cases/codex-agents-md-context/)
- [What AGENTS.md Is and Which Agents Actually Read It](https://brainfeed.atharvashah.com/blog/agents-md/)

## 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.
