---
title: "Sessions"
description: "How abx attaches your terminal to a box, how to detach and reattach, and where agent transcripts are stored."
---

> Documentation Index
> Fetch the complete documentation index at: https://sandrinodm.github.io/agent-box/llms.txt
> Use this file to discover all available pages before exploring further.

# Sessions

A session is a named terminal that keeps running inside a box after you detach. This page covers attaching, detaching, naming and listing sessions, one-shot runs that attach no terminal, and the `transcripts/` directory.

## Attaching and detaching

`abx <agent> <box>` and `abx shell <box>` attach your terminal to a session in the box. Inside the guest, the session is held by `dtach`, so the agent or shell keeps running when you leave.

Press **Ctrl-\\** to detach. To reattach, run the same command again:

```sh
abx claude fix-auth     # start, or reattach
# press Ctrl-\ to detach
abx claude fix-auth     # reattach
```

When you detach or the session ends, abx prints a notice with the command that reattaches. An interactive launch replaces the `abx` process with smolvm once the box is open, so the terminal belongs to the guest command and the exit status of `abx` is the guest's.

An interactive shell needs a terminal. Without one, give a command after `--`, which makes the launch one-shot.

## Session names

`-s NAME` or `--session NAME` opens or reattaches to a named session. The default is the agent name, `shell` for `abx shell`, or `root-shell` with `--root`.

```sh
abx shell fix-auth -s tests        # a second terminal in the same box
abx shell fix-auth --root          # a root shell, session root-shell
```

Each name is a separate session in the same box. To see which are running:

```sh
abx ls --sessions
abx ls --sessions --json
```

`ls --sessions` is opt-in because it runs one command in each running box to see which sessions are live. Plain `abx ls` runs nothing in your boxes. With `--json`, each box has a `sessions` field, which is `null` unless the box is ready and running. Each session lists `name`, `program`, `conversation`, `conversationState` and `running`. `running` is `null` when the guest could not be asked. `conversationState` is `pending` until the next launch of the session confirms the conversation.

A detached session keeps the box running. `abx stop` refuses with `box-busy` while any session or other guest process is still running, so exit the agent or shell first. `abx stop --force` stops the box anyway and ends its sessions. Either way the box's disk, including `/work`, is kept. See [Boxes](https://sandrinodm.github.io/agent-box/concepts/boxes/#stop-versus-remove).

## One-shot launches

A launch is one-shot when it does not attach a terminal: a guest command after `--` for `shell`, `--no-tty` before `--`, or no terminal on stdin and stdout. abx waits for the command and exits with its status, or with 128 plus the signal number if a signal killed it. A failure that abx itself reports exits **125**, so any other status came from the guest. SIGTERM and SIGHUP sent to abx are forwarded to the command.

```sh
abx claude fix-auth --no-create --no-tty -- -p "fix the failing test"
```

See [Headless runs](https://sandrinodm.github.io/agent-box/automation/headless/) for the full contract.

## Transcripts

Each box shares exactly one host directory with its guest: `transcripts/`, mounted read-write at `/abx/transcripts`. On the host it is `$ABX_HOME/workspaces/<name>-<id8>/boxes/<box>-<id8>/transcripts/`.

- Claude Code and Codex keep their transcripts there. Claude's `cleanupPeriodDays` is raised in the guest so they are not deleted after 30 days.
- `abx rm` moves the directory to the workspace `archive/` with the rest of the box record. It never deletes transcripts.
- The path is recorded in `box.json` and must equal `transcripts/` under the box's own directory. On open it must be owned by you with mode `0700`.

> **Transcripts are untrusted guest output**
>
> The guest can change, delete or fill this directory, and symlinks in it appear as real symlinks on the host. Read it without following symlinks, and do not run or source anything from it. abx itself never creates, writes or follows anything below it.

See [Files on the host](https://sandrinodm.github.io/agent-box/reference/files/) and the [security model](https://sandrinodm.github.io/agent-box/concepts/security-model/).

Source: https://sandrinodm.github.io/agent-box/concepts/sessions/index.mdx
