Private directories the bridge owns: the empty working directory of each claude process, and the debug log directory.
Everything lives under one base directory, <tmp>/minga-claude-bridge-<home uid>, created with mode 0700. Before it uses any of these directories, ensure_private_dir/1 checks that it is a real directory (not a symlink) owned by the current user, then sets its mode to 0700. A base that fails the check is an error, never repaired, because another user may control it.
A session directory is <base>/sessions/<key>. create/2 removes a stale directory with the same key first, so the child always starts in an empty directory. Claude Code stores sessions under ~/.claude/projects, keyed by the working directory path, so a stable key per conversation keeps --resume working across restarts.
Summary
Functions
Returns the base directory path for tmp_dir. Does not create it.
Creates the empty working directory for session key under base and returns its path. key may hold only letters, digits, -, and _.
Creates (if needed) and checks a 0700 directory owned by the current user.
Returns a random session key.
Removes a session directory. Safe to call more than once.
Types
Functions
Returns the base directory path for tmp_dir. Does not create it.
Creates the empty working directory for session key under base and returns its path. key may hold only letters, digits, -, and _.
Creates (if needed) and checks a 0700 directory owned by the current user.
@spec random_key() :: String.t()
Returns a random session key.
@spec remove(Path.t() | nil) :: :ok
Removes a session directory. Safe to call more than once.