Enhance memory search functionality with timeline context retrieval (#151)

- Introduced optional timeline context retrieval step in memory search flow to provide users with better understanding of previous sessions.
- Updated SKILL.md to reflect new flow, including timeline context commands and usage scenarios.
- Refactored timeline retrieval commands in timeline-by-query.md and timeline.md to utilize new MCP tools for streamlined access.
- Implemented filtering logic in search-server.ts to respect depth_before and depth_after parameters when displaying timeline items.
- Improved response formatting to include filtered item counts and enhanced user guidance for timeline queries.
This commit is contained in:
Alex Newman
2025-11-30 14:58:01 -05:00
committed by GitHub
parent 01be3156fb
commit 03fefca884
5 changed files with 151 additions and 110 deletions
@@ -9,14 +9,16 @@ Search for observations and get timeline context in a single request. Combines s
- User asks: "Timeline of database work"
- Need to find something then see temporal context
## Command
## MCP Tool
```bash
Use the `get_timeline_by_query` MCP tool:
```
# Auto mode: Uses top search result as timeline anchor
curl -s "http://localhost:37777/api/timeline/by-query?query=authentication&mode=auto&depth_before=10&depth_after=10"
get_timeline_by_query(query="authentication", mode="auto", depth_before=10, depth_after=10)
# Interactive mode: Shows top N search results for manual selection
curl -s "http://localhost:37777/api/timeline/by-query?query=authentication&mode=interactive&limit=5"
get_timeline_by_query(query="authentication", mode="interactive", limit=5)
```
## Parameters
@@ -34,8 +36,8 @@ curl -s "http://localhost:37777/api/timeline/by-query?query=authentication&mode=
Automatically gets timeline around best match:
```bash
curl -s "http://localhost:37777/api/timeline/by-query?query=JWT+authentication&mode=auto&depth_before=10&depth_after=10"
```
get_timeline_by_query(query="JWT authentication", mode="auto", depth_before=10, depth_after=10)
```
**Response:**
@@ -64,8 +66,8 @@ curl -s "http://localhost:37777/api/timeline/by-query?query=JWT+authentication&m
Shows top search results for manual review:
```bash
curl -s "http://localhost:37777/api/timeline/by-query?query=authentication&mode=interactive&limit=5"
```
get_timeline_by_query(query="authentication", mode="interactive", limit=5)
```
**Response:**
@@ -89,7 +91,7 @@ curl -s "http://localhost:37777/api/timeline/by-query?query=authentication&mode=
"score": 0.87
}
],
"next_step": "Use /api/timeline/context?anchor=<id>&depth_before=10&depth_after=10"
"next_step": "Use get_context_timeline(anchor=<id>, depth_before=10, depth_after=10)"
}
```
@@ -9,17 +9,14 @@ Get a chronological timeline of observations, sessions, and prompts around a spe
- User asks: "What happened before and after that change?"
- Need temporal context around an event
## Command
## MCP Tool
```bash
# Using observation ID as anchor
curl -s "http://localhost:37777/api/timeline/context?anchor=1234&depth_before=10&depth_after=10"
Use the `get_context_timeline` MCP tool:
# Using session ID as anchor
curl -s "http://localhost:37777/api/timeline/context?anchor=S545&depth_before=10&depth_after=10"
# Using ISO timestamp as anchor
curl -s "http://localhost:37777/api/timeline/context?anchor=2024-11-09T12:00:00Z&depth_before=10&depth_after=10"
```
get_context_timeline(anchor=1234, depth_before=10, depth_after=10)
get_context_timeline(anchor="S545", depth_before=10, depth_after=10)
get_context_timeline(anchor="2024-11-09T12:00:00Z", depth_before=10, depth_after=10)
```
## Parameters