Skip to content

Add session summary fields (firstUserPrompt, topics) #6

@samkeen

Description

@samkeen

Background

API client feedback requested a way to understand what a session was about without fetching all messages.

Current Behavior

The Session model only includes metadata:

  • id, startTime, endTime, messageCount, model, isSubAgent, parentSessionId, subAgentIds

To understand what a session was about, clients must fetch all messages and parse them.

Requested Enhancement

Add summary fields to the Session response:

{
  "id": "499c44ca-...",
  "startTime": "2025-12-30T15:49:17",
  "messageCount": 418,
  "firstUserPrompt": "is this anything of concern in our context...",
  "topics": ["API debugging", "FastAPI", "endpoint routing"]
}

Fields

Field Description Implementation
firstUserPrompt First user message text (truncated) Extract from first type: "user" message in JSONL
topics Session topics/themes TBD - could be extracted from tool names, file paths, or require LLM analysis

Implementation Notes

  • firstUserPrompt is straightforward - read first user message from JSONL, truncate to ~200 chars
  • topics is more complex:
    • Option A: Derive from tools used + file paths (e.g., "Bash", "api/src/routes")
    • Option B: Simple keyword extraction from messages
    • Option C: LLM-based summarization (expensive, would need caching)

Acceptance Criteria

  • firstUserPrompt field added to Session model
  • Field populated on list and detail endpoints
  • Truncation with ellipsis for long prompts
  • Consider topics implementation approach

Related

This was item #3 from client API feedback. Items #1, #2, #4, #5 already exist:

  • ✅ Cross-project activity: GET /api/v1/activity/
  • ✅ Date range filtering: startDate/endDate params on sessions
  • ✅ Flattened content: flatten=true on messages
  • ✅ Activity summary: GET /api/v1/activity/summary

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions