What
A new environment variable, CLAUDE_CODE_ATTACHMENTS_IN_USER_DATA, sets up a way for remote sessions to keep attachments (files sent into the conversation) in a folder under a user-data root. An environment variable is a named setting passed to a program when it starts. The variable is new in this build and has been added to two lists of variables Claude Code passes through.
- At startup, the routine runs only when both
CLAUDE_CODE_ATTACHMENTS_IN_USER_DATAandCLAUDE_CODE_REMOTE_SESSION_IDare set. - It checks your organization's data-retention policy first. If the retention exemption is disabled it backs off with the reason
retention_governed. If the retention state cannot be determined it backs off withretention_unknown. In both cases the feature is recorded as not used. - It then checks that the user-data root is usable. If so, it looks for the session's existing attachment folder and how many files it holds.
- Saving an attachment into that folder now opens each part of the path one step at a time. It refuses symbolic links (shortcuts to other locations) and folders not owned by the current user, and checks whether the file system honours the "do not follow links" option.
- When a save is refused, it fails with
nothing was saved: the attachments folder cannot be used. Before, the folder was created with a plainmkdirand the file written directly.
Why
The feature is off unless the variable is set, and it steps aside for organizations under retention rules. The stricter save path guards against an attachment being redirected somewhere unexpected, but it can make saves fail in unusual setups, such as folders owned by another user.
New in this build: CLAUDE_CODE_ATTACHMENTS_IN_USER_DATA