Skip to main content

Valqore QED

A self-hosted policy and evidence kernel for AI-agent actions.

CI License Python Evidence format Docs

An agent proposes an action. qed decides ALLOW / BLOCK / REQUIRE_APPROVAL with deterministic rules. Every step is written to one Ed25519-signed, hash-chained evidence ledger that a third party can verify without trusting the instance that produced it.

No LLM in the decision path. No network in the kernel. Runs on your own hardware, including air-gapped.

Valqore QED — quod erat demonstrandum, which is the claim: a third party can verify what happened here without trusting the instance that recorded it. qed is the command, the import package and the repository.

It was called gate until 2026-10-08 — why the name changed

The name changed because "gate" is already a commercial product in this exact category, is not registrable for the thing it describes, and named the half of the product every competitor ships rather than the half that is hard to copy. The rename cost one commit and invalidated no evidence, because ADR-0006 had already taken the product name out of the hash domain separators in week 1 — which is why gate still appears in docs/adr/, CHANGELOG.md and two superseded spec literals, and nowhere else.

Licence: Apache-2.0. See LICENSE and NOTICE. What each channel serves, and what it does not. pip install valqore-qed installs the kernel, and pip install qed-verify the standalone verifier that checks a chain without it. docker run ghcr.io/valqore/qed:1.2.0 and the Helm chart at oci://ghcr.io/valqore/charts/qed are public and cosign-signed; docs/deployment.md carries the cosign verify line to check that with. brew install valqore/tap/qed works from a public tap holding three binaries whose checksums match the assets CI built — but those binaries are not code-signed or notarised, so macOS may refuse to run one until you clear it. deploy/qed.spec keeps UPX off so that signing stays possible; no release step signs anything yet. npm install valqore-qed resolves to a 0.0.0 stub that holds the name and nothing else: QED is a Python program and a JavaScript client has never existed. .github/workflows/release.yml still gates both publishing steps behind the PUBLISH_PYPI and PUBLISH_GHCR repository variables. That gate is no longer an embargo — it is what stops a v* tag from publishing because somebody cut it to test the pipeline. Which version an index serves is a question for the index, and never for this file.

What it does today, capability by capability, is under Status.

Quick start

python -m venv .venv && . .venv/bin/activate      # Windows: .venv\Scripts\activate
pip install -e ".[dev]" -e packages/qed-verify

qed --version                                     # confirms what you installed
qed demo

qed --version prints the version, whether it is a wheel or the single-file binary, and the interpreter — which is what a bug report needs and what tells you whether pip install valqore-qed has shadowed a clone. The number is also ENGINE_VERSION, stamped into every verdict this instance writes.

One command, no configuration: it generates a key, writes a qed.yaml, decides five proposals — a read, a destructive migration, an open security group, an unapproved egress and an agent nobody authorised — and verifies the chain it just wrote. It exits 0 although a BLOCK is in it, because the exit code of a demo is whether the demo ran. Everything lands in ./qed-demo (gitignored by the demo itself, every record marked dev); delete it when you are done.

Then the same thing by hand, which is what an adapter does:

qed keys init --dir .qed                         # Ed25519 evidence key, 0600
qed check examples/proposals/prod-db-drop.json --dir .qed
qed export --dir .qed --out chain.jsonl
qed-verify chain.jsonl --keys .qed/public --instance-id qed-local

The wheel also installs vqed as an alias for the same entry point, for a machine where qed is taken or ambiguous — it is also the name of a Unix text editor, the ancestor of ed. qed is the documented command and the import package; everything below is written with it.

qed check exit codes: 0 ALLOW, 2 BLOCK, 3 REQUIRE_APPROVAL, 1 error — but the default mode is shadow, and shadow always exits 0. The first run above prints REQUIRE_APPROVAL and exits 0, which is deliberate: a pipeline that failed in shadow mode would make shadow mode useless as a way to find out what a policy would do. docs/onboarding-shadow-to-enforce.md covers the three separate dials that all have to point at "enforce" before a BLOCK stops anything.

