AGENTS.md and .agents/skills¶
AGENTS.md and .agents/skills/ are the closest thing to a cross-tool convention for project instructions and
Agent Skills. With agents_md = true, ai-rulez renders them once and every preset that reads them stops writing its
own copy. The flag is off by default; with it off, output is byte-for-byte what earlier releases produced.
What changes:
- Always-on rules and context go into one
AGENTS.md(plus a nested<scope>/AGENTS.mdper[[scopes]]entry). - Skills without
targetsgo into one.agents/skills/<name>/SKILL.mdtree. - Presets that read these files stop writing their root file (
GEMINI.md,.hermes.md, ...), their copy ofAGENTS.mdand their own skills directory. - Everything the tool cannot read from the shared files stays per-preset: scoped rules folders, agents, commands, MCP files and settings. A rules folder is created only when at least one rule file is written into it.
Without the flag, codex, opencode, xum and amp already write the same AGENTS.md, while claude, gemini,
cursor and the rest each repeat the same content in their own file.
Tool support¶
Research as of 2026-10-03. V verified against official docs or source, P partial or experimental, N not
supported, ? not verified. Tools are listed in the order of the presets that read the shared files, followed by two
tools that only matter because they can shadow AGENTS.md.
| Tool | Root AGENTS.md |
Nested AGENTS.md |
Precedence and double-loading | .agents/rules |
.agents/skills |
Agents, commands |
|---|---|---|---|---|---|---|
| Claude Code | V, only when no CLAUDE.md, .claude/CLAUDE.md or CLAUDE.local.md exists in cwd or an ancestor (v2.1.277+; all sessions v2.1.281+) |
V lazily, when a file in a subdirectory without any CLAUDE.md is read |
@AGENTS.md import in CLAUDE.md never loads twice. CLAUDE.local.md suppresses AGENTS.md unless the user-level instructionFiles setting is claude-md-and-agents-md. Reads .claude/AGENTS.md, not AGENTS.local.md |
N | N (.claude/skills) |
N (.claude/agents, .claude/commands) |
| Codex CLI | V | V project root down to cwd only; no lazy loading below cwd | Per directory first of AGENTS.override.md, AGENTS.md, fallback names; concatenated root-down; project_doc_max_bytes 32 KiB |
N | V repo-local, cwd up to repo root; ~/.agents/skills |
? (.codex/agents/*.toml) |
| Cursor | V | V any subdirectory, more specific wins | ? Docs call AGENTS.md an alternative to .cursor/rules; co-presence and deduplication not documented |
N | V .agents/skills, .cursor/skills, nested ones anywhere |
V .cursor/agents, .claude/agents, .codex/agents; no .agents/agents |
| Copilot cloud agent, CLI | V | V nearest file in the tree takes precedence | Cloud agent: all relevant instruction sets are provided, no deduplication. CLI: removes duplicate copies of identical instructions, defines no general precedence | N | V .github/skills, .claude/skills, .agents/skills |
? (.github/agents) |
| Copilot in VS Code | V chat and agent | P experimental chat.useNestedAgentsMdFiles |
Additive. CLAUDE.md needs chat.useClaudeMdFile |
N | V same three locations | ? |
| Windsurf (Devin) | V always-on rule; agents.md also recognized |
V subdirectory file is a glob rule <dir>/** |
Same rules engine as .devin/rules; .devin/ wins over .windsurf/ |
N | V .agents/skills, native .devin/skills, .windsurf/skills |
? workflows |
| Gemini CLI | N by default: reads only GEMINI.md unless context.fileName lists more |
V for configured names, hierarchical and on file access | Only names in context.fileName load (.gemini/settings.json); @file.md imports work in GEMINI.md |
N | V .agents/skills beats .gemini/skills within a tier |
N (.gemini/agents, .gemini/commands only) |
| Antigravity | V | V AGENTS.md, GEMINI.md or .agents/rules/ in any subdirectory |
Cumulative; directory level wins on conflict. 24 KB per file, 20k tokens in aggregate | V any directory level, immediate .md children only, trigger frontmatter |
V <workspace>/.agents/skills; legacy .agent/skills |
? workflows are being superseded by skills |
| Junie | V | ? not in the fetched docs | .junie/AGENTS.md first; else AGENTS.md + .junie/rules/*.md; else legacy .junie/guidelines.md; identical content deduplicated |
N | V .junie/skills, .agents/skills |
? |
| Cline | V | ? shipped code reads the root file only | Listed beside .clinerules, .cursorrules, .windsurfrules; per-file toggles |
N | V in code (.agents/skills); docs list only .cline/skills and others |
N |
| Continue | P root only; a loop bug means only AGENTS.md is read, not AGENT.md or CLAUDE.md |
N | Always-apply rule, additive with .continue/rules and .continue/prompts |
N | N | N |
| opencode | V | V lazily, nearest file per read | Finds the first existing of AGENTS.md, CLAUDE.md, CONTEXT.md and stacks every ancestor copy of it |
N | V .agents/skills, .claude/skills, .opencode/skills |
N (.opencode) |
| Amp | V | V when the agent reads a file in the subtree | Per directory AGENTS.md, else AGENT.md, else CLAUDE.md |
N | V .agents/skills in project and parents |
? |
| xum | V | V | AGENTS.md > AGENT.md > CLAUDE.md; also AGENTS.local.md |
N | ? | ? |
| Hermes | V git root to cwd | V | One context type only: .hermes.md shadows AGENTS.md entirely |
N | V .hermes/skills, .agents/skills |
? |
| Zed | V | N | One file per worktree root: the first existing of .rules, .cursorrules, .windsurfrules, .clinerules, .github/copilot-instructions.md, AGENT.md, AGENTS.md, CLAUDE.md, GEMINI.md. Earlier entries shadow AGENTS.md |
N | V .agents/skills |
N |
| Warp | V file name must be upper case | V root and current directory | WARP.md beats AGENTS.md in the same directory |
N | V .agents/skills (recommended) |
? |
Only Antigravity reads .agents/rules; ai-rulez uses it for that tool alone. Other tools covered in the research
(Kilo Code, Roo Code, Factory, Kimi CLI, Aider) are not ai-rulez presets and are omitted.
Sources, all fetched 2026-10-03: Claude Code memory docs (agents-md section) and release notes for v2.1.277;
Cursor docs (cursor.com/docs/context/rules, cursor.com/docs/context/skills); GitHub docs on repository
instructions and agent skills; the VS Code custom-instructions matrix; Devin docs (docs.devin.ai, AGENTS.md and
skills); Gemini CLI docs and source (settingsSchema.ts, memoryTool.ts); the Antigravity rules and skills pages;
Junie guidelines and agent-skills docs; Cline rules docs and extension source; Amp docs
(ampcode.com/docs/customize/agents-md); and source reads of Codex (agents_md.rs, skills host roots), opencode
(instruction.ts), Continue (loadMarkdownRules.ts), Hermes (prompt_builder.py) and Zed (prompts.rs,
agent.rs). Tools change quickly; re-check a cell before relying on it.
What each preset does¶
Rules mode is the default split unless noted. "Shared" means the one AGENTS.md or .agents/skills tree.
Paths below are what a project with an always-on rule, an overview context file, a glob rule, auto and manual
rules, a glob-scoped context file, two skills, one agent and one MCP server writes (taken from the test fixtures).
| Preset | Reads AGENTS.md | Root file | Skills | Written beside the shared files |
|---|---|---|---|---|
codex, opencode, xum |
natively | shared AGENTS.md |
shared; .codex/skills, .opencode/skills, .xum/skills dropped |
their own agents, commands and MCP files |
amp |
natively | shared AGENTS.md |
shared | unchanged |
claude |
through CLAUDE.md containing @AGENTS.md |
CLAUDE.md is a banner plus @AGENTS.md |
.claude/skills kept (Claude ignores .agents/skills) |
.claude/rules/*.md for non-always-on items, .claude/agents, .claude/settings.json, .mcp.json |
gemini |
through context.fileName in .gemini/settings.json |
GEMINI.md not written |
shared | .gemini/settings.json, .gemini/agents/<id>.md, .mcp.json |
antigravity |
natively | GEMINI.md not written |
shared | .agents/rules/*.md for non-always-on items, .agents/agents/<id>.md, .agents/settings.json, .mcp.json |
hermes |
natively | .hermes.md not written |
shared | .mcp.json |
cursor |
natively | none | shared | .cursor/rules/*.mdc for non-always-on items and glob context, .cursor/agents/<id>.md, .mcp.json |
copilot |
natively | .github/copilot-instructions.md not written |
shared; .github/skills dropped |
.github/instructions/*.instructions.md for applyTo-scoped items, .github/agents/<id>.agent.md |
windsurf |
natively | none | shared; .windsurf/skills dropped |
.windsurf/rules/*.md for non-always-on items and glob context, .windsurf/agents/<id>.md |
cline |
natively | none | shared; .cline/skills dropped |
.clinerules/*.md for non-always-on items and glob context, .cline/agents/<id>.md |
continue-dev |
root file only | none | not shared: .continue/prompts/ai_rulez_prompts.yaml keeps the skills |
.continue/rules/*.md for non-always-on items and glob context, .continue/agents/<id>.md |
junie |
natively | .junie/guidelines.md not written |
shared; .junie/skills dropped |
.junie/rules/*.md for non-always-on items, .junie/agents/<id>.md |
Every preset above still writes its MCP file where it did before. Declarative providers (amp, hermes, claude,
junie, ...) honor the flag as well. Custom presets and provider specs that are not in the table take no part, and
their AGENTS.md or .agents/skills output is dropped in favor of the shared copy (see
Overlapping writers).
How each tool finds AGENTS.md¶
- Native readers (
codex,opencode,xum,amp,hermes,cursor,copilot,windsurf,cline,junie,antigravity): nothing to configure. - Claude Code reads
CLAUDE.md, and only readsAGENTS.mditself from v2.1.277 and in every session from v2.1.281. ai-rulez therefore keepsCLAUDE.mdas a generated shim: the generated-file banner followed by@AGENTS.md. The import works on every version and never loads the file twice. - Gemini CLI loads only the names in
context.fileName. With the flag on, ai-rulez merges"AGENTS.md"(and"GEMINI.local.md") intocontext.fileNamein.gemini/settings.json, keeping existing names and other keys (a single-string value becomes a list), and writes the file even when there are no[[mcp_servers]]. Gemini replaces its defaultGEMINI.mdwith whatever is configured, which is whyGEMINI.mdis not written. - Continue reads
AGENTS.mdat the repository root only, so nested<scope>/AGENTS.mdfiles are not read by it.
Why copilot-instructions.md, .hermes.md and friends are dropped¶
Some tools load a single instruction file and pick it by order, so a preset's own root file would hide AGENTS.md:
- Zed takes the first existing of
.rules,.cursorrules,.windsurfrules,.clinerules,.github/copilot-instructions.md,AGENT.md,AGENTS.md,CLAUDE.md,GEMINI.md. A generated.github/copilot-instructions.mdwould hideAGENTS.mdfrom Zed, so thecopilotpreset does not write it.CLAUDE.mdandGEMINI.mdcome later and do not shadow it..clinerulesis a directory here, which Zed does not treat as a rules file. - Hermes loads one context type, and
.hermes.mdshadows the wholeAGENTS.mdchain; thehermespreset does not write it. - Warp prefers
WARP.mdin the same directory. No preset writes it; do not add one by hand. - Junie prefers
.junie/AGENTS.md, thenAGENTS.mdplus.junie/rules, and only then the legacy.junie/guidelines.md. The guidelines file is dropped because it duplicatesAGENTS.md.
Overlapping writers¶
If another preset (including a custom provider) also writes AGENTS.md or a file under .agents/skills, the shared
output wins and the other copy is not written. Without this, the last preset in name order would overwrite the
shared file.
Where rules and context go¶
The shared AGENTS.md always carries always-on rules and context, and anything scoped only by negated globs
(!gen/**), which no rules folder can express. What else it carries depends on the presets that rely on it.
| Kind | Rules folder presets (cursor, windsurf, cline, continue-dev, claude and antigravity in split mode, junie in split mode) |
Presets without a folder (codex, opencode, amp, xum, hermes, gemini) |
|---|---|---|
| Always-on rule or context | AGENTS.md only |
AGENTS.md |
| Glob-scoped rule or context | the preset's folder | AGENTS.md with an _Applies to_ line |
| Auto rule | the folder | AGENTS.md with a _When relevant_ line |
| Manual rule | the folder | AGENTS.md |
Only negated globs (!gen/**) |
AGENTS.md only |
AGENTS.md |
The decision is made once for the whole file, from the configured built-in presets that rely on it:
| Configured preset (rules mode) | Scoped items (glob rules, glob context) in AGENTS.md |
Auto and manual items in AGENTS.md |
|---|---|---|
codex, opencode, amp, xum, hermes, gemini |
yes | yes |
claude, antigravity (split) |
no | no |
claude, antigravity (inline) |
no | yes |
cursor, windsurf, cline, continue-dev (either) |
no | no |
copilot (either) |
no | yes, its folder only holds applyTo items |
junie (split) |
no | no |
junie (inline) |
yes, it writes no rule files | yes |
The most inclusive row among the configured presets wins. In inline mode claude and antigravity still write
glob-scoped files, so only auto and manual items move into AGENTS.md. cursor ignores the mode: it always writes
files. Scoped context is inlined together with scoped rules.
Duplication trade-off¶
The inlining is decided for the file, not per reader. When a preset without a folder is enabled next to a preset
with one, the scoped items appear in AGENTS.md and in the folder, so the tool with the folder loads them twice.
Examples: claude + codex, cursor + codex, cursor + gemini, cursor + amp, cursor + hermes, and
(auto and manual items only) claude in inline mode + cursor. The research found no cross-file deduplication for
Cursor or Claude Code, and none for the Copilot cloud agent. A mixed setup that wants no duplication should keep to
presets that all have folders, accept the overlap, or leave agents_md off.
Machine-local rules are never part of the shared AGENTS.md. They keep their per-preset files (for example
.github/instructions/<id>.local.instructions.md, CLAUDE.local.md, AGENTS.override.md). See
Local Configuration for the file each tool loads.
Skills¶
- Skills without
targetsare written once to.agents/skills/<name>/SKILL.md, with bundled resources, in the generic Agent Skills format (name,description). Codex'smetadata.short-descriptionis not emitted there. - Claude Code reads
.claude/skills, not.agents/skills, so theclaudepreset keeps writing its own copy. - Continue reads neither, so the
.continue/promptsfile keeps carrying skills (and no.agents/skillstree is written ifcontinue-devis the only reader). - Skills that set
targetsstay out of the shared tree: they are written to the per-preset skills directories of the presets the targets allow, exactly as without the flag. A skill targetingcodexgoes to.codex/skillswhile an untargeted skill goes to.agents/skills; a skill targeting a preset that is not configured is written nowhere. .agents/skillsis read by Codex, Cursor, Copilot, Windsurf, Gemini CLI, Antigravity, Junie, Cline, opencode, Amp, Hermes, Zed, Warp and others, per the table above.
targets¶
Frontmatter targets select the presets or files an item is written for. The shared file changes who an item can
reach:
- A rule or context item is included in
AGENTS.mdwhen itstargetsname a preset that relies on the file (claude,gemini,cursor,codex, ...), the root file such a preset replaced (CLAUDE.md,GEMINI.md,.hermes.md,.junie/guidelines.md,.github/copilot-instructions.md, by path or base name), or any default owner ofAGENTS.md(codex,opencode,xum,amp), configured or not. - A target naming an unconfigured preset's root file (for example
GEMINI.mdwith onlycodexconfigured) does not select the item forAGENTS.md. - Widening: the file is shared, so an always-on rule targeted at a single preset now reaches every tool that reads
AGENTS.md. - Folder-only targets: an always-on rule or context item whose
targetsmatch only a rules folder or rule file path (.cursor/rules/,.claude/rules/,.github/instructions/,.windsurf/rules/, ...) and noAGENTS.mdowner or root file is not inAGENTS.md. The preset writes it as a rule file in that folder, exactly as without the flag. To limit an always-on item to one tool, target its rules folder path rather than its preset name. - Skills with
targetsare covered under Skills.
Scopes, local files and hashes¶
Scopes. Each [[scopes]] entry gets a nested <scope>/AGENTS.md carrying only the scope's own domain content.
A scope's claude preset writes <scope>/CLAUDE.md as a shim with @AGENTS.md, so Claude Code imports the nested
file. Gemini CLI reads project settings only, so .gemini/settings.json is written at the root and not in scopes;
the root setting is what makes Gemini find nested AGENTS.md files. If gemini is configured for a scope but not for
the root, Gemini gets no instructions for that scope and generate warns; add gemini to the root presets.
Local overrides. Machine-local content is not part of AGENTS.md.
CLAUDE.local.mdis still written when local content exists. Claude Code ignoresAGENTS.mdwhen aCLAUDE.local.mdexists, butCLAUDE.mdimports it explicitly, so nothing is lost.- Tools that read an AGENTS chain get local content through the file they load for it. Codex, and Hermes with the
flag on, load
AGENTS.override.mdinstead ofAGENTS.md, so ai-rulez writes a git-ignoredAGENTS.override.mdthat repeats the sharedAGENTS.mdand appends the local rules and context. OpenCode listsAGENTS.local.mdinopencode.jsoninstructions; xum appendsAGENTS.local.mditself. Amp has no project-local file, so its local content is not written andgeneratewarns. Claude Code is covered throughCLAUDE.local.md. - Gemini CLI loads
GEMINI.local.mdbecause.gemini/settings.jsoncontext.fileNamelists it: ai-rulez writes["AGENTS.md", "GEMINI.local.md"](["GEMINI.md", "GEMINI.local.md"]with the flag off), whether or not local content exists. Acontext.fileNameyou wrote yourself is kept andGEMINI.local.mdis appended to it;cleantakes back only the names ai-rulez added. - Junie and Antigravity load the local context from their rules folders (
.junie/rules/ai-rulez.local.md,.agents/rules/ai-rulez.local.md).
Hashes. The shared outputs carry one Source-Hash (and Content-Hash, per [header] hashes) computed from the
content and the settings that shape the file. It does not depend on the list of presets, rules modes, MCP servers or
plugins, so adding a preset that reads the file leaves the provenance line unchanged unless the file itself changes.
It changes with the inlining decision above, and, only when some rule or context item has targets, with the set of
presets relying on the file. AGENTS.md and the files under .agents/skills share the hash. The [header] hashes
modes apply as elsewhere: full writes both hashes, content only Content-Hash, none neither.
Turning the flag on and off¶
- On: files that were only needed by the per-tool layout (
GEMINI.md,.hermes.md,.github/copilot-instructions.md,.junie/guidelines.md,.codex/skills,.windsurf/skills, ...) are removed through the generated manifest.CLAUDE.mdis rewritten as the shim. - Off: the per-tool files are regenerated and the shared
AGENTS.mdand.agents/skillsfiles that no preset writes itself are removed. An off, on, off sequence ends where it began, except for the Gemini setting below. .gemini/settings.json: on toggle-off, acontext.fileNamethat exactly equals a value ai-rulez wrote (["AGENTS.md"],["AGENTS.md", "GEMINI.local.md"]) is rewritten to["GEMINI.md", "GEMINI.local.md"], whether or not ai-rulez wrote the whole file. In a list you authored, only theAGENTS.mdai-rulez appended is removed; if the value listsAGENTS.mdbut notGEMINI.md,generatewarns so you can add it yourself. Other keys and existingmcpServersare untouched.- Hand-written files are never removed. A skill you wrote at
.codex/skills/mine/SKILL.mdor.agents/skills/mine/SKILL.mdsurvives any number of toggles, because only manifest-tracked files are cleaned up.
Caveats¶
- Claude Code before v2.1.277 does not read
AGENTS.mdby itself; the@AGENTS.mdshim covers it. Claude Code also dropsAGENTS.mdwhenever anyCLAUDE.mdis found, which is why the shim imports rather than relies on discovery. - Duplication is possible in mixed setups (see the trade-off). The Copilot cloud agent and Copilot in VS Code provide all relevant instruction sets and document no deduplication; Copilot CLI only removes identical copies.
- Continue loads the always-on context twice with the flag on: once from
AGENTS.mdand once as prompts, because its prompts file carries context as well. - Size limits apply to the one larger file: Codex reads at most 32 KiB of project instructions by default
(
project_doc_max_bytes), Kimi CLI caps at 32 KiB, and Antigravity reads 24 KB per file and 20k tokens in aggregate. Usecompact = trueor move bulk content to skills when the file grows. - Cursor documents neither co-presence nor deduplication of
AGENTS.mdwith.cursor/rules; the preset keeps only non-always-on items in.cursor/rulesso the same text is not in both. - Nested
AGENTS.mdsupport varies: Codex reads only from the project root down to cwd, Cursor, Copilot, Amp and opencode load nested files; Zed and Continue do not; Cline and Junie are unverified. - Not verified: the entries marked
?in the tool table, and whether Copilot expands the@AGENTS.mdline of the Claude shim when it readsCLAUDE.mdas agent instructions.
See also: Configuration: agents_md, Rules and native rules folders,
Local Overrides, Monorepo.