Skip to content

Feature Request: Smart Environment Discovery for agentignore init #5

Description

@skkdevcraft

Enhance agentignore init to perform lightweight project/environment discovery and generate useful default entries in .agentignore and .agentallow.

Today, agentignore init creates template files with comments. The proposed behavior would keep those templates but additionally detect common development ecosystems and pre-populate rules that reflect the current workspace.

This would help users get immediate value from AgentIgnore without having to manually configure common exclusions and tool allowances.

Motivation

Most projects contain large dependency directories, build outputs, caches, and tooling that agents rarely need to inspect directly.

Likewise, many agent workflows require access to common package managers and build tools.

Instead of starting from empty configuration files, AgentIgnore could provide sensible defaults based on the detected project type.

Benefits:

  • Better out-of-the-box experience.
  • Reduced configuration friction.
  • Faster onboarding for new users.
  • Encourages least-privilege visibility by default.
  • Keeps configuration explicit and editable.

Proposed Behavior

When agentignore init is executed:

  1. Perform lightweight discovery of the current workspace.
  2. Detect common project ecosystems.
  3. Generate commented sections in .agentignore.
  4. Generate matching tool allowances in .agentallow.
  5. Allow users to review and modify the generated entries.

Example:

If the workspace contains:

package.json
node_modules/

Generated .agentignore:

# Node.js
node_modules/

Generated .agentallow:

# Node.js tooling
npm
npx
node

Suggested Ecosystem Detection

Node.js / JavaScript / TypeScript

Detection:

  • package.json
  • node_modules/
  • pnpm-lock.yaml
  • yarn.lock
  • bun.lockb

Suggested .agentignore:

node_modules/
dist/
build/
.next/
.nuxt/
coverage/

Suggested .agentallow:

node
npm
npx
pnpm
yarn
bun

Rust

Detection:

  • Cargo.toml
  • Cargo.lock

Suggested .agentignore:

target/

Suggested .agentallow:

cargo
rustc
rustup

.NET

Detection:

  • *.csproj
  • *.sln
  • global.json

Suggested .agentignore:

bin/
obj/

Suggested .agentallow:

dotnet

Python

Detection:

  • pyproject.toml
  • requirements.txt
  • Pipfile
  • poetry.lock
  • .venv/
  • venv/

Suggested .agentignore:

.venv/
venv/
__pycache__/
.pytest_cache/
.mypy_cache/
dist/
build/

Suggested .agentallow:

python
python3
pip
pip3
poetry
uv
pytest

Go

Detection:

  • go.mod

Suggested .agentignore:

bin/

Suggested .agentallow:

go
gofmt

Java

Detection:

  • pom.xml
  • build.gradle
  • build.gradle.kts

Suggested .agentignore:

target/
build/
.gradle/

Suggested .agentallow:

java
javac
mvn
gradle

PHP

Detection:

  • composer.json

Suggested .agentignore:

vendor/

Suggested .agentallow:

php
composer

Ruby

Detection:

  • Gemfile

Suggested .agentignore:

.bundle/
vendor/bundle/

Suggested .agentallow:

ruby
bundle
bundler

Docker

Detection:

  • Dockerfile
  • docker-compose.yml
  • compose.yaml

Suggested .agentallow:

docker
docker-compose

Kubernetes

Detection:

  • kustomization.yaml
  • helm/
  • Chart.yaml

Suggested .agentallow:

kubectl
helm

Additional Ideas

Commented Generation

Generate entries with comments indicating why they were added:

# Detected Cargo.toml
target/

Preview Mode

agentignore init --dry-run

Show detected technologies and the generated configuration before writing files.

Interactive Mode

agentignore init --interactive

Example:

Detected:
✓ Node.js
✓ Docker
✓ Kubernetes

Generate Node.js defaults? [Y/n]
Generate Docker defaults? [Y/n]
Generate Kubernetes defaults? [Y/n]

Future Plugin Architecture

Consider implementing the discovery mechanism as a registry of detectors:

type Detector interface {
    Detect(path string) bool
    IgnoreEntries() []string
    AllowEntries() []string
}

This would make it easy to add support for new ecosystems over time.

Open Question

Should generated entries be:

  1. Added automatically (best onboarding experience), or
  2. Added as commented suggestions that users explicitly enable?

My preference is automatic generation with clear comments explaining how each entry was discovered.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions