Overview
Close a coding session and optionally attach a summary. This marks the session’sended_at timestamp and stores any provided summary text.
This tool is part of the agent profile and uses deferred loading.
Parameters
Session identifier to closeMust match the
id used in mem_session_start. If the session doesn’t exist, an error is returned.Summary of what was accomplished during the sessionA brief description of the session’s work. For detailed summaries, use
mem_session_summary instead, which creates a structured observation.This field is stored directly on the session record and is useful for quick session overviews.Response
Confirmation message with session ID
Usage Examples
End Session Without Summary
End Session With Summary
Session End vs Session Summary
Two ways to summarize:
-
mem_session_endwithsummaryparameter (simple):- Stores a short summary on the session record
- Good for brief overviews
- Doesn’t create a searchable observation
-
mem_session_summary(recommended for detailed work):- Creates a structured observation with Goal/Instructions/Discoveries/Accomplished/Files format
- Searchable via
mem_search - Provides rich context for future sessions
- Referenced 16 times across agent protocols
mem_session_summary first, then mem_session_end with a brief summary.Session Lifecycle
When to Use
- Session completion: When the coding session is definitively over
- Agent shutdown: Before the agent exits
- Timeout/idle: When a session has been inactive and should close
- Manual end: When using CLI or API to close a session
Idempotency
This tool is idempotent — calling it multiple times on the same session won’t cause errors. The
ended_at timestamp and summary will be updated on subsequent calls.What Gets Updated
The session record is updated with:- ended_at: ISO 8601 timestamp of when
mem_session_endwas called - summary: The summary text (if provided)
Error Handling
If the session ID doesn’t exist:mem_session_start before mem_session_end.
Recommended Workflow
Related Tools
mem_session_start- Register session startmem_session_summary- Save detailed structured summarymem_save- Save observations during sessionmem_context- Retrieve recent session context