Repository navigation
Description
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:
-
Structure scan —
pjm map --buildwalkedbin/andobj/. In our workspace the walk hit the_MAX_FILES = 5000cap on build artifacts (structure.jsonreportsfiles: 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. -
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 insummary.md's Notes section and dilute exactly the distilled memory projectmem exists to provide.
Root cause
src/projectmem/structure.py—_IGNORE_DIRSis a hard-coded, Python-oriented list (__pycache__,.venv,dist,build,target, …). It contains nobin/obj(nor e.g.out,packages,TestResults), and_walk()does not consult.gitignoreat all.src/projectmem/commands/watch.py—ALWAYS_IGNORElikewise has none of these, and the.gitignorefallback 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.tomlonly supportsrecent_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
-
Add
ignore_pathsto.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) andwatch._should_ignore()(skip the event), via one shared helper — ideally the same helper inprecheck/auto-capture so a config entry means one thing everywhere. -
Harden the
.gitignorefallback 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
fnmatchhandling**,!negation and directory-only patterns), or shell out togit check-ignore --stdin -zwhen git is available — exact, cross-platform, no new dependency.
- minimum: normalize separators, match per-segment case-insensitively on Windows, handle bracket globs like
-
Optional built-in additions:
objis unambiguous and safe to hard-code;binis not universal (POSIX repos sometimes track scripts inbin/), 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.gitignoretemplate).
Drafted with AI assistance (Kilo) from measurements in a real workspace.
Activity
riponcm commentedon Oct 28, 2026
Thanks for the detailed report, and glad it's part of your workflow. You're right on both counts: the
.gitignorefallback 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:watch,structureand precheck, so an ignore rule means the same thing everywhere.git check-ignore --stdin -zwhen 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.ignore_pathstoconfig.toml, defaulting to empty, so existing users see no change.objbut notbin, as you suggested, since some POSIX repos track scripts inbin/.Please add a test with the VisualStudio
.gitignoreand Windows-style paths. Aiming for 0.3.5.riponcm commentedon Oct 31, 2026
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-ignorewith a fallback,ignore_pathsdefaulting to empty, andobjhard-coded but notbin. 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.