ReasonGate is a self-hostable LLM safety gate that inspects content entering and leaving the model, returns an explainable allow / flag / block decision for each call, and generates machine-readable audit records. The open-source core is rule-based and mainly does four things: identify known prompt injection and jailbreak wording; restore obfuscation such as zero-width characters, homoglyphs, leet substitutions, letter spacing, and base64 before matching; scan for indirect injection before retrieved context and tool output reach the model; and check model output for secret leakage and planted canary tokens. These detections are combined in a pipeline, fusing multiple weak signals with a calibrated noisy-OR strategy. The project is pure Python, zero-dependency, makes no network requests, and serializes each decision into a structured record containing a decision ID, timestamp, action, score, and per-detector evidence.
Limitations must be emphasized: it cannot solve prompt injection, and signature matching can only intercept attacks with existing patterns, not recognize rewritten or semantically novel attacks. On deepset/prompt-injections, the rule core intercepts 13.3% of attacks on the held-out test set and 19.8% on the full corpus, with a 0.5% false positive rate; semantic recall depends on a separately authorized embedding detector, at about 88% on out-of-distribution data. The official recommendation is to use it as one layer of defense in depth, not as a boundary.
Action gating (ToolGate) targets agent tool calls, asking not "is this text an injection" but "given the trust level of the data that produced this action, is this action executable". It provides two explainable signals: argument contamination (the target of a sensitive call comes from untrusted content) and capability co-occurrence (a sensitive call is made when untrusted content is present and there is no trusted authorization). This feature requires explicitly declaring tool policies and calling the gate; the core Shield is unaffected.
reasongate-mcp is a stdio MCP gateway that can start a real server, forward messages, draft policies based on the server's tools/list schema, and reply to blocked tools/call itself in the form of a tool error. Usage example: in the configuration, follow -- with the original server command; for multiple servers, specify the same --session FILE for each entry. Related modes include taint (default), strict, vouch, and ask. --audit session.jsonl saves the full record, and reasongate-audit session.jsonl reads it back. The project provides an online demo https://reasongate-demo-nvgo.onrender.com , with no API key required.
It also provides PolicyGate for handing deployment policy to an optional model review; by default it does not review and returns "not evaluated" rather than allow; the reference reviewer requires an additional install of pip install "reasongate[judge]". The measurement data is based on AgentDojo, with specific values in RESULTS.md.