
What is agent memory? A production architecture for context, memory, and sources
August 24, 2026Engineering

What a portable Desktop snapshot must preserve, what it can rebuild, and how restore avoids leaving partial local state.
A backup is not the file produced by an Export button. It is a tested promise that a user can recover the state they care about after a device failure, a bad upgrade, or an accidental replacement. For a local memory system, that promise includes much more than the rows currently visible in the interface.
FishMem Desktop treats a backup as a versioned namespace snapshot. Canonical records and their history travel with the snapshot. Search indexes and other projections are declared rebuildable rather than promoted to source truth.
The first design decision is which data can be recreated and which data cannot. The answer should be written into the format rather than left to tribal knowledge.
| Data | Portable authority | Restore behavior |
|---|---|---|
| Memory content and scope | Canonical records | Preserve stable IDs, timestamps, validity, and deletion state |
| Corrections and audit | Immutable history and events | Restore with the record so prior decisions remain explainable |
| Entities and associations | Canonical graph rows | Validate internal references before commit |
| Source documents | Versioned source content and descriptors | Restore the source family before rebuilding retrieval |
| Vectors, FTS, sidecar views | Derived projections | Rebuild and verify against canonical content |
A raw database copy may be useful for emergency forensics, but it couples recovery to one schema version, one storage engine, and one moment in the process lifecycle. It may also capture a write in progress or omit external source objects. A product backup needs a stable, validated representation above those implementation details.
The FishMem snapshot has a format version and a source namespace identity. Export hydrates document sources into the portable form and records that vector and sidecar state must be rebuilt. Import can bind the snapshot to a different empty namespace while preserving canonical identities and history.
Desktop asks the user for a destination, exports the default namespace through the engine, and writes JSON through a temporary file before renaming it into place. The final file uses restrictive permissions. A crash during serialization should leave either the previous file or no final file, not a half-written backup that looks valid.
The current Desktop backup has a 512 MB input safety limit on restore. That limit is a fence, not a claim that every 512 MB snapshot will restore instantly. Large local libraries still need enough disk space and time to rebuild their semantic projections.
Restore is destructive and requires an explicit RESTORE confirmation inside the Desktop service contract. Before current data is purged, the app checks that the selected path is a regular JSON file within the size limit and parses the complete portable snapshot against the target namespace.
Validation needs to reject more than malformed JSON. It checks the format version, record shapes, namespace rebinding, stable identities, and internal references. A snapshot in which a history row points to a missing memory should fail before replacement begins.
If import or projection rebuild fails, Desktop purges the partial target and imports the saved pre-operation snapshot. If both restore and rollback fail, it returns an aggregate error rather than claiming that either library is healthy.
Rollback reduces risk; it does not replace an independent backup. Power loss, disk failure, or filesystem corruption can interrupt both the main restore and the local rollback attempt.
Semantic retrieval depends on a local multilingual embedding model and a compatible index identity. On a new machine, the model may still be downloading. After a model or index change, vectors may require rebuilding. Desktop therefore exposes readiness errors instead of silently falling back to a lower-quality remote or keyword-only path.
The interface should distinguish at least these states:
A backup test that compares JSON counts is necessary but insufficient. A release exercise should start from an installed application and verify the behavior users depend on:
This proves that the UI, main process, service, SQLite store, local embedding runtime, and CLI agree on the recovered state. Merely reopening a window proves only that Electron launched.
A Desktop snapshot is not continuous replication, cloud synchronization, multi-device merging, or protection against a compromised operating system. Desktop remains a single local authority with a user-owned backup workflow. Teams that need shared operations, managed recovery, organizations, and hosted workers should evaluate the Cloud or self-hosted service surfaces instead.