Summary
Clicking "Unlink" on an Obsidian vault does not just remove the vault link — it deletes the entire project's shared .cliodeck/brain.db, which also holds the PDF vector index, the Tropy (primary source) index, and the research journal/history. A user reasonably expects "unlink vault" to be a safe, narrowly-scoped, reversible action; instead it silently wipes unrelated indexed corpora.
Found while auditing the ClioDeck wiki against the actual code (pass 11, brainstorm & integrations cluster).
Current behavior (verified against code)
obsidianStorePath() (backend/integrations/obsidian/ObsidianVaultIndexer.ts:313-315) returns path.join(workspaceRoot, '.cliodeck', 'brain.db') — the same shared database used elsewhere in the app, not a dedicated Obsidian file.
backend/core/workspace/layout.ts:67 confirms brainDb: path.join(root, 'brain.db') is the one shared store for PDF vectors, Tropy primary sources, and journal history (consistent with the CLAUDE.md architecture note: ".cliodeck/brain.db — shared SQLite store (PDFs + Tropy + research history)").
- The
fusion:vault:unlink IPC handler (src/main/ipc/handlers/fusion-handlers.ts:619-634) does:
const dbPath = obsidianStorePath(root);
try {
await fs.unlink(dbPath);
} catch {
// db already gone — fine.
}
This deletes brain.db outright, with no check that the file is shared with non-Obsidian data and no backup/confirmation beyond whatever generic UI confirmation (if any) precedes the unlink action.
- This appears to have been introduced by a change (referenced by the auditing agent as commit
c044d42) that consolidated the previously-separate obsidian-vectors.db into the shared brain.db — the unlink handler was not updated to account for the new shared-file risk.
Impact
A user unlinking an Obsidian vault (e.g. to switch to a different vault, or because they no longer want Obsidian notes indexed) unknowingly destroys:
- Their entire indexed PDF/bibliography corpus (would need full re-indexing).
- Their indexed Tropy primary-source archive.
- Their AI usage journal / research history.
This is data loss disguised as a narrow, reversible settings change — comparable in shape to already-filed issue #16 (journal purge wipes PDF index), but arguably more severe given how routine "switch vaults" or "remove a vault I no longer use" sounds to a user.
Suggested fix
fusion:vault:unlink should stop deleting brain.db wholesale. Either:
- Scope the deletion to Obsidian-sourced rows/vectors only (requires the store to distinguish source type at the row level), or
- Stop deleting the file at all on unlink — just clear
cfg.vault and leave stale Obsidian vectors to be pruned on next re-index (consistent with how other "detach" actions in the app behave, e.g. removing a book chapter from the manifest never touches the file).
Evidence trail
backend/integrations/obsidian/ObsidianVaultIndexer.ts:313-315 — obsidianStorePath().
backend/core/workspace/layout.ts:67 — confirms brain.db is the shared store.
src/main/ipc/handlers/fusion-handlers.ts:619-634 — the unlink handler.
src/main/services/pdf-service.ts:161, 1.9-Journal-and-History.md ("Research journal (brain.db)") — confirm other subsystems share this same file.
- Wiki page corrected in the same pass:
1.14-Obsidian-Vault-Guide.md.
Summary
Clicking "Unlink" on an Obsidian vault does not just remove the vault link — it deletes the entire project's shared
.cliodeck/brain.db, which also holds the PDF vector index, the Tropy (primary source) index, and the research journal/history. A user reasonably expects "unlink vault" to be a safe, narrowly-scoped, reversible action; instead it silently wipes unrelated indexed corpora.Found while auditing the ClioDeck wiki against the actual code (pass 11, brainstorm & integrations cluster).
Current behavior (verified against code)
obsidianStorePath()(backend/integrations/obsidian/ObsidianVaultIndexer.ts:313-315) returnspath.join(workspaceRoot, '.cliodeck', 'brain.db')— the same shared database used elsewhere in the app, not a dedicated Obsidian file.backend/core/workspace/layout.ts:67confirmsbrainDb: path.join(root, 'brain.db')is the one shared store for PDF vectors, Tropy primary sources, and journal history (consistent with the CLAUDE.md architecture note: ".cliodeck/brain.db— shared SQLite store (PDFs + Tropy + research history)").fusion:vault:unlinkIPC handler (src/main/ipc/handlers/fusion-handlers.ts:619-634) does:brain.dboutright, with no check that the file is shared with non-Obsidian data and no backup/confirmation beyond whatever generic UI confirmation (if any) precedes the unlink action.c044d42) that consolidated the previously-separateobsidian-vectors.dbinto the sharedbrain.db— the unlink handler was not updated to account for the new shared-file risk.Impact
A user unlinking an Obsidian vault (e.g. to switch to a different vault, or because they no longer want Obsidian notes indexed) unknowingly destroys:
This is data loss disguised as a narrow, reversible settings change — comparable in shape to already-filed issue #16 (journal purge wipes PDF index), but arguably more severe given how routine "switch vaults" or "remove a vault I no longer use" sounds to a user.
Suggested fix
fusion:vault:unlinkshould stop deletingbrain.dbwholesale. Either:cfg.vaultand leave stale Obsidian vectors to be pruned on next re-index (consistent with how other "detach" actions in the app behave, e.g. removing a book chapter from the manifest never touches the file).Evidence trail
backend/integrations/obsidian/ObsidianVaultIndexer.ts:313-315—obsidianStorePath().backend/core/workspace/layout.ts:67— confirmsbrain.dbis the shared store.src/main/ipc/handlers/fusion-handlers.ts:619-634— the unlink handler.src/main/services/pdf-service.ts:161,1.9-Journal-and-History.md("Research journal (brain.db)") — confirm other subsystems share this same file.1.14-Obsidian-Vault-Guide.md.