Skip to content

Feature Request: Plugin hook for filtering session list in /sessions dialog #9553

Closed

Description

@codelipenghui

Design: Session Filtering Hook for Plugin Integration

Goal

Allow plugins to control which sessions appear in the /sessions dialog by returning a filtered list of session IDs.

API Surface

New Plugin Hook

  • session.list.filter(input, output)
    • Input: { projectID, directory, sessionID? }
    • Output: { sessionIDs? }
    • Behavior: If sessionIDs is provided, the UI should only display those sessions. If not provided, the UI shows all sessions.

New Server Endpoint

  • GET /session/filter?sessionID=...
    • Invokes the hook and returns { sessionIDs? }
    • Tied to current Instance.project.id and Instance.directory

Data Flow

  1. /sessions dialog opens in TUI.
  2. TUI requests /session/filter using the SDK internal client (so it runs through Server.App().fetch).
  3. Server triggers session.list.filter hook.
  4. Plugin returns sessionIDs to display.
  5. TUI filters the session list to those IDs.

TUI Behavior

  • If hook returns sessionIDs, filter the list with a set lookup.
  • If hook returns nothing, show all sessions (current behavior).

Backward Compatibility

  • If no plugin implements the hook, session list remains unchanged.
  • No behavior change for existing sessions or storage formats.

Files Touched (opencode)

  • packages/plugin/src/index.ts — hook type definition
  • packages/opencode/src/server/routes/session.ts — filter endpoint
  • packages/opencode/src/cli/cmd/tui/component/dialog-session-list.tsx — request + UI filtering

Activity

  1. github-actions commented on Jan 20, 2026

    @github-actions
    Contributor

    Thanks for this detailed feature request! I've searched through existing issues and found several related session management discussions, but this appears to be the first request specifically for a plugin hook to filter/customize the session list.

    While I found related issues around session management and organization (like #8541 for directory navigation in sessions, #6461 for session origin tracking, and #9526 for session switching), none of them propose the plugin hook mechanism you're suggesting here.

    Your proposal for a session.list.filter hook is a good design that maintains composability across multiple plugins. The use cases you outlined—workspace-based filtering, tag/label filtering, time-based views, and multi-project views—are all compelling scenarios that would benefit from this extensibility.

    This seems like a solid foundation for plugin-driven session management!

  2. github-actions commented on Mar 26, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 90 days of no activity. If the issue is still relevant please open a new one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

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