--instance-id is not decoration. It is the only check that ties an export to a particular instance; everything else the verifier does is self-referential, so a chain generated on a laptop with a fresh key passes without it. Omit it and the verifier now says bound to : NOTHING and names the check that did not run. The id must come from outside the file — and if you are the auditor rather than the operator, so must the public keys.

Put it in front of an MCP server

qed mcp --human you@example.com --env prod \
         --target-template 'db:{env}/{args.table}' \
         -- npx -y @some/mcp-server

The default mode is shadow: every tool call is decided and recorded, and nothing is stopped. Point your agent at qed mcp instead of the server, work for a week, then read what would have happened:

qed export --dir .qed --format oscal --out assessment.json

--human or --mandate is required. See docs/mcp-proxy.md for why.

Put it in front of your coding agent

qed install claude-code --human you@example.com

Every Bash, every file write, every MCP call and every skill then goes through the same kernel. A refused call comes back as deny with the rule ids; one that needs a person comes back as ask, which puts the question to whoever is at the terminal.

This adapter is advisory and always will be — whoever can edit the settings can delete the entry that calls it, so the chain records it as advisory and never claims the call could not have happened. docs/hooks.md has the hardening, and why an ALLOW verdict deliberately prints nothing at all.

Put it in front of your own function

from qed.sdk import Qed, guard

qed = Qed.from_env()


@guard(qed, target=lambda account_id, **_: f"crm:accounts/{account_id}", deletes=True)
def delete_account(account_id: str) -> None: ...

For the action that has no front: a function in your own application that charges a card or deletes a tenant. The decorator proposes before the call, raises QedBlocked or QedApprovalPending if the answer was no, runs the function, and reports what happened. A refused action never runs.

It fails closed by default, unlike the hook: an application has no human watching, so a QED it cannot reach must stop the action rather than wave it through. examples/sdk/ has governed LangGraph and CrewAI tools that run whether or not those frameworks are installed.

Put it in front of everything else

qed proxy --human you@example.com --env prod
HTTPS_PROXY=http://127.0.0.1:8888 HTTP_PROXY=http://127.0.0.1:8888 your-agent

The MCP proxy governs the tools an agent was given; this governs the rest -- the curl in a shell step, the SDK call in a script, the request an agent makes because something in its context told it to.

Read docs/http-proxy.md before relying on it, for one reason: a CONNECT tunnel is always recorded as advisory. QED decides whether the connection may be opened, but the request inside it is encrypted, so it cannot replace the credential and the agent is using its own. Plain HTTP is fully visible and fully brokered.

Run it on Postgres

# qed.yaml
evidence:
  store_env: QED_DATABASE_URL     # a URL has a password; name the variable
pip install 'valqore-qed[postgres]'   # or -e '.[postgres]' from a clone
export QED_DATABASE_URL=postgresql://user:pass@host/qed
qed keys init && qed serve

SQLite is the default and runs the whole product on one file. Postgres is for the case SQLite genuinely cannot serve: more than one replica sharing a chain, with exactly one of them holding pg_try_advisory_lock and appending (SPEC §15).

It is one store implementation, not two. Forty repository methods are written once and run against either backend, because two copies would be two implementations of the chain's append path and the day they drifted is the day the chain behaved differently depending on which database somebody deployed. tests/evidence/test_cross_backend.py writes the same records to both and asserts every hash, signature and payload matches byte for byte — because if they did not, an export from a Postgres deployment would fail verification against records written on SQLite, and nobody would notice until an auditor did.

Run more than one replica

helm install qed ./deploy/helm/qed   --set signingKey.existingSecret=qed-signing-key   --set replicaCount=3   --set evidence.backend=postgres   --set evidence.postgres.existingSecret=qed-db

Every replica serves the API and decides. The decider writes its record durably to an outbox and answers immediately; exactly one replica holds pg_try_advisory_lock(1734440037) and turns those records into chain entries afterwards (ADR-0009). So decision latency is independent of chain latency, and evidence_ref may be an outbox id until the leader catches up — GET /v1/evidence/by-ref/{ref} resolves either shape.

Kill the leader and its connection drops, the lock is released, and another replica takes over on its next tick. Nothing has to notice, announce or hand over. deploy/docker-compose.yml is the same arrangement on a laptop, if you would rather watch it happen than read about it.

