[FEATURE] Split Startup and Runtime env in settings.json
Preflight Checklist
- [x] I have searched existing requests and this feature hasn't been requested yet
- [x] This is a single feature request (not multiple features)
Problem Statement
I often need to differentiate between the environment variables present at Claude Code startup and those actually required at runtime. Hooks and LLM requests can partially address this, but they don't trigger reliably every time.
Previously (at least through Claude Code v2.1.77), this wasn't an issue because settings.json was loaded after startup, allowing runtime overrides. However, as of Claude Code v2.1.114, that behaviour has changed, requiring me to manage these differences manually.
Proposed Solution
I'd like to propose adding a new field in settings.json (something like "runtime_env") that allows defining/redefining environment variables to be set within the Claude Code process after startup, rather than being inherited from the shell environment at launch time.
Alternative Solutions
Current workaround is using hooks, requests to LLM to change internal env var.
Priority
High - Significant impact on productivity
Feature Category
Configuration and settings
Use Case Example
Main reason is to hide CLAUDE_CODE_OAUTH_TOKEN env var.
Additional Context
_No response_
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