Back to all rules / Drift between files
nested-duplicate
A subfolder instruction file repeats rules from the file above it.
Source: Claude Code docs: How Claude remembers your project (code.claude.com), read 14 October 2026.
On GitHub: the rule doc and the tests.
Jump to another rule89
What it catches#
A subfolder instruction file repeats rules from the file above it.
A subfolder CLAUDE.md, AGENTS.md or GEMINI.md that repeats rules from the same kind of file in a folder above it. The agent loads both when it works in the subfolder, so the shared rules cost context twice, and the two copies drift apart the first time someone edits one. Needs at least two shared rules of 24 characters or more. When many subfolders copy the same file, you get one note that lists them.
Why it matters#
Subfolder CLAUDE.md, AGENTS.md and GEMINI.md files load together with the ones above them, so repeated rules cost context twice and drift apart over time. Needs at least two shared rules of 24 characters or more.
Bad example#
CLAUDE.md - Run tests with pnpm test before you commit
- Never commit generated files under dist/
packages/api/CLAUDE.md - Run tests with pnpm test before you commit
- Never commit generated files under dist/
- API handlers live in src/routes/
Good example#
CLAUDE.md - Run tests with pnpm test before you commit
- Never commit generated files under dist/
packages/api/CLAUDE.md - API handlers live in src/routes/
How to fix#
Keep shared rules in the top file and only folder-specific ones in the subfolder file.
Suppress or configure#
For one finding, put a comment on the line above it. The reason after -- is optional but worth writing:
<!-- asitis-disable-next-line nested-duplicate -- why this one is fine -->
For a whole file:
<!-- asitis-disable-file nested-duplicate -- why this file is an exception -->
For every file, turn it off or change its severity in .asitisrc.json:
{ "rules": { "nested-duplicate": "off" } }
A .asitisrc.json overrides entry limits a change to some paths, and a baseline (asitis lint --format json --write-baseline) accepts today's findings so only new ones fail the build.
Source#
Claude Code docs: How Claude remembers your project, read on 14 October 2026.
See what an agent changed in your CLAUDE.md. Keep or revert each change.
The linter is free and needs no signup. I'm also building a desktop editor for the markdown your agents write and read. It shows what an agent changed since you last looked, lets you keep or revert each change, and never touches a line you didn't edit. No release date yet. One email to confirm, one when the paid beta opens, one when 1.0 ships. $29 once for a founding licence, with 24 months of updates.
Or add the linter to CI, no email needed.
Your address is stored with Cloudflare, which hosts this site. No IP address is kept. See the privacy policy.
Related guides
Run the rule
- In your browser, on one file
- In Claude Code, on the project
- In CI, on every pull request
This page is generated from the plugin's rule registry. Edit it on GitHub. False positive? Open an issue with the line it fired on.