Back to all rules / Hidden content and security

local-agent-file-not-ignored

A local-only agent file is in the repo and no .gitignore covers it.

warning by default Hidden content and security Needs the whole project Config or baseline only

Source: Claude Code docs: Settings (code.claude.com), read 14 October 2026.

On GitHub: the rule doc and the tests.

Jump to another rule89

Severity: error for sign-in credential files and ~/.claude.json copies, a warning for the rest.

What it catches#

A local-only agent file is in the repo and no .gitignore covers it.

Local-only agent files that are in the repo tree while no .gitignore in the repo covers them:

  • .claude/settings.local.json at any depth, and hand-made copies such as settings.local.json.bak (templates like .template or .example are fine);
  • CLAUDE.local.md;
  • .claude/agent-memory-local/ (subagent memory with the local scope);
  • sign-in files, reported as errors: .claude/.credentials.json, .codex/auth.json, .gemini/oauth_creds.json, and a copy of ~/.claude.json.

It reads only files named .gitignore to decide, never the local files themselves, and it does not walk folders a .gitignore excludes. It runs only when the folder is the top of a git checkout. Without git it cannot see whether a file is tracked, or read .git/info/exclude and your global excludes file, so the message says the file is not covered by .gitignore rather than that it is committed. Needs --include config.

Why it matters#

settings.local.json, CLAUDE.local.md and local subagent memory are personal by design. Claude Code ignores settings.local.json only through each user's global git excludes, so a clone or a second machine commits it. Sign-in files (.claude/.credentials.json, .codex/auth.json) are errors.

Bad example#

.gitignore           (node_modules/, dist/)
.claude/settings.json
.claude/settings.local.json
CLAUDE.local.md

Claude Code adds **/.claude/settings.local.json to your global git excludes the first time it writes the file, so it stays out of your commits on that machine. A clone, a sandbox or a teammate without that line commits it.

Good example#

# .gitignore
node_modules/
dist/
**/.claude/settings.local.json
CLAUDE.local.md
.claude/agent-memory-local/

How to fix#

Add the patterns to .gitignore. If git already tracks the file, run git rm --cached .claude/settings.local.json (the file stays on disk) and rotate any password or token it ever held, since history and forks keep the old copies. For a credentials file, sign out or revoke the session first.

Suppress or configure#

local-agent-file-not-ignored is a security rule, so it cannot be suppressed with a comment in the file: a suppression comment is itself a hidden comment, and an attacker who can add a payload can add one next to it. A comment that tries gets a suppression-not-allowed warning.

Turn it off, or change its severity, in .asitisrc.json, which shows up in review:

{ "rules": { "local-agent-file-not-ignored": "off" } }

Or accept the findings you have today in a baseline, so only new ones fail the build:

asitis lint --format json --write-baseline > .asitis-baseline.json
asitis lint --baseline .asitis-baseline.json

Source#

Claude Code docs: Settings, 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.

Run the rule

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.