Aider's repository map is one of the sharpest context-filtering mechanisms in AI-assisted coding. Instead of stuffing entire codebases into your prompt, Aider parses your Git tree with Tree-sitter, graphs dependencies, and uses a personalized PageRank algorithm to squeeze key architectural definitions into a tight token budget—typically capped at 1,024 tokens.
That token budget is precious real estate.
If you let Aider scan minified bundles, multi-megabyte CSV datasets, or generated database schemas, those artifacts crowd out the actual application logic you need the model to understand. Worse, if your repository contains local environment keys or confidential configuration templates that were tracked in Git, the LLM will happily digest them.
At 365Finds, our stance is unequivocal: relying solely on .gitignore to govern AI context is an operational mistake. .gitignore manages version control hygiene; .aiderignore manages AI attention and security. Here is how to configure .aiderignore properly to keep build noise, massive fixtures, and sensitive secrets out of Aider's repository map.
Why .gitignore Alone Is Not Enough
Aider automatically respects .gitignore by default. If a file is ignored by Git, Aider will generally leave it alone.
So why bother with .aiderignore? Because version control priorities and LLM context requirements often pull in completely opposite directions:
- Committed artifacts you must store, but never prompt: You might intentionally commit mock test fixtures, static demo payloads, generated type definitions, or lockfiles to Git. You want your CI pipeline to have them, but you do not want Aider spending 400 of its 1,024 map tokens parsing a generated 12,000-line GraphQL schema.
- Accidental tracking: A developer runs
git add .in a hurry on a feature branch, tracking an internal credential file or a heavy local SQLite database. Aider's Tree-sitter parser immediately picks it up. - Monorepo noise: In a monorepo, backend developers do not want frontend client components cluttering their PageRank graph.
.aiderignore creates a strict perimeter around what Aider can see, index, and edit—independent of what Git tracks.
File Placement and Configuration Syntax
By default, Aider searches for a file named .aiderignore located in the root of your Git repository.
Its syntax mirrors .gitignore exactly:
- Blank lines and lines starting with
#are treated as comments. - Trailing slashes (such as
dist/) indicate directories. - Standard glob patterns apply:
*matches characters within a directory,**matches directories recursively. - Exclamation points
!negate a previously ignored pattern, creating exceptions.
Create the file in your project root:
touch .aiderignore
Below is the production-tested .aiderignore baseline we recommend at 365Finds for modern software repositories:
# ==========================================
# 1. Build Artifacts & Machine-Generated Code
# ==========================================
dist/
build/
out/
target/
.next/
.nuxt/
coverage/
*.min.js
*.min.css
*.bundle.js
*.tsbuildinfo
*.map
# Generated client SDKs and schemas
generated/
openapi-spec.json
schema.graphql
# ==========================================
# 2. Large Datasets, Fixtures & Binaries
# ==========================================
data/
datasets/
fixtures/large/
seed-data/
*.csv
*.tsv
*.parquet
*.jsonl
*.sqlite3
*.db
*.bin
*.tar.gz
*.zip
# ==========================================
# 3. Sensitive Files, Keys & Local Envs
# ==========================================
.env*
!*.env.example
*.pem
*.key
*.cert
*.p12
*.pfx
credentials/
secrets/
id_rsa*
*.vault
# ==========================================
# 4. Dependency Trees & Lockfiles
# ==========================================
node_modules/
vendor/
.venv/
env/
package-lock.json
pnpm-lock.yaml
yarn.lock
poetry.lock
Notice the exception pattern !*.env.example. This allows Aider to understand the environment shape and key names your application expects while keeping actual .env and .env.local values completely isolated from the model's context window.
What Happens Behind the Scenes
When you launch Aider with a valid .aiderignore, three distinct behaviors take effect:
| Aider Subsystem | Impact of .aiderignore |
|---|---|
| Repository Map | Ignored files are filtered before Tree-sitter extraction; no definitions or tags from these files consume --map-tokens. |
| Active Chat Context | Aider will refuse to add matching files to chat when using /add <filename>, returning a message that the file is ignored. |
| Model File Discovery | The LLM cannot unilaterally ask Aider to open or inspect ignored paths during multi-step reasoning. |
The Deliberate Escape Hatch: /read
There are rare cases where you need Aider to read a single configuration structure or sample payload without letting the model modify it or allowing it to permanently contaminate the repo map.
Aider provides an intentional override: /read. Running /read path/to/file pulls the content into the chat context as read-only, bypassing both .gitignore and .aiderignore constraints. At 365Finds, we appreciate this separation: /add is for editable code that belongs in your workflow, while /read is an explicit, conscious override for background reference.
Advanced Workflows: Monorepos and Scoped Ignores
For teams working in multi-service repositories, a single static .aiderignore at the root is often insufficient. If you are touching a Python backend in services/api/, indexing TypeScript components in apps/web/ wastes tokens and distorts symbol relevance.
Aider allows you to point to custom ignore profiles using the --aiderignore flag:
# Launch Aider scoped to backend development
aider --aiderignore .aiderignore.backend
# Launch Aider scoped to frontend development
aider --aiderignore .aiderignore.frontend
Alternatively, set your preference in .aider.conf.yml within your project or home directory:
aiderignore: .aiderignore.backend
map-tokens: 1024
Or via environment variable:
export AIDER_AIDERIGNORE=.aiderignore.backend
How to Verify Your Repository Map
Never assume your glob patterns worked without verifying them. A missing trailing slash or misplaced wildcard can leave thousands of lines in the index.
-
Inspect the generated map directly: Run the CLI flag without entering interactive chat:
aider --show-repo-mapScroll through the output. If you see classes from
dist/or functions from mock data files, your patterns have not matched. -
Check inside the chat session: Within an active Aider session, run:
/mapThis displays the current structural map Aider is sending to the LLM.
-
Force a cache refresh: If you modified
.aiderignorewhile Aider was running, tell Aider to rebuild its AST cache immediately:/map-refresh -
Verify token consumption: Run
/tokensto see current context distribution. An uncurated repo map often strains against the limit, forcing Aider to drop relevant source definitions. A clean.aiderignorekeeps map tokens lean and focused strictly on the classes and interfaces your feature actually depends on.