Skip to content

fix(cli): add source-scoped unmine command - #2289

Open
MichaelWave369 wants to merge 1 commit into
MemPalace:developfrom
MichaelWave369:fix/unmine-source-2213
Open

fix(cli): add source-scoped unmine command#2289
MichaelWave369 wants to merge 1 commit into
MemPalace:developfrom
MichaelWave369:fix/unmine-source-2213

Conversation

@MichaelWave369

Copy link
Copy Markdown

Addresses the recovery half of #2213.

#2213 reports two separate problems:

  1. project-mode mining can file overlapping/duplicate content under different filenames;
  2. once a bad/duplicate source is filed, there is no supported source-scoped way to remove it.

This PR intentionally fixes only (2). It does not define a project-miner content-dedup policy.

Adds:

  • mempalace unmine <source-file> with dry-run by default;
  • --apply required to actually remove data;
  • optional --wing scope for a source intentionally filed into multiple wings;
  • exact source_file matching only — no fuzzy/similarity deletion;
  • removal of matching drawers, conversation registry sentinels, and closets;
  • execution under the existing palace writer lock;
  • WAL receipts under unmine_source.

Why this slice:
Current conversation mining already has (wing, content_hash) dedupe for re-exported conversations (commit 54397a5), but #2213's concrete case used --mode projects. Applying chunk/content dedupe to project mode needs a separate semantics decision because identical text in two project files can be legitimate. A precise recovery command is useful independently and does not pre-commit that policy.

Example:

  • mempalace unmine /path/to/duplicate-export.md reports what would be removed.
  • mempalace unmine /path/to/duplicate-export.md --apply removes exactly that source.
  • --wing demo narrows it further.

Validation against current develop (639c69a):

  • python -m pytest -q tests/test_sync.py43 passed
  • python -m mempalace.cli unmine --help
  • root CLI help contains unmine
  • ruff check mempalace/sync.py mempalace/cli.py tests/test_sync.py
  • ruff format --check mempalace/sync.py mempalace/cli.py tests/test_sync.py
  • python -m compileall -q mempalace/sync.py mempalace/cli.py tests/test_sync.py

One clean commit, only:

  • mempalace/cli.py
  • mempalace/sync.py
  • tests/test_sync.py

I am deliberately leaving #2213 open for the project-mode ingest-dedupe half.

@MichaelWave369
MichaelWave369 force-pushed the fix/unmine-source-2213 branch 2 times, most recently from 982d3e5 to 41a68d5 Compare August 20, 2026 17:02
@igorls igorls added bug Something isn't working area/mining File and conversation mining area/cli CLI commands needs-rebase PR has merge conflicts with develop and needs rebase labels Aug 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/cli CLI commands area/mining File and conversation mining bug Something isn't working needs-rebase PR has merge conflicts with develop and needs rebase

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants