Repository avatar
AI Tools
v0.1.2
active

axiom-gate

io.github.Impius-Lab/axiom-gate

Fail-closed MCP tool firewall in Rust with Wasm sandbox, <2k LoC proof checker, and host-only keys.

Documentation

AXIOM Gate — Fail-Closed Proof-Carrying AI Agent Tool Firewall

AXIOM Gate MCP server quality score on Glama

Give AI agents real tools without trusting them with your keys, filesystem, or bank account.

AXIOM Gate live CLI transcript

AXIOM Gate (v0.1.1) sits between any untrusted LLM (Claude Desktop, Cursor, VS Code, Antigravity, OpenAI, Anthropic, LangChain, Vercel AI) and your production actions. Instead of relying on probabilistic prompt guardrails, every tool call passes through 6 deterministic, fail-closed software locks — backed by a frozen < 2,000 LoC Proof-Carrying Code attestation checker (axiom-tcb), a fuel-metered pure-Rust Wasm32-WASI sandbox (wasmi), and a zero-secret host credential broker.

Open-Core License: MIT / Apache-2.0 Core (Permanent) + Source-Available Commercial Pro Packs — the verification runtime, frozen TCB, CLI, MCP server, SDKs, audit export, Local Gate Studio, 10-vector Attack Arena, and Core 4 tools are MIT / Apache-2.0 forever ($0). Commercial Pro Packs (tools/pro_*) are source-available for audit and governed by COMMERCIAL-PRO-LICENSE.md.


Zero-Compile Install (30 Seconds)

Prebuilt v0.1.1 binaries are published for macOS (arm64 / x86_64), Linux (x86_64), and Windows (x86_64) with SLSA Build Level 2 provenance (GitHub Artifact Attestations / slsa.dev/provenance/v1) + CycloneDX SBOM and verified SHA256SUMS.txt. (Linux aarch64 builds cleanly from source via Cargo.)

macOS (arm64 / x86_64) & Linux (x86_64) — SHA-256 verified release binary:

curl -fsSL https://github.com/Impius-Lab/axiom-gate/releases/latest/download/install.sh | sh

Windows (x86_64) PowerShell — SHA-256 verified release binary:

irm https://github.com/Impius-Lab/axiom-gate/releases/latest/download/install.ps1 | iex

Homebrew (macOS / Linux x86_64) or npx (Node 18.18+):

brew install impius-lab/tap/axiom-gate
# or run directly via npm without a global install:
npx -y @impius/axiom-gate --version

15-Second Independent TCB Audit (from source):

cargo test -p axiom-tcb
# Verifies frozen < 2,000 LoC (1,969 total src lines, 1,764 code LoC),
# zero unsafe in our workspace crates, and 0 solver/compiler/async/network deps
# (4 audited crypto/JSON crates: ed25519-dalek, blake3, serde, serde_json)

Runtime vs. Authoring Split (Zero Z3 at Runtime)

PhaseCommandsRequires Z3?External Network?
Production Runtime, Arena & Verificationaxiom-gate verify, run, arena, mcp-serve, pack verify-license, audit verify, audit export, studioNo (Zero Z3)No (100% Offline)
Tool Authoring & Policy Signingaxiom-gate sign, axiom-gate init (when compiling & signing fresh .axiom sources)Yes (Tier 1 Z3 ens proofs at sign time)No (100% Offline)

Honest v0.1 Verification & Runtime Trust Boundary

We keep the trust boundary explicit rather than hiding it behind marketing slogans:

  • Sign-time formal verification (axiom-gate sign): Tier 1 Z3 verifies each .axiom tool's ens return contracts against its AST before signing.
  • Frozen verification core (crates/axiom-tcb): 1,764 code LoC (1,969 total src lines across 14 files), zero unsafe in our workspace crates (transitive crypto/OS crates such as blake3, curve25519-dalek, and libc use unsafe internally), and 0 solver/compiler/async/network deps (4 audited crypto/JSON crates: ed25519-dalek, blake3, serde, serde_json — zero AXIOM language parser, compiler, or SMT solver in the TCB; JSON manifest parsing uses serde_json). At runtime, axiom-tcb verifies Ed25519 signatures, static capability subsets (observed_effects <= allowed_capabilities), gas caps, and compact v0.1 Edinburgh LF attestation bundles bound to BLAKE3(BinWire).
  • Runtime execution TCB (v0.1): Compiling verified .axiom sources to Wasm32-WASI and enforcing the sandbox/egress boundary also places axiom-codec, axiom-mlir, wasmi 2.0, and rustls inside the runtime execution trust boundary.
  • Roadmap: Precompiled .wasm digest pinning (removing axiom-codec/axiom-mlir from runtime startup) and full non-tautological structural LF body proofs covering WASI/string operations (beyond compact v0.1 attestation bundles) are explicit roadmap milestones.

