TrustGraph GitHub

Decide where your agent's output can go, based on what it read.

TrustGraph is policy-as-code for what AI agents produce. Restrictions follow the data through every hand-off, and every output gets allow, needs approval or deny, with the reason.

salariesreaders: hr researcher planning noteshr only planner roadmaphr, engineering summaryhr only #hrALLOWED #engineeringDENIED

Try it — runs the real Rust engine

Policy

Connecting to the policy engine…

    Tab indents. Shift+Tab, or Esc then Tab, leaves the editor.

    The run

    Loading the run…

    Waiting for the policy engine.

    Tests not run yet
    • Tests run when the policy is checked.
    What changed no changes
    • No changes from the example as loaded.
    Read this policy in plain English
    • Appears once the policy is valid.

    The problem

    Permission systems decide what an agent may read. They lose track once it writes something new. In May 2025, Invariant Labs showed what that costs.

    1. An agent reads something private.

      A coding agent reads a user's private repositories. It is allowed to.

    2. A crafted issue tells it to write.

      It reads an issue on a public repository and writes what it found into a pull request.

    3. The private code is now public.

      The pull request opens on the public repository. Every step was allowed; nothing checked that the second came from the first.

    Taking access away does not fix it: the agent needs the private code. The playground above shows the missing rule, with two agents handing off.

    Simulate

    Seeded runs drive the real runtime through policy changes, crashes and approval expiry, and check five safety invariants at every step. They cannot cover what your system does after allow.

    Uses the policy in the playground above.

    Written by agents, approved by people

    Agents draft the policy: every command has --json output with a stable code, a path and a did-you-mean suggestion. A person reviews the plain-English explanation and a diff that flags every widening.

    Agent guide · llms.txt

    $ trustgraph policy check --json trustgraph.policy.yaml
    {
      "diagnostics": [
        {
          "code": "unknown_name",
          "message": "`leadrship` is not a group or person in this policy",
          "path": "sources.comp_review.readers[1]",
          "severity": "error",
          "suggestion": "did you mean `leadership`?"
        }
      ],
      "ok": false
    }

    The rule

    Approval adds a human check; it never widens who may read a source. Anything the policy does not name is denied.

    readers(output) = readers(input 1) ∩ readers(input 2) ∩ …
    allowed         = everyone the action reaches ⊆ readers(output)

    How we know it works

    Deterministic

    No language model in the decision path. Same policy, same inputs, same answer.

    Repeatable is not right: your tests say what right means.

    Simulated

    The simulator runs the shipped runtime and checks five invariants after every step.

    Evidence, not a proof over every execution.

    Proved, within bounds

    Ten Kani proofs cover the decision ordering, the approval window and the reader rules. All pass in CI.

    Those kernels within fixed bounds, not the whole system.

    Verification details

    Use it

    Put trustgraph gateway between your agents and their MCP servers. It records what each agent reads and checks every action before forwarding it; a person approves held calls and sees exactly what they approve. Agents cannot skip it, provided the gateway alone holds the servers' credentials and agents have no other route to them. Gateway guide

    trustgraph serve is the decision service over HTTP and MCP, for stacks that report reads and ask before acting themselves. Serve guide

    The CLI writes, tests and simulates policies. Python integrations are in the repository, but their session handling is being rebuilt after security review: do not rely on them yet.

    cargo install --locked --git https://github.com/skishore23/trustgraph trustgraph-cli
    
    trustgraph gateway --policy trustgraph.policy.yaml --operator leo --config gateway.yaml
    trustgraph serve --policy trustgraph.policy.yaml --operator leo
    
    trustgraph policy init
    trustgraph policy check trustgraph.policy.yaml
    trustgraph policy test trustgraph.policy.yaml
    trustgraph policy simulate trustgraph.policy.yaml --seed 0

    Limits

    • It only knows what it is told the agent read. The gateway records reads through its configured tools; reads by any other route are invisible.
    • Except through the gateway, it decides and does not act: ask right before acting, and act only on allow.
    • One sensitive input restricts the whole output.
    • Groups are lists in the file, not a directory.

    Where it fits

    Permission databases such as SpiceDB or OpenFGA decide what your agent may read. TrustGraph decides where what it wrote may go.