[FEATURE]: TUI session tabs: automatic groups, nested subagent sessions, and automatic order
Feature hasn't been suggested before.
- [x] I have verified this feature I'm about to request hasn't been suggested before.
Related requests, not duplicates: #50196 (tabs too narrow with many projects), #51759 and #60241 (project groups in the desktop and web side tabs), #60357 (child sessions that you cannot see), #61209 (pin the New session slot), #60236 (pinned sessions), #55797 (tab order in vertical mode, closed), #61251 (one-step tab group update for plugins), #59201 (reactive tab badges).
Describe the enhancement you want to request
Problem. In the TUI, the session tabs are one flat list in open order. A new tab goes to the end of the list. With tabs.scope: "global" and sessions from many projects, you must read each title to find a session. Subagent sessions do not have their own tabs, so a child that runs or waits for input shows only as a status on its root tab. To put tabs in order, you must move each tab manually.
Checked on 2.2.5 and on current dev (55276f2108):
packages/tui/src/context/session-tabs-model.ts:SessionTabis{ sessionID, title },openSessionTabappends, andmoveSessionTabis the only order operation.packages/tui/src/context/session-tabs.tsx: a child route opens its root tab (root(sessionID)).packages/tui/src/config/index.tsx:tabshasmode,scope,layoutandindicators, and no option for groups or order.
Proposal. Three new options. Each is off by default, so the current tab list does not change.
-
Automatic groups:
tabs.group: "none" | "project" | "directory".- Vertical layout: one header row for each group. The header shows the project and branch text that
sessionTabDetailmakes, the count of tabs, and the most important status in the group, in this sequence: waits for input, error, busy,idle. Select the header to hide or show the tabs of the group. Keep this state with the saved tab layout. - Horizontal layout: a short group name before the first tab of each group.
- A new tab goes to the end of its group, not to the end of the list.
"directory"keeps the worktrees of one project in different groups.
- Vertical layout: one header row for each group. The header shows the project and branch text that
-
Automatic nesting of subagent sessions:
tabs.children: "off" | "active" | "all".- Vertical layout: below each root tab, show its child sessions as indented rows, each with its own status. Use the same tree for each level when
experimental.subagent_depthis more than 1. "active"shows only the children that run, wait for input, or stopped with an error in the last 10 minutes."all"shows all children of the root.- When a child waits for a permission or a question, show the children of its root automatically.
- Select a child row to open that child session. Select the root row control to hide its children.
- Vertical layout: below each root tab, show its child sessions as indented rows, each with its own status. Use the same tree for each level when
-
Automatic order:
tabs.sort: "manual" | "recent" | "attention"."recent": the tab with the most recent change is first."attention": tabs that wait for input are first, then tabs with an error, then busy tabs, thenidletabs. In each class, the manual order stays.- The order applies in each group.
- Do not move tabs while the mouse pointer is on the tab list or while a tab menu is open. Apply the new order when you go to a different tab, so that a click does not go to an incorrect tab.
More options that work with these three:
- Pinned tabs: a pinned tab stays at the top of its group, and automatic order does not move it (see #60236 and #61209).
- Keybinds: go to the next tab that waits for input; hide or show the tabs of the current group; go to the next tab in the same group.
- Group commands in the tab menu: close the group, close the other tabs in the group, and move the group up or down.
- Unused tabs: an option that moves tabs with no change for a set number of hours into a hidden "Earlier" group. The tabs stay available and do not close.
- Plugin API: let a TUI plugin give the group key and the order of a tab, and apply a full tab layout in one update (see #61251).
Benefit. A user with many projects, or with many subagents that run at the same time, sees the state of each group and each child without opening each tab. That user goes directly to the session that waits for input. Users who want the current flat list keep it, because each option is off by default.
Thanks for the detailed proposal, @iceteaSA! You're asking for three opt-in TUI tab options: automatic grouping by project or directory, nested rows for subagent sessions, and automatic ordering (recent or attention). You also suggest pinned tabs, keybinds, group commands and plugin hooks to go with them. Maintainers will consider it.
On plugins: the current TUI plugin API (api.tabs.list/open/focus/move/close) lets a plugin reorder tabs, but only one move() call per tab. It can't draw group headers, collapse groups or show child sessions as rows, because there is no slot for the tab bar and move() always resolves a child to its root tab. So this can't be built as a plugin today.
These related issues cover parts of this request:
- #61251: one-step tab layout updates for plugins
- #54927 / #54952: a plugin slot to replace or extend the session tab bar
- #60236 / #61209: pinned sessions and pinning the New session slot
- #51759 / #44589 / #60241 / #60581: project grouping for desktop and web side tabs and the sidebar
- #60270 / #53757: ordering by recent activity or attention (desktop/web)
- #50196 / #56749: tabs with many projects, and showing the project name on tabs
Check this project: https://github.com/igorovh/opencode-better-tabs
Same need on the desktop app sidebar. There the tab list is ordered by open order (oldest first) and the row context menu only offers rename / export / mark as unread / close tabs — no pin and no sort option. So a session opened weeks ago stays stuck at the top forever.
If tabs.sort: "recent" and pinned tabs land for the TUI strip, please apply
the same to the desktop sidebar. To confirm the use case: I have ~15 open tabs
across projects and the list is effectively unordered for me.
Related: #61746
Same need here, and the desktop app already has a working model for it.
I work with one task per directory (each ticket is its own folder), with tabs.scope: "cwd" and tabs.layout: "vertical". Even with per-directory tabs, a long task ends up with 8–12 tabs (main session + subagents + review sessions), and the strip turns into a flat wall of truncated titles.
Two additions to the proposal:
- Port the desktop experimental implementation instead of designing a new model.
Settings → Experimental → Tab groups(settings.general.tabGroups,packages/app/src/shell/titlebar/tab-groups.ts, #64407) already has named groups with a color, collapsible headers, automatic grouping by server/project/none, and manual groups via drag-and-drop. Keeping the same setting shape in the TUI would keep both clients consistent. - Scope groups together with
tabs.scope, socwdusers get groups per directory, plus an automatic mode that groups by project or directory as a direct upgrade path for them.
The third-party plugin igorovh/opencode-better-tabs already shows this UX works in the TUI today: groups by git repository, collapsible headers with working/waiting/unread counters, drag reorder, indented sub-sessions and /tabs search. As the bot noted above, it cannot be built as a plugin without a tab-bar slot, and it should not be required to install a plugin for basic tab navigation — which is the argument for bringing this into core.