Why AXIOM Gate?

GuaranteePrompt GuardrailsDocker ContainersPython WrappersAXIOM Gate (v0.1)
Tool-boundary enforcement under prompt injectionProbabilistic text filterOS container onlyMutable runtime regex/AST6 deterministic fail-closed software locks
Per-call boundary latency200–1,500 ms150–900 ms cold start5–40 ms7.01 ms p50 warm MCP (256 us cached Lock 2, 1.48 ms Wasm exec); 17.55 ms median cold verify
API key & secret isolationVisible to agent envVisible inside containerShared host heap memoryHost-only TLS 1.2/1.3 (rustls) WASI egress broker
Business-logic ceilingsNatural-language rulesNo logic visibilityAd-hoc unit testsSign-time Z3 ens contracts + host-pinned args + deterministic Wasm guards
Verification TCBBillions of parametersLinux kernel + containerdCPython + dependency tree1,764 code LoC (1,969 src lines), zero workspace unsafe, 4 crypto/JSON crates (runtime execution also trusts axiom-codec, axiom-mlir, wasmi, rustls)
Compliance audit trailUnverified logsContainer stdoutMutable application logsBLAKE3 hash-chained Ed25519 receipts (audit export free in Core)

The 6-Lock Fail-Closed Software Architecture

flowchart LR
    LLM["Untrusted AI Agent<br/>(MCP / Python / TS SDK)"] --> L1["Lock 1: Ed25519 Signed Policy<br/>Keyring &amp; Offline License (E0730/E0734)"]
    L1 --> L2["Lock 2: Frozen &lt;2,000 LoC TCB<br/>LF Attestation &amp; Cap Check (E0711/E0302)"]
    L2 --> L3["Lock 3: BLAKE3 Digest Pins<br/>Policy == Manifest == BinWire + PCC (E0731)"]
    L3 --> L4["Lock 4: Strict JSON Schema,<br/>Anti-Cap/Pin Spoof &amp; Rate Limit (E0732/E0733)"]
    L4 --> L5["Lock 5: Fuel-Metered Wasm32-WASI,<br/>FS Jail &amp; TLS 1.2/1.3 Host Broker"]
    L5 --> L6["Lock 6: BLAKE3 Hash-Chained<br/>Ed25519 Audit Receipt (audit_ledger.jsonl)"]
  1. Lock 1 — Signed Policy Keyring & Offline License (E0730, E0734): Verifies the RFC 8785 canonical gate.policy.json Ed25519 signature (strict verify_strict, weak-key rejection) against your pinned organization keyring (--pubkey, fail-closed by default when empty unless explicit --allow-unpinned-dev is set) and verifies offline GATE-PRO-V1 licenses for commercial Pro Packs.
  2. Lock 2 — Frozen < 2,000 LoC Attestation Checker (E0711, E0302): crates/axiom-tcb verifies the Ed25519 Human Trust Manifest (.trust.jsonld), compact v0.1 Edinburgh LF attestation bundle (.pcc.json), static capability subset (observed_effects <= allowed_capabilities), and gas cap — with zero Z3, zero LLVM, zero AXIOM language parser, zero workspace unsafe, and only 4 audited crypto/JSON crates (ed25519-dalek, blake3, serde, serde_json).
  3. Lock 3 — Cryptographic Artifact Hash Pins (E0731): Enforces signed pcc_blake3, trust_manifest_blake3, and policy.module_blake3 == manifest.module_hash == BLAKE3(BinWire) plus signer-identity equality (bundle.manifest.author_public_key == policy.signer_public_key) so swapped bundles or modified .axiom sources fail closed before execution.
  4. Lock 4 — Strict Schema, Anti-Cap<...> / Anti-Pin Spoofing, Host State & Rate Limiting (E0732, E0733): Unforgeable Cap<"..."> handles, Ed25519-signed pinned_args (financial ceilings, allowlisted base URLs, journal paths), and jailed host_state_args (host-managed risk counters stored in segregated data/state/, strictly disjoint from every tool's fs.write allow_dirs) are stripped from the LLM-facing schema and injected solely by the Rust host. Spoofed capability/pinned arguments and excess per-minute calls fail closed before Wasm execution.
  5. Lock 5 — Fuel-Metered Wasm32-WASI, Contract Guards & Zero-Secret Host Broker (E0201, E0712, E0726, E0727):
    • Executes pure .axiom tools inside pure-Rust wasmi 2.0 linear memory with deterministic fuel metering, bounded StoreLimits, and per-call host I/O caps.
    • Enforces sign-time Z3-verified ens return contracts alongside deterministic Wasm runtime guards (secret/PII redaction, file-extension allowlists, outbound credential blocks).
    • Enforces canonicalized filesystem jails blocking ../, rooted paths, Windows mixed-slash UNC paths (/\, \/), DOS device names, symlinks, and NTFS junctions (FILE_ATTRIBUTE_REPARSE_POINT).
    • Enforces exact (scheme, method, host:port, path_prefix) HTTP/HTTPS route allowlists, full RFC 6890 non-global SSRF IPv4/IPv6 blocking (169.254.169.254, RFC 1918, loopback, CGNAT, tunneling ranges), redirect-escape rejection, and host-only TLS 1.2/1.3 (rustls) secret header injection inside the Rust host WASI egress handler (zero secret bytes ever enter Wasm guest memory, tool outputs, or audit logs, with runtime echo scrubbing and zeroize).
  6. Lock 6 — Tamper-Evident Audit Ledger (audit_ledger.jsonl): Every allowed or blocked invocation appends a BLAKE3 hash-chained, Ed25519-signed AuditReceipt (with OS file locking + sync_data()) verifiable offline (--expected-head / --min-entries for tail-truncation protection) and exportable free in Core to standalone HTML or JSON compliance reports.

Quickstart (axiom-gate)

AXIOM Gate fails closed when no trusted --pubkey is pinned (pass --allow-unpinned-dev only for local throwaway testing). Pass --pubkey ./projects/axiom_gate/policies/demo_org.pub to verify against the bundled demo organization key:

# 1. Verify a pre-signed policy + frozen TCB attestation bundle offline (Zero Z3)
axiom-gate verify \
  --policy ./projects/axiom_gate/policies/secret_safe_reader.gate.policy.json \
  --pubkey ./projects/axiom_gate/policies/demo_org.pub \
  --json

# 2. Execute a signed tool through all 6 locks and append a signed receipt
axiom-gate run \
  --policy ./projects/axiom_gate/policies/secret_safe_reader.gate.policy.json \
  --pubkey ./projects/axiom_gate/policies/demo_org.pub \
  --args '{"path":"orders_sample.txt","max_chars":2048}' \
  --ledger ./audit_ledger.jsonl \
  --json

# 3. Run all 10 live adversarial prompt-injection & policy attacks (offline, Zero Z3)
axiom-gate arena --json

# 4. Verify the BLAKE3 + Ed25519 audit chain offline and export a free Core compliance report
#    (Pass --key <receipt.key.json> across multiple CLI `run` calls to keep one consistent signer)
axiom-gate audit verify --ledger ./audit_ledger.jsonl --json
axiom-gate audit export --ledger ./audit_ledger.jsonl --out ./compliance_report.html

# 5. (Optional, requires Z3 at signing time) Scaffold & sign a fresh org workspace
axiom-gate init ./my-agent-gate

Measured v0.1.1 Performance Benchmarks

Measured on release axiom-gate.exe (Windows x86_64, zero Z3 installed at runtime):

WorkloadMeasured LatencyBreakdown / Notes
Warm pooled MCP stdio tools/call (secret_safe_reader, orders_sample.txt)7.01 ms p50 (6.88–7.78 ms across 5 warm calls)Cached digest-rehashed Lock 2: 256 us p50 (217–308 us); inner Wasm exec_ms: 1.48 ms p50 (1.43–1.86 ms). initialize: 6.39 ms; 1st cold-compile call: 56.25 ms.
Cold uncached axiom-gate verify --json (all 7 policies, --pubkey demo_org.pub)17.55 ms median tcb_verify_us (17.26–18.22 ms; 42.2–45.7 ms CLI wall)Full .pcc.json JSON parse + strict Ed25519 + LF attestation check. (Isolated synthetic axiom-tcb unit microbenchmarks: 43.3 us Tier 1 / 68.7 us Tier 3 multi-step mean.)
Cold one-shot CLI axiom-gate run --json (secret_safe_reader, orders_sample.txt)67.15 ms CLI wall17.48 ms uncached Lock 2 + 1.98 ms Wasm exec (930,478 fuel). Blocked ../../.env: 66.88 ms wall (0.91 ms exec). Blocked $99,999 refund: 17.82 ms Lock 2 + 0.82 ms exec (4,329 fuel).
Offline zero-Z3 axiom-gate arena --json (all 10 vectors)2,083.4 ms total (2,093.8 ms wall)10/10 blocked (all_passed: true), 0 Z3 errors. Per-scenario exec_ms: 0.15–1.12 ms; cached Lock 2: 117–165 us.
Large file + multi-line PEM redaction (4,286 B file)8.74 ms execFull multi-line RSA private key + sk-proj- + hyphenated PAN + email redacted; 0 Wasm traps, 0 leaks.

Connect MCP Clients (Claude, Cursor, VS Code, Antigravity)

Generate a ready-to-paste client configuration automatically (auto-pinning --pubkey when an organization .pub key is present):

axiom-gate mcp-config --client claude      --policy-dir ./projects/axiom_gate/policies --ledger ./audit_ledger.jsonl
axiom-gate mcp-config --client cursor      --policy-dir ./projects/axiom_gate/policies
axiom-gate mcp-config --client vscode      --policy-dir ./projects/axiom_gate/policies
axiom-gate mcp-config --client antigravity --policy-dir ./projects/axiom_gate/policies

Example claude_desktop_config.json / .cursor/mcp.json:

{
  "mcpServers": {
    "axiom-gate": {
      "command": "axiom-gate",
      "args": [
        "mcp-serve",
        "--transport", "stdio",
        "--policy-dir", "./projects/axiom_gate/policies",
        "--pubkey", "./projects/axiom_gate/policies/demo_org.pub",
        "--ledger", "./audit_ledger.jsonl"
      ],
      "env": {
        "STRIPE_API_KEY": "sk_live_kept_strictly_on_host"
      }
    }
  }
}

Or serve over Streamable HTTP (loopback-only with mandatory Bearer authentication, Host/Origin validation, and Content-Type: application/json enforcement):

AXIOM_GATE_MCP_BEARER_TOKEN="replace-with-strong-local-token" \
axiom-gate mcp-serve \
  --policy-dir ./projects/axiom_gate/policies \
  --pubkey ./projects/axiom_gate/policies/demo_org.pub \
  --transport http \
  --addr 127.0.0.1:8787 \
  --ledger ./audit_ledger.jsonl

Try Online on Glama

Before installing locally, you can inspect AXIOM Gate on Glama (Impius-Lab/axiom-gate) to:

  • browse all 7 MCP tools, 8 resources, and the live Glama quality score
  • test the server interactively in your browser using MCP Inspector

Tool Packs & Open-Core Pricing (MIT Forever Core + Pro Packs)

All data directories are strictly segregated by role: read-only inputs in data/input/, writable reports in data/reports/, financial journals in data/journals/, and host-managed risk state in data/state/ (rejected fail-closed at startup if any fs.write tool overlaps data/state/).

Tool / TierPack & LicenseLeast-Privilege CapabilitiesSign-Time Z3 ens Contracts vs. Deterministic Wasm / Host Guards
secret_safe_readerCore Free (MIT OR Apache-2.0, $0 forever)fs.read, clock (no write, no net)Z3 ens: rejects empty path (Err(2)) and zero max_chars (Err(1002)). Wasm/Host guards: linear-time redaction of API keys, bearer/basic tokens, full multi-line PEM private-key blocks, emails, SSNs, and card numbers; max_chars truncation; jailed data/input/.
capped_refund_guardCore Free (MIT OR Apache-2.0, $0 forever)net.http, fs.read, fs.write, clockZ3 ens: amount_cents == 0 || amount_cents > max_refund_cents => Err(1001), empty order_id (Err(1002)), empty billing_url (Err(9)) before any HTTPS request. Host guards: host-pinned ceiling/URL/journal (data/journals/), Stripe application/x-www-form-urlencoded body, host-only STRIPE_API_KEY egress injection.
allowlisted_webhook_senderCore Free (MIT OR Apache-2.0, $0 forever)net.http, io, clock (no fs)Z3 ens: empty webhook_url (Err(9)), empty or > max_bytes message (Err(1003)). Wasm/Host guards: blocks credential markers (Err(1004)), caps channel <= 128, host-pinned webhook_url + narrow route allowlist + RFC 6890 SSRF block.
jailed_report_writerCore Free (MIT OR Apache-2.0, $0 forever)fs.write, clock (no net, no read)Z3 ens: empty output_path (Err(2)), str_len(content) > max_bytes (Err(1005)). Wasm/Host guards: permits only .md, .txt, .json, .csv (Err(1006) on .ps1/.sh/.bat/.exe/.env), blocks credential markers (Err(1004)), jailed to data/reports/ only.
github_devops_guardPro Pack B (pro_github, $49 one-time, Individual Perpetual v1.x)fs.read, net.http, clock (no fs.write)Z3 ens: rejects issue_num == 0 (Err(3001)), empty or > max_body_bytes comment_body (Err(3002)). Wasm/Host guards: constructs {repo_api_base}/issues/{issue_num}/comments from host-pinned repo_api_base, caps combined body, blocks secret-bearing comments (Err(3003)), host-injected GITHUB_TOKEN locked to /repos/<org>/<repo>/issues/.
csv_pii_readerPro Pack C (pro_csv, $49 one-time, Individual Perpetual v1.x)fs.read, clock (no write, no net)Z3 ens: rejects empty csv_path (Err(2)), max_rows == 0 (Err(4001)), max_chars == 0 (Err(4002)). Wasm/Host guards: deterministic row-slicing, per-row PII/credential redaction, output truncation, jailed data/input/.
quant_order_guardPro Pack A (pro_quant, $79 one-time, Individual Perpetual v1.x)net.http, fs.read, fs.write, clockZ3 ens: host-pinned notional cap (Err(2001)), leverage cap (Err(2002)), host-ledger daily drawdown kill-switch (Err(2003)), strict buy/sell side (Err(2004)). Wasm/Host guards: leverage_bps >= 1, symbol charset check, OMS / signer-proxy routing keeping wallet keys off Wasm, read-only data/state/quant_risk_state.json.

Commercial Bundles & Team Licensing

axiom-gate audit export (standalone HTML and JSON compliance reports), the frozen TCB, CLI, MCP server, Attack Arena, Local Gate Studio, SDKs, and Core 4 tools are free forever under MIT OR Apache-2.0 ($0). Commercial licenses cover Pro Packs and multi-seat/CI usage:

  • Pro All-Access Bundle (pro_all, $129 one-time): Unlocks all 3 Pro Packs (pro_quant, pro_github, pro_csv) under an Individual Perpetual v1.x license (1 developer).
  • Team / Org Annual License (team_org, $299/yr): Unlocks all 3 Pro Packs for up to 10 developers and shared organizational CI/CD runners.
  • Enterprise Custom: Custom seat counts, private authority keys, custom formally verified .axiom tool packs, and invoice billing — email 2aghous94@gmail.com.

All commercial licenses are issued as zero-telemetry, offline-verifiable Ed25519 GATE-PRO-V1 tokens and backed by our 14-day technical-failure refund guarantee (https://axiom-gate-site.weight-space-engineering.workers.dev/refunds):

axiom-gate pack verify-license --token "GATE-PRO-V1.<payload_b64url>.<sig_b64url>" --json

See COMMERCIAL-PRO-LICENSE.md for the full "MIT Forever" Core Pledge and commercial license terms.


Python & TypeScript SDKs

Python SDK (OpenAI, Anthropic & LangChain Adapters)

(Not yet published to PyPI — install directly from a local checkout or GitHub:)

pip install ./projects/axiom_gate/sdks/python
# or directly from GitHub:
pip install "git+https://github.com/Impius-Lab/axiom-gate.git#subdirectory=projects/axiom_gate/sdks/python"
from axiom_gate import AxiomGateClient, to_openai_tools

with AxiomGateClient(
    policy_dir="./projects/axiom_gate/policies",
    pubkey="./projects/axiom_gate/policies/demo_org.pub",
    ledger_path="./audit_ledger.jsonl",
) as gate:
    # Export tool schemas with unforgeable Cap<...> and pinned_args stripped automatically
    openai_tools = to_openai_tools(gate)

    # Execute through all 6 locks and inspect the signed AuditReceipt
    result = gate.call(
        "secret_safe_reader",
        path="orders_sample.txt",
        max_chars=2048,
    )
    assert result.ok, f"Blocked ({result.diagnostic_code}): {result.reason}"
    print("Verified receipt hash:", result.receipt_hash)

TypeScript SDK (Node 18.18+, Vercel AI SDK & OpenAI Adapters)

npm install @impius/axiom-gate
import { AxiomGate, asVercelAiTools } from "@impius/axiom-gate";

const gate = await AxiomGate.connect({
  policyDir: "./projects/axiom_gate/policies",
  pubkey: "./projects/axiom_gate/policies/demo_org.pub",
  ledgerPath: "./audit_ledger.jsonl",
});

try {
  // Plug directly into Vercel AI SDK or OpenAI tool definitions
  const tools = await asVercelAiTools(gate);

  const res = await gate.callTool<string>("secret_safe_reader", {
    path: "orders_sample.txt",
    max_chars: 2048,
  });

  console.log(res.ok ? res.data : res.diagnosticCode);
} finally {
  await gate.close();
}

Local Gate Studio & Product Site

Local Gate Studio (Offline Desktop Web Console)

Inspect your Tool Vault, review pinned_args / host_state_args, run the live 10-vector Attack Arena, verify your BLAKE3 audit ledger, and generate MCP configs on 127.0.0.1 (protected by a per-session CSPRNG token and strict same-port Host/Origin enforcement; pass --enable-signing only when authoring policies):

# Build the React Studio UI once (optional; API works standalone too)
cd projects/axiom_gate/web/studio && npm ci && npm run build && cd ../../../..

# Launch Local Gate Studio (prints tokenized http://127.0.0.1:8790/?token=... URL)
axiom-gate studio \
  --policy-dir ./projects/axiom_gate/policies \
  --pubkey ./projects/axiom_gate/policies/demo_org.pub \
  --ledger ./audit_ledger.jsonl \
  --port 8790

Cloudflare Workers Product Site & Whop Offline License Minter

projects/axiom_gate/web/site contains the static product site, an interactive client-side policy & live Ed25519 receipt simulator (real Wasm execution runs in the native Rust CLI), and the Cloudflare Worker (worker/src/license.ts) that verifies Whop webhooks and mints byte-for-byte Rust-compatible GATE-PRO-V1 Ed25519 tokens:

cd projects/axiom_gate/web/site
npm ci
npm run typecheck
npm test
npm run build
npx wrangler dev --ip 127.0.0.1 --port 8788

Independent Verification & Security Policy

To inspect every tool's transitive use import graph, least-privilege capabilities, typed-hole absence, and workspace #![forbid(unsafe_code)] compliance locally:

cargo test -p axiom-tcb
axiom-gate arena --json

For the full threat model, honest non-goals (including semantic misuse within allowed parameter bounds, the .axiom DSL tradeoff, and offline license revocation), runtime trust boundaries, and coordinated vulnerability disclosure instructions, see SECURITY.md.

NPM
@impius/axiom-gate
Install Command
npm install @impius/axiom-gate