[BUG] No path-level exclusion for sensitive files in file-change-notification behavior

Open 💬 0 comments Opened Jul 4, 2026 by orbex

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

When a file changes outside of Claude's own Read/Write/Edit tool calls (e.g., the user edits it directly), a system notification surfaces the diff as context so Claude stays in sync.

There's no way to exclude specific paths (e.g., .env, credential files) from this. Unlike hooks, which support per-tool matchers, and unlike the @-mention file picker, which respects .gitignore via respectGitignore.

This means editing a secrets file mid-session while Claude is active can surface plaintext credentials into the conversation transcript with no way to prevent it.

What Should Happen?

Requesting either:
(a) this notification mechanism respects .gitignore/a configurable exclude list similar to claudeMdExcludes
(b) a settings.json field to opt specific paths/globs out of file-change surfacing

Error Messages/Logs

Steps to Reproduce

Mid-session adjust/update a .env file (not the .env.example file) with a sensitive credential like an API key or password.

Claude Model

Sonnet (default)

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

Version 1.18286.0 (259c3f) Claude Code

Platform

Anthropic API

Operating System

Windows

Terminal/Shell

PowerShell

Additional Information

_No response_

View original on GitHub ↗