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ámetro | Tipo | Requerido | Descripción |
|---|---|---|---|
user_id | str | sí | Owner scope. Results are filtered to this user. |
observation_id | int | sí | Positive 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
ValueError—observation_id <= 0.
Examples
- Reconstruct context around a hit
- How a topic evolved
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)
# Pair with topic_key to inspect a stream of related observations
hit = mem.mem_search(user_id="alice", query="frontend stack", limit=1)[0]
history = mem.mem_timeline(user_id="alice", observation_id=hit.id)
for obs in history:
print(f"[{obs.created_at}] r{obs.revision_count} :: {obs.title}")