Background Terminals
Use bg_start for long-running commands; use regular bash for quick commands.
Start
Call bg_start with:
command: shell command to runtitle: short recognizable labelworking_dir: project directory when different from the current directorytimeout_seconds: optional deadline for finite work such as builds, tests, or migrations; omit for servers and watchers
Background commands receive no stdin. Never use them for interactive prompts.
After starting, continue useful work instead of polling. The terminal sends one completion message when it exits or times out.
Inspect and stop
- Use
bg_statusonly when current output or status is needed. - Use
bg_listto inventory all tracked terminals. - Use
bg_killwhen a process is no longer needed or is stuck; termination continues even if the tool wait is aborted. - Tell the user they can open
/psto inspect live output and kill terminals interactively.
Prefer meaningful titles and avoid starting duplicate servers or watchers. Full output is captured to spill files; tool and completion output shows a concise tail. Terminals are session-scoped and are stopped during shutdown or reload.