MemorySync
Advanced / Retention decision

Retention & Tiers

Not everything deserves to be a memory. Decide the lifetime of a fact before you write it, and give short-lived context an exit path.

Decision

Decide the lifetime first

Ask one question before every write: how long does this need to be true? The answer decides whether it becomes a memory at all.

Write it as a normal memory.

This is what memory is for: stable preferences, constraints, and decisions. Tag it so you can find and maintain it later.

Example: “I prefer concise answers and metric units.”

Pattern

Handle session context

session = "conv-42"

ms.add("Debugging the staging environment for this ticket.", session_id=session, tags=["session"])
result = ms.query("Which environment am I working in?", session_id=session, k=5)

# when the conversation ends and the facts are not durable:
ms.forget(session_ids_you_recorded, reason="session_ended")

Keep your own list of ids written for a session. Nothing expires on your behalf, so the exit path has to be part of the feature.

Copy and run

Copy a working example

session = "conv-42"
created = ms.add("Debugging the staging environment.", session_id=session, tags=["session"])
result = ms.query("Which environment am I working in?", session_id=session, k=5)
ms.forget([created.id], reason="session_ended")
Was this page helpful?