Braide runs each agent and each terminal as a child process. This page describes what happens when those processes start, when they exit, and what guarantees you can rely on — particularly if you're running Braide headless on Linux or scripting around it.
When you enable an agent (or when Braide restarts and restores agents from your saved settings), the agent goes through a short startup sequence:
npx or uvx skip this step.If a running agent exits unexpectedly — crash, killed by the OS, network drop on a remote — Braide tries to restart it automatically with exponential backoff:
| Attempt | Delay before retry |
|---|---|
| 1st | 1 second |
| 2nd | 2 seconds |
| 3rd | 4 seconds |
After three failed attempts the agent moves to error state and stays there until you manually restart it from the Process Manager. A successful handshake at any point resets the counter.
If you stop the agent yourself (toggle it off, or click Stop), Braide does not auto-restart it.
When you quit Braide, disable an agent, or stop one from the Process Manager, the agent goes through a layered shutdown so it has a chance to flush state but cannot block you forever:
When the whole Braide server is shutting down, an overall 10-second cap applies: if every agent hasn't shut down within 10 seconds, Braide exits anyway. This prevents a single unresponsive agent from blocking quit indefinitely.
Terminal processes (PTY shells, both interactive and agent-spawned) follow the same process-group shutdown pattern: SIGHUP first (or SIGTERM for non-PTY terminals), a 5-second grace period, then SIGKILL. Anything you started inside the terminal — long-running commands, background jobs — receives the signal too, so closing a terminal cleans up its children.
If you're running the Braide server directly rather than the desktop app, you can shut it down with any of these signals. All trigger the same graceful sequence and exit with code 0:
| Signal | When you'd send it |
|---|---|
SIGTERM | Standard "please stop" — what systemctl stop and kill send. |
SIGINT | Ctrl+C in the foreground terminal. |
SIGUSR2 | Used by nodemon and similar tools for graceful restarts. |
If Braide itself crashes (an uncaught exception or unhandled promise rejection), it logs a fatal error and exits with code 1 after running shutdown. The FATAL line is also written synchronously to ~/.braide/logs/braide-crash.log (or electron-main-crash.log for crashes in the desktop app's main process) so the record survives even an abrupt exit — see Crash Logs. Signal handlers are idempotent — sending SIGTERM twice doesn't double the shutdown, it just confirms you really meant it.
If you're seeing different behaviour — orphaned node or java processes after quitting Braide, agents that never restart, or shutdown that hangs — that's a bug. Capture the logs and file an issue.