Background tasks in Claude Code let you move slow, long-running work off to the side so it keeps running on its own while you keep working. Instead of sitting and watching a build finish or a test suite complete, you hand the job to the background, get your terminal back, and get notified when it's done. The /background command (short alias /bg) is how you detach the current session so it runs as a background agent and frees up your screen for the next task.
What background tasks are in Claude Code
Think of it like starting a load of laundry. You press start, walk away, and do something else while the machine runs. You don't stand there watching it. Background tasks work the same way: you kick off the slow part, step away to something more useful, and come back when it's finished. Claude keeps working on the detached job in the background, and your main session stays open for whatever you want to do next.
Detach the current session to run in the background. Click to copy.
You can also pass one more instruction along with the command, so Claude picks up that task right as it detaches. In plain terms: tell it the last thing you want done, then let it run without you.
Send a final instruction, then detach and keep working elsewhere.
The three steps: start, keep working, get pinged
Every background task follows the same simple shape. You start it, you go do other work, and the main session lets you know when it finishes so you can pick the results back up.
/background (or /bg) to send the long-running job off on its own and free your terminal.Monitoring what's running with /tasks
Once you have work running in the background, you need a way to see it. The /tasks command opens a view of everything currently running in the background of your session, so you can check status and manage what's going. The same view is also available as /bashes, which is handy when the background work is a long shell command (a command you run in the terminal, like a build or a script) rather than a whole detached session.
A rough idea of what the background view shows: what's running, what's done, what's waiting.
A real example
Say you've made a change and want to run the whole test suite, which takes several minutes. Normally you'd start it and then stare at the terminal until it's done. Instead, you detach it:
You never had to babysit the screen. The test suite ran on its own, you got a useful stretch of time back, and the main session pinged you the moment it was done. The same pattern works for a long build, a data crunch across many files, or any job where the waiting is the only slow part.
/background is best for work that takes a while and doesn't need you in the loop. For a task that finishes in seconds, there's nothing to detach, so just ask for it directly.How this fits with the rest of Claude Code
Background tasks are one of a few ways Claude Code handles more than one thing at a time. It's the right tool when you want a single long job to run on its own so your terminal stays free. When you instead want to hand off a smaller side task while you keep going, that's a job for subagents. And when you want a job to repeat on a schedule rather than run once, that's what a loop is for. They all share the same goal: less waiting, more of your attention on the work that matters.
