MemorySync
Getting Started

Your First Memory

A useful memory is a durable fact, preference, constraint, or outcome that can improve a later interaction. Start small and preserve enough source context to understand it.

Choose information worth remembering

Good candidateAvoid
A confirmed response-style preferenceA temporary instruction for one request
A user-approved project constraintPasswords, tokens, or private credentials
A completed task outcome useful laterAn entire transcript with no selection policy
A source-backed fact with useful metadataUnverified model output presented as fact

Write the record

import os
from memorysync import MemorySyncClient
client = MemorySyncClient(
api_key=os.environ["MEMORYSYNC_API_KEY"],
base_url="https://api.memorysync.io",
project_id=os.environ["MEMORYSYNC_PROJECT_ID"],
end_user_id="user-123",
)
memory = client.add(
"The user prefers concise answers and dark mode.",
source="chat",
metadata={'conversation_id':'conv-42'},
)

Start with these fields

FieldUse
textThe durable information future requests may need.
sourceA short application-defined origin such as chat or profile.
metadataNon-secret identifiers that help your app trace or filter the record.
Scope headersThe project and end user that own this memory context.

Retrieve with the same scope

import os
from memorysync import MemorySyncClient
client = MemorySyncClient(
api_key=os.environ["MEMORYSYNC_API_KEY"],
base_url="https://api.memorysync.io",
project_id=os.environ["MEMORYSYNC_PROJECT_ID"],
end_user_id="user-123",
)
result = client.query("How should I format the answer?", k=5)
for memory in result.memories:
print(memory.text)

Ask for the meaning you need, not an exact copy of the stored sentence. Semantic retrieval is designed for related wording.

Review before production

  • Confirm the write policy excludes secrets and unnecessary personal data.
  • Confirm the same user cannot read another user’s memory through your application.
  • Preserve source metadata needed for support and deletion workflows.
  • Test update, export, and forget behavior for your product’s lifecycle needs.
Was this page helpful?