{"version":"2.1.281","anchor":"session-scoped-add-dirs-carried-across-relaunch-via-claude-r","canonical_anchor":"session-scoped-add-dirs-carried-across-relaunch-via-claude-r","heading":"Background and relaunched sessions keep added directories and check workspace trust","tier":"notice","area":"Sessions","url":"https:\/\/changelogs.core-directive.com\/v\/2.1.281\/e\/session-scoped-add-dirs-carried-across-relaunch-via-claude-r","release_url":"https:\/\/changelogs.core-directive.com\/v\/2.1.281","markdown":"### Background and relaunched sessions keep added directories and check workspace trust\n\nDirectories added mid-session now survive a relaunch or background handoff, and reattached sessions run untrusted with a warning when trust is missing\n\n**What**\n\nA 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.\n\nAdded directories:\n\n- Directories you add during a session, for example with `\/add-dir`, are saved into the new environment variable `CLAUDE_RELAUNCH_SESSION_ADD_DIRS`. The variable is on the list preserved on relaunch, next to `CLAUDE_BG_SESSION_PERMISSION_RULES`, `CLAUDE_BG_WORKSPACE_TRUSTED` and `CLAUDE_BRIDGE_REATTACH_SESSION`.\n\n- Permission setup takes a new `relaunchSessionAddDirs` input and also reads `addDirs` from the background session's permission rules. It adds those directories as session directories and merges any new ones into the session's list, returned as `inheritedSessionDirectories`. Directories passed with `--add-dir` still count as command-line directories.\n\n- Sending a session to the background with the left arrow now includes `addDirs` in its permission rules, not only its allow and deny rules. The agents dispatch now takes extra arguments from a helper instead of only `--restricted`.\n\nWorkspace trust (whether you have told Claude Code to trust a folder):\n\n- When `claude --bg` or `\/bg` dispatches a session, the environment passed to it can now include `CLAUDE_BG_WORKSPACE_TRUSTED` set to `1`. This happens only when the launcher passes a trusted flag.\n\n- When a background or bridge session reattaches, Claude Code now checks whether trust is recorded for the directory. It also accepts `CLAUDE_BG_WORKSPACE_TRUSTED` when a path check passes.\n\n- 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.\n\n- 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\".\n\n**Why**\n\nDirectories 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.\n\n- Area: Sessions\n- Names: `CLAUDE_RELAUNCH_SESSION_ADD_DIRS`\n- Tier: You'll notice\n- Useful: 3\/5\n- Signal: 2\/5"}