[FEATURE] .claudeignore — exclude files from Claude Code's context window
Preflight Checklist
- [x] I have searched existing requests and this feature hasn't been requested yet
- [x] This is a single feature request (not multiple features)
Problem Statement
## Summary
Add support for a .claudeignore file that tells Claude Code to skip specified files and directories when building context, using the same syntax as .gitignore.
## Problem
Teams increasingly want to store non-code artifacts in their repos — security threat models, WIP design docs, ADRs, old specs — because version control and co-location with the code are genuinely valuable. But these documents create a real problem with Claude Code:
they get pulled into the context window during normal development sessions, where they can bias coding behavior, consume context budget, or surface stale/WIP information as if it were authoritative.
The current workaround — permissions.deny rules in .claude/settings.json — works but has poor discoverability and is unintuitive. Most developers won't know it exists or think to use it.
## Why Not Just Use permissions.deny?
.claudeignoreis immediately understandable to any developer who has used git- It lives in the repo, so the exclusion is shared across the team automatically — no per-developer config needed
permissions.denyis a hard block;.claudeignoreis a softer "don't auto-consume" that still allows explicit access- The mental model matches the use case: "ignore for context purposes" vs. "deny access entirely"
## Use Cases
- Security threat models and vulnerability assessments stored in
docs/security/— valuable to version but should not bias coding sessions - WIP design documents that are incomplete and could mislead an AI assistant
- Historical ADRs that provide context for humans reading the repo but are too voluminous for routine coding context
- Generated documentation, changelogs, or reports that bloat the context window without adding coding value
Proposed Solution
A .claudeignore file at the repo root (and optionally in subdirectories) using standard .gitignore glob syntax:
Don't pull security docs into coding sessions
docs/security/
Ignore WIP specs
specs/wip/
Ignore old ADRs
docs/adr/deprecated/
### Behavior
- Files matching
.claudeignorepatterns are excluded from automatic context building - Claude Code can still read them if the user explicitly asks (e.g., "read docs/security/threat-model.md") — this is not a permissions block, just a context filter
- Follows the same precedence model as
.gitignore(directory-level files apply to their subtree)
Alternative Solutions
_No response_
Priority
Medium - Would be very helpful
Feature Category
CLI commands and flags
Use Case Example
_No response_
Additional Context
_No response_
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