Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.

Save & snapshots

Persist a collection to disk with save, take a point-in-time copy with snapshot, and reopen it with open_collection.

create_collection builds a collection in memory; nothing touches disk until you call save(). This page covers the durability lifecycle: save() as the commit point, snapshot() for a point-in-time copy, and open_collection to reopen what you saved.

collections() lists only saved collections (directories that contain a collection.json). An unsaved collection is invisible to it and cannot be reopened until you call save().

The persistence lifecycle

1

Create and populate in memory

create_collection returns a live collection but writes nothing to disk yet.

from telys import Telys
from telys.embedding import AlgentaMultigramEmbedder

telys = Telys("./telys-data")
emb = AlgentaMultigramEmbedder()

col = telys.create_collection(
    "notes",
    dim=emb.profile.dimension,   # kernel-sourced dimension for this embedder
    partition_by="scope",
    embedder=emb,
)
col.add_texts(
    texts=["First note.", "Second note."],
    ids=["note-1", "note-2"],
    metadata=[{"scope": "user:42"}, {"scope": "user:42"}],
)

telys.collections()   # -> []  (nothing saved yet)
2

Save — the commit point

save() writes the id_map.npy sidecar first, then collection.json last. Because the JSON is written last, a reader never sees a half-written commit — it gets either the previous state or the new one. save() returns the collection's directory.

path = col.save()
print(path)                # ./telys-data/notes

telys.collections()        # -> ['notes']  (now discoverable)

collection.json persists the durable metadata: name, dim, dtype, key_name, filter_columns, the id_map sidecar reference, telys_version, default_target_recall, applied_tuner, lexical, and the embedder profile.

3

Reopen with open_collection

Reopen a saved collection in a fresh process. If you registered a provider for its embedding space, the embedder re-attaches automatically; otherwise pass one so text operations keep working.

telys = Telys("./telys-data")
col = telys.open_collection("notes", embedder=AlgentaMultigramEmbedder())
print(len(col))            # -> 2
4

Take a point-in-time copy with snapshot

snapshot() captures the current state as a point-in-time copy — useful before a risky bulk update or as a checkpoint.

col.snapshot()

On-disk layout

A saved collection lives in its own directory under the engine path you passed to Telys(...):

./telys-data/
|-- notes/
    |-- collection.json     # durable metadata — written last, the commit point
    |-- id_map.npy          # external-id to row sidecar
    |-- ...                 # runtime vector slab files

The engine path (./telys-data) is whatever you pass to Telys(path). It is separate from $TELYS_HOME (default ~/.telys), which holds credentials and the MCP / telys mem store. See On-disk layout for the full tree.

Expected result

Before save(), collections() is empty and the directory does not exist. After save(), the collection is listed and reopens with the same rows:

[]
./telys-data/notes
['notes']
2

Next steps

Last updated

Was this helpful?