Sessions
Commit Session
Archive messages and extract long-term memories from a session
POST
Commit Session
Commit a session to archive its messages and extract long-term memories. This operation:
- Archives current messages to
history/archive_N/ - Extracts memories into 6 categories (profile, preferences, entities, events, cases, patterns)
- Clears active message buffer
- Updates context usage statistics
Request
Path Parameters
The session ID to commit
Headers
Your OpenViking API key for authentication
Must be
application/jsonResponse
Response status (
ok or error)Commit operation result
The session identifier
Commit status (usually
committed)Whether messages were archived
Number of long-term memories extracted
Number of context usage records updated
Request processing time in seconds
Examples
Response Example
Memory Extraction Categories
The commit operation extracts memories into 6 categories:User Memories
Location:
viking://user/{user}/memories/profile.mdUser profile information (name, role, background, expertise)Merge strategy: Always merged into single profile.md fileLocation:
viking://user/{user}/memories/preferences/User preferences organized by topic (coding style, communication style, tool preferences)Merge strategy: Merged by topic when similarLocation:
viking://user/{user}/memories/entities/Important entities (people, projects, organizations, concepts)Merge strategy: Merged when referring to same entityLocation:
viking://user/{user}/memories/events/Significant events (decisions, milestones, incidents)Merge strategy: Created as separate events, not mergedAgent Memories
Location:
viking://agent/{agent}/memories/cases/Problem-solution pairs (specific bugs fixed, issues resolved)Merge strategy: Created as separate cases, not mergedLocation:
viking://agent/{agent}/memories/patterns/Reusable patterns (workflows, processes, interaction patterns)Merge strategy: Merged when similar patterns detectedMemory Structure
Each memory is stored with three levels:Archive Structure
Committed messages are archived in:When to Commit
Auto-commit by Token Count
Commit at Natural Boundaries
Full Lifecycle Example
Best Practices
Always Track Usage Before Commit
Commit Regularly
Don’t let sessions grow too large:Check Commit Results
Related Endpoints
- Add Message - Add messages to session
- Get Session - Check session stats
- Create Session - Start new session
- Search - Search with session context
Commit Session
