feat: add --exclude flag and config-based exclude for mining - #161
feat: add --exclude flag and config-based exclude for mining#161adv3nt3 wants to merge 3 commits into
Conversation
|
Context on why I built this: I'm mining a 7.5k file repo that's been running for 14 hours now — most of that time spent on hundreds of JSON test fixture files that are necessary for the test suite and tracked in git, but completely useless as memory material. Can't gitignore them, can't remove them. With |
|
@bensig Note: this is complementary to |
52eb476 to
250e741
Compare
|
this is the conversation with Claude, btw:
pip install --upgrade mempalace — get the .gitignore support
The options are:
Let me check if the merged PR added any non-gitignore exclusion mechanism: Confirmed — no custom exclusion support. Only .gitignore and a hardcoded skip list.
My recommendation: Let the current mine finish (you're ~600 files away). The index works fine with the extra data — it just took longer to build. For conversations mining next, there won't be this problem since those files are small. If the index size or search noise bothers you later, open an issue on the repo for |
|
24h+: [6977/7530] and it's still running. we need this exclude setup |
250e741 to
d0b3523
Compare
web3guru888
left a comment
There was a problem hiding this comment.
✨ Review of #161 — feat: add --exclude flag and config-based exclude for mining
Scope: +79/−2 · 4 file(s)
mempalace/cli.py(modified: +10/−0)mempalace/miner.py(modified: +42/−0)mempalace/room_detector_local.py(modified: +23/−2)tests/test_cli.py(modified: +4/−0)
Strengths
- ✅ Includes test coverage
🟢 Approved — clean, well-structured PR. Good work @adv3nt3!
🏛️ Reviewed by MemPalace-AGI · Autonomous research system with perfect memory · Showcase: Truth Palace of Atlantis
|
Hi, thanks for the contribution. This PR has merge conflicts with Could you rebase onto If this change is no longer relevant, feel free to close the PR. (This message is part of a periodic backlog pass, sent to all open PRs that match this state.) |
Add user-configurable path exclusions for the mining pipeline: CLI: mempalace mine <dir> --exclude dist,vendor,tmp Config: 'exclude' list in mempalace.yaml Init: interactive prompt during mempalace init to set exclusions CLI --exclude and config exclude are merged at runtime. Paths are project-relative and normalized to POSIX. --include-ignored overrides --exclude for specific paths (include wins). Applied in scan_project() alongside existing SKIP_DIRS and .gitignore filtering. Prunes directories during os.walk for efficiency.
Use getattr for args.exclude to avoid AttributeError when tests construct Namespace without the new attribute. Wrap exclude prompt input() in try/except (EOFError, OSError) for non-interactive and test environments.
Add exclude=[] to test Namespace objects and exclude_paths=[] to the expected mine() call assertion. Use getattr for args.exclude to handle tests that construct Namespace without the attribute. Wrap exclude prompt input() in try/except for non-interactive environments.
6bd0ffc to
0dff3c2
Compare
|
@igorls rebased onto |
Summary
Add user-configurable path exclusions for the mining pipeline. Currently, the only ways to skip paths are the hardcoded
SKIP_DIRSset and.gitignorerules. This adds explicit--excludesupport via both CLI flag andmempalace.yamlconfig.Motivation
Projects often contain directories that are technically not gitignored but shouldn't be mined — test fixtures with hundreds of JSON files, vendored dependencies, generated code, large asset folders, or CI output directories. Today the only options are:
.gitignore— but they might be tracked intentionally (test data, vendored libs)SKIP_DIRScovers them — but it can't know every project's layoutUsers setting up MemPalace for the first time shouldn't have to modify their
.gitignoreor know about hardcoded skip lists to get a clean mine. The--excludeflag andmempalace.yamlexclude:key give explicit, project-specific control without touching anything else in the repo.Real examples:
node_modulesis inSKIP_DIRS, butvendor/,fixtures/,testdata/,__mocks__/are nottests/snapshots/containing 500 JSON snapshot files — valid test data, tracked in git, but useless for memory mininggenerated/orproto/directories with auto-generated code that adds noise to the palace without adding contextUsage
CLI flag
Config (mempalace.yaml)
During init
How it works
Precedence (highest to lowest)
--include-ignored— force-includes always win (overrides all exclusions)--exclude+ configexclude— merged at runtime (union).gitignore— respected by defaultSKIP_DIRS— hardcoded baseline (.git,node_modules,__pycache__, etc.)Path matching
exclude: [dist]→ skipsdist/and everything under itexclude: [src/generated]→ skips onlysrc/generated/, notsrc/itselfos.walkfor efficiency — excluded subtrees are never traversedConfig merge
CLI
--excludeandmempalace.yamlexcludeare combined. This means you can set permanent exclusions in config and add one-off exclusions via CLI:Changes
3 files changed, 72 insertions, 2 deletions:
miner.pyis_excluded()helper,exclude_pathsparam toscan_project()+mine(), read config excludes, print in statuscli.py--excludeargument (same pattern as--include-ignored), parse and pass tomine()room_detector_local.pyget_exclude_paths()interactive prompt, updatesave_config()to writeexcludelist to YAMLWhat's NOT changed
mine --mode convos):--excludeonly applies to project mining. Convo mining has its ownscan_convos()with separateSKIP_DIRS. Adding exclude support there is a natural follow-up.--yes(non-interactive) init: Defaults to empty exclude list — no change to automated flows.SKIP_DIRS: The hardcoded set is unchanged.--excludeis additive on top of it.Test plan
ruff checkpasses clean on all 3 filesruff format --checkalready formattedpython3 -m py_compilecompiles OK for all 3 files--include-ignoredoverride verified: force-included paths bypass exclude filtering