---
title: Sessions
description: Start, list and message Wain sessions from the command line, with every flag for model, effort, agent, base branch, worktree, issues and fast mode, and hand tasks to bots, post merge and issue cards, and react as a bot.
sidebar:
  order: 2
---

`wain session` starts and manages the same sessions you see in the sidebar. A session made here is an ordinary session: you can open it, read it, stop it or delete it like any other.

Run from inside a Wain session, every command knows which session is calling. A new session is nested under the caller and inherits its settings. Run from your own terminal, there is no caller, so the app's defaults apply.

| Command | What it does |
|---|---|
| [`new`](#start-a-session) | Start a session on a prompt. |
| [`ls`](#list-sessions) | List sessions. |
| [`send`](#send-a-message) | Message a session. |
| [`model`](#switch-a-sessions-model) | Switch a session's model, effort or agent. |
| [`rename`, `stop`, `settle`, `unsettle`, `set-aside`, `unset-aside`](#rename-stop-settle) | The sidebar's buttons. |
| [`attach`, `detach`](#attach-and-detach) | Hand a task to a bot, or take it back. |
| [`merge-card`](#merge-card) | Post a card for a task's pull request. |
| [`issue-card`](#issue-card) | Post a card of GitHub issues. |
| [`need`](#need-line) | Say what a bot's task needs from you. |
| [`react`](#reaction) | React to your newest message, as a bot. |

## Start a session

```bash
wain session new "Fix the login redirect loop. Steps to reproduce: …"
```

Prints the new session's id, then a line like `Started "Fix login redirect loop" in worktree calm-owl`. It returns at once: the session starts working on its own and nothing waits for it.

Write the prompt for someone who has not read your conversation. The new session starts with no context.

| Flag | What it does | Default |
|---|---|---|
| `--project <path>` | The repo to run in. With `--no-worktree`, any folder. | The git repo you are in, then the calling session's project. |
| `--no-worktree` | Run in the project folder as it is, with no worktree or branch. See [Worktree or not](#worktree-or-not). | Off. |
| `--model <alias>` | A model the agent knows, like `opus`, `sonnet`, `fable` or `haiku` on Claude Code, or a `provider/model` id on pi. | The calling session's model, if the agent is the same. Otherwise the agent's own default. |
| `--effort <level>` | `low`, `medium`, `high`, `xhigh`, `max` or `ultra`. | The calling session's effort, if the agent is the same. Otherwise the model's default. |
| `--harness <name>` | Which agent runs it: `claude_code`, `codex`, `pi`, `fx`, `grok` or `opencode`. | The calling session's agent, else Claude Code. |
| `--base <session\|ref>` | Start the worktree from existing work: a session id, a branch, a tag or a commit. Committed work only. See [Start from existing work](#start-from-existing-work). | `origin/<default branch>` |
| `--title <title>` | The session's title. | One generated from the prompt. |
| `--issue <ID>` | An issue this work is against, like `DRA-53` or `owner/repo#12`. Repeat for several. | None. |
| `--fast` | Run at the agent's faster tier, which uses more of your plan. | The calling session's setting, if the agent is the same. |
| `--hidden` | Keep the session out of the sidebar. Its permission and question cards show in the calling session. Needs a calling session. | Off. |

`--from` is an older name for `--base` and still works.

```bash
wain session new --harness codex --effort high "Port the retry logic to the Go client"
wain session new --model opus --fast "Rename the config keys listed below …"
wain session new --issue DRA-53 --title "Add the issue panel" "Build the issue panel described in DRA-53"
```

Started from a bot, or from anything a bot started, the new session always runs hidden, whatever `--hidden` says, and reports back after every turn. If other bots have open tasks in the same project, `wain` prints a warning naming them, so the bot can check with them first.

### Worktree or not

By default every session made here gets its own git worktree on its own branch, `worktree-<name>`. Sessions started this way run at the same time, and two agents in one checkout overwrite each other. There is no flag to pick the name.

The worktree starts at `origin/<default branch>`, not at the branch you are on. So a plain new session cannot see unpushed work. Pass `--base` to start it from other work.

`--no-worktree` runs the session in the `--project` folder as it is: a repo's own checkout, or a folder that is no repo at all. It is for work that changes no repo's files, like setting up a machine or research. Never use it to edit a repo: the session shares that checkout with you and every other session in it.

```bash
wain session new --no-worktree --project '~' "Set up Docker on this machine and report the version"
wain session new --no-worktree --project ~/code/app "Find out why the dev server here fails to start"
```

`~` quoted is the home folder of the machine that runs the session, which matters with [`--machine`](#on-another-machine). `--no-worktree` cannot go with `--base`. The line printed says `in <folder>, no worktree`.

A folder that is no git repository needs `--no-worktree`. A bot's own folder is never a project, so a bot always names one with `--project`.

### Start from existing work

```bash
wain session new --base <session-id> "Review the work on this branch and report what you find"
wain session new --base feature/login "Write tests for the login flow on this branch"
```

`--base` takes a session id, a branch, a tag or a commit.

- **A session id or a tag or commit** gets a new `worktree-<name>` branch starting there. It never checks out that session's branch, so it cannot commit onto its work. The line printed says what the id resolved to: `based on worktree-brisk-jade`.
- **A branch** is worked on by its own name, as the new-task composer's branch picker does, so the new session's commits land on it. The line says `on branch feature/login`.
  - The default branch starts from `origin/<default branch>`, as with no `--base`.
  - A branch only on the remote is fetched, and a local branch tracking it made.
  - A branch in both places is fetched first. Behind its remote, it moves up; holding commits the remote lacks, it is used as it is.
  - A branch already checked out elsewhere, in your own checkout or another session's, gets a tree at its tip with no branch checked out, and the agent is told how to push to it.

Either way, only committed work is there. Changes not yet committed are not in the new worktree. See [Orchestration](/docs/cli/orchestration#review-with-a-second-model) for using this to review.

### What a new session inherits

From the calling session it takes the agent, the model, the effort, fast mode and the permission mode. Each of these but the permission mode can be overridden with a flag.

The model, effort and fast mode only carry over when the new session uses the same agent. A Codex session started from a Claude Code one takes Codex's own defaults, since the two have different models and their effort levels do not match.

There is no flag for the permission mode. A new session runs under the caller's, or the app's default with no caller. See [Orchestration](/docs/cli/orchestration#permission-prompts).

The new session inherits no conversation. Put everything it needs in the prompt.

### How deep it can go

A session you start from the composer may create sessions. Those may create sessions too. Their sessions may not. Past that, `wain session new` and `wain draft start` are refused with a message saying so. Start the next batch from a top-level session.

## List sessions

```bash
wain session ls
```

One line per session: id, status, title, branch. A session created by another one also says `spawned by <id>`, a hidden one says `hidden`, and one on another machine says `on <machine>`.

| Flag | What it does |
|---|---|
| `--all` | Every project, not just this one. |
| `--project <path>` | List this repo instead of the one you are in. |
| `--json` | One JSON array, for scripts. Each entry carries `sessionId`, `title`, `cwd`, `projectPath`, `branch`, `worktreeName`, `status`, `modified`, `parentSessionId` and `hidden`, and `machine` for a session on another machine. |

Status is `idle`, `in_progress` or `completed`. `completed` means the turn finished and nobody has opened the session since. Settled sessions are not listed.

`wain --machine <name> session ls` lists another machine's sessions, and `wain session ls --machine all` lists this machine's and every connected machine's together.

A session nobody watches reports back to nobody, unless a bot started it. To find out when one finishes, check `wain session ls`, or have the session [message you](#send-a-message).

## Send a message

```bash
wain session send 0198f0a2-1c5e-7000-8000-000000000000 "The API moved to /v2. Update the client to match."
```

The message arrives as an ordinary prompt and starts a turn, so it wakes an idle session. If the session is mid-turn, the message is queued and picked up next; `wain` says `Queued — the session is mid-turn and will pick it up.` That is not a failure.

Sent from inside a session, the receiving agent is told which session sent it, with its id, so it can reply with `wain session send`. A message never changes the receiving session's model, effort or permission mode.

## Switch a session's model

```bash
wain session model <id> fable
wain session model <id> opus --effort high
wain session model <id> --effort low
wain session model <id>
```

Does what the model picker in the session's composer does. The new model and effort apply from the session's next turn, including a message already waiting behind a running turn. The running turn is not stopped.

| Form | What it does |
|---|---|
| `model <id> <alias>` | Switches the model. The session keeps its effort if the new model has that level, else takes the model's default. |
| `model <id> <alias> --effort <level>` | Switches both. A level the model lacks is refused, and the error lists the ones it has. |
| `model <id> --effort <level>` | Changes the effort alone. |
| `model <id>` | Prints the model and effort the session runs on. |

An alias the session's own agent does not know, but another installed agent does, moves the session to that agent, like `gpt-6-luna` on a Claude Code session. It keeps its worktree, branch and transcript, and the new agent is handed the conversation so far. A move is refused while a turn runs. See [Switch to another agent](/docs/using-wain/composer#switch-to-another-agent).

## Rename, stop, settle

```bash
wain session rename <id> "Add retry to the upload client"
wain session stop <id>
wain session settle <id>
wain session settle <id> --delete-worktree
wain session unsettle <id>
wain session set-aside <id>
wain session unset-aside <id>
```

| Command | What it does |
|---|---|
| `rename <id> <title>` | Renames the session. Your title stays: no generated one replaces it. |
| `stop <id>` | Stops the running turn, like the Stop button. |
| `settle <id>` | Stops the session and moves it out of the active list. Its worktree stays. Refused while a turn is running: stop it first, or wait. |
| `settle <id> --delete-worktree` | Also deletes the worktree and its branch, whatever they hold, uncommitted and unpushed work included. Nothing asks first. Refused for a session with no worktree of its own. |
| `unsettle <id>` | Brings a settled session back to the active list. |
| `set-aside <id>` | Sinks the session to the bottom of the sidebar: started, not wanted now. |
| `unset-aside <id>` | Takes it out of set-aside. |

These are the same as the sidebar's buttons. Settling a session also settles the hidden sessions it started, with one exception: the sub-tasks of a bot's task keep running, and report to the nearest open session above them.

`set-aside` and `unset-aside` also work on a session whose machine is offline, where this machine knows which one holds it: a task a bot started there, or one named with `--machine`. The change waits here and lands when the machine answers.

## Attach and detach

```bash
wain session attach <task-id> --bot "Ops"
wain session detach <task-id>
```

`attach` is the sidebar's **Attach to bot**. The task leaves the sidebar for the bot's Tasks tab, the bot gets a note saying where the task stands, and from then on the task reports to the bot after every turn. `--bot` takes the bot's name or id. The bot must be on the same machine as the task and have a chat already. A settled task, a bot's own chat, and a task already under a bot are refused.

`detach` is **Detach from parent**, or **Detach from bot** for a bot's task. The task stops nesting under the session that started it, shows in the sidebar even if it ran hidden, and reports to nobody.

See [Attach a task to a bot](/docs/using-wain/bots#attach-a-task-to-a-bot).

## Merge card

```bash
wain session merge-card <task-id>
```

Run from inside a session, this posts a card in that session's chat for the open pull request on another session's branch, usually a task it started. The card shows the task, the pull request's number and live status, and a **Merge** button, so you can merge without opening the task or the side panel. It is refused when the branch has no open pull request, and while the task is still mid-turn.

Wain also posts the card on its own, once per pull request, in the chat of the session that started the task. It waits until GitHub says the pull request can merge: its branch protection, required checks and required reviews pass, and no check is still running. It also waits for the task's turn to end. A card already in the chat for that pull request, posted by hand or not, stops a second. So agents post one by hand only when you ask.

The task can run on another machine, such as a sandbox of its own. The card then reads and merges the pull request through the GitHub CLI on the chat's machine, so it keeps working after that machine is gone.

In a bot's chat, Merge also settles the task and deletes its worktree. In any other chat it only merges. See [Merge cards](/docs/using-wain/bots#merge-cards).

## Issue card

```bash
wain session issue-card ismatbabirli/wain 12
wain session issue-card ismatbabirli/wain 12 15 '#18'
```

Run from inside a session, this posts a card of GitHub issues in that session's chat: each issue's number, title and labels, in the order given, 20 at most. A closed issue's number shows in purple. Click an issue to open it on the Issues page. **Work on it** on an open issue sends the agent a message naming it, so it starts on it.

Bots post a card whenever they show you GitHub issues.

## Need line

```bash
wain session need <task-id> "Pick: keep the button or drop it"
wain session need <task-id>
```

Sets what a bot's task needs from you, in one line. It shows on the task's row in the **Waiting on you** card at the foot of the bot's chat, and clears once the task moves. With no text it clears now. Bots write it themselves when a task has sat waiting on you for 2 minutes.

A task whose pull request is ready to merge gets a line only when it asked you to try or check something before merging. Otherwise its row shows **Merge** alone. See [Waiting on you](/docs/using-wain/bots#waiting-on-you).

## Reaction

```bash
wain session react 👀
```

Run by a bot when your message needs no words back. It puts one emoji on your newest message in the bot's chat, as a badge on the bubble, and the bot ends its turn without replying:

| Emoji | Word | Means |
|---|---|---|
| 👍 | `like` | got it, ok |
| 👀 | `seen` | looking into it |
| ✅ | `done` | done |
| 🎉 | `celebrate` | good news |
| ❤️ | `love` | thanks |
| 😂 | `laugh` | funny |
| 😢 | `sad` | sorry to hear |
| 👎 | `dislike` | dislike |

The word works in place of the emoji. A new reaction on the same message replaces the old one. It works only in a bot's chat. Claude Code bots use a built-in tool for the same thing. See [Reactions](/docs/using-wain/bots#reactions).

## On another machine

```bash
wain --machine vps session new "Run the load test" --title "Load test"
wain --machine vps session ls
wain session send <session-id> "Use the staging DB"
```

`--machine <name>` runs a session command on a machine from `wain machine ls`, through this machine's Wain server. A command that names a session id needs no `--machine`: an id this machine does not hold is looked for on every machine it reaches.

A new session there runs in that machine's checkout of the same repository, found by its `origin` remote. Pass `--project <path on that machine>` where it has none. `--base <session-id>` names that session's branch, which the other machine can see only once it is pushed. Model, effort, agent and fast mode inherit as they do here.

A session on another machine can message you back only if its machine has added this one. See [Servers](/docs/cli/servers).

## Limits

- No flag sets the permission mode or the worktree name.
- `--fast` can only turn fast mode on. Leaving it off inherits the caller's setting.
- `--base` sees committed work only. Changes not yet committed are not in the new worktree.
- A model that has no faster tier runs at its normal speed with `--fast`, and nothing says so.
- You cannot read a session's transcript from here.
