# Sessions, rewind and undo

> bitsrun saves every session on your computer so you can continue it later, rewind to an earlier message with its files, undo changes and keep long conversations within the model's memory.

Source: https://bitsrun.com/docs/agent/sessions/
Updated: 2026-11-09

A **session** is one conversation with the agent in one project folder: your prompts, its answers, its to-do list and a copy of every file before it changed it. bitsrun saves the session after every turn, on your computer only.

## Continue a session

| How | What it does |
|---|---|
| `bitsrun -c` or `bitsrun --continue` | Opens the newest session of this folder. |
| `bitsrun -r` or `bitsrun --resume` | Lists this folder's sessions to pick from. |
| `/resume` inside the agent | The same list, without leaving. |

The list shows each session's title, how long ago it was used and how many messages it has:

```text
Resume which session?
  Add --dry-run to sync script · 2 hours ago · 6 messages
  Fix flaky usage test · yesterday · 11 messages
  Cancel (esc)
```

When a session continues, bitsrun shows a short recap of the last few exchanges so you can see where you left off.

## Start fresh

`/clear` clears the screen and starts a new session. The previous one is saved, and `/resume` brings it back.

## Rewind

Press <kbd>Esc</kbd> twice, or type `/rewind`, to go back to just before one of your earlier messages.

1. Pick the message. Messages that changed files are marked "changed files".
2. bitsrun lists the files that would go back to how they were, and notes files the agent created (they would be removed) and files that changed since, by you or by a command (your later changes to them would be lost).
3. Choose what goes back:
   - **Files and conversation**
   - **Conversation only** (files stay as they are now)
   - **Files only** (keep the conversation)

Your old message returns to the prompt, so you can edit it and send it again.

> [!WARNING]
> Rewind and undo cover changes the agent made with its file tools. Changes made by shell commands (for example a code formatter it ran, or `git checkout`) are not tracked and stay as they are. bitsrun says so in the rewind question.

## Undo

`/undo` puts back the files changed by the most recent message that changed files, and tells the model it did. It shows which files and asks before doing it.

## How undo works: checkpoints

Before the agent first changes a file in a turn, bitsrun saves the file's content (or notes that the file did not exist). Those checkpoints are stored with the session, so rewind and undo still work after you close bitsrun and continue later.

## Compaction

Every model can only keep a certain amount of conversation in mind at once, called its **context** (measured in tokens, roughly three quarters of a word each). Long sessions fill it up. **Compaction** means the model summarizes the conversation so far into one message, so you can keep going.

bitsrun does this for you:

- **Right after an answer**, when the conversation is above 60% of the context, it compacts while you read and type, so your next prompt is not delayed.
- **Before a prompt**, above 75%, it compacts first.
- **During a long run of tool calls**, above 80%, it shortens older tool outputs, which is quick and usually enough.

To compact yourself at any time, type `/compact`. After compaction, rewinding to a message from before it can still restore files, but not the conversation.

BitsRun endpoints report the context they serve, and bitsrun reads it before each prompt. For other connections it uses what the provider reports, and assumes 32,768 tokens when nothing says otherwise.

## Where sessions are stored

Sessions live in the `sessions` folder inside your config folder (`~/.config/bitsrun/sessions/` on macOS and Linux, `%APPDATA%\bitsrun\sessions\` on Windows), readable only by you. bitsrun keeps the newest 200 sessions and deletes older ones. Deleting the folder removes them all.

Sessions never leave your computer. With remote control on, your phone shows the live session through an end-to-end encrypted connection: BitsRun only forwards encrypted messages and cannot read them. See [Remote control](https://bitsrun.com/docs/remote/).
