Skip to content

feat(memory): /smart-compact forget — safe project memory deletion - #70

Merged
alpertarhan merged 1 commit into
mainfrom
feat/issue-63-forget
Sep 17, 2026
Merged

alpertarhan merged 1 commit into
mainfrom
feat/issue-63-forget

Conversation

@alpertarhan

Copy link
Copy Markdown
Owner

Implements #63. Review context: #63 (comment)

What

/smart-compact forget permanently deletes the current project's graph memory.

Graph layer (forgetProjectGraph): drains the pending index queue first — a scheduled compaction state that flushes after deletion would otherwise resurrect the memory — then deletes in one transaction:

  • context_nodes_fts rows for the project's nodes (the duplicated-content FTS copy — see the review comment: the FTS table is standalone, not external-content, so both copies must go)
  • context_edges for the project
  • context_nodes for the project

Command layer: cwd → deriveProjectIdFromCwd (same resolution as /loops), no-op notice when there is nothing to delete, then a confirmation dialog showing exactly what will be removed (node count, session count) and what is kept. TUI-only, matching the settings action pattern.

Deliberately kept: compaction state files (they power restore, they are not memory) and backups.

Why deletion is now safe

Two earlier pieces make this sound:

  • fix(graph): tombstones are terminal — re-derivation cannot resurrect facts #69 (merged): tombstones are terminal — after forgetting, a later compaction that re-derives the same facts from the transcript cannot resurrect them; a fresh ingest of genuinely new content works normally.
  • The paired-delete precedent (removeFtsNode + removeNode) already existed for single nodes; this is its project-scoped bulk form.

Verification

  • 989 tests (2 new: forget clears nodes/edges/FTS including a direct SQLite probe of the FTS table while a sibling project stays intact; parser accepts the forget action), bench, build, release audit — all green

- forgetProjectGraph(projectId): drains queued index writes first (so a
  scheduled compaction cannot resurrect the memory), then deletes FTS
  copies, edges, and nodes in one transaction
- /smart-compact forget: cwd-resolves the project, shows node/session
  counts, requires a TUI confirmation dialog; compaction state (restore
  data) and backups are deliberately kept
- tombstone-terminal semantics from #69 guarantee deleted facts cannot
  be re-derived back into existence by later compactions
@alpertarhan
alpertarhan merged commit 7b78a43 into main Sep 17, 2026
2 checks passed
@alpertarhan
alpertarhan deleted the feat/issue-63-forget branch September 17, 2026 18:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant