Route full saves and metadata updates through one bounded commit protocol,
with session-owned staging and atomic publication that preserves message bytes.
Simplify behavioral coverage and keep documentation focused on core contracts.
* fix(storage): stream chat summary index snapshots to bound peak memory
The chat summary index buffered the whole metadata-heavy snapshot in memory: flushing deep-cloned every cached ChatSearchResult (including unbounded chat_metadata Value trees) and serialized it into a single Vec<u8>, so the original tree, the clone and the serialized bytes were alive at the same time. On Android, a 118 MB index file made this flush allocate gigabytes within seconds and abort in a tokio worker (memory allocation failed, SIGABRT, no panic visible to users). Related to #215.
The snapshot is now a streamed JSONL document (schema v4): reading parses line by line, writing encodes each entry by reference into a bounded chunk written asynchronously, and the index is published via the standard sync + atomic rename helper. Peak memory is bounded by a single cached entry. Incompatible or corrupt index files are dropped and rebuilt from cold scans, as before.
* fix(storage): keep chat metadata out of summary caches
Cache lightweight directory projections and load full metadata only on request.
Unify header metadata and identity reads, and publish versioned index snapshots
without cloning payloads.
Validation: pnpm run check; native large-metadata allocation measurements.
---------
Co-authored-by: Darkatse <39111369+Darkatse@users.noreply.github.com>
Add a disabled-by-default setting with reload semantics and localized help. Document the cold representation, ownership, and save compatibility contracts.