Skip to main content

mem_timeline

Signature

mem.mem_timeline(user_id: str, observation_id: int) -> list[Observation]

Returns observations that are temporally adjacent to an anchor observation — useful when you want to reconstruct the chronological context around a specific memory.

Results are filtered by the store to user_id, ordered by (created_at, id) ASC. The number of neighbors before/after the anchor is set by Store.DEFAULT_TIMELINE_NEIGHBORS.

Parameters

ParámetroTipoRequeridoDescripción
user_idstrOwner scope. Results are filtered to this user.
observation_idintPositive integer primary key of the anchor observation.

Returns

list[Observation] (Pydantic models):

Adjacent observations ordered chronologically (oldest first). Same fields as mem_get_observation.

Raises

  • ValueErrorobservation_id <= 0.

Examples

hits = mem.mem_search(user_id="alice", query="auth bug")
if hits:
anchor = hits[0].id
nearby = mem.mem_timeline(user_id="alice", observation_id=anchor)
for obs in nearby:
print(obs.created_at, obs.title)

See also