Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Gates

Gates are plugins that subscribe to before:* events and may veto them before the corresponding action takes effect. They are how Nexus enforces iteration limits, banned content, token budgets, schema validation, rate limits, and similar guardrails — without baking the policy into agents or providers.

Plugins

PluginVetoesPurpose
nexus.gate.endless_loopbefore:llm.requestCap LLM calls per turn (replaces agent max_iterations).
nexus.gate.stop_wordsbefore:llm.request, before:io.outputBlock messages containing banned terms.
nexus.gate.token_budgetbefore:llm.requestCap session token usage.
nexus.gate.rate_limiterbefore:llm.requestThrottle LLM call frequency (pause via gate.llm.retry, not reject).
nexus.gate.prompt_injectionbefore:llm.requestDetect and block prompt-injection patterns in user input.
nexus.gate.json_schemabefore:io.outputValidate output against JSON Schema; LLM-retry on failure.
nexus.gate.output_lengthbefore:io.outputCap response length; LLM-retry to compress.
nexus.gate.content_safetybefore:io.outputBlock or redact PII / secrets / sensitive content.
nexus.gate.context_windowbefore:llm.requestEstimate context size; trigger compaction when approaching the limit.
nexus.gate.tool_filterbefore:llm.requestModify the tool list (allowlist / blocklist).
nexus.gate.approval_policybefore:tool.invoke, before:llm.requestPolicy-driven HITL approvals; emits before:hitl.requested then hitl.requested and applies the operator’s allow/reject/edit.

Configuration

Every gate’s full YAML config — keys, types, defaults — is in the Configuration Reference.

Mechanics

The vetoable event system, priority ordering, and the shared gate.llm.retry pattern are documented in .claude/docs/gates.md. That document is the design-level reference; the configuration reference is the keys-and-defaults reference.