Source (maintainer, 2026-06-09)
I have two Claude installations. One is the usual with subscription. Another uses a different config. There is a .claude folder that sets up the second config. You can set up a config directory and then point to this directory and it starts a different session. I want to use that. For Claude, especially for the second one, we also need to be resetting some variables in the same way we do for OpenCode. For all Claude sessions we unset these variables and then we can have the default one and then we can have profiles. These profiles can be configured in the host configuration. As a follow-up, do similar for Codex.
Background
Claude Code supports CLAUDE_CONFIG_DIR to point to a different config directory. The maintainer has two profiles:
- Default (
~/.claude/) — normal Anthropic subscription
- Z.AI (
~/.zlaude/) — uses ANTHROPIC_AUTH_TOKEN, ANTHROPIC_BASE_URL="https://api.z.ai/api/anthropic", and model overrides (glm-5.1, glm-5-turbo)
The setup lives in ~/git/.claude/configure.sh which creates the ~/.zlaude profile.
We already strip 71 API key env vars for OpenCode sessions (SessionTypePickerSheet.OPENCODE_ENV_UNSET_VARS). The same pattern should apply to Claude Code sessions — unset all provider API keys so the profile's own credentials are used, not leaked env vars from the host.
Scope
1. Env var stripping for Claude Code sessions
- When launching a Claude Code session, unset the same provider API key env vars we unset for OpenCode (all 71 vars from
OPENCODE_ENV_UNSET_VARS)
- This ensures Claude Code uses its own credentials from
CLAUDE_CONFIG_DIR, not leaked host env vars
- The env strip should be the default for ALL Claude Code sessions, not just the second profile
2. Agent profiles in host configuration
- Add a "Claude Code profiles" section to the host configuration (per-host, not global)
- Each profile has:
- Name (e.g., "Default", "Z.AI")
- Config directory path on the remote host (e.g.,
~/.claude, ~/.zlaude)
- When launching a Claude session with this profile, set
CLAUDE_CONFIG_DIR=<path> before the claude command
- Default profile: no
CLAUDE_CONFIG_DIR override (uses Claude Code's default ~/.claude)
- Session type picker shows available profiles for Claude when creating a new session
3. Session creation flow
- In the session type picker, when "Claude Code" is selected, show a profile selector (dropdown or chip row) if multiple profiles are configured
- The selected profile determines the
CLAUDE_CONFIG_DIR env var set before launch
- The env var strip (all provider keys) is always applied regardless of profile
Acceptance criteria
Non-goals
- Codex profile support (separate follow-up issue)
- Profile sync between Android device and remote host (profiles reference remote paths)
- Creating/managing profiles on the remote host from the app (assume they exist)
- OpenCode profile support (OpenCode already works differently with its SQLite config)
Files
app/src/main/java/com/pocketshell/app/projects/SessionTypePickerSheet.kt — add profile selector, env strip for Claude
shared/core-storage/src/main/java/com/pocketshell/core/storage/entity/HostEntity.kt — add profile fields
app/src/main/java/com/pocketshell/app/hosts/AddEditHostViewModel.kt — profile editing in host form
app/src/main/java/com/pocketshell/app/projects/FolderListGateway.kt — launch command composition with profile
Refs
~/git/.claude/configure.sh — existing profile setup script (zlaude)
~/.zlaude/settings.json — Z.AI profile config (ANTHROPIC_AUTH_TOKEN, ANTHROPIC_BASE_URL)
- Claude Code env vars docs —
CLAUDE_CONFIG_DIR documentation
SessionTypePickerSheet.OPENCODE_ENV_UNSET_VARS — existing 71-var env strip pattern
Source (maintainer, 2026-06-09)
Background
Claude Code supports
CLAUDE_CONFIG_DIRto point to a different config directory. The maintainer has two profiles:~/.claude/) — normal Anthropic subscription~/.zlaude/) — usesANTHROPIC_AUTH_TOKEN,ANTHROPIC_BASE_URL="https://api.z.ai/api/anthropic", and model overrides (glm-5.1,glm-5-turbo)The setup lives in
~/git/.claude/configure.shwhich creates the~/.zlaudeprofile.We already strip 71 API key env vars for OpenCode sessions (
SessionTypePickerSheet.OPENCODE_ENV_UNSET_VARS). The same pattern should apply to Claude Code sessions — unset all provider API keys so the profile's own credentials are used, not leaked env vars from the host.Scope
1. Env var stripping for Claude Code sessions
OPENCODE_ENV_UNSET_VARS)CLAUDE_CONFIG_DIR, not leaked host env vars2. Agent profiles in host configuration
~/.claude,~/.zlaude)CLAUDE_CONFIG_DIR=<path>before theclaudecommandCLAUDE_CONFIG_DIRoverride (uses Claude Code's default~/.claude)3. Session creation flow
CLAUDE_CONFIG_DIRenv var set before launchAcceptance criteria
CLAUDE_CONFIG_DIRbefore theclaudecommandNon-goals
Files
app/src/main/java/com/pocketshell/app/projects/SessionTypePickerSheet.kt— add profile selector, env strip for Claudeshared/core-storage/src/main/java/com/pocketshell/core/storage/entity/HostEntity.kt— add profile fieldsapp/src/main/java/com/pocketshell/app/hosts/AddEditHostViewModel.kt— profile editing in host formapp/src/main/java/com/pocketshell/app/projects/FolderListGateway.kt— launch command composition with profileRefs
~/git/.claude/configure.sh— existing profile setup script (zlaude)~/.zlaude/settings.json— Z.AI profile config (ANTHROPIC_AUTH_TOKEN, ANTHROPIC_BASE_URL)CLAUDE_CONFIG_DIRdocumentationSessionTypePickerSheet.OPENCODE_ENV_UNSET_VARS— existing 71-var env strip pattern