v37

latestOpenAPI 3.1.0raw.githubusercontent.com2026-06-1170194628.0 KB
v1
Messages

Compress Session

Get compressed conversation context for a session.

Compress your conversation into hierarchical summaries with rich metadata,
perfect for reducing token usage in LLM context windows.

**Authentication Required**: Bearer token, API key, or session token

**What it returns**:
- **short_term**: Last 15 messages compressed
- **medium_term**: Last ~100 messages compressed  
- **long_term**: Full session compressed
- **topics**: Key topics discussed
- **session_intent / current_state / next_steps**: Structured session context for agents
- **project_context / files_accessed / technical_details**: Project and file operation metadata

**Perfect for**:
- Reducing token usage in LLM prompts (96% savings)
- Providing conversation context without full history
- Quick conversation overview for AI agents
- Project documentation and status snapshots

**Input**: Just the session ID - all context is extracted automatically
get/v1/messages/sessions/{session_id}/compress

Path parameters

session_idstring required

Response

Session summary (compressed context)

session_idstring required

Session ID of the conversation

ai_agent_notestring required

Instructions for AI agents on how to search for more details about this conversation

from_cacheboolean required

Whether summaries were retrieved from cache (true) or just generated (false)

message_countinteger nullable

Number of messages summarized (only present if just generated)

Example response

{
  "ai_agent_note": "To find more details about this conversation, search memories with metadata filter: sessionId='session_123'",
  "from_cache": true,
  "session_id": "session_123",
  "summaries": {
    "current_state": "Working: requirements gathered. Not working: none. Blockers: none.",
    "last_updated": "2024-01-15T10:31:00Z",
    "long_term": "Product planning and strategy conversation focused on Q4 roadmap development and execution.",
    "medium_term": "Ongoing product planning discussion for Q4, covering objectives, timelines, and resource allocation.",
    "next_steps": [
      "Draft roadmap outline",
      "Review with stakeholders"
    ],
    "session_intent": "Plan the Q4 product roadmap with clear objectives and milestones.",
    "short_term": "User requested help planning Q4 product roadmap. Assistant offered to help identify key objectives.",
    "topics": [
      "product planning",
      "Q4 roadmap",
      "objectives",
      "strategy"
    ]
  }
}