Smritea

Time-aware memory

Memories can carry dates. Use event time on add and point-in-time or range filters on search.

Ask AI about this page

A time-aware memory is a memory with a validity window. The window starts at active_from and ends at active_to. Search can ask what was true at one moment, or what was true during a range.

How a memory gets its dates

You do not set active_from or active_to yourself. Smritea sets them when it stores the memory. They appear in results and in get.

FieldHow Smritea sets it
active_fromThe first date that exists, in this order: a date found in the text, then event_occurred_at, else empty.
active_toA date found in the text, such as an end date. Smritea never derives it from event_occurred_at.

An empty date means unknown. The API leaves the field out of the result.

Your one input is event_occurred_at on add. It says when the event in the text happened. Smritea also uses it to resolve words like "yesterday" in the text. Send it as an RFC 3339 time with a time zone, such as 2026-11-05T10:00:00Z.

If you omit event_occurred_at, Smritea resolves words like "yesterday" against the time of the call. It does not set active_from to that time. A fact with no date in the text gets an empty active_from.

Set the event date when you store a memory

To date a memory, pass event_occurred_at on add, then read active_from from the result.

These examples reuse client. The search examples also reuse a scope named alice, built as in Scope memories. The Go and Java examples take client and alice as parameters. The Go example also takes ctx.

result = client.add(
    "Alice moved to Berlin",
    scope=alice,
    event_occurred_at="2026-01-10T09:00:00Z",
)
for m in result.memories or []:
    print(m.active_from, m.content)

The text has no date, so event_occurred_at sets active_from to 2026-01-10T09:00:00Z.

Search by time

Search takes three optional time fields. Each is an RFC 3339 time with a time zone.

FieldReturns memories that were valid
valid_atAt that moment.
from_timeAt or after that moment, until the end of time.
to_timeAt or before that moment, from the start of time.
from_time and to_timeAt some point in that range.

A memory is valid at a moment when active_from is on or before it, and active_to is empty or on or after it. A memory with an empty active_from matches every moment.

With no time field, search applies no time filter.

Rules that cause errors

Each of these returns HTTP 400. The table shows the code for each mistake.

MistakeCodeFix
You send valid_at with from_time or to_time.VALIDATION_FAILEDUse valid_at for one moment. Use from_time and to_time for a range.
A time is not valid RFC 3339.VALIDATION_ERRORInclude the date, the time and a time zone.
from_time is after to_time.VALIDATION_FAILEDMake from_time equal to or before to_time.

Last updated on