Summary
When notes are removed from nav or deleted locally, Notion pages are left intact. Over time this causes orphan pages and stale section nodes in the wiki database.
Today the sync only logs:
deleted locally (Notion page left intact): <path>
Motivation
Structure reconciliation (reparent / ensure sections) fixes wrong parent but not pages that should no longer exist in the mirrored tree. Users need an explicit, safe way to clean up Notion without accidental mass deletion.
Proposed solution
Add opt-in pruning — never enabled by default.
mkdocs-note ns --prune=archive # archive in Notion + drop from local state
mkdocs-note ns --prune=delete # hard delete (dangerous)
mkdocs-note ns --dry-run --prune=archive
Optional flags:
--prune-sections — remove empty stale section pages after content orphans are handled.
mkdocs.yml: notion_sync.prune: off | archive | delete
Behavior
- After building nav tree + loading state, compute pages in state that are no longer nav-listed (scoped by
--section when set).
--prune=archive: Notion archive API + remove key from .notion_sync_state.json.
--prune=delete: delete page + remove from state.
- Dry-run: list every page that would be archived/deleted with title and URL.
Safety requirements
Acceptance criteria
Related
- Structure reconciliation (reparent / ensure sections) — separate issue
Summary
When notes are removed from nav or deleted locally, Notion pages are left intact. Over time this causes orphan pages and stale section nodes in the wiki database.
Today the sync only logs:
Motivation
Structure reconciliation (reparent / ensure sections) fixes wrong parent but not pages that should no longer exist in the mirrored tree. Users need an explicit, safe way to clean up Notion without accidental mass deletion.
Proposed solution
Add opt-in pruning — never enabled by default.
Optional flags:
--prune-sections— remove empty stale section pages after content orphans are handled.mkdocs.yml:notion_sync.prune: off | archive | deleteBehavior
--sectionwhen set).--prune=archive: Notion archive API + remove key from.notion_sync_state.json.--prune=delete: delete page + remove from state.Safety requirements
archived,deleted,orphans_skipped.not_in_navescape hatch).Acceptance criteria
--prune=archivearchives a page removed from nav.--dry-run --prune=archiveshows targets without API writes.Related