You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Feature]: let hooks receive selected environment variables (allowlist) so orchestrators can attribute events #4
I'm integrating Muse Code into Orca (an AI orchestrator that hosts CLI agents side-by-side, each in its own terminal pane/worktree, with live working/waiting/done status per pane). Orca installs managed status hooks (UserPromptSubmit/PreToolUse/PostToolUse/PermissionRequest/Stop) and attributes each event to a pane via an env var (ORCA_PANE_KEY) stamped into that pane's environment — the same mechanism Claude Code integrations use.
Problem
Muse Code runs hooks with a cleared environment. Verified against muse 1.0.3: a hook's environment contains only _ HOME LANG LOGNAME OLDPWD PATH PWD SHELL SHLVL TERM TMPDIR USER — every custom variable (including the pane identity) is stripped. The hook fires and its stdin payload is Claude-compatible and complete (hook_event_name, session_id, prompt, last_assistant_message, …), but the event cannot be attributed to a pane: cwd is shared across panes in one worktree, and matching on prompt text risks attributing status to the wrong pane, which is worse than no status.
Request
A per-hook (or settings-level) environment passthrough, e.g. an allowedEnvVars list on hook entries as Claude Code's HTTP hooks have, so orchestrators can pass a pane/session token through to their own hooks without weakening the cleared-environment default for everything else.
Verification notes
muse 1.0.3 (1.0.3-R2198.1), macOS arm64; hooks fire fine via both the settings.json hooks block and managed_hooks_path (same schema, no trust step — thank you).
muse hooks management CLI is absent in this binary, so there is currently no channel at all to convey per-pane identity to a hook.
Update after testing Muse Code 1.3.0: this appears fixed for managed hooks.
Using managed_hooks_path together with the new managed_hooks_env_vars setting, we verified that allowlisted values including ORCA_AGENT_HOOK_TOKEN, ORCA_AGENT_HOOK_ENDPOINT, ORCA_PANE_KEY, ORCA_TAB_ID, and ORCA_WORKTREE_ID reach the managed hook process. Real UserPromptSubmit and Stop payloads were successfully attributed to the correct Orca pane.
This resolves Orca’s managed-hook use case from #19188. We have not separately tested environment passthrough for inline user-defined hooks, so that portion remains unverified if parity with plain settings hooks is part of this issue’s scope.
(Originally posted 2026-09-16; reposted with internal references removed.)
This is tracked internally: a per-hook environment allowlist (managedEnvVars) is being implemented for managed hooks right now. We are confirming that the same allowlist is available to plain user-settings hooks, which is your case; if it turns out to be scoped to managed configuration only, a follow-up will cover the settings.json path. Your verification notes on 1.0.3 are accurate: hooks currently run with a cleared environment.
(Originally posted 2026-10-01; reposted with internal references removed.)
Thanks for testing this on 1.3.0 and confirming the managed-hook path works for Orca. You're right about the other part: managed_hooks_env_vars applies only to hooks loaded from managed_hooks_path. Inline hooks in settings.json and project hooks still get the cleared environment. Parity for those is tracked internally.
Until that lands, keep the hooks in a file referenced by managed_hooks_path. That works from your own settings.json, as you set it up. I'm leaving this open for the remaining part.
Activity
homesh-dev commentedon Sep 22, 2026
Update after testing Muse Code 1.3.0: this appears fixed for managed hooks.
Using
managed_hooks_pathtogether with the newmanaged_hooks_env_varssetting, we verified that allowlisted values includingORCA_AGENT_HOOK_TOKEN,ORCA_AGENT_HOOK_ENDPOINT,ORCA_PANE_KEY,ORCA_TAB_ID, andORCA_WORKTREE_IDreach the managed hook process. RealUserPromptSubmitandStoppayloads were successfully attributed to the correct Orca pane.This resolves Orca’s managed-hook use case from #19188. We have not separately tested environment passthrough for inline user-defined
hooks, so that portion remains unverified if parity with plain settings hooks is part of this issue’s scope.mjdouglas commentedon Oct 2, 2026
(Originally posted 2026-09-16; reposted with internal references removed.)
This is tracked internally: a per-hook environment allowlist (
managedEnvVars) is being implemented for managed hooks right now. We are confirming that the same allowlist is available to plain user-settings hooks, which is your case; if it turns out to be scoped to managed configuration only, a follow-up will cover the settings.json path. Your verification notes on 1.0.3 are accurate: hooks currently run with a cleared environment.mjdouglas commentedon Oct 2, 2026
(Originally posted 2026-10-01; reposted with internal references removed.)
Thanks for testing this on 1.3.0 and confirming the managed-hook path works for Orca. You're right about the other part:
managed_hooks_env_varsapplies only to hooks loaded frommanaged_hooks_path. Inlinehooksinsettings.jsonand project hooks still get the cleared environment. Parity for those is tracked internally.Until that lands, keep the hooks in a file referenced by
managed_hooks_path. That works from your ownsettings.json, as you set it up. I'm leaving this open for the remaining part.