The chart refuses replicaCount > 1 on SQLite. Two writers would read the same chain tip and either collide on the hash primary key — losing the evidence for a decision already delivered — or fork the chain, which still verifies record by record and has simply stopped being a chain. docs/deployment.md has the rest.

Run the API

qed serve --dir .qed --dev          # --dev skips adapter signatures; local only
curl -s localhost:8710/readyz | jq

/readyz answers 503 until there is a signing key and a way to authenticate adapters (SPEC §17). Without --dev, register one first:

qed adapters add mcp-proxy-ci --dir .qed    # prints the secret once
qed adapters list --dir .qed                # is the variable actually set?

Adapters sign each request; see docs/api.md for the signature and for how qed adapters rotate keeps the old secret working while a fleet restarts.

Put it in your pipeline

export QED_URL=https://qed.internal
export QED_ADAPTER_ID=adp_ci QED_ADAPTER_SECRET=...
qed check deploy-proposal.json

Exit 0 ALLOW, 2 BLOCK, 3 REQUIRE_APPROVAL — and 1 when QED could not decide at all, which is the distinction a pipeline cannot do without: a runner that could not reach the instance has not been refused anything, and reading that as an allow is the failure this whole project exists to prevent.

--server keeps the evidence signing key out of CI and the evidence itself alive after the job. Without an instance, --evidence-out qed-evidence.jsonl leaves the chain behind as an artifact anyone can check with the public key. docs/ci.md has the Actions workflow.

Status

All twelve weeks of the §22 build order are code-complete. The exit criteria that depend on people — two design partners in enforce mode, written auditor acceptance, 1,000 gated actions — are not met and are tracked separately; what follows is what the code does.

Evidence format 1.0 is frozen (ADR-0015). A record written under schema_version: "1.0" verifies under every later verifier, and the repository carries the records that prove it: tests/evidence/fixtures/evidence-format-1.0/ is a real export produced once and never regenerated, checked on every CI run. docs/evidence-format.md is the specification, with a conformance section for anyone writing a second verifier.

What works today:

Capability Entry point
Domain model (ActionProposal, Verdict, EvidenceRecord, mandates, budgets) qed/core/schemas.py
RFC 8785 (JCS) canonical JSON qed/core/jcs.py
Hash chain, Ed25519 signing, Merkle checkpoints qed/core/evidence/
Evidence ledger on SQLite or PostgreSQL, one implementation qed/infra/storage/
Policy loader, linter, predicates, engine qed/core/policy/
Deterministic blast-radius score (0–100) qed/core/policy/blast_radius.py
Baseline pack, 46 rules qed/core/policy/packs/agent-baseline/
Standalone verifier packages/qed-verify/
MCP proxy (stdio and Streamable HTTP), shadow mode qed/adapters/mcp/
HTTP forward proxy (CONNECT and plain HTTP) qed/adapters/http_proxy/
Claude Code hook + qed install qed/adapters/hooks/
Python SDK (@guard) qed/sdk/
Credential broker (env, file, Vault) qed/core/broker/, qed/infra/secrets/
HTTP API: /v1/proposals, /v1/evidence, /healthz, /readyz qed/api/
OSCAL 1.1.2 assessment-results export qed/core/evidence/export/oscal.py
Approvals: Slack Block Kit (a click resolved to an identified person, not a workspace member), CLI qed approve, POST /v1/approvals with an OIDC bearer qed/infra/channels/slack.py, qed/api/human_auth.py
Web approval pages — in the separate AGPL qed-ui package, which is not published. This wheel contains no UI and qed serve --ui mounts what it cannot supply qed/api/ui.py (the mount point, SPEC §19)
HA: evidence outbox + one chain leader on Postgres qed/infra/chain_drain.py, qed/api/leader.py
qed check --server and --evidence-out for CI docs/ci.md
Container, distroless and non-root deploy/Dockerfile
Single-file binary for Homebrew, no Python needed deploy/qed.spec
Helm chart and a two-replica compose stack deploy/helm/qed, deploy/docker-compose.yml
Key rotation (qed keys rotate), verifiable across the change qed/infra/keys/rotation.py
Retention and purge, with purge-then-verify qed/core/evidence/retention.py
Checkpoint anchors: file, S3 object-lock, git tag qed/infra/publishers/
Prometheus /metrics and OCSF SIEM events qed/api/routers/metrics.py, qed/infra/siem.py
Control catalogues for 10 frameworks, with honest coverage qed/compliance/packs/, docs/compliance.md
Signed catalogue import, air-gap, recorded in the chain qed/remote/packs.py, ADR-0012
Transparency-log anchor client, six values and no payload qed/remote/anchor.py, ADR-0013
Self-governance: qed's own admin ops behind an approval qed/core/admin.py, ADR-0014
Frozen evidence format 1.0 + conformance fixture and cross-version test docs/evidence-format.md, tests/evidence/fixtures/, ADR-0015
Landing page, one file, no external request landing/index.html
CLI: demo, keys, adapters, check, policy, export, verify, replay, serve, mcp, proxy, hook, install, login, token, mandate, approve, approvals, doctor, status, checkpoint, packs qed/cli.py

