[Bug] Resolved environment variables from settings files not exposed to Claude conversation context
Bug Description
Title: env vars from settings files are not available to Claude during conversation — local overrides silently lost
Problem:
Environment variables defined in settings.json / settings.local.json under the env key are injected into hook processes and shell commands, but Claude itself has no awareness of them
during conversation. When a skill references an env var to control behavior, Claude must manually read and parse the settings JSON files — and correctly apply the precedence rules — which
is fragile and easy to get wrong.
Reproduction:
- .claude/settings.json (committed, shared with team) defines:
{ "env": { "UPDATE_WORKSPACE_FIX": "false" } }
- .claude/settings.local.json (gitignored, personal override) defines:
{ "env": { "UPDATE_WORKSPACE_FIX": "true" } }
- A skill instructs Claude: "skip this step unless UPDATE_WORKSPACE_FIX=true is set in project settings env vars."
- Claude skipped the step, ignoring the user's local override entirely. It did not read either settings file — it just assumed the default value from the skill description.
Why this is hard to fix with workarounds:
Even if Claude is instructed (via CLAUDE.md or memory) to "always read settings files before checking env vars," it must:
- Know to read both settings.json and settings.local.json
- Know to also check ~/.claude/settings.json (user-level)
- Correctly apply the precedence order: managed > local > project > user
- Merge the env objects across all levels
This is reimplementing settings resolution logic that the harness already does — but only exposes to hooks and shell, not to Claude's conversation context.
Expected behavior:
The resolved env vars (after precedence merging across all settings scopes) should be surfaced to Claude as conversation context — similar to how CLAUDE.md content is automatically loaded.
For example:
Resolved env vars from settings:
UPDATE_WORKSPACE_FIX=true
COOK_DEVELOPER=true
This would let skills reliably gate behavior on env vars without Claude needing to reimplement settings resolution.
Impact:
Users who set personal overrides in settings.local.json have no way to ensure Claude respects them, short of telling Claude every session. The entire purpose of settings.local.json —
personal per-repo overrides that take priority over shared settings — is undermined for any env var that Claude (not a hook) needs to act on.
Environment Info
- Platform: win32
- Terminal: pycharm
- Version: 2.1.85
- Feedback ID: dd32dc48-3420-40da-8ffd-75f2e3c89620
Note: Content was truncated.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