Skip to main content

render_claude_settings

Function render_claude_settings 

Source
pub fn render_claude_settings(
    compose: &Compose,
    h: AgentHandle<'_>,
) -> Option<String>
Expand description

Wrapper-managed Claude Code settings JSON for a single agent. Returns Some(json) for claude-code runtime regardless of permission_mode — the wrapper decides whether to apply it. Returns None for runtimes that don’t read Claude settings (codex, gemini, …).

The base payload is a single PreToolUse deny hook covering the synchronous-prompt tools that today strand a headless pane: AskUserQuestion, EnterPlanMode, ExitPlanMode. The systemMessage tells the model why the deny fired and points it at the team MCP tools as the headless-safe alternative — without that, the model just sees the call vanish and may retry. Matcher is a regex; extend it (rather than the hook count) when claude-code gains new synchronous- prompt tools.

#383 Phase 2: per-agent hooks declared in compose (Agent.hooks) are merged on top of that base. Each declaration is appended as its own entry under its event, so the built-in deny hook keeps its slot and a user hook can extend behavior but not clobber the interactive-prompt deny. Hook commands are compose-root-relative and rendered absolute.