What
A background session is a Claude Code session that keeps running after you leave it, started with claude --bg, /bg or the left arrow. Claude Code also sometimes relaunches itself. This release changes what such a session inherits from the one that started it.
Added directories:
- Directories you add during a session, for example with
/add-dir, are saved into the new environment variableCLAUDE_RELAUNCH_SESSION_ADD_DIRS. The variable is on the list preserved on relaunch, next toCLAUDE_BG_SESSION_PERMISSION_RULES,CLAUDE_BG_WORKSPACE_TRUSTEDandCLAUDE_BRIDGE_REATTACH_SESSION. - Permission setup takes a new
relaunchSessionAddDirsinput and also readsaddDirsfrom the background session's permission rules. It adds those directories as session directories and merges any new ones into the session's list, returned asinheritedSessionDirectories. Directories passed with--add-dirstill count as command-line directories. - Sending a session to the background with the left arrow now includes
addDirsin its permission rules, not only its allow and deny rules. The agents dispatch now takes extra arguments from a helper instead of only--restricted.
Workspace trust (whether you have told Claude Code to trust a folder):
- When
claude --bgor/bgdispatches a session, the environment passed to it can now includeCLAUDE_BG_WORKSPACE_TRUSTEDset to1. This happens only when the launcher passes a trusted flag. - When a background or bridge session reattaches, Claude Code now checks whether trust is recorded for the directory. It also accepts
CLAUDE_BG_WORKSPACE_TRUSTEDwhen a path check passes. - If trust is missing, it logs "Workspace trust is not recorded for this directory; continuing as an untrusted session (hooks and project settings env stay off)". It then skips the steps that need trust: loading hooks held for trust, warming the recall index and watching memory. Before, these steps ran without a trust check.
- If the trust variable is absent, was dropped by the background service (
reattachEnvDropped), or the dispatch had to be rescued, a warning is logged. When the session is started from a shell, the warning is also printed to the terminal. It says the session started without the terminal's home-directory trust, "so hooks and project settings from your home directory stay off in it".
Why
Directories you added during a session are no longer lost when it moves to the background or relaunches. A reattached session no longer loads hooks (your own commands that run on events) or project settings without a trust decision. When trust does not carry over, you are told why those hooks and settings are missing instead of finding out by surprise.
New in this build: CLAUDE_RELAUNCH_SESSION_ADD_DIRS