---
id: 10192
title: Implement set_session_id MCP tool and document Handoff Retrieval Hints
state: CLOSED
labels:
  - enhancement
  - ai
assignees: []
createdAt: '2026-04-22T18:40:50Z'
updatedAt: '2026-04-22T19:11:03Z'
githubUrl: 'https://github.com/neomjs/neo/issues/10192'
author: neo-gemini-pro
commentsCount: 0
parentIssue: null
subIssues: []
subIssuesCompleted: 0
subIssuesTotal: 0
blockedBy: []
blocking: []
closedAt: '2026-04-22T19:11:03Z'
---
# Implement set_session_id MCP tool and document Handoff Retrieval Hints

# Context
The memory-core shared SQLite database faces session fragmentation when agents restart across different harnesses (Claude Code, Antigravity). Agents need a way to manually resume a prior session ID to maintain conceptual continuity. Additionally, future agents need semantic anchors ("Handoff Retrieval Hints") to query the substrate across fragmented sessions.

# The Problem
Current session IDs are volatile across server restarts. `GraphService` context is lost without a way to explicitly reconnect to the prior `sessionId`.

# The Architectural Reality
The `SessionService` needs a new tool (`set_session_id`) to override `currentSessionId`. Also, the `ticket-create` skill documentation must mandate "Handoff Retrieval Hints" instead of relying on a single Origin Session ID.

# The Fix
- Implement `setSessionId` in `SessionService.mjs` with logic to prune orphaned zero-memory sessions.
- Expose `set_session_id` via `toolService.mjs`.
- Update `openapi.yaml` with the new endpoint.
- Update `.agent/skills/ticket-create/references/ticket-create-workflow.md` to mandate "Handoff Retrieval Hints".
- Fix paths in `.agent/skills/ticket-create/SKILL.md`.

# Acceptance Criteria
- [ ] `set_session_id` is available as an MCP tool.
- [ ] Overriding the session ID prunes the previous (empty) session if it has no memories.
- [ ] `ticket-create` documentation requires Handoff Retrieval Hints.

# Out of Scope
- Solving cross-process cache invalidation (handled in Epic #10186).

# Handoff Retrieval Hints
- `query_raw_memories(query="set_session_id MCP tool session continuity")`

## Timeline

- 2026-04-22T18:40:51Z @neo-gemini-pro added the `enhancement` label
- 2026-04-22T18:40:51Z @neo-gemini-pro added the `ai` label
- 2026-04-22T18:41:19Z @neo-gemini-pro cross-referenced by PR #10193
- 2026-04-22T18:53:57Z @neo-gemini-pro cross-referenced by #10194
- 2026-04-22T18:54:25Z @neo-gemini-pro referenced in commit `21d87d8` - "feat(memory-core): add set_session_id and retrieval hints (#10192)"
- 2026-04-22T19:08:35Z @neo-gemini-pro referenced in commit `45702a9` - "feat(memory-core): add set_session_id and retrieval hints (#10192)"
- 2026-04-22T19:11:03Z @tobiu referenced in commit `d066d62` - "feat(memory-core): add set_session_id and retrieval hints (#10192) (#10193)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>"
- 2026-04-22T19:11:03Z @tobiu closed this issue

