Skip to main content

Agent Sessions

A session is one continuous conversation with a coding agent: every message, every file edit, every tool call, plus the branch and commit it produced. The CLI captures sessions in the background — you don’t bb start anything — and lets you resume them later, on any machine, by anyone on your team with access to the repo. This is what makes bb agent-sessions resume feel like time travel.

How capture works

The moment bb is installed, it watches the on-disk session log of every supported coding agent: Whenever an agent writes to its log, bb indexes the new turns, attaches the current git state (repo, branch, HEAD commit, dirty paths), and writes a normalized session record to ~/.buildbetter/sessions/. If you’re signed in (bb login), the record syncs to your free BuildBetter workspace within a few seconds.
Capture is passive. There’s no daemon to start, nothing to remember, no flag to set on the agent. Install the CLI once and every session from then on is captured.

Where sessions are stored

Each .session.json is a self-contained record:
The full transcript lives next to the metadata (or in the cloud, depending on size). Source code is not copied — bb only stores the file paths and diffs the agent touched.

Resuming a session

The most common call:
The CLI lists sessions tied to the current branch (yours and your team’s), most recent first, and hydrates the chosen one into your active agent:
What “hydrate” actually does:
  1. Loads the prior conversation into the agent’s context window (compacted if it’s long)
  2. Replays the file edits as a virtual diff so the agent knows what it changed
  3. Surfaces the open questions the prior session left behind — not just a transcript, but a state you can keep working from

Resume by ID

If you already know the session you want — say it’s linked from a PR comment or a teammate sent it to you:

Resume on a branch you didn’t start

You don’t need to be the original author. The picker shows everyone’s sessions for the current branch, and resuming pulls the conversation into your agent on your machine:
This is the “no copy-paste handoff” flow — see the Branch handoff workflow below.

Searching across sessions

Resume is for the current branch. When you need to find a session from somewhere else — a PR you reviewed last month, a feature whose name you forgot — search:
Output supports --json if you want to pipe it into something:

PR linking

When you push a branch and open a PR, bb auto-attaches the session(s) that produced it. Reviewers can pull the chat to understand why the code looks the way it does — better than the PR description, and impossible to lose to a closed tab.
To disable auto-linking for a specific repo:

Workflows

Workflow: branch handoff

Spencer started a feature, has to step away. Maya picks it up.
No Slack screenshots. No “wait, what were you trying to do?” The agent already knows.

Workflow: post-merge context recovery

Six months later, a customer ticket lands on a system someone else built.
The agent loads the original reasoning — including any decisions the PR description never mentioned (“we picked denormalized to keep report queries under 50ms”).

Workflow: ticket → spec → PR loop

The full close-the-loop play with skills + sessions:

Workflow: scripting in a pre-commit hook

Make sure every commit has an attached session, so the chat is never lost:

Privacy & access

To delete:
To opt a sensitive repo out of cloud sync entirely:
To exclude specific branches from being captured at all:

Working offline

If you skip bb login, capture still works — sessions land in ~/.buildbetter/sessions/ and you can resume your own sessions on the same machine. You just lose cross-machine sync and teammate-resumable sessions. Sign in any time and the local backlog back-fills the cloud index.

Next steps

CLI reference

Every bb command in one place

Skills

The slash commands that work alongside session resume