Overview
Create a new session record to track the beginning of a coding session. Sessions group related observations and provide chronological context for memory retrieval.This tool is part of the agent profile and uses deferred loading.
Parameters
Unique session identifierShould be unique across all sessions. Common patterns:
- UUIDs:
550e8400-e29b-41d4-a716-446655440000 - Timestamped:
session-2026-03-03-1430 - Agent-generated:
opencode-abc123
mem_save, mem_save_prompt, etc.Project nameThe name of the project being worked on. Used for filtering and grouping memories.Examples:
engram, my-api, frontend-appWorking directory pathThe file system path where the session is running. Useful for context but not required.Example:
/home/user/projects/engramResponse
Confirmation message with session ID and project
Usage Examples
Basic Session Start
With Working Directory
Session Lifecycle
- Start: Call
mem_session_startat the beginning of a coding session - Work: Use
mem_save,mem_search,mem_context, etc. during the session - Summarize: Call
mem_session_summarywhen significant work is complete - End: Call
mem_session_endto mark the session complete
When to Use
- Agent initialization: When an AI coding assistant starts working
- Manual sessions: When using the CLI or API directly
- Session tracking: To maintain chronological context across multiple interactions
Idempotency
This tool is idempotent — calling it multiple times with the same
id won’t create duplicate sessions. If the session already exists, the call succeeds without error.What Gets Created
A session record with:- id: The session identifier
- project: Project name
- directory: Working directory (if provided)
- started_at: ISO 8601 timestamp of creation
- ended_at:
nulluntilmem_session_endis called - summary:
nulluntilmem_session_endis called
Session ID Best Practices
Related Tools
mem_session_end- Mark session as completedmem_session_summary- Save end-of-session summarymem_save- Save observations during the sessionmem_save_prompt- Record user promptsmem_context- Retrieve recent session context