# Permission gate ordering and auto-mode fail-safe Status: accepted ## Context Parallel tool calls may each need a prompt, and auto mode layers rules, a classifier and an LLM judge. ## Decision - Prompts are serialized behind one lock; after waiting, the stored rules are re-checked because the previous answer (e.g. "always") may already cover this call. - In auto mode, dangerous calls are refused without a prompt, even when a stored "always" rule matches; safe calls run; the rest goes to the judge, then the user. - The judge is a cheap model; any failure or unusable answer means "ask the user", never "allow". ## Consequences A stored rule never overrides a danger block. Concurrent calls queue, so prompts are one at a time. Code: crates/hx-core/src/tool.rs (`gate`, `gate_result`), crates/hx-core/src/lib.rs (`ToolState` prompt lock), crates/hx-core/src/danger.rs (`Judge`)