{"version":"2.1.281","anchor":"claude-tmux-worktree-passes-a-sanitized-env-to-tmux-s","canonical_anchor":"claude-tmux-worktree-passes-a-sanitized-env-to-tmux-s","heading":"claude --tmux --worktree now checks managed policy, cleans its environment and forwards arguments correctly","tier":"use","area":"Worktrees","url":"https:\/\/changelogs.core-directive.com\/v\/2.1.281\/e\/claude-tmux-worktree-passes-a-sanitized-env-to-tmux-s","release_url":"https:\/\/changelogs.core-directive.com\/v\/2.1.281","markdown":"### `claude --tmux --worktree` now checks managed policy, cleans its environment and forwards arguments correctly\n\nLaunching with --tmux and --worktree now enforces managed policy, stops parsing at --, passes a clean env and makes path arguments absolute\n\n**Unclear.** The finding does not say which environment variables are kept or dropped when tmux is started.\n\n**What**\n\n`--worktree` starts Claude Code in a separate git worktree, which is a second working copy of your repository in its own folder. `--tmux` opens that session inside tmux, a terminal multiplexer. Claude Code has a shortcut (a fast path) for this combination, and it changed in several ways:\n\n- The shortcut now loads settings early and checks managed policy, meaning the rules an administrator sets. If policy refuses the launch, Claude Code exits with an error. Before, this shortcut only enabled config loading, and the other shortcuts already did this check.\n\n- tmux is now started with an explicit, cleaned-up set of environment variables (`extendEnv: !1`) instead of every variable inherited from your shell.\n\n- Claude Code stops looking for `--worktree` and `--tmux` when it reaches `--`. Flags that take a value are skipped with their value, so a value such as `-- --worktree` is no longer misread.\n\n- The arguments forwarded into the new tmux session are now built by a helper instead of an inline filter that copied everything except `--tmux` and `--worktree`.\n\n- Path arguments are rewritten to absolute (full) paths when they are forwarded. This covers `--settings`, `--mcp-config`, `--agents`, `--add-dir`, `--plugin-dir`, `--system-prompt-file`, `--append-subagent-system-prompt-file` and `--debug-file`. Inline JSON and paths starting with `~` are left as they are.\n\n- `--setting-sources` and `--managed-settings` are now recognised explicitly.\n\n**Why**\n\nThe session inside tmux runs in the worktree folder, not the folder you launched from. A relative path such as `--settings .\/my.json` would otherwise point at the wrong place, and absolute paths keep it pointing at the file you meant. The policy check means administrators' managed policy applies to this way of launching too.\n\n- Area: Worktrees\n- Names: `--tmux`, `--worktree`\n- Tier: Use it now\n- Useful: 2\/5\n- Signal: 1\/5"}