Skip to content

feat(mcp,worker): add recall_session tool + ?around paging on observations endpoint#62

Merged
NagyVikt merged 1 commit intomainfrom
agent/claude/add-recall-session-mcp-tool-around-pagin-2026-04-25-13-17
Apr 25, 2026
Merged

feat(mcp,worker): add recall_session tool + ?around paging on observations endpoint#62
NagyVikt merged 1 commit intomainfrom
agent/claude/add-recall-session-mcp-tool-around-pagin-2026-04-25-13-17

Conversation

@NagyVikt
Copy link
Copy Markdown
Collaborator

Automated by gx branch finish (PR flow).

…tions endpoint

Lets an agent pull a compact timeline of a different session (its own past
or another agent's) and audits the recall as a kind:'recall' observation in
the calling session. Progressive disclosure preserved: only IDs come back —
bodies still come from get_observations(ids[]).

Wire contract on the recall observation:
- kind === 'recall'
- metadata.recalled_session_id
- metadata.owner_ide (inferIdeFromSessionId fallback when the row's ide
  column is 'unknown', so foreign-session recalls stay traceable)
- metadata.observation_ids
- metadata.around_id, metadata.limit

Both target_session_id and current_session_id are validated up-front via
storage.getSession(); MemoryStore.addObservation routes through
ensureSession (memory-store.ts:96), which silently materialises a missing
sessions row, so the early checks make a typo loud instead of writing a
recall row into a phantom session.

Foreign-session around_id is also validated: the integer would otherwise be
used as a numeric anchor in the target's id space and silently slice the
target's history at a position the caller never meant. The tool returns an
empty timeline (and the worker route returns []) instead — bleed-free.

Worker's GET /api/sessions/:id/observations gains ?around=<id>&limit=<n>
so the same paged window is reachable from the HTTP surface. The route
already proxied to Storage.timeline, which has supported aroundId for a
while.
@NagyVikt NagyVikt merged commit f48269e into main Apr 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant