# K1 access profile SQLite leaf
This leaf owns the concrete SQLite representation of saved access profiles. Its consumer owns callback/KTO validation, replay, registration, logging, handle policy, and failure fencing.
`ProfileDatabase::open` returns the database and a validated `Snapshot`; `apply` supports `Create`, `Replace`, and `Delete`, ownership-filtered queries use read-only WAL connections, `clear` atomically removes all rows and resets the cursor, and `rebuild` removes the database and sidecars before one fresh open attempt.
The database is exactly `profiles.sqlite3` beneath the supplied root. It uses WAL, synchronous `FULL`, and a zero busy timeout. Its exact version 1 schema stores 12-byte IDs, owners, revisions, and non-null cursors plus canonical `kcode-k1-access-profile-wire` bytes. Open validates integrity, exact DDL, metadata, field widths, canonical encoding, and row/cursor consistency; malformed derived state is `OpenError::Rebuildable`, while ordinary SQLite and filesystem availability failures are fatal. Mutations are single `BEGIN IMMEDIATE` transactions with no retries.