Advanced / Created or skipped
Write Outcomes
A successful write can create a memory or report that nothing was stored. Both are normal responses, and your code has to branch on them explicitly.
Two valid results
Compare the two write outcomes
{
"id": 4821,
"text": "The user prefers concise answers.",
"tags": ["preference"],
"source": "chat",
"importance": 0.8,
"is_summary": false,
"created_at": "2026-08-01T12:04:11Z"
}A record exists. Keep the id if you may need to update, summarize, or forget it later.
Client code
Branch on the outcome
from memorysync import AddSkippedResponse
result = ms.add("The user prefers concise answers.", tags=["preference"], source="chat")
if isinstance(result, AddSkippedResponse):
log.info("not stored: %s", result.reason) # expected, not an error
else:
save_reference(result.id) # a record now existsTreating a skipped write as a failure causes retry loops and misleading error rates. Count it as its own outcome instead.
Input quality
Give a write the best chance
- Send one durable fact per call rather than a whole transcript.
- Write statements that will still be useful next week, not conversational filler.
- Attach source and tags so the record can be filtered and audited later.
- Use bulk_add() for batches; each item reports its own created, skipped, or rejected status.
Copy and run
Copy a working example
from memorysync import AddSkippedResponseresult = ms.add("The user prefers concise answers.", tags=["preference"])if isinstance(result, AddSkippedResponse):print("skipped:", result.reason)else:print("created:", result.id)
Was this page helpful?