Launch a session in the background and monitor it

sessions

// what it does

claude --bg "investigate the flaky test" starts an agent that runs detached and returns the terminal immediately. claude agents opens a view to monitor and dispatch these background sessions, claude attach <id> reattaches one to your terminal, and claude logs <id> prints its recent output. This is how you fan out several long tasks and check on them later.

// shell

$ claude --bg "investigate the flaky test"
$ claude agents
$ claude attach 7c5dcf5d

// gotcha

Background sessions are managed by a supervisor daemon; if agents seem stuck, claude daemon status reports its state. Attaching does not stop the agent — closing the terminal again leaves it running in the background.

// resources