Scan instruction files such as AGENTS.md
Last updated 23 November 2026
Coding agents read instruction files from your repository before they act: AGENTS.md, CLAUDE.md, Cursor rules and others. Text in them steers an agent as strongly as a skill does, and anyone who can change the file can change what the agent does. Since scanner 1.13.0 the scanner finds these files, checks them with the skill rules, pins them in the lock file and reports them in every format. It is on by default, so a CI check that passed before can fail after you upgrade; this page says how to read a result and how to leave the files out.
What the scanner reads
Each instruction file is one item of kind instructions. The scanner checks its text with the skill rules, such as SW-SKL-001 for prompt-injection phrases, SW-SKL-002 for hidden text and SW-SKL-019 for external content fetched into context, except the two rules that check a skill's SKILL.md metadata, which do not apply to a file that is not a skill. Fenced code blocks in the file are read too.
The same check runs in the free scanner, in CI with the GitHub Action or the GitLab component, and in connected mode, where the files are uploaded with the rest of the report.
Since scanner 1.20.0 rules, commands, subagents and output styles are instruction files too: each is Markdown that an agent takes as instructions. The skill rules read their text in the same way, and SW-SKL-036 also reads allowed-tools in the front matter of a file under a commands or agents folder. The other front matter keys of a command or a subagent, such as inline hooks, mcpServers, permissionMode and tools, are read but not judged for what they configure. How often the skill rules are right on the text of commands and subagents has not been measured.
Which files
The first table holds the formats the scanner has read since 1.13.0. The second holds the formats that scanner 1.20.0 added. Every folder named below is found at any depth of the repository.
| Format | Where |
|---|---|
agents-md | A file named AGENTS.md, at any depth. |
claude-md | A file named CLAUDE.md, at any depth, so .claude/CLAUDE.md and docs/CLAUDE.md both count. |
gemini-md | A file named GEMINI.md, at any depth. |
copilot-instructions | .github/copilot-instructions.md at the scan root. |
cursor-mdc | A .mdc file under a folder .cursor/rules/, at any depth, subfolders included. |
cursorrules | .cursorrules at the scan root. |
windsurf-rules | A .md file under .windsurf/rules/ or .devin/rules/, subfolders included since 1.20.0, and .windsurfrules at the scan root. Windsurf's documentation moved to Devin, so both folders are read. |
| Format | Where |
|---|---|
claude-rule | A .md file under .claude/rules/, subfolders included. |
claude-command | A .md file under .claude/commands/, subfolders included. |
claude-agent | A .md file under .claude/agents/, subfolders included. |
claude-output-style | A .md file directly in .claude/output-styles/. |
cursor-agent | A .md file directly in .cursor/agents/. |
codex-agent | A .md file directly in .codex/agents/. |
gemini-agent | A .md file directly in .gemini/agents/. |
devin-agent | A .md file directly in .devin/agents/, and <name>/AGENT.md in that folder. |
github-instructions | A file whose name ends in .instructions.md under .github/instructions/. |
github-agent | A .md file under .github/agents/, subfolders included. |
Scanner 1.20.0 also reads these as instruction files:
AGENTS.override.md,AGENTS.local.md,AGENT.mdandCLAUDE.local.md, the variants of the files in the first table.global_rules.mddirectly in a.windsurfor.devinfolder, which the agent always applies.- A
.mdfile directly in.agents/agents/, and<name>/AGENT.mdin that folder. - The Markdown under
commands/andagents/of a local plugin directory. These items carry the plugin's name.
- Paths are matched whatever their case and Unicode form, as macOS and Windows open them, so a file named claude.md that an agent loads as CLAUDE.md is scanned on Linux CI too.
- The usual include, exclude and walk rules apply first: dependency folders such as node_modules are not walked.
- A file inside a skill folder or a plugin folder belongs to that package and is scanned once, there, so a finding appears once. A command or subagent file inside a skill folder belongs to that skill.
- From scanner 1.16.1, a file over 10 MiB is an error and the scan is incomplete (exit code 2), because an instruction file is agent content that the scanner would leave unread. Shrink the file or exclude it in the settings. A large file that is not agent content is skipped with the notice file_too_large.
- Not read:
.github/prompts/*.prompt.md, the prompt files of VS Code's Local harness;.mdfiles in.cursor/rules/, which Cursor ignores;.cursor/commands/, which has no documented format; the workflows in.windsurf/workflows/and.devin/workflows/, which run only when the user asks;.codex/agents/*.toml; Gemini CLI's.gemini/commands/**/*.toml; and files that need a parser or a rule the scanner does not have, such as.cursor/permissions.json,.codex/rules/*.rules, Gemini CLI's policy files and.claude/workflows/*.js. Which files Spellwarden reads for each coding agent has the whole list, agent by agent. The instruction files in a person's home folder are not part of a repository scan:spellwarden scan --userreads them, as Scan a developer workstation describes.
What the findings look like
A finding in an instruction file is an ordinary finding whose item and path are the file's path, with the same rule id, severity, masked evidence and fingerprint as for a skill. Accept it in the baseline file or, in the dashboard, with a note, as for any finding.
Cursor and Windsurf rule files start with front matter that says when the rule applies. The scanner reads it with a simple line parser, not YAML, because Cursor writes values that YAML refuses, such as globs: *.ts. It reads between the first line --- and the next --- within the first 4096 bytes, the keys description, globs and alwaysApply for Cursor and trigger, globs and description for Windsurf, keeps at most 20 globs and 300 characters of description, and shows the result under each finding in words:
Since 1.20.0 the same parser reads paths of a Claude Code rule and applyTo of a GitHub instruction file, both shown as globs, and the description of a GitHub instruction file, a command, a subagent or an output style. In a command, a subagent or an output style, a description written as a YAML block is not read and stays null.
Applied: alwaysfor a rule that always applies.Applied to files matching:followed by the globs.Applied when the agent judges it relevant:followed by the description.Applied when asked forfor a rule that applies only when it is called by name.
A global_rules.md directly in a .windsurf or .devin folder is always applied, an output style applies when asked for, and a command, a subagent or a GitHub instruction file applies as its globs or its description says.
A file whose front matter cannot be read is still scanned. Its front matter is null and the notice instructions_front_matter names the file. In the JSON report an instruction file is an item of this shape:
{
"kind": "instructions",
"path": ".cursor/rules/style.mdc",
"name": "style.mdc",
"plugin": null,
"format": "cursor-mdc",
"front_matter": {
"description": "House style for the web app",
"globs": [
"src/**",
"tests/**"
],
"always_apply": false,
"trigger": null
}
}The lock file
Each instruction file is pinned in .spellwarden/lock.json under the kind instructions, with its path, its format and a hash of its bytes, so a change to the file shows as a change in the lock. Two things follow from the upgrade:
- A repository that already has a lock sees every instruction file as added.
spellwarden scan --lockedexits with code 3 until you runspellwarden lockonce and commit the result. - A lock that holds instruction files cannot be read by scanner 1.12.0 or older: they stop with the error
lock_unreadable. If a laptop or a pipeline runs an older scanner than 1.13.0, upgrade it, or turn instruction files off. - Scanner 1.20.0 finds more instruction files, so a repository that holds them sees new lock items as added, and
spellwarden scan --lockedexits with code 3 untilspellwarden lockruns once. A scanner at 1.19.0 reports the same items as removed, also with exit code 3, so a team that runs both versions on one repository should upgrade both. - From scanner 1.16.2, when the scanner could not read some agent content, for example a file over 10 MiB or a configuration file it cannot parse,
spellwarden lockwrites no lock file andspellwarden lock --checkcompares nothing. Both end with exit code 2 and name what to fix or exclude.
Linked rule folders
Some teams share rules through a linked folder, as Claude Code documents: for example .claude/rules/shared as a symbolic link to ../../shared-rules. By default the scanner does not follow a linked directory. It gives the notice symlink_skipped, the rule files reached only through the link are not judged, and the scan can pass with them unread. Since scanner 1.20.0, spellwarden scan --follow-links follows such a link. It is off by default, and nothing changes while it is off.
- A link counts when it sits in an instruction folder: below
.claude/rules/,.cursor/rules/,.windsurf/rules/,.devin/rules/,.claude/commands/,.claude/agents/,.github/instructions/or.github/agents/, a named folder in.devin/agents/or.agents/agents/, or one of these folders itself. - When the target is a directory inside the scan root, each file below it is judged under the link's path, such as
.claude/rules/shared/a.md, and every report, the lock file and the upload name it by that path. A link is followed one level. - At most 50 links are followed per scan root. More is the error
instructions_limit, and every file read through a link counts toward the 300 instruction files. - A link that cannot be followed, for example one with an absolute target, a missing target or a target that git ignores, is the error
unsafe_path, and the scan is incomplete with exit code 2. Replace the link with the files it should hold, or leave it out withexclude. - Never followed, with or without the option: a link whose target is outside the scan root, which gets a notice while what it leads to is not judged; a linked folder above an instruction folder, such as
.claudeitself; a linked directory anywhere else; and a link to a directory inside a skill or a local plugin directory. - The lock file does not record the option. Give
spellwarden lock,spellwarden lock --check,spellwarden scan --lockedand thespellwarden baselinecommands the same--follow-linksas the scan, or the files read through the link show as added or removed. - In CI, the GitHub Action and the GitLab component take the input
follow-links; see Linked rule folders in CI. A workstation scan refuses the option, because it already follows a link to a directory inside the home directory.
Turn it off
Set instructions: false in .spellwarden/config.yml. Instruction files, commands, subagents and output styles among them, are then not found, not locked, not scanned and not reported; there is no flag and no environment variable. On a pull or merge request the scanner reads this file from the base revision, as it does for every setting, so a request cannot switch off the scan of its own files.
Scanners older than 1.13.0 refuse a settings file that has this key, so a team that mixes scanner versions should upgrade them together. A repository with no instruction files gets the same findings, items, lock and exit code as before, except that each finding of the JSON report now carries its framework tags.
Limits
A scan root holds at most 300 instruction files. The files an agent reads at the root of the repository come first, then the rest, shallowest first. More is the error instructions_limit: the scan is incomplete, exits with exit code 2, and the files past the limit are not read. Content that the scanner leaves unread never looks like a pass. To narrow what is scanned, add the folders that hold generated or vendored instruction files to exclude in the settings file; the change is reviewed like any other.
Since scanner 1.20.0 commands, subagents and output styles count toward the limit, and the files of the agent folders at the root of the repository are among those read first. A repository that was under the limit can pass it after the upgrade; the way out is the same exclude.
In the dashboard
A repository whose CI uploads reports in connected mode lists its instruction files on the repository page: the file, its kind in words, when it applies and how many findings are open in it. A repository with none shows No instruction files were found in the latest scan. A scanner older than 1.13.0 sends no instruction items, so its repository shows that sentence too; connected mode itself still needs scanner 1.2.0 or later. The private registry's check does not consider instruction files.
Instruction files do not change how a skill or an MCP server is scanned: those are checked as before. Open-source scanner, CI wrappers and Infra Pack covers the command line, and Scan in CI with GitHub or GitLab covers the pipeline.