Skip to content

Make repository file scans gitignore-aware, with .agentic-workspace as managed exception #1214

@rickardvh

Description

@rickardvh

Problem

Some Agentic Workspace command paths still enumerate repository files with raw filesystem traversal plus hardcoded skip directories. The recent reuse-pressure timeout showed why this is brittle: ignored dependency/cache trees can still be expensive or surprising unless every scanner remembers the right exclusions.

Hardcoded skips are still useful as a fallback for non-git repositories, but they are too blunt as the primary policy for git repositories.

Desired policy

For git repositories, ordinary command scans should use git ignore semantics by default:

  • include tracked files
  • include untracked, non-ignored files when the command needs untracked workspace context
  • ignore gitignored files
  • preserve a managed exception for .agentic-workspace/**, because AW commands intentionally read checked-in and local workflow surfaces there

For non-git targets, keep conservative hardcoded skip dirs as the fallback.

Scope notes

Do not rush this into the current runtime while the CLI extraction is in progress. This should be aligned with the extracted CLI/runtime boundary so scanners do not spread more ad hoc filesystem policy.

A likely implementation shape is a central path enumeration helper that wraps git-backed listing when available, with an explicit .agentic-workspace/** inclusion rule, then migrates command scanners incrementally.

Known affected areas

  • reuse-pressure scanning recently needed a local pruning fix after implement --changed ... timed out in a repo with .venv
  • repo friction / artifact footprint / other report-style scanners should be audited for raw rglob, glob, or os.walk use

Acceptance sketch

  • gitignored files outside .agentic-workspace/** are not scanned by ordinary command file enumeration
  • .agentic-workspace/** remains visible to AW-managed command surfaces when appropriate
  • non-git repositories still avoid obvious dependency/cache directories
  • tests cover tracked files, untracked non-ignored files, ignored files, and .agentic-workspace exceptions

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions