# Storage Format ## Directory Layout ``` ~/.local/share/lattice/ ├── identity.key # Ed25519 private key (not replicated) ├── meta.db # Global metadata (redb) └── stores/{uuid}/ ├── logs/{author}.log # Append-only SignedEntry stream └── state.db # Per-store KV state (redb) ``` ## meta.db (redb) | Table | Key | Value | Purpose | |---------|---------------|--------------------|------------------------------| | stores | UUID (16B) | created_at (u64) | Known stores | | meta | "root_store" | UUID (16B) | Auto-opened on CLI startup | ## state.db (redb, per store) | Table | Key | Value | Purpose | |---------|----------|-------------|------------------------| | kv | String | Vec | Key-value data | | meta | String | Vec | last_seq, last_hash | ## Log Files Each `{author}.log` contains length-delimited `LogRecord` messages: ```protobuf message LogRecord { bytes hash = 1; // BLAKE3 hash of entry_bytes bytes entry_bytes = 2; // Serialized SignedEntry } ``` Hashes are verified on read; corruption causes `LogError::HashMismatch`.