# Vaults

> What a vault is on disk, local-only against synced, switching and leaving, and the two recovery paths when a folder goes missing.

Source: https://baalda.com/docs/vaults
Site: Baalda, https://baalda.com

A vault is a folder. Everything else, the index, the history and the server's copy, is derived from what is in it.

## On disk

```
VaultRoot/
├── Notes/ … .md                 # the source of truth: human, AI and git editable
├── attachments/ …               # images, PDFs, other files
└── .context/                    # the app's own folder, never indexed or synced
    ├── index.sqlite             # local search index, backlinks, tags, registry map
    ├── crdt/                    # local CRDT history
    └── config.json              # vault id, device id, server URL, settings
```

> Never sync `.context` yourself through another tool. It carries this device's identity, and a copy of it on a second machine confuses the running client. The file tree and the watcher both skip it.

## Local only, or synced

A new vault is local. Vault Settings, General, Turn on sync and sharing registers it with the server you are signed in to, which is what gives it members, access control and a Remote Vault. A synced vault can be made local only again while keeping its files.

Synced vaults live under a dedicated Baalda Vaults folder, so the app always knows where its vault roots are, and a vault folder that goes missing can be put back in the same place.

## Switching, leaving and deleting

- The vault switcher opens on hover over the vault name or its path, and clicking the path copies it.
- Vault Settings, Vaults lists every vault on the account, with its state and the actions available on it.
- Leaving a vault you do not own removes it from your account. Deleting one you own is confirmed in the standard dialog, and on the managed service a subscription attached to it is cancelled at period end before the delete goes through.
- Deleting a synced vault also moves its folder to the trash on this computer, rather than leaving a stale copy that looks live.

## When the folder goes missing

If the open vault's folder is moved, renamed or deleted outside the app, Baalda says so and offers two ways back. Restore here recreates it at the same path and syncs everything down. Locate folder lets you point at where it went. A local-only vault gets Locate folder only, because there is nothing to sync down.

While the folder is missing, open tabs close, the sidebar says Folder missing instead of the path, and the sync pill reads Paused. Launching with a synced vault's folder already gone shows the same wording in the set-up prompt.

## Reset local copy

In the danger zone of Vault Settings, Vaults, Reset local copy stops sync, permanently deletes this device's folder of the vault and restores it from the Remote Vault. The confirmation names any notes whose changes have not reached the server first.

> Reset local copy destroys this device's copy. Nothing changes for the team. The Rust side refuses anything but the open vault root itself: not a symlink, not your home folder, not the vaults folder, and not a folder without a `.context`.
