An AGENTS.md file with security rules marked not loaded, next to a CLAUDE.local.md marked loaded

AppSec

AI security

Does Claude Code read AGENTS.md? Why your security rules might not be loading

Summary

Yes. Since v2.1.277 in September 2026, Claude Code reads AGENTS.md as your project instructions, but only when there's no CLAUDE.md, .claude/CLAUDE.md or CLAUDE.local.md in your working directory or above it.

That default is where security rules go missing. If your team writes them once in AGENTS.md for every agent, one stray CLAUDE.md, or a teammate's personal CLAUDE.local.md, means Claude Code stops loading them without any warning.

When does Claude Code read AGENTS.md?

Claude Code added AGENTS.md support in v2.1.277 on 18 September. By default, it reads AGENTS.md only when you have no CLAUDE.md in your working directory or above it.

‍

Your repo hasClaude Code reads
AGENTS.md and no CLAUDE.md filesAGENTS.md
AGENTS.md plus a CLAUDE.md or CLAUDE.local.md here or aboveCLAUDE.md files only
CLAUDE.md that imports @AGENTS.mdBoth, through the import

‍

Three files count for that check: CLAUDE.md, .claude/CLAUDE.md and CLAUDE.local.md. If any of them sits in your working directory or a parent folder, Claude Code reads those and skips AGENTS.md.

Your personal ~/.claude/CLAUDE.md, your organization's managed CLAUDE.md and .claude/rules/ files don't count. They load alongside AGENTS.md either way.

‍

Why does this matter for your security rules?

Plenty of teams keep their security rules in AGENTS.md precisely because Codex, Cursor and now Claude Code all read it. Write them once, and every agent sees them. That's the idea, anyway.

In practice, CLAUDE.md files are everywhere. One check of 283 repositories found that for 56.9% of the repos the new support was aimed at, nothing changed on 18 September, because a CLAUDE.md still won.

The sneakiest version is CLAUDE.local.md. A developer adds one for their own shortcuts ("use pnpm, never npm"), and from that session on, their Claude Code stops loading the AGENTS.md that says every billing query filters by orgId. Nothing warns them, and the code still passes its tests.

A few other gaps are worth knowing about:

  • Some files are never read. Claude Code ignores AGENTS.local.md, AGENTS.override.md and anything under a .agents/ folder, so overrides written for other agents don't carry over.
  • Some sessions skip AGENTS.md entirely. Versions before v2.1.277, sessions where the built-in agents-md plugin is turned off, and sometimes the first session after an upgrade all read CLAUDE.md files only.
  • Audit hooks go quiet. If you log loaded instructions with the InstructionsLoaded hook, it doesn't fire for an AGENTS.md that Claude Code reads directly. It does fire when a CLAUDE.md imports the file.

‍

How can you check which file Claude Code loaded?

Start a session and watch the first lines. When Claude Code reads AGENTS.md directly, it says so.

‍

Repo with only AGENTS.md
~/repo $ claude
no CLAUDE.md found; AGENTS.md loaded: ~/repo/AGENTS.md
Same repo, after a teammate adds CLAUDE.local.md
~/repo $ claude
> /memory
Project memory: ~/repo/CLAUDE.local.md

‍

If you don't see that line, Claude Code is reading CLAUDE.md files instead. Run /memory to see which CLAUDE.md and rules files are loaded, and check the Project instructions value in /config.

‍

How do you make sure Claude Code always loads your security rules?

Pick whichever of these fits how your team works. The first one works on every version.

1. Import AGENTS.md from CLAUDE.md

Keep one shared file and point CLAUDE.md at it. Claude-specific notes can sit underneath.

@AGENTS.md

## Claude Code
Use plan mode for changes under src/billing/.

This is the safest default, because it doesn't depend on the version, the plugin or which other files exist.

2. Load both files for everyone

Set Project instructions to claude-md-and-agents-md, and Claude Code reads each folder's CLAUDE.md files first and its AGENTS.md after them. You can roll that out through managed settings:

{
"pluginConfigs": {
"agents-md@builtin": {
"options": { "instructionFiles": "claude-md-and-agents-md" }
}
}
}

Claude Code ignores this setting in project and local settings files, so it has to live in user or managed settings.

3. Put the must-haves in your managed CLAUDE.md

Your organization's managed CLAUDE.md loads in every session, whatever else is in the repo. It's a good home for the short list of rules that should never go missing.

4. Treat instructions as context, not enforcement

Anthropic is clear that Claude treats these files as context, not enforced configuration. Agents also don't follow every rule they're given: in OctoBench, the best model followed every instruction in a task only 28% of the time.

So even when the right file loads, you still want a security review on every pull request to catch what slips through.

‍

What should the security section actually say?

Name your real code. "Enforce access control" changes nothing. "Every query on billing, invoices or members filters by orgId using scopedQuery()" changes what an agent writes.

We cover what to include, and where each agent looks for it, in how to write security guidance for AGENTS.md and Claude Code skills.

‍

How does Dam Secure fit?

‍

Security context
AGENTS.md
CLAUDE.md
.cursor/rules/security.mdc
.github/copilot-instructions.md
AGENTS.mdUp to date
## Security - Every billing query filters by orgId. Use scopedQuery() from lib/db. - Call requireTeamAdmin() before changing roles. - Never log req.body or tokens. - Outbound calls go through safeFetch().

‍

Managed Security Context maps how your codebase works, from your auth patterns to how you handle data, and writes security context in the formats Claude Code, Cursor, Codex and GitHub Copilot read. Your rules reach every agent, whichever instruction file it ends up loading.

The context keeps pace with your code. When a new service or auth pattern lands, the guidance covering it updates. And when a PR security review finds a vulnerability, the fix becomes guidance that stops agents writing the same pattern again.

‍

FAQ

Does Claude Code read AGENTS.md?

Yes, from v2.1.277. By default it reads AGENTS.md only when there's no CLAUDE.md, .claude/CLAUDE.md or CLAUDE.local.md in your working directory or above it.

Can Claude Code read CLAUDE.md and AGENTS.md together?

Yes. Set Project instructions to claude-md-and-agents-md in /config or managed settings, or import AGENTS.md from your CLAUDE.md with @AGENTS.md.

Does CLAUDE.local.md stop Claude Code reading AGENTS.md?

Yes. CLAUDE.local.md counts as a CLAUDE.md file, so adding one switches Claude Code to CLAUDE.md files only, unless you change the Project instructions setting.

Where should security rules for coding agents live?

Keep shared rules in AGENTS.md and import it from CLAUDE.md, so every agent reads the same file. Put the few rules that must never go missing in your managed CLAUDE.md.

Want your agents' security context written and kept current for you? Speak to our team.

GET STARTED WITH DAM SECURE

Your Security.
Enforced at AI Speed.

Attackers are already using Mythos-level models to find vulnerabilities. Join the teams putting frontier models on your side first.

Trusted by modern engineering teams

Dovetail logo
Pluss Communities logo with stylized purple and pink shapes between words.
Green rounded button with the word 'skip' and two forward arrows above the letter p.
Green rounded button with the word 'skip' and two forward arrows above the letter p.