# Session groups

> Gather several sessions that belong to one piece of work under one sidebar row, switch between members with ⌃1–⌃9, and pin, snooze or close them together.

A **session group** puts a few sessions (say, agents in their own worktrees, directories or repos that belong to one piece of work) under one row in the sidebar, the way a browser's tab groups do. The members keep their own directories and layouts; the group gives them one row, one bar to switch between them, and one pin and snooze.

## Make a group

Any of these:

- Right-click a session row and choose **New group with this session**.
- Drag a session row onto the middle of another session's row. Flow asks for the new group's name.
- Click the **+** at the right of an ungrouped session's primary pane header. It starts the New session flow, and the new session lands in a group with this one.
- Run **New session group** from the palette: it makes a group of the active session (refused when it is already in one).

An unnamed group reads "Untitled group". A group of one member stays a group; a group whose last member leaves is deleted.

## Add, move and remove members

| To | Do |
|---|---|
| Add a session to a group | Right-click it › **Add to group ›**, drag its row onto the group's row or onto the group bar, or run **Add to session group…** |
| Start a new session in the group | **New session in group** (group menu, the bar's **+**, or the palette) |
| Move a member to another group | Right-click it › **Move to group ›** |
| Take a member out | Right-click it › **Remove from group**, or drag its row to a spot outside the group |
| Reorder members | Drag a member row along the group |
| Dissolve the group | **Ungroup** (the sessions are kept) |
| Close every member | **Close group…** (one confirm for all) |

A new session started in a group lands right after the active member and becomes the active one.

## The sidebar row

A group's row shows a pile of up to three members' icons (the active one in front), the group's name, an unread dot while a member wants attention, a working glyph while a member's agent is mid-turn, and the active member's time. Its members show as indented rows under it while it is expanded. The chevron toggles that. Right-click the row for the group menu:

| Item | Does |
|---|---|
| Rename group… | Names the group |
| New session in group | Starts the New session flow for this group |
| Collapse group / Expand group | Hides or shows the member rows |
| Expand when focused | The default: members show only while the group holds the session you are on |
| Pin group / Unpin group | Pins every member |
| Snooze | Snoozes every member |
| Ungroup | Dissolves the group, keeping the sessions |
| Close group… | Closes every member after one confirm |

A collapsed group's row reads "name / active member's title". A click on the row switches to its active member; dragging it moves the whole group.

## The group bar

While you are on a member, a bar spans the top of the Sessions area, above every pane:

- the **group chip** (its icons, name and a chevron), which opens a menu listing every member (with its `repo/branch` and `⌃N` key) to switch to, then New session in group, Rename group…, Ungroup and Close group;
- one **tab per member**, with its title, unread dot, working glyph and repo; the active member's tab has a × that closes that member after a confirm; right-click a tab for that session's menu;
- a **+** for New session in group.

Drop a session row on the bar to add it to the group. The bar is shown on the Sessions page only, not on Dashboard cards, pop-outs or tool pages.

## Keys

| Keys | Does |
|---|---|
| `⌃1` to `⌃9` | Switch to the group's Nth member |
| `⌃Tab` / `⌃⇧Tab` | Next / previous member, wrapping |

These keys work on the Sessions page while the current session is in a group, and cannot be rebound. A focused Files tab keeps its own `⌃Tab`, and in a group of one `⌃Tab` goes to the terminal. The palette also has these actions, all unbound by default: New session group, New session in group…, Rename session group…, Remove from session group, Ungroup sessions, Close session group, Next session in group, Previous session in group, Expand/collapse session group, Add to session group…

## What members share

- **Pin and snooze**: pinning, snoozing or waking any member applies to every member, a session that joins takes the group's state, and a woken group moves to the top as one block.
- **Focus**: switching to a member makes it the group's active member; closing the active member hands that to its neighbour.

Members can be local sessions, sessions on a remote host, or sessions from a paired device, mixed in one group.

## From the command line

```sh
flow-cli bundle new 2 3 --name "Checkout redesign"   # group sessions 2 and 3
flow-cli bundle add "Checkout redesign" 5            # add session 5
flow-cli bundle fold "Checkout redesign" open        # auto | open | closed | toggle
flow-cli bundle ungroup "Checkout redesign"          # keep the sessions
flow-cli bundle close "Checkout redesign" --yes      # close every member
```

With no session named, `new`, `add` and `remove` act on the active session. See [flow-cli](https://flow.worldbreakstudios.com/docs/cli/flow-cli.md).
