Skip to content

Experiment: sidebar Inbox (agent tabs grouped by what they need from you) - #421

Draft
frenchie4111 wants to merge 7 commits into
mainfrom
sidebar-inbox
Draft

frenchie4111 wants to merge 7 commits into
mainfrom
sidebar-inbox

Conversation

@frenchie4111

@frenchie4111 frenchie4111 commented Nov 25, 2026 •

Copy link
Copy Markdown
Collaborator

An experiment to live with for a few days, not a finished feature. It adds an Inbox icon to the sidebar header row (beside New worktree / Task list). It's a plain inbox icon when nothing needs you and an accent bell-with-dot when something does; clicking it swaps the worktree list for the Inbox and back. Projects is unchanged and stays the default. Inbox lists one row per agent tab (repo · worktree · tab, plus a one-line "why"), in urgency order:

  1. Needs approval: the pending command, e.g. Bash "curl -sI https://example.com"
  2. Asked you something: an AskUserQuestion, or a turn whose last paragraph ends in a question (the question is quoted)
  3. Done, unread: finished a turn since you last viewed that tab (first line of the reply)
  4. PR needs you: CI failed / merge conflict / changes requested
  5. PR updates: merged / approved and green (good news, so they don't count toward the bell or Cmd+J)
  6. Working: folded, shows a count
  7. Seen / idle: folded

Needs-you sections sort oldest first. Cmd+J opens the top needs-you item, skipping the tab you're already on, so repeated presses walk the list. It's rebindable and listed in the cheatsheet.

How it works

  • New inbox slice with turns (per tab: how the last turn ended, plus one line of text), seenAt (stamped by the server, monotonic), and prSeen (per-worktree PR-event fingerprint), all persisted to config.json. When a tab entered its current status is terminals.statusSince, which the terminals reducer stamps from an at in the status payload. Reducers keep object identity when nothing changes, and there is one test per event.
  • InboxDeriver (main) records a turn whenever a tab's status moves into waiting. Dispatches are scoped to that one tab and deduped against the last status, so streaming adds nothing. Turns for closed tabs are pruned per worktree.
  • Read marking: a tab counts as read when it is the focused tab and the window has focus. A turn that finishes in a background window stays unread. Because the slice is shared, a mark made on one client clears the row on every other client.
  • PR events come from prs.byPath. The first time main sees a worktree's PR it records the current state as already seen, so an existing backlog stays quiet. Opening the worktree by any route marks the current event seen. Marking stores a fingerprint (event kind + head SHA or review time), so a new failure on a new commit shows up again.
  • Pruning: records for worktrees that are missing from the list and gone from disk are dropped, which also covers worktrees removed while Ness was off.
  • The model is built from the merged multi-backend maps, so the Inbox covers every connected backend, the same as Projects.

The main open question: "asked a question" vs "just finished"

  • Chat tabs: fully distinguishable. Main holds the entries, so the deriver classifies the last top-level assistant message and skips sub-agent output. AskUserQuestion shows up as a pending approval with that tool name and goes in "Asked you something".
  • Terminal Claude tabs: also distinguishable, which the brief didn't expect. The Stop hook payload includes transcript_path, and hooks.ts fires onStopEvent before it dispatches waiting. The deriver records the turn immediately, then reads the last 256 KB of the jsonl off the hot path and fills in the text.
  • Codex / Cursor terminal tabs: fall back to "finished" with no text, because their transcripts use other formats.
  • The question test is a heuristic: a sentence ending in ? in the final paragraph, with fenced code ignored. Rhetorical questions earlier in a reply don't count.

Verified

  • typecheck, electron-vite build, build:headless, and vitest (201 files / 2775 tests, 19 of them new) all pass.
  • Headless server with a throwaway data dir and a sandbox repo (main + 2 worktrees, Haiku chats). Checked: approval / question / done-unread rows appear; the main chat moves from "asked" to "needs approval" when it requests curl; unread turns survive a server restart; clicking a row opens the tab and clears it; Cmd+J goes to the approval first and then to the next item.
  • Not exercised live: terminal-tab Stop-hook text (it would need the user-scope hooks installed into the real ~/.claude; covered by a unit test with a temp transcript), and PR events (the sandbox repo has no GitHub remote; covered by model tests).

Easy to change after you try it

  • Section order, labels, and which ones start folded: the INBOX_SECTIONS table in src/renderer/inbox-model.ts.
  • Question heuristic: src/shared/inbox-turn.ts (classifyTurnText).
  • What counts as a PR event, and its priority: prEventFor in inbox-model.ts.
  • What marks a tab read: the effect in App.tsx next to jumpToNextInboxItem. For example, require a scroll to the bottom, or count only clicks from the Inbox.
  • Hotkey: jumpToInbox in hotkeys.ts (Cmd+J).
  • Sort order: needs-you is oldest first and the rest newest first, set in buildInboxModel.

Open questions

  • Should a question you've seen but not answered stay in "Asked you something"? Right now it moves to Seen, the same as any other turn, so the inbox can empty out. The alternative is to keep it until you send the next message.
  • "Review requested" PRs (the Reviewing / phantom-PR group) aren't in the inbox yet, because they have no agent tab. Should they be?
  • The mobile/touch picker still shows only the worktree list. The read state is shared, but there's no Inbox view on the phone yet.
  • Rows where the status is known but the start time isn't (anything from before this boot) show no age.

🤖 Generated with Claude Code

frenchie4111 and others added 7 commits November 25, 2026 12:34
Adds a Projects | Inbox toggle at the top of the sidebar. The Inbox view
lists one row per agent tab in urgency order: needs approval, asked you
something, done-unread, PR events, then working and seen/idle folded.

- New `inbox` slice: per-tab turn summaries (question vs finished plus
  one line of the last message), server-stamped read marks, status-since
  timestamps, and seen PR-event fingerprints. Persisted except statusSince.
- InboxDeriver (main) records a turn when a tab goes to 'waiting'. Chat
  tabs classify their last assistant entry; terminal Claude tabs read the
  Stop hook's transcript tail; Codex/Cursor terminal tabs degrade to
  "finished".
- Viewing a tab in a focused window marks it read. Cmd+J opens the top
  needs-you item.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Found in the headless sandbox:
- The Projects | Inbox toggle pushed the header icons off-screen at the
  default 224px width; it now sits on its own row.
- After a restart chat tabs sleep with no status, which dropped their
  unread turns into "Seen". Any settled tab with an unread turn now stays
  in its needs-you section.
- Main-worktree rows no longer read "repo · repo"; the why-line wraps to
  two lines instead of truncating at one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts:
#	src/renderer/hooks/useHotkeyHandlers.ts
The toggle row was too loud for something you glance at. The Inbox is
now one icon in the header row beside New worktree / Task list: a plain
inbox when nothing needs you, an accent bell-with-dot when something
does (count in the tooltip). Click toggles the view; it stays
highlighted while the Inbox is showing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts:
#	src/renderer/components/Sidebar.tsx
#	src/renderer/hooks/useHotkeyHandlers.ts
…rminals

- PR events: main seeds inbox.prSeen on first sight of a worktree's PR,
  so existing merges and red builds don't light the bell; opening a
  worktree by any route marks its event seen; merged/ready move to a
  non-blocking "PR updates" section outside needs-you.
- Pruning: records for worktrees missing from the list AND from disk are
  dropped on listChanged (covers removals while Ness was off), including
  prSeen via the new inbox/worktreesForgotten.
- statusSince moves to the terminals slice, stamped by the reducer from
  an `at` the dispatcher supplies and dropped on terminals/removed. No
  extra event per status flip, no shell-tab leak.
- The Stop hook's transcript path is consumed once; a test covers a slow
  read racing a newer turn.
- Ages tick every 30s; Cmd+J says so when the only item is the one
  you're on; the focus gate's WebContentsView gap is documented.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant