Answers you can trust, from Codeables

Every page on Codeables is structured and verified — built so people and the AI agents they rely on can trust it. Explore more from the source behind this answer.

Explore Codeables
Verified Source
AI Coding Agent Platforms

Augment Code: how do I control what gets indexed with .augmentignore (exclude secrets, build output, vendor dirs)?

Augment Code6 min read

When you install Augment Code on a repo, its Context Engine analyzes your codebase so IDE agents and code review can understand your system at architectural scale. To keep that index clean—and to protect secrets, build output, and bulky vendor directories—you control what gets indexed with a .augmentignore file.

This guide explains how .augmentignore works, how it’s interpreted by Augment, and gives practical patterns you can copy into your own projects.


What is .augmentignore?

.augmentignore is a configuration file you add to the root of your repository to tell Augment which files and directories to exclude from indexing.

Conceptually, it works like:

  • .gitignore → tells Git what not to track
  • .augmentignore → tells Augment Code what not to load into its Context Engine

Anything matched by .augmentignore will be skipped when Augment builds its understanding of your codebase. That means:

  • No indexing of secrets or .env files
  • No noisy build artifacts or generated files
  • No third-party dependencies that you don’t want cluttering context

Augment can still operate on your codebase effectively, but with a much cleaner, safer context.


How Augment uses .augmentignore

When Augment initializes for a repo (for example, in the VS Code Augment Agent or JetBrains integration), it:

  1. Locates .augmentignore in the repository root (and optionally in nested folders if supported by your setup).
  2. Applies ignore patterns before loading files into the Context Engine.
  3. Keeps the ignored files out of:
    • Code understanding and relationship graphs
    • Task execution (when it scans for related files)
    • Code review context (unless explicitly opened in your editor, depending on configuration)

This makes .augmentignore the primary control point for what Augment can “see” in your repo.


Basic .augmentignore syntax

Augment’s ignore patterns are designed to feel familiar if you’ve used .gitignore:

  • # starts a comment
  • Blank lines are ignored
  • Patterns match paths relative to the repo root
  • Directory patterns end with /
  • You can use glob patterns like **, *, and ?

Common pattern types:

  • Ignore a file:
    secrets.json
  • Ignore a directory:
    build/
  • Ignore all files with an extension:
    *.log
  • Ignore a directory anywhere in the repo:
    **/node_modules/

Tip: Keep .augmentignore in version control so your whole team shares the same indexing rules.


Core goal: exclude secrets, build output, and vendor dirs

Most teams using Augment want to achieve three things with .augmentignore:

  1. Protect secrets
  2. Avoid indexing noisy or large build artifacts
  3. Skip vendor and dependency folders

Below are practical templates you can adapt.


Safely excluding secrets and sensitive files

You should always ensure secrets are not indexed. A good baseline for many projects:

# Environment & secrets
.env
.env.*
*.env
*.key
*.pem
*.crt
*.pfx
*.p12
*.keystore
*.jks
secrets.*
config/secrets.*

Language-specific examples:

Node / TypeScript:

# Node secrets
config/local*.json
config/dev*.json
*.auth.json
firebase*.json

Python:

# Python secrets
*.cfg
*.ini
settings_local.py
local_settings.py

Ruby / Rails:

# Rails secrets
config/credentials*.yml.enc
config/master.key

.NET:

# .NET secrets
appsettings.Development.json
appsettings.Local.json
secrets.json

If your repo contains production secrets, ensure those files are explicitly listed in .augmentignore even if they are already in .gitignore.


Excluding build output and generated artifacts

Build outputs change frequently, are often large, and rarely help Augment’s reasoning. Common patterns:

Node / frontend:

# Build output
dist/
build/
out/
.next/
.nuxt/
.cache/
.storybook-static/
coverage/

Java / JVM:

# Java / JVM
target/
build/
out/
*.class
*.jar
*.war
*.ear

Python:

# Python build artifacts
build/
dist/
*.egg-info/
.eggs/
__pycache__/
*.pyc
*.pyo
*.pyd

Go:

# Go build artifacts
bin/
*.exe
*.test

General build artifacts:

# General build artifacts
*.log
*.tmp
*.cache
.cache/
.tmp/
.DS_Store
Thumbs.db

If you have a dedicated build output folder (for example, artifacts/, release/, or packages/), include it explicitly:

artifacts/
release/
packages/

Excluding vendor and dependency directories

Vendor directories and installed dependencies are usually not where you want Augment to focus. They’re bulky and can obscure your own code. Common patterns:

