Skip to content

Move Claude-Code-only exports from shell.zsh into settings.json env #174

Description

@ooloth

Current state

Claude Code's configuration is split across two mechanisms, so no single file answers "how is Claude Code configured?" — and eight of its settings leak into every process in the shell rather than applying only to Claude Code. tools/claude/shell.zsh exports ANTHROPIC_DEFAULT_OPUS_MODEL, ANTHROPIC_DEFAULT_SONNET_MODEL, ANTHROPIC_MODEL, CLAUDE_CODE_DISABLE_BACKGROUND_TASKS, CLAUDE_CODE_ENABLE_TELEMETRY, CLAUDE_CODE_ENABLE_TASKS, DISABLE_ERROR_REPORTING, and DISABLE_TELEMETRY into the shell environment. All eight are read only by Claude Code. Meanwhile tools/claude/config/settings.json has no env block, even though the schema it declares on line 2 supports one.

Documentation:

Ideal state

  • tools/claude/config/settings.json has an env block holding the eight Claude-Code-only variables
  • None of those eight variables are exported from tools/claude/shell.zsh
  • A new shell has none of the eight in its environment; a Claude Code session has all eight
  • Claude Code behaves identically to before — same default models, same telemetry and error reporting state, same background-task and task-tracking behavior
  • The work-machine Vertex routing still applies on the work machine and still does not apply elsewhere
  • Reading settings.json alone tells you how Claude Code is configured, apart from machine-specific routing

Out of scope

  • The is_work Vertex block (ANTHROPIC_VERTEX_PROJECT_ID, CLAUDE_CODE_USE_VERTEX, CLOUD_ML_REGION) — it is conditional on which machine this is, and a static JSON file cannot express that branch. It stays a shell export.
  • The cc and ccy aliases — shell ergonomics, not agent configuration
  • tools/codex/shell.zsh, tools/gemini/, and tools/pi/shell.zsh — this issue covers Claude Code only
  • Changing any variable's value — relocation only

Starting points

  • tools/claude/shell.zsh — the eight exports, plus the is_work block that stays
  • tools/claude/config/settings.json — the destination; currently has no env key
  • tools/zsh/config/tools.zsh — how shell.zsh files get sourced, if the loading order turns out to matter

QA plan

  1. Before changing anything, open a new shell and run env | grep -E '^(ANTHROPIC_|CLAUDE_CODE_|DISABLE_)' — expect the eight variables, so you have a baseline to compare against
  2. After the change, open a new shell and run the same command — expect none of the eight, and on the work machine expect only the three Vertex variables
  3. Run claude -p 'Run this bash command and report its raw output: env | grep -E "^(ANTHROPIC_|CLAUDE_CODE_|DISABLE_)"' — expect all eight present inside the session with their original values
  4. Start an interactive session and run /status — expect the same model configuration as before the change
  5. Export one of the eight to a different value in the shell, then launch Claude Code and re-run step 3 — observe whether the shell value or the settings.json value wins, and confirm the result matches the precedence described in the settings documentation. If the shell wins, note it, since it means a stray export can silently override the config file
  6. On the work machine, start a session and send any prompt — expect it to succeed via Vertex, confirming the conditional block still applies
  7. On a personal machine, run env | grep VERTEX — expect no output

Done when

Claude Code's non-conditional configuration is readable from settings.json alone, with no Claude-Code-only exports left in tools/claude/shell.zsh.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions