# Storage

Locate every file KuraDB keeps under `~/.config/kuradb/` and know which ones are authoritative and which can be rebuilt.

## Storage topology

### Durable stores

| Store | Authority | Contents |
|---|---|---|
| `db.json` | Durable registry | Database names and UTC creation timestamps |
| `config.json` | Durable configuration | Optional pinned HTTP `port` and `remote` MCP flag |
| `{db}/data.db` | Source of truth | `file_data` rows: source, chunk index and total, content, embedding, embed and dismiss flags |
| `global.db` | Durable cache store | `query_cache` rows: query text to embedding blob |

Each database also owns `{db}/inbox/`, the watched folder, exposed as the `~/Kura_{db}` symlink.

### Process and watcher state

| File | Authority | Contents |
|---|---|---|
| `{db}/record.json` | Watcher snapshot | Size, mtime, directory flag, and child snapshots for every inbox entry |
| `runtime.uid` | Ephemeral process state | UID, PID, and start time; removed on shutdown |
| `endpoint` | Ephemeral discovery | Current local HTTP base URL; removed on shutdown |
| `daemon.log` | Operational log | Daemon stdout and stderr, appended across runs |

### In-memory caches

`vector.Cache` (per-database buckets of chunk and source vectors) and `openai.Cache` (query text to embedding) are accelerators, not authoritative stores. The vector cache is rebuilt from `file_data.embedding` at startup, and the query cache is preloaded from `global.db`; both must stay reconstructible from SQLite.

See [Data Consistency](/core-concepts-data-consistency) for how writes keep these stores aligned.
