{"version":"2.1.307","anchor":"hooks-module-env-writes-restricted-by-host-rule","canonical_anchor":"hooks-module-env-writes-restricted-by-host-rule","heading":"Hooks can no longer set some environment variables","tier":"notice","area":"Hooks","scope":"individual","heads_up":true,"url":"https:\/\/changelogs.core-directive.com\/v\/2.1.307\/e\/hooks-module-env-writes-restricted-by-host-rule","release_url":"https:\/\/changelogs.core-directive.com\/v\/2.1.307","markdown":"### Hooks can no longer set some environment variables\n\nA hook's `$.env.set` is now refused for variables that only the starting environment or Claude Code itself may set\n\n**Unclear.** It is not stated which variables count as ones only the starting environment or Claude Code may set.\n\n**What**\n\nA hook is a script you set up to run at certain points while Claude Code works. Hooks can set environment variables, the settings passed to programs when they start, with `$.env.set`. Claude Code now refuses that for variables that only the environment Claude Code starts with, or Claude Code itself, may set. The error says so in those words. Before, the only check was against the list of variable writes found in the hook.\n\n**Why**\n\nSome hooks that set environment variables without trouble before will now get an error.\n\n- Area: Hooks\n- Tier: You'll notice\n- Useful: 2\/5\n- Signal: 2\/5\n- Scope: individual\n- Heads-up: yes"}