Detection is free and runs entirely offline — no account, no key, nothing sent
anywhere. You need Python 3.11 or newer and uv.
git clone https://github.com/ywc668/rag-rollout-policy-gate cd rag-rollout-policy-gate uv sync --extra dev # install bash scripts/demo.sh # ingest, gate twice, diff, render report open out/report.html # the report
The demo ingests the bundled two-tenant corpus, runs the gate against two
permission snapshots, diffs the access surface across two embedding configurations, and renders the
HTML report. It leaves everything in out/.
uv run raggate ingest --corpus corpus --db out/gate.db
uv run raggate run --db out/gate.db --snapshot corpus/acl_snapshots/v2.yaml \
--scenarios corpus/scenarios --evidence out/evidence.jsonl # exit 1 = leaks found
uv run raggate diff --corpus corpus --snapshot corpus/acl_snapshots/v2.yaml \
--scenarios corpus/scenarios --out-jsonl out/diff.jsonl
uv run raggate report out/evidence.jsonl -o out/report.html --diff out/diff.jsonlThere is also raggate quickstart, which runs the gate on a bundled
sample and opens a report without any setup.
Two ways in, depending on whether you want to test your pipeline or your store.
Wrap your retriever — filters, reranking, query rewriting, all of it — behind one endpoint that
accepts a query, an identity and a top_k, and returns the chunks it would really
serve. Then run the gate against that endpoint.
This is the honest option: what gets tested is the pipeline you ship, including
any ACL filtering you already apply. The request and response shapes are documented in
docs/spec/retrieval-endpoint.md.
Ten adapters ship in the repository: sqlite-vec, Elasticsearch, OpenSearch, pgvector, Qdrant, Milvus, Weaviate, Redis, Azure AI Search, and one for a self-hosted RAG product. Ingest a corpus and gate it without writing any glue.
Relevance scores are recomputed locally as exact cosine, so a threshold means the same thing regardless of how the backend normalises its own scores.
| Input | What it is |
|---|---|
| Identities | The roster of principals that issue queries — an id and the tenant each belongs to. |
| A permission snapshot | Who may read which document, and group membership. Versioned, so you can gate a stale index against current policy. |
| Scenarios | An identity plus a query, and optionally the documents that would be a leak if returned. Ordinary questions work best — the useful ones are what a real user would actually ask. |
The corpus and scenario formats are plain YAML and JSON, kept deliberately backend-neutral.
The gate is a command with meaningful exit codes, which is the whole integration story.
| Exit code | Meaning |
|---|---|
0 | No leaks in the scenarios you ran. |
1 | At least one forbidden document reached the context window. Fail the build. |
2 | The run could not be trusted — bad arguments, an unreachable backend, a malformed response. Never confused with a clean result. |