Overview
Retrieves observations that occurred before and after a specific observation, providing chronological context for what was happening around that moment in the coding session.Authentication
Requires Bearer token ifauthToken is configured in daemon settings.
Request
Path Parameters
Observation ID to get timeline context for
Query Parameters
Number of observations to retrieve before the target (max 100)
Number of observations to retrieve after the target (max 100)
Response
The target observation (null if ID not found)
Observations that occurred before the target
Observations that occurred after the target
id, tool_name, created_at, compressed_summary, concepts, files_referenced
Example
cURL
Response
Use Cases
Debugging Context
When searching finds a relevant observation, get the timeline to understand what led to it and what happened next:Workflow Reconstruction
Understand the sequence of operations in a debugging session by examining the timeline around each key observation.MCP Integration
Themem_timeline MCP tool uses this endpoint to provide LLMs with chronological context when they need to understand a sequence of events.
Implementation Details
Fromdaemon/routes.ts:315-323:
- Parses observation ID from URL path
- Clamps
beforeandafterto [0, 100] range - Calls
getTimeline()which queries observations ordered by timestamp - Returns observations from the same session only
- Target observation is excluded from
beforeandafterarrays
Query Optimization
Timeline queries are efficient because:- Observations table is indexed by
session_idandcreated_at - Query limits prevent unbounded result sets
- Results are ordered chronologically
Error Responses
Invalid ID
Not Found
If the observation ID doesn’t exist, returns:Related
- GET /observation/:id - Get full observation details
- GET /search - Find observations by query
- mem_timeline - MCP tool that uses this endpoint