Skip to content

Auto-pin new and interacted-with sessions to the focus queue #81

@germanescobar

Description

@germanescobar

Summary

Today the focus queue is only populated when the user explicitly clicks the pin button on a session in the sidebar. We want two automatic pinning behaviors so focus mode always reflects what the user is actively working on:

  1. Pin every newly created session automatically, regardless of whether focus mode is currently active.
  2. Pin every session the user interacts with (e.g. opens, sends a message to, or navigates into) that is not already pinned.

Motivation

  • Focus mode is currently gated on having at least one pinned session (see client/src/App.tsx: the "Pin a session to use focus mode" toast), which is a poor first-run experience.
  • Users naturally assume "the conversation I just started" is part of their focus queue. Forcing an extra manual click on every new session is friction.
  • If we auto-pin on interaction, focus mode becomes a faithful picture of what the user is currently doing, with no extra bookkeeping.

Proposed Behavior

Auto-pin on creation

  • When a brand-new session is created via startSession (or the server-side equivalent when a session is first persisted), set focusPinnedAt on the session automatically.
  • Resuming an existing session should not change its pinned state.
  • A user who explicitly unpins a brand-new session should not have it re-pinned silently on the next interaction. Unpin is treated as a user preference for that session.

Auto-pin on interaction

  • The "interact" signal should include at least:
    • Opening/navigating into a session (handleSelectSession, handleNewThread, openFocusItem).
    • Sending a message to a session (the startSession call from SessionView with a non-resume sessionId).
  • Interaction-triggered pinning must be a no-op for sessions that are already pinned (focusPinnedAt set) and must respect an explicit prior unpin for that session (see "edge cases" below).
  • Interaction-triggered pinning should work whether or not focus mode is currently active.

Edge cases to think through

  • Unpin semantics: if a user unpins session X and later interacts with it, should it be re-pinned? Two reasonable options:
    • (a) Yes — "unpin" is a soft action and any new interaction re-pins.
    • (b) No — track a per-session "user-unpinned" flag so we don't keep re-pinning against the user's explicit choice.
    • Please call out which option you want in the issue comments before implementation; default suggestion: (b), with the flag cleared when the session is archived or when focus mode is exited globally.
  • Archived sessions: auto-pin should never resurrect an archived session into the focus queue.
  • Plan-mode / resumed sessions: resuming a session is not a "new" session and should not auto-pin; sending a fresh message to a resumed session is an interaction and should.
  • Focus mode is off: the auto-pinning still happens; it just populates the queue for whenever the user enables focus mode.

Affected Areas (from a quick code read)

  • server/lib/sessions.tsupdateSessionFocus already mutates focusPinnedAt; the server-side session-create path will need to set it on first persist.
  • client/src/api.tsstartSession is the client entry point for new sessions; pinSessionFocus already exists.
  • client/src/App.tsx — natural place to react to handleNewThread / handleSelectSession / openFocusItem and call pinSessionFocus when appropriate.
  • client/src/pages/SessionView.tsx — the message-send path; may need to also signal "interaction" for resumed sessions.
  • client/src/components/sidebar.tsx — pin/unpin button should still reflect effective state, including the "user-unpinned" flag if we go with option (b).

Acceptance Criteria

  • Creating a new session results in that session being pinned automatically.
  • Navigating to or sending a message to an unpinned (and not previously user-unpinned) session pins it automatically.
  • Sessions the user has explicitly unpinned stay unpinned on subsequent interactions, unless a new "reset unpin preference" affordance is invoked.
  • Focus mode, when enabled after these changes, shows the sessions the user is actually working in without any manual pinning step.
  • Existing pinned sessions continue to behave as before (manual pin, manual unpin, focus-done, etc.).
  • No new pinning happens for archived sessions.

Open Questions

  1. Confirm option (a) vs (b) for the unpin-then-interact case (see Edge cases).
  2. Should the auto-pin be visible to the user via a toast (e.g. "Pinned to focus") or be silent? Default suggestion: silent to avoid noise, with a small "auto-pinned" indicator in the sidebar so it's discoverable.
  3. Do we want a global setting to opt out of auto-pinning? Default suggestion: not in this issue, revisit later if requested.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions