build_settings_with_hooks

Function build_settings_with_hooks 

Source
pub fn build_settings_with_hooks(
    user_settings_content: Option<&str>,
    user_hooks_content: Option<&str>,
) -> Option<String>
Expand description

Build .claude/settings.json content with the auto-injected PreToolUse Bash hook (under the "hooks" key) that redirects Bash invocations into the streaming wrapper (agentmux-bashwrap exec). User-supplied settings.json (from the agent’s content_map["settings"]) is parsed and merged at the top level; user-supplied legacy hooks content (from content_map["hooks"]) is merged into settings.hooks.

File location matters. Claude Code reads project hooks from <project>/.claude/settings.json under the "hooks" key. A standalone .claude/hooks.json is NOT a Claude Code discovery location — that was the v0.33.804 streaming-bug root cause: the file was written but Claude never read it, so the PreToolUse hook never fired and live streaming silently failed.

See docs/specs/SPEC_STREAMING_BASH_RUNNER_2026_05_11.md §5 and Claude Code docs: https://code.claude.com/docs/en/hooks.md