Skip to content

Add ignore_paths config: build outputs (bin/, obj/) are still scanned and flood churn events #27

Open

Description

@trueai-org

Hi — projectmem has become part of our daily workflow, thanks for building it. This is a feature request (with evidence) about ignore handling that makes it noisy on non-Python repos — ours is a .NET workspace.

Problem

Our repo uses the standard VisualStudio-style .gitignore, where build outputs are expressed as [Bb]in/ and [Oo]bj/. Two subsystems still pick those files up:

  1. Structure scan — pjm map --build walked bin/ and obj/. In our workspace the walk hit the _MAX_FILES = 5000 cap on build artifacts (structure.json reports files: 5000; the cache is ~1.4 MB of mostly build output). The map is silently truncated, so parts of the real code tree never make it into the Project Map.

  2. Churn watcher — it logs false churn events for build artifacts, e.g.

    High churn detected: client/App/obj/Debug/net10.0-windows/App.dll (4 edits in 10 min)
    

    Of the 44 events in our events.jsonl, 10 are such false churn events (.dll, .pdb, *_MarkupCompile.cache, project.assets.json, project.nuget.cache, …). They land in summary.md's Notes section and dilute exactly the distilled memory projectmem exists to provide.

Root cause

  • src/projectmem/structure.py — _IGNORE_DIRS is a hard-coded, Python-oriented list (__pycache__, .venv, dist, build, target, …). It contains no bin/obj (nor e.g. out, packages, TestResults), and _walk() does not consult .gitignore at all.
  • src/projectmem/commands/watch.py — ALWAYS_IGNORE likewise has none of these, and the .gitignore fallback in _should_ignore() is a literal substring check (pat in str(rel), with only a trailing / stripped). The code comment itself says "simple substring match, not full gitignore semantics". Consequently standard patterns such as [Bb]in/ / [Oo]bj/ can never match a real path; on Windows it is worse (paths arrive with \ separators). The suffix guard only covers *.pyc/*.pyo/*.log/*.swp/*.tmp, not .dll/.pdb/.cache.
  • No configuration knob exists today: config.toml only supports recent_days / project_description. (Side note: the watcher already carries the comment "Tunables (defaults — overridable via .projectmem/config.toml later)", so this looks like a planned direction.)

Proposal

  1. Add ignore_paths to .projectmem/config.toml (default [], zero behavior change for existing users):

    ignore_paths = ["bin", "obj", "packages", "TestResults"]

    Semantics: a path-segment match anywhere in the tree (prune the directory) and/or gitignore-style globs relative to the repo root. Apply it in structure._walk() (prune before recursing) and watch._should_ignore() (skip the event), via one shared helper — ideally the same helper in precheck/auto-capture so a config entry means one thing everywhere.

  2. Harden the .gitignore fallback so the built-in lists are only a safety net:

    • minimum: normalize separators, match per-segment case-insensitively on Windows, handle bracket globs like [Bb]in;
    • better: real gitignore semantics (e.g. translate patterns to fnmatch handling **, ! negation and directory-only patterns), or shell out to git check-ignore --stdin -z when git is available — exact, cross-platform, no new dependency.
  3. Optional built-in additions: obj is unambiguous and safe to hard-code; bin is not universal (POSIX repos sometimes track scripts in bin/), so that one may better stay config-driven. Happy to follow your preference.

I'm happy to submit a PR for any/all of this if you're open to it. Today's workaround is patching the two sets in site-packages (lost on upgrade) or pjm watch --stop.

Environment

  • projectmem 0.3.4 (pip), Python 3.11, Windows 11; all code references re-checked against current main.
  • Affected repo: a multi-project .NET workspace (bin//obj/ gitignored via the standard VisualStudio .gitignore template).
Image

Drafted with AI assistance (Kilo) from measurements in a real workspace.

Activity

  1. riponcm commented on Oct 28, 2026

    @riponcm
    Owner

    Thanks for the detailed report, and glad it's part of your workflow. You're right on both counts: the .gitignore fallback is a substring check that can never match patterns like [Bb]in/, and the hard-coded lists only fit Python projects. A PR would be very welcome. My preferences:

    • One shared helper used by watch, structure and precheck, so an ignore rule means the same thing everywhere.
    • Use git check-ignore --stdin -z when git is available, for exact semantics with no new dependency, and fall back to a cleaned-up matcher (normalized separators, bracket globs) when it isn't.
    • Add ignore_paths to config.toml, defaulting to empty, so existing users see no change.
    • Hard-code obj but not bin, as you suggested, since some POSIX repos track scripts in bin/.

    Please add a test with the VisualStudio .gitignore and Windows-style paths. Aiming for 0.3.5.

  2. riponcm commented on Oct 31, 2026

    @riponcm
    Owner

    0.3.5 is out now, so this one moves to the next release. Everything in my earlier comment still stands: one shared ignore helper, git check-ignore with a fallback, ignore_paths defaulting to empty, and obj hard-coded but not bin. A PR is still very welcome whenever you have time. If you'd rather we take it on, just say so, and we'll credit your report.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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