Overview
Marks a session as completed in the LongMem database. This allows the system to properly track session boundaries and improve memory recall.Authentication
Requires Bearer token ifauthToken is configured in daemon settings.
Request
Session identifier to mark as completed
Response
Always “ok” on success
Example
cURL
Response
Use Cases
Clean Session Boundaries
Call this when ending a coding session to mark the completion timestamp:Integration Cleanup
Most integrations (OpenCode plugin, Claude Code hooks) call this automatically when the AI session ends or the tool exits.Implementation Details
Fromdaemon/routes.ts:245-256:
- Looks up the session in the cache or database
- Marks the session as completed with a timestamp
- Removes the session from the in-memory cache
- No-op if session doesn’t exist (returns “ok” anyway)
Behavior Notes
- Idempotent: Safe to call multiple times with the same
session_id - Optional: Sessions don’t require explicit ending — they’ll be marked completed on daemon restart
- No data loss: Observations and prompts are already saved when this is called
Error Responses
Missing session_id
Related
- POST /session/start - Create or resume a session
- POST /observe - Record tool executions
- GET /search - Search across sessions