-
Notifications
You must be signed in to change notification settings - Fork 15.3k
[FEATURE]: Display model information in session list #21128
Description
Problem
When users have many sessions, it becomes difficult to identify which session was used for what purpose. Currently, the session list (both CLI and TUI) only shows:
- Session ID
- Title
- Last updated timestamp
This makes it hard to distinguish between sessions, especially when users work with multiple models for different types of tasks.
Proposed Solution
Add model information to the session list display. This would show which model the session was started with, helping users quickly identify sessions based on the model used.
Why the starting model?
- The starting model indicates the user's intent for that session (e.g., a fast model for quick questions vs. a capable model for complex refactoring)
- It provides consistent, predictable information that doesn't change as the session progresses
- Users can easily correlate sessions with their workflow patterns
Implementation Details
Data Source
Model information is currently stored at the message level, not the session level:
Usermessages contain:model: { providerID, modelID }Assistantmessages contain:modelID,providerID
To get the starting model, we need to query the first message of each session.
Changes Required
-
Session Table Schema (
src/session/session.sql.ts)- Add
modelcolumn to store{ provider_id: string, model_id: string }
- Add
-
Session.Info Schema (
src/session/index.ts)- Add optional
modelfield:{ providerID: string, modelID: string }
- Add optional
-
Session List Logic (
src/session/index.ts)- Modify
Session.list()andSession.listGlobal()to include model from session table
- Modify
-
CLI Output (
src/cli/cmd/session.ts)- Add Model column to table format
- Add model field to JSON output
-
TUI Display (
src/cli/cmd/tui/component/dialog-session-list.tsx)- Show model alongside session title or in the footer
-
REST API (
src/server/routes/session.ts)- Include model info in session list responses
Performance Considerations
- Model info stored directly on session table avoids per-session message queries
- Backwards compatible: existing sessions will have null model field
- Model populated when session is initialized or first message is created
Acceptance Criteria
- CLI
session listshows model column in table output - CLI
session list --format jsonincludes model in JSON output - TUI session list displays model information
- REST API session list endpoints include model info
- Sessions without model data (legacy) gracefully handled
- Performance impact is minimal for typical session counts (<100)
References
-
Session schema:
packages/opencode/src/session/session.sql.ts -
Session list CLI:
packages/opencode/src/cli/cmd/session.ts -
TUI session list:
packages/opencode/src/cli/cmd/tui/component/dialog-session-list.tsx -
Message types with model:
packages/opencode/src/session/message-v2.ts -
I have verified this feature hasn't been suggested before