.gitignore is not .agentignore
Thesis
âDo not track in source controlâ and âdo not let a coding agent see the fileâ are not the same thing.
Corollary
Defaulting to hiding git-ignored files from agents is a mistaken design.
The Original Problem
As AI coding agents get more popular, people are realizing that they want to be able to keep certain files from the agents. This can be for a variety of reasons:
- Sensitive local configuration / credentials (
.env.local, etc.) - Text content generated by build tooling that is never manually edited (Documentation sites, code coverage reports, etc.)
-
Binary content generated by build tooling that is never manually edited or even read by developers (
*.class,*.jar, etc.) - Personal, repo-specific agent guidelines that are not relevant to the project at large
-
node_modulesand other such directories - âŠand more!
The Red Herring
Many of those things are also things that should not be tracked in source control - and .gitignore (and its lesser-known cousin, .git/info/exclude) exist!
Cursor was an early and high-profile pioneer of this approach, hiding content in .gitignore by default, in addition to its own .cursorignore file.
The result was that most projects never bothered to set up a .cursorignore - because their .gitignore covered most of what they needed to exclude.
The Emerging Problem
There are at least three things on that ignore list that indeed shouldnât be in source control but you may very well want to let an agent see:
- Text content generated by build tooling that is never manually edited
- Personal, repo-specific rules that are not relevant to the project at large
node_modules
Text Content
Access to generated text content is actually required if you want an agent to use and be able to verify that the build tooling works! Imagine asking an agent to update your documentation site, but then it canât see the generated content to check afterwards!
For example⊠this very blog! When changing how Jekyll builds it, the agent must be able to see the output in site/ - but we do not commit site/ to source control!
Personal, Repo-Specific Rules
The problem here emerges for agentic coding power-users: Once you start customizing an agentâs behavior, you realize:
- Most customizations that your harness supports live within the repositoryâs directory tree.
- Even if your harness does support global customizations, many customizations are specific to a particular repository.
- Other people working on the project may not share your preferences for those customizations.
- Other people working on the project may not even use the same harnesss you do (e.g. you use Cursor, they use Claude Code).
So, you want to put something in the repository directory tree that is there for you and your agent, but not committed to source control.
Git Ignore is the right tool for the job! Specifically, .git/info/exclude, which is itself not tracked in source control.
But an agentic coding harness that assumes all git-ignored files are also irrelevant to the agent doesnât allow this (you have to end up doing insane things to make it workâŠ).
node_modules
This is a point of contention, but in my experience, allowing an agent to be able to access node_modules - or other such installed-dependency directories - is amazing.
The reason itâs amazing is the agent can directly read all the source code in the entire call graph, including all the dependencies. This makes understanding architecture and tracking down bugs way easier. Nothing to download, no reliance on prose documentation or StackOverflow claims - just, go follow the entirety of the code in use in the project.
As an aside, I think this is one of the reasons that JavaScript (via node) has become one of the most-popular languages for agentic development, despite human devsâ longstanding complaints about JS. The available context can expand all the way up to the entirety of all possible call graphs!
The Right Ideas
The solution is a dedicated, standardized âAgent Ignoreâ file.
Youâve got a semantically-new class of thing that accesses most files in a directory tree but shouldnât always access the full set of files? It gets its own ignore file!
Whether it be a harness-specific file like .cursorignore, or an emerging standard like .agentignore, this is a pattern that has prior art and is worth continuing.
Consider,
-
.dockerignore- for Docker builds -
.helmignore- for Helm charts
At the moment, weâve got a bunch of nearly-identical implementations with no real standardization, including but likely not limited to:
| Tool | Ignore Method |
|---|---|
| Android Studio | .aiexclude |
| Claude Code | âDenyâ tool settings |
| Cline | .clineignore |
| Cursor | .cursorignore |
| Gemini Code Assist | .geminiignore, .aiexclude |
The Solution
Itâs time for âAgent Ignoreâ to become an officially-proposed standard somewhere with traction⊠and then get adopted.
AND, itâs time to *stop deferring âAgent Ignoreâ to âGit Ignoreâ!
If youâre building a new agentic coding harness, take heed!
âDo not track in source controlâ and âdo not let a coding agent see the fileâ are not the same thing.