Catch agent hallucinations before your users do.

Deterministic citation-span entailment, workspace AST symbol grounding, and surgical self-correction prompts in 0.128 ms P50 — zero LLM-as-a-Judge calls.

$ uvx --from git+https://github.com/codesphere-u/truthgate truthgate demo
Open Studio →
40-Scenario F1100.0%
False Positives0.0%
P50 Latency0.128 ms
P95 Latency0.347 ms

Demo Run: truthgate demo audits 4 claims in 1.200 ms, flagging TG003 (polarity flip), TG004 (4.28 ms vs 42.8 ms), and TG008 (missing verify_token_v2()).

Pure Python 3.11+ stdlib core · Stdio & HTTP/SSE MCP · FastAPI ASGI adapter Try Live Auditor 40-Scenario Proof

Catches Polarity Flips (TG003)

Detects omitted negations and antonym swaps like permitted vs prohibited or enabled vs disabled against cited RAG sources.

Stops Numeric Drift (TG004)

Matches decimals, percentages, latencies, and multi-currency literals (USD, UGX, EUR, ms) verbatim before decimal shifts slip through.

Grounds Files & AST Symbols (TG006–TG008)

Verifies referenced file paths, #Lstart-Lend line bounds, and Python AST / TS / JS / Go / Rust symbol tables directly against your repository.

Compiles Surgical Fixes (0.128 ms)

When verification fails, compiles a focused repair prompt naming only violating claims and exact ground-truth spans so agents fix errors in one hop.


Eight Deterministic Verification Gates

Citation entailment meets AST workspace symbol verification, exposed via CLI, Python SDK, REST API, and MCP.

TG001 Citation
TG002 Support
TG003 Polarity
TG004 Numbers
TG006 Paths
TG008 AST

Frequently Asked Questions

Why use TruthGate instead of an LLM-as-a-Judge guardrail?

LLM judges add 1–3 seconds of latency, extra API cost, and stochastic variance. TruthGate audits citations, negation flips, numeric drift, and AST symbols deterministically in 0.128 ms P50 with 100.0% precision and recall on its 40-scenario benchmark.

What rules does TruthGate check across text and code?

TG001–TG005 check phantom source IDs, IDF-weighted entity support, negation/antonym polarity inversions, numeric/currency drift, and uncited factual assertions. TG006–TG008 ground file paths, #Lstart-Lend ranges, and AST symbols.

Does TruthGate work as an MCP Server and HTTP Workbench?

Yes. Run truthgate mcp for Stdio JSON-RPC 2.0 MCP or truthgate serve-http for Streamable HTTP/SSE MCP, REST endpoints, Prometheus metrics, and the Workbench UI.