# Sessions and forks

> The sessions list, session details, and forking, editing or deleting a message in the terminal app.

What sessions, forks and spaces are in both apps: [one engine, two apps](https://zidane.si/docs/apps.md#sessions).

## The sessions list

`Esc` in a chat opens the list: the current project's sessions, newest first, with turn, message and run counts. Settings › UI › All projects opens it on every project.

*Terminal: The sessions list: search, a new-session row and two sessions.*

```text
 ┌ sessions ───────────────────────────────────────────────────── ~/acme-api · 2 sessions ┐
 │                                                                                        │
 │ ┌────────────────────────────────────────────────────────────────────────────────────┐ │
 │ │ search sessions: title, project, or message content                                │ │
 │ └────────────────────────────────────────────────────────────────────────────────────┘ │
 │                                                                                        │
 │ ▶   + new session                                                                      │
 │     start fresh                                                                        │
 │ ────────────────────────────────────────────────────────────────────────────────────── │
 │     Rate limiting /chat                                                                │
 │     4 turns · 2 user · 1 run · just now                                                │
 │ ────────────────────────────────────────────────────────────────────────────────────── │
 │   ● Test command                                                                       │
 │     2 turns · 1 user · 1 run · just now                                                │
 │                                                                                        │
 │                                                                                        │
 │                                                                                        │
 │                                                                                        │
 │                                                                                        │
 │                                                                                        │
 │                                                                                        │
 │                                                                                        │
 │                                                                                        │
 │                                                                                        │
 │                                                                                        │
 │                                                                                        │
 │                                                                                        │
 │                                                                                        │
 └────────────────────────────────────────────────────────────────────────────────────────┘
 ↑↓ navigate · ↵ open · tab all projects · ctrl+shift+x session · ctrl+o settings
```

| Key | Does |
| - | - |
| Type | Filter by title and message text |
| `↑` `↓`, `PgUp` `PgDn` | Move |
| `Enter` | Open the session, or start one on the `+ new session` row |
| `Tab` | Switch scope: current project, all projects, then the sessions a window has open now (with the daemon or a remote host) |
| `Shift`+`Tab` | Next space, also while you type a search. It wraps after the last space. With Settings › UI › Spaces on or a space from an extension. Rebind it as `cycleSpaceInList` ([keyboard map](https://zidane.si/docs/tui-keys.md#sessions-list)) |
| `←` `→` | Previous and next space |
| `Ctrl`+`F` | The view of the list: grouping, sort and filters ([below](#the-view-of-the-list)) |
| `Ctrl`+`Shift`+`X` | Details of the highlighted session |
| `Ctrl`+`R` | Retry a session whose environment failed to start |
| `Esc` | Back to the open chat, or quit |

When there is another space, the title shows the space between arrows, like `‹ Work ›`. Click it to show the next space. The footer shows the key, `shift+tab space` by default.

`Ctrl`+`N` in a chat starts a new session with the same provider and model.

### What a row shows

| Mark | Means |
| - | - |
| `▶` | The highlighted row |
| `●` | The session open in this window |
| `◆` | The [Main session](https://zidane.si/docs/daemon.md#main-session), always first |
| `★` | A favorite. Favorites stay at the top. |
| Spinner | After the title: a run is streaming |
| `◉` | Pulses after the title: the session waits for your answer |
| `○` | After the title: another window has it open, idle |
| Badges | Artifacts and extension badges. Right-click one for its actions. |

The marks after the title come from presence, which needs [the daemon](https://zidane.si/docs/daemon.md).

An extension can add a glyph before the title, and a line of text and chips under the counts, such as the session's branch. It can also add rows of its own, such as a ticket or a scheduled job, with the sessions it lists under them. `Enter` or a click opens such a row, and `Ctrl`+`Shift`+`X` shows its actions.

Extensions can pin lines of their own between the search box and the list, and right under the list, such as an inbox count. They stay in place while the list scrolls, and a click runs what the extension set.

### The view of the list

`Ctrl`+`F` on the sessions list opens its view. Each row cycles its value with `←` `→`, and a change applies at once.

| Row | Choices |
| - | - |
| Group | None, Agent, Project, State, the groupings extensions add, and Space default when the space has its own |
| Sort | Recent, Created, `A–Z`, the sorts extensions add, and Space default when the space has its own |
| Agent | All, then each agent by name |
| Extension filters | One row per filter an extension offers in the space: Off or On, or one of its choices. A filter with several choices gets one Off or On row per choice |
| Reset view | Back to the space's defaults |
| Save view as space… | Asks for a name, then adds a space that lists the sessions the view keeps, and turns Spaces on |

Each space keeps its own view.

### Spaces from extensions

An extension can add spaces. They show next to yours, even with Settings › UI › Spaces off. Such a space lists the sessions the extension chose, plus the sessions started in it. A session started there is tagged with the space and can start on the extension's agent and model. Sessions tagged with an extension's space leave Default, and come back to it when the extension goes. To hide one, add an entry with its id and `hidden: true` to the `spaceList` setting.

### Hosts and environments

With [remote hosts](https://zidane.si/docs/tui-remote.md) on, the list groups sessions under each host with a status dot (connected, connecting or offline). A new session asks which host, and on a server, which of its folders (this computer keeps the window's folder).

On this computer, Settings › Agent › Environments picks local, OS sandbox, git worktree or a sandbox provider ([execution contexts](https://zidane.si/docs/execution-contexts.md)).

## Session details

`Ctrl`+`Shift`+`X` shows the current session's id, dates, folder, counts, token totals, environment and space.

*Terminal: Session details, with its keys in the bottom row.*

```text
 ┌ Rate limiting /chat ──── ▢ ─ ~/acme-api  1 user message  4 turns  ctrl+shift+x session ┐
 │ ┌────────────────────────────────────────────────────────────────────────────────────┐ │
 │ │ ❯ How is /chat rate limited?                                                       │ │
 │ └────────────────────────────────────────────────────────────────────────────────────┘ │
 │                                                                                        │
 │ ↳ ▸ Used find the rate limiter and read it  [expand]                                   │
 │  ┌─ Rate limiting /chat ────────────────────────────────────────────────────────────┐  │
 │ T│                                                                                  │  │
 │ c│  id 57da8e7e-057c-48b9-a5e9-cc0a05a4bead  active                                 │  │
 │  │                                                                                  │  │
 │ I│  created just now  updated just now                                              │  │
 │ t│                                                                                  │  │
 │  │  cwd ~/acme-api                                                                  │  │
 │ ≡│                                                                                  │  │
 │  │  4 turns  2 user messages  1 run  completed                                      │  │
 │  │                                                                                  │  │
 │  │  title auto                                                                      │  │
 │  │                                                                                  │  │
 │  │  favorite no  f add                                                              │  │
 │  │                                                                                  │  │
 │  │  5.34k tokens  5.20k in  138 out                                                 │  │
 │  │                                                                                  │  │
 │  │  g title  e/j export  k compact  d delete  c copy  esc close                     │  │
 │  │                                                                                  │  │
 └──└──────────────────────────────────────────────────────────────────────── #57da8e ─┘──┘
 ┌──────────────────────── ↵ send  shift+↵ newline  ↑↓ history  ? search  ctrl+s messages ┐
 │ Ask zidane…                                                                            │
 └────────────────────────────────────────────────────────────────────────────────────────┘
 shift+tab Build  ctrl+m/l Opus 5.5 +1 medium  ctrl+shift+x session  ctrl+o settings
                                                                     ctx 2.89k / 1.00M (0%)
```

| Action | Keys | Description |
| - | - | - |
| Delete (`sessionDelete`) | `D` | Delete the session (press twice). |
| Copy id (`sessionCopyId`) | `C` | Copy the session id. |
| Generate title (`sessionGenerateTitle`) | `G` | Title the session with the current model. |
| Export md (`sessionExportMarkdown`) | `E` | Export the session as Markdown under .{prefix}/sessions/. |
| Export json (`sessionExportJson`) | `J` | Export the session as JSON under .{prefix}/sessions/. |
| Compact (`sessionCompact`) | `K` | Summarize older turns to free context. |
| Space (`sessionMoveSpace`) | `S` | Move the session to the next space (needs Spaces). |
| Favorite (`sessionFavorite`) | `F` | Add the session to favorites, or remove it. |
| Move (`sessionMoveEnvironment`) | `M` | Move the session to another environment or machine. |

| Detail | Behavior |
| - | - |
| Delete | Press the key twice |
| `1` to `9` | Run the environment's own actions, when it lists some |
| Rename | No free-text rename. `G` writes a title from the conversation. Settings › Agent › Auto-update session titles names new sessions after their first exchange ([automatic titles](https://zidane.si/docs/decisions.md#automatic-session-titles)). |
| Export | To `<git root>/.zidane/sessions/<id>.md` (or `.json`), or `sessions/` in the data folder outside a git repository |
| `K` | Compact older turns now ([compaction](https://zidane.si/docs/sessions.md#compaction)) |

## Fork, edit or delete a message

When the agent is idle and nothing waits for approval, `Ctrl`+`S` (or `?` on an empty prompt) selects a message. `↑` `↓` move, `Enter` opens it.

*Terminal: Selecting a message: the last answer is highlighted.*

```text
 ┌ Rate limiting /chat ──── ▢ ─ ~/acme-api  1 user message  4 turns  ctrl+shift+x session ┐
 │ ┌────────────────────────────────────────────────────────────────────────────────────┐ │
 │ │ ❯ How is /chat rate limited?                                                       │ │
 │ └────────────────────────────────────────────────────────────────────────────────────┘ │
 │                                                                                        │
 │ ↳ ▸ Used find the rate limiter and read it  [expand]                                   │
 │                                                                                        │
 │ The limiter in src/limits.ts keeps a sliding window per IP: 20 requests a minute on /  │
 │ chat, then a 429.                                                                      │
 │                                                                                        │
 │ It lives in memory, so each instance counts on its own. Behind a load balancer, move   │
 │ the counts to Redis.                                                                   │
 │                                                                                        │
 │ ≡ Opus 5.5  2s  ↻2  ↑5.2k ↓138  74000 tk/s                                             │
 │                                                                                        │
 │                                                                                        │
 │                                                                                        │
 │                                                                                        │
 │                                                                                        │
 │                                                                                        │
 │                                                                                        │
 │                                                                                        │
 │                                                                                        │
 │                                                                                        │
 └────────────────────────────────────────────────────────────────────────────────────────┘
 ┌────────────────────────────── ↑↓ navigate  ↵ open  esc exit  @ files  / skills  # chat ┐
 │ Search this conversation…                                                              │
 └────────────────────────────────────────────────────────────────────────────────────────┘
 shift+tab Build  ctrl+m/l Opus 5.5 +1 medium  ctrl+shift+x session  ctrl+o settings
                                                                     ctx 2.89k / 1.00M (0%)
```

*Terminal: An open message, with fork, delete, copy and edit.*

```text
 ┌ Rate limiting /chat ──── ▢ ─ ~/acme-api  1 user message  4 turns  ctrl+shift+x session ┐
 │┌─ turn 2 / 2 (assistant) ─────────────────────────────────────────────────────────────┐│
 ││                                                                                      ││
 ││  id f70c3c  created just now  run run_1                                              ││
 ││  blocks 1 text                                                                       ││
 ││                                                                                      ││
 ││                                                                                      ││
 ││  ┌─ preview ──────────────────────────────────────────────────────────────────────┐  ││
 ││  │ assistant                                                                      │  ││
 ││  │ The limiter in `src/limits.ts` keeps a sliding window per IP: 20 requests a    │  ││
 ││  │ minute on `/chat`, then a 429.                                                 │  ││
 ││  │                                                                                │  ││
 ││  │ It lives in memory, so each instance counts on its own. Behind a load          │  ││
 ││  │ balancer, move the counts to Redis.                                            │  ││
 ││  │                                                                                │  ││
 ││  │                                                                                │  ││
 ││  │                                                                                │  ││
 ││  │                                                                                │  ││
 ││  │                                                                                │  ││
 ││  │                                                                                │  ││
 ││  │                                                                                │  ││
 ││  │                                                                                │  ││
 ││  │                                                                                │  ││
 ││  │                                                                                │  ││
 └│  └────────────────────────────────────────────────────────────────────────────────┘  │┘
 ┌│                                                                                      │┐
 ││  f fork  d delete  c copy  e edit  esc close                                         ││
 └│                                                                                      │┘
 s└────────────────────────────────────────────────────────────────── 1 before, 0 after ─┘
                                                                     ctx 2.89k / 1.00M (0%)
```

| Action | Keys | Description |
| - | - | - |
| Fork (`turnFork`) | `F` | Fork the session at this turn (press twice). |
| Delete (`turnDelete`) | `D` | Delete this turn (press twice). |
| Copy (`turnCopy`) | `C` | Copy this turn. |
| Edit (`turnEdit`) | `E` | Edit this turn's text. |

Fork and delete need two presses.

| Action | Result |
| - | - |
| Fork | A new session with every turn up to and including this one. You land in the fork. The original stays as it was. |
| Delete | Removes this turn, and tool calls left without their result. You stay in the session. |
| Copy | Copies the text through the terminal (OSC 52). Some terminals do not support it. |
| Edit | Rewrites the text of the turn. Tool calls and thinking stay. `Enter` saves, `Shift`+`Enter` adds a line, `Esc` cancels. |

To try another direction, fork at an earlier message and send a new one. What a fork keeps (folder, model chain, effort, space, environment): [one engine, two apps](https://zidane.si/docs/apps.md#sessions).

## Reference

- [Sessions](https://zidane.si/docs/sessions.md): the session model in the SDK
- [`zidane/session`](https://zidane.si/docs/reference/session.md)
