Skip to content
BENIBIX Learn

Background Session Commands

Level 3 · Parallel work and review

How to send work to the background and keep your terminal. /background, /fork, /subtask and /stop in a session, and claude attach, logs, rm and daemon outside.

Course contentsLesson 7 of 17

After this lesson you can

  • Pick /background, /fork or /subtask
  • Open and stop a background session from the shell
  • Restart every session after an update

13 mincovers 12 glossary entries

Worth reading first: Models, Goals and Folders

How to run a session in the background and manage it

A background session keeps working with no terminal open. One supervisor process runs them all. /background, or /bg, moves the chat you are in there and frees your terminal. claude --bg starts a new one from the shell and hands your prompt back at once. You watch them all in agent view, which claude agents opens.

Three commands send work out of a session, and they differ in what stays. /background moves the whole chat. /fork copies it to a new background session, and you keep working here. The copy gets your model, mode and effort. It is told to use its own worktree before it edits code.

/subtask hands one task to a subagent that inherits the whole chat. It works in the background while you keep going. When it is done, its result comes back into this chat. A /fork copy never reports back on its own. /subtask is only there when agent view is on.

/tasks lists the background work inside this one session: shell commands left running, and subagents, finished ones too. Open one to read its output or stop it. It is not Claude's to-do list, which Ctrl+T shows. /bashes is another name for it.

From the shell, claude attach opens a background session in your terminal, by ID or name. Press the left arrow on an empty prompt, or run /exit, to leave it running. /stop is the way to end it from inside. claude logs prints its recent output without opening it at all.

claude respawn starts a session again and keeps its chat, whether it was running or stopped. Add --all to restart every running one, so they all move to a new version after an update. claude rm takes a session off the list, and its chat stays on disk for claude --resume. It refuses while the worktree holds changes you have not committed.

claude daemon looks after the supervisor itself. claude daemon status prints its state and how many sessions it holds, and ends with code 1 if it is not running. claude daemon logs follows its log file. claude daemon stop --any shuts it down, and --keep-workers leaves the sessions running for the next one.

Which one to pick

  1. 1

    /background

    Pick it when you are done watching and want your terminal back. The whole chat goes with it.

  2. 2

    /fork

    Pick it when you want to try something on the side and keep working here. The copy does not report back.

  3. 3

    /subtask

    Pick it when a side task should bring its answer back into this chat when it is done.

bash
claude --bg "investigate the flaky test"
claude attach 7c5dcf5d
claude logs 7c5dcf5d
claude respawn --all
claude daemon status
Start a session in the background, open it and read its output. Then restart them all, and check the one process that runs them.
One process runs every background session. Each command acts on one session, or on that process.

Worked example

Jack starts three jobs before a meeting

Before a 1 hour meeting, Jack starts 3 sessions with claude --bg: fix a bug, write tests, and review a branch.

Afterwards, claude logs shows two done and one waiting on a question. He runs claude attach on that one, answers it, and presses the left arrow to leave it running.

The words for this lesson12

Check yourself

You want a helper to take a side task and bring its answer back into this chat. Which command fits?

Finished this lesson?

Marking it complete also marks its 12 glossary entries learned, which updates your roadmap and your saved page. 0 are already marked.