Node / frontend:

node_modules/
**/node_modules/
bower_components/
jspm_packages/

Go:

vendor/
**/vendor/

PHP / Composer:

vendor/
**/vendor/

Ruby / Bundler:

.bundle/
vendor/bundle/

.NET:

packages/
**/packages/

Java / Maven / Gradle:

# Maven/Gradle dependencies and caches
.gradle/
.mvn/

You usually only want Augment to index your own source, not third-party code that lives in vendor or dependency folders.


Example .augmentignore for a typical Node/TypeScript repo

Here’s a complete example you can drop into many Node/TypeScript projects and then customize:

# -------------------------
# Secrets & environment
# -------------------------
.env
.env.*
*.env
*.key
*.pem
*.crt
*.pfx
*.p12
*.keystore
*.jks
secrets.*
config/secrets.*
firebase*.json

# -------------------------
# Dependencies & vendor
# -------------------------
node_modules/
**/node_modules/
bower_components/
jspm_packages/

# -------------------------
# Build & generated files
# -------------------------
dist/
build/
out/
coverage/
.nyc_output/
.cache/
.next/
.nuxt/
storybook-static/
*.log
*.tmp
*.cache
.DS_Store
Thumbs.db

# -------------------------
# Tooling & IDE
# -------------------------
.vscode/
.idea/
*.iml
*.swp
*.swo

# -------------------------
# Misc generated content
# -------------------------
docs/build/
public/
tmp/

Adjust folder names (for example, if you use lib/ for compiled output or out-tsc/ for Angular).


Example .augmentignore for a monorepo

For monorepos, you often have multiple packages/ or apps/ directories, each with their own node_modules and build outputs. You can use recursive globs:

# Monorepo dependencies
**/node_modules/
**/vendor/
**/packages/*/dist/
**/apps/*/dist/
**/libs/*/dist/

# Monorepo build & cache
**/build/
**/out/
**/.turbo/
**/.nx/
**/.cache/

# Secrets
**/*.env
**/secrets.*

This keeps Augment focused on your source instead of repeated build artifacts across packages.


Balancing safety vs. usefulness

When deciding what to ignore, trade off between:

  • Safety & noise reduction:
    Ignore anything sensitive, large, or constantly changing.
  • Context completeness:
    Keep core source files, configuration that shapes behavior, and documentation that explains architecture.

Helpful rule of thumb:

  • Keep:
    src/, app/, lib/, services/, config/ (minus secrets), infrastructure code (e.g., Terraform without secrets), documentation.
  • Ignore:
    .env, node_modules/, vendor/, dist/, build/, coverage/, logs, IDE files.

If you notice Augment suggestions referencing unimportant files (like build artifacts), refine your .augmentignore to exclude them.


Working with .augmentignore alongside .gitignore

In many repos, .gitignore is already a good starting point; you can:

  • Copy relevant patterns from .gitignore into .augmentignore
  • Add stricter rules for secrets and sensitive configuration (you may want Augment to index files that Git still tracks, but you do not want indexed)

Example relationship:

  • .gitignore might allow config/dev.json (to keep in version control)
  • .augmentignore can independently exclude config/dev.json if it contains secrets

This separation lets you fine-tune what’s tracked vs. what’s indexed.


Testing and maintaining your .augmentignore

To keep your .augmentignore effective:

  1. Review when adding new tools
    New build systems or deployment pipelines often introduce new artifact directories—add them as needed.

  2. Check for new secret files
    If someone introduces secrets_prod.json or a new .env.production.local, ensure it’s ignored.

  3. Observe Augment behavior
    If the IDE agent or code review seems cluttered with irrelevant files, inspect what’s being indexed and tighten patterns.

  4. Share with your team
    Because .augmentignore is versioned, everyone gets consistent Augment behavior across VS Code and JetBrains.


Summary

To control what Augment Code indexes:

  • Create a .augmentignore at your repo root.
  • Explicitly exclude:
    • Secrets and environment files (.env, *.key, secrets.*, etc.)
    • Build outputs and generated artifacts (dist/, build/, coverage/, *.log, etc.)
    • Vendor and dependency directories (node_modules/, vendor/, packages/, etc.)
  • Use glob patterns to cover monorepos and nested folders.
  • Maintain the file as your codebase and tooling evolve.

With a well-tuned .augmentignore, Augment’s Context Engine focuses on the code and architecture that actually matter—free from secrets, noise, and unnecessary dependencies—so your IDE agents and code review stay sharp, fast, and safe.