Skip to content
pi-c View Ticket
Login

View Ticket

Storage: user database ~/.pic/pic.sqlite with picu_ tables

Closed2ad667b78b0b4d743c19b36b7104b076100ac169Created 11.3 days agoUpdated 11.3 days ago
Description2026-11-19 15:56:17
Move pic's user-level state from loose files into one SQLite database, hosted on libfossil's SQLite like the journal: WAL, normal locking, a busy timeout, foreign_keys off.

Tables: picu_setting(key, value, updated_ms), picu_catalog(provider, sz, models (sqlar), checked_ms, last_modified_ms, etag), picu_trust(path, trusted, decided_ms), picu_scoped_model(position, pattern), picu_workspace(path, journal, last_used_ms).

- settings.json and models-store.json are imported in one transaction on first open, then deleted. - main.c setting()/set_setting() and catalog.c/catalog_fetch.c switch to the tables; keys keep Pi's names (defaultModel, defaultThinkingLevel, thinkingLevel:<provider/id>). - Every table carries the picu_ prefix (journal: pic_, libfossil: fsl*) so one file can hold everything later.

Done when: no pic code writes under ~/.pic except pic.sqlite; tests cover the migration, concurrent processes and the catalog refresh.

Plan: https://artifacts.craftdesign.group/v/-DvLRzrfEh1mIldmhMgfG#06c5bdb18c04b6b8d28d045ed9812ef5c91f2f85f57c6feb26b574cb21cec0ef (section 1)

2026-11-19 16:52:31
Landed in 26395fd45988: ~/.pic/pic.sqlite with picu_ tables (settings, catalog cache with sqlar compression, trust, scoped models, workspaces); settings.json and models-store.json migrate and are removed; pic settings command; tests isolated from the real ~/.pic. CI and Fil-C green.