Skip to content
Edith

Agent docs

Coding agentsBeta

Crew background sessions: agents that outlive Edith

Every Crew agent runs inside the agents engine. With background sessions on, Edith hands each engine session to launchd, so the engine keeps running when Edith quits, updates or crashes. It also starts again when you log in.

Turn background sessions on or off

Background sessions are on by default, so there is nothing to set up: start an agent with New agent and it keeps running after you quit Edith. Open the Crew page again later and your agents are still on the board.

To check them or turn them off, use the terminal:

Terminal
ed crew backgrounded crew background offed crew background on

ed crew background shows whether background sessions are on, and which sessions have a launchd job.

Command What it does
status Show whether background sessions are on and which sessions run under launchd
on The next session Edith starts runs under launchd
off Stop running new sessions in the background and remove the session jobs. Running sessions keep going until you stop them or log out
start [--session <name>] Hand one session to launchd now and wait for its server
restart [--session <name>] Restart a session so it runs the engine this copy of Edith ships
repair [--session <name>] Fix a session whose login job is out of date, unloaded, disabled or stopped

Without --session, these use the default session. See ed crew background for the JSON output.

How a session runs

Each session gets one LaunchAgent in ~/Library/LaunchAgents. The job:

  • runs ~/.edith/agents/bin/edith-agents server on its own, separate from Edith
  • starts again at login and after a crash, but stays stopped after edith-agents server stop
  • exits at once when that session's engine is already running
  • starts login shells for panes, so agents see your full environment
  • shows under Edith in System Settings > General > Login Items

What survives a restart

When the engine restarts, for example after a reboot, it reopens every workspace, tab and pane it had, in the same folders. It resumes the agents it knows a conversation id for, such as claude --resume <id> or codex resume <id>. Running processes themselves cannot survive a reboot.

For threads, Continue threads after a restart under Thread engine in Agent launch settings (Filter > Edit launch settings on the Crew page) resumes turns that were running when the engine stopped.

Restart after an update

After you update Edith, a running session can keep the engine it started with. edith-agents status shows whether a restart is needed because the engine binary changed.

Terminal
ed crew background restarted crew background repair

restart stops and starts the session's login job. Shells and agents in that session restart and resume where they can. repair reinstalls a job set up for another engine version, or restarts one that is stopped or runs an older engine, and leaves a healthy session alone.

If macOS refuses the job

The usual cause is Edith being switched off in System Settings > General > Login Items. Turn Edith back on there. Until you do, ed crew background reports the error, and Edith falls back to starting the engine detached. That engine still keeps running after Edith quits, but it does not start again at login.

start leaves a session that is already running alone. Its JSON reports managed: false when that engine was started outside launchd, for example by edith-agents server --detach. To move it under launchd:

Terminal
edith-agents --session work server stoped crew background start --session work

Give agents environment variables

The engine reads KEY=VALUE lines from service.env in its home and gives them to every shell and agent it starts, also when it starts at login.

Terminal
ed crew background enved crew background env set OPENAI_BASE_URL=https://proxy.example.tested crew background env set FOO=1 BAR="two words"ed crew background env ls --valuesed crew background env unset OPENAI_BASE_URL

Values are taken literally. PATH and the engine's own variables are managed by the engine and ignored. A change reaches new shells and agents at once; ones already running keep the value they started with. ls --values prints the values too, which can hold keys and tokens. Add --machine box to change a machine's engine.

On other machines

Machines have no launchd job. The engine starts detached the first time an agent starts there. On Linux, edith-agents service install --linger adds a systemd user unit that starts it at login. See Remote machines.

Exit codes

ed crew background exits 4 when Crew is not running, background sessions are off, the engine is missing, or macOS refused the job.

Where to go next