Back to all rules / Drift between files

cross-file-contradiction

Two files loaded for the same agent, or mirrored for different agents, contradict.

warning by default Drift between files Needs the whole project Inline suppression allowed

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#

Two files loaded for the same agent, or mirrored for different agents, contradict.

Two files that are loaded for the same agent in one session, or that mirror each other for different agents (CLAUDE.md and AGENTS.md, AGENTS.md and GEMINI.md), where one says "always X" and the other "never X" (or "do not X") for the same action, worded the same way. The files have to apply to the same folder, and both have to be in the same lint run: a whole-folder lint, or both passed as paths. A file that already says both sides on its own is left to the single-file contradiction rule.

Why it matters#

When CLAUDE.md says one thing and AGENTS.md or GEMINI.md the opposite, agents behave differently on the same repo.

Bad example#

<!-- CLAUDE.md -->
- Always squash commits before merging.
<!-- AGENTS.md -->
- Never squash commits before merging.
- Keep the full history.

A contributor using Claude Code squashes, one using Codex does not. Each agent did what its file said.

Good example#

<!-- CLAUDE.md -->
@AGENTS.md
<!-- AGENTS.md -->
- Squash commits before merging.

How to fix#

Keep one source of truth and import or link it from the other file. Where two files must differ on purpose (one agent has a tool the other lacks), say so in the line.

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 cross-file-contradiction -- why this one is fine -->

For a whole file:

<!-- asitis-disable-file cross-file-contradiction -- why this file is an exception -->

For every file, turn it off or change its severity in .asitisrc.json:

{ "rules": { "cross-file-contradiction": "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.

Back to all rules

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.