Not built yet: the Codex hook (its API is unconfirmed, SPEC §12.2), mode: mitm for the HTTP proxy, the remote.packs feed (the air-gap import is built; fetching a bundle from a URL is the same verification with a download in front of it), the anchor log itself (the client is built; the log is qed-cloud's, SPEC §24.2), and SPEC §19's live-stream and budget pages.

Measured, not estimated: p95 decision latency is 4.5 ms on SQLite and 10.6 ms on PostgreSQL, against SPEC §18's 50 ms target — though that budget is a claim about the disk, not about Python, and slow storage can blow through it. Throughput is 250–400 decisions/s per replica, so SPEC §22's "1k rps" is several replicas rather than one. docs/performance.md has the numbers, including the ones that are less flattering.

Documentation

qed.valqore.io — built from docs/ with mkdocs-material and deployed from CI on every push to main (mkdocs serve to read it locally). New here? docs/onboarding-shadow-to-enforce.md is the install path, in the order that keeps you able to roll back at every step — and it explains the three separate dials that all have to point at "enforce" before a BLOCK stops anything.

examples/README.md is the index of things that run.

Reading order

  1. QED_SPEC.md — the implementation specification (v0.3.1). Normative. (SPEC §20.1 calls this file SPEC.md; it is left under its original name because every inbound reference in this repository already spells it that way.)
  2. DESIGN_DECISIONS.md — ADR-001…008, accepted. Written in Turkish during the planning phase and superseded by the spec; kept because the public ADR index cites it as the record of what was decided before any code existed.
  3. docs/adr/ — decisions made while implementing, where the spec was silent.
  4. THREAT_MODEL.md — STRIDE, and twelve things qed does not protect against. Read that section first.
  5. docs/onboarding-shadow-to-enforce.md — getting from shadow to enforce.
  6. docs/evidence-format.md, docs/policy-language.md, docs/blast-radius.md.
  7. docs/mcp-proxy.md, docs/http-proxy.md, docs/hooks.md, docs/credential-broker.md, docs/delegation.md, docs/approvals.md, docs/api.md, docs/oscal.md, docs/assurance-classes.md, docs/compliance.md, docs/policy-testing.md.
  8. Running it: docs/deployment.md (process, container, Helm, HA, releasing), docs/ci.md (qed check in a pipeline), docs/checkpoints.md (anchors), docs/siem.md (OCSF), docs/performance.md (what it actually costs) and docs/validation.md (what a green test suite cannot see).

The planning-phase architecture draft that preceded the spec is superseded and is not distributed; QED_SPEC.md is the only normative document.

Invariants (enforced by tests, not by convention)

Invariant Test
qed.core imports no HTTP client and no socket tests/core/test_no_network.py
qed.core imports no model SDK tests/core/test_no_llm.py
Decisions are independent of rule file order tests/policy/test_golden.py
Same inputs produce byte-identical verdicts tests/policy/test_engine.py
Tamper, delete, reorder in the chain are all detected tests/evidence/test_chain.py
Records verify after their payload is purged tests/evidence/test_chain.py
Ed25519 only — no HMAC path exists anywhere tests/evidence/test_no_hmac.py
The CLI and POST /v1/proposals decide identically tests/api/test_proposals.py
Every /v1 route refuses an unsigned request tests/api/test_auth.py
Masking never rewrites a kernel-generated identifier tests/masking/test_masking.py
No package shadows a standard-library module tests/test_no_stdlib_shadowing.py
The hook never emits allow, and never exits 1 tests/adapters/test_claude_code_hook.py
import qed.sdk loads no web framework tests/sdk/test_sdk_is_light.py
One signing implementation, shared by signer and verifier tests/sdk/test_sdk_is_light.py
SQLite and PostgreSQL produce byte-identical chains tests/evidence/test_cross_backend.py
No SQL string breaks the ? → %s conversion tests/evidence/test_store_dialects.py
An adapter's execution_result records the enforcement its proposal did tests/adapters/http_proxy/test_proxy_e2e.py
The OSCAL export validates against the NIST schema tests/evidence/test_oscal_schema.py
Tool-call classification imports nothing that can fail tests/adapters/test_import_boundary.py
A destructive payload under a mild tool name still routes to approval tests/policy/test_golden_mcp.py
A mandate's signature is verified before it reaches the engine tests/delegation/test_mandate_is_verified_at_runtime.py
Records frozen under schema_version 1.0 still hash and verify tests/evidence/test_frozen_format.py
A schema_version bump fails CI until it has a fixture tests/evidence/test_frozen_format.py
Every path a document cites exists tests/docs/test_claims.py
Every number on the landing page is derived from its source tests/docs/test_landing.py

Development

ruff check . && ruff format --check .
mypy
pytest

pytest runs the full suite; -m "not slow and not perf" is what CI's matrix runs on four cells, and the perf marker is separated because a timing assertion measures the host as well as the code (docs/performance.md).

Every commit needs a Signed-off-by line — git commit --signoff. CI enforces it on every commit in a pull request, and a commit without it cannot merge.

The project

Contributing, and the DCO CONTRIBUTING.md
Who may merge, and what is in scope GOVERNANCE.md
Reporting a vulnerability — not as an issue SECURITY.md
Twelve things qed does not protect against THREAT_MODEL.md
What a green test suite cannot see docs/validation.md
Code of conduct CODE_OF_CONDUCT.md
Licence LICENSE, NOTICE

Found a claim in this repository that overstates what the code does? There is an issue template for exactly that (.github/ISSUE_TEMPLATE/overclaim.yml), and it is the most useful issue you can open here.

Metadata

Release files for valqore-qed 1.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for valqore-qed 1.2.0
File Size Uploaded Provenance Actions
valqore_qed-1.2.0.tar.gz 413.9 kB With provenance Details for valqore_qed-1.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for valqore-qed 1.2.0
File Interpreter ABI Platform Actions
valqore_qed-1.2.0-py3-none-any.whl Python 3 none any Details for valqore_qed-1.2.0-py3-none-any.whl

Total release size: 873.8 kB

Release files / valqore_qed-1.2.0.tar.gz

Download URL valqore_qed-1.2.0.tar.gz
Size 413.9 kB
Tags Source
SHA-256 checksum
How to use checksums
8d5d49b537094038e00703fe13b7784ce8033a5d67577262d751b2f14e157bae
BLAKE2b-256 checksum
How to use checksums
ac89b56d16e37e8c1be40058d87b46ecf54504c8f100718d4c5c9daaf2b890a8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 14, 2026.

Transparency log

Release files / valqore_qed-1.2.0-py3-none-any.whl

Download URL valqore_qed-1.2.0-py3-none-any.whl
Size 459.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
159dec10115fa5bbd30957cf799f6d2ab95be6d789d36f36fd89b796079afcee
BLAKE2b-256 checksum
How to use checksums
b5a209ca56771ab70912cf6dfe6a33911a3fada5b115c314481d7b2e7ddab748
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 14, 2026.

Transparency log

Security for valqore-qed 1.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for valqore_qed-1.2.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 14, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page