---
title: "Mentat: The Permission and Audit Layer for Coding Agents"
description: "Your agents ask what they are allowed to do before they write. Your team's decisions become enforceable rules with an owner, a reason, and an expiry date, and every answer leaves a record you can hand to an auditor."
url: https://trymentat.pages.dev/
---

Mentat · the permission and audit layer for coding agents

# Your agents need permission before they touch your code.

Identity says who can act. Sandboxing says what they can touch. Nothing says what an agent is *allowed to decide*, or on whose authority. Mentat turns your team's decisions into rules agents have to ask about, and every answer leaves a record you can hand to an auditor.

[Connect in one line](#connect)[Hand it two contradictory rules](https://trymentat.pages.dev/playground)

**87%**of instruction conflicts detected by agents, and almost never mentioned

**Aug 2026**EU AI Act asks for lineage-backed auditability and human oversight

**1 in 4**architectural decisions stale within two months

**0 / 20**false conflicts on the precision gate, every build

Claude CodeCursorCodexWindsurfZedVS CodeJetBrains

Live, against the demo graph

mentat.relevant

\> relevant("src/routes/orders.ts")

01Positioning

## Not another code reviewer.

Every review tool on the market checks code against decisions and assumes the decision is still correct. Mentat checks the decisions against each other, and against time. Their unit of work is the diff. Ours is the graph.

| Capability | Code review tools | Mentat |
| --- | --- | --- |
| **Code against a decision** | Yes, well funded and crowded | Late, quietly, and never led with |
| **Decision against another decision** | No | Derived on every write, with scope resolution |
| **Is the decision still correct** | Assumed | Assumptions are nodes; breaking one cascades |
| **Where the answer arrives** | A comment on your pull request | The agent's read, before the code is written |
| **Who arbitrates** | The model, silently | Nobody. It stops and names both people |

The bottleneck was never detection. Models can already spot the contradiction. What they cannot do is decide whether Sarah's call or Miguel's call wins, because that is not a reasoning problem. It is an organisational one, and a better model does not solve it.

02Enforcement

## A rule a machine can hold you to.

One decision compiles into three things at once: the sentence in AGENTS.md, the rule CI runs, and the block the resolver serves. They cannot drift, because they come from the same record. And the failure message an engineer reads at 6pm is the justification with a name and a date on it, not a rule id.

```
// Generated by Mentat from the decision graph. Do not edit.
// Every rule below carries the reason it exists and the person who recorded it.
// To change a rule, change the decision and run `mentat enforce`.
module.exports = {
  forbidden: [
    {
      name: "mentat-the-domain-layer-must-not-import",
      severity: "error",
      comment:
        "The domain layer must not import from infrastructure. Keeps the domain " +
        "testable and the infrastructure swappable. Recorded by miguel@ on 2026-01-30. " +
        "Disagree? Do not edit this file: change the decision and recompile.",
      from: { path: "^src/domain/.*" },
      to: { path: "^(src/)?infrastructures?(/|$)" },
    },
  ],
};
```

Only code-inferable and structural decisions are ever compiled. A benchmark over 980 architecture decision records put 42 percent of automated violation-detection errors on infrastructure and 26 percent on principle-driven intent, so generating CI failures from those two would undo every precision decision in this codebase.

03The pipeline

## Derive it yourself.

Type two rules. Watch all three stages run, including the ones that decide there is nothing here. Precision over recall is the whole design: two real conflicts a month beats twenty maybes, because a false accusation between colleagues is the most expensive thing this product can emit.

TRY

DECISION A

Constraint

Why

Scope

DECISION B

Constraint

Why

Scope

01

Scope intersectiondeterministic

Waiting.

…

02

Axis and directiondeterministic

Waiting.

…

03

Adjudicationmodel

Waiting.

…

04Assumptions

## Decisions expire. Nobody notices.

An assumption is a node, not a sentence buried in a justification field. Break one and every decision standing on it is questioned at once, across the graph. Click a premise below and pull it.

loading the graph

05Self-checking premises

## The number breaks it. Not a person.

Decay on a timer says nobody has looked at this in sixty days. A monitor says this is no longer true, and here is the reading. Point an assumption at a metric and the decisions resting on it go questioned at three in the morning, because the premise crossed, not because somebody finally got round to a review.

ASSUMPTION

read replica lag stays under 200ms

prometheus · histogram\_quantile(0.95, rate(replica\_lag\_ms\_bucket\[5m\]))

holding

58ms

breach 0 of 2

One breach is not a broken premise. A single spike would question two people's decisions over a scrape blip, so the monitor waits for 2 consecutive readings, and an unreachable exporter is recorded as unreadable rather than as a failure.

06Resolution

## Two owners. One clock. No assignee.

Blocking the agent is the lever, but the person who benefits from coherence is not the person who does the work of resolving it. So a contradiction becomes an item with both authors on it, an age measured from the first time an agent was actually stopped, and a message that goes to the two of them privately.

OPEN CONTRADICTIONS · ORDERED BY AGE

2

OPEN

both above the blocking bar

11d

MEDIAN AGE

from first block, not from creation

7

BLOCKS AVOIDED

engineers who would otherwise have guessed

12%

REVERSAL RATE

resolutions that came back

WHAT BOTH OWNERS RECEIVE, PRIVATELY

Two of your decisions disagree about data access

You two recorded decisions that disagree about data access.

sarah@ mandates one handling of the datastore path that miguel@ explicitly permits an exception to, on overlapping scope and with no exception recorded.

An agent has been stopped by this 7 times, most recently on src/routes/orders.ts.

Open for 19 days.

Mentat will not choose between miguel@ and sarah@. One of you deciding is the only thing that unblocks it.

Sent to the two authors, never to a channel. Telling a team that two colleagues disagree is a different act from telling the two colleagues, and only the second one helps. Past three open items nobody is messaged at all: a digest of counts goes out instead, because twenty interruptions is how a governance tool gets muted.

07Precedent

## What did everyone else do?

The only genuine network effect here: Mentat gets better for you because other teams resolved harder versions of your problem, and no amount of compute buys that. It is also the fastest way to destroy a governance product's reputation, so the privacy contract is the feature, and it is on this page rather than in a policy document.

14 teams have recorded a disagreement on data access.

carved out a scoped exception71%

20% of those came back

let the broader rule win14%

no reversals recorded

let the narrower rule win7%

no reversals recorded

left it open7%

still open

Phrased as history, never as a recommendation. This is what other teams did, not what you should do, and a tool that turns an aggregate into advice has picked a winner through the back door.

THE ENTIRE SHARE RECORD

dimension data\_access

polarities \["require", "permit"\]

concepts \["persistence"\]

outcome carved-out

action except

daysToResolveBucket under-a-week

reversedLater false

contributorDigest k3f9x1q7m2ab

WHAT NEVER LEAVES

-   constraint text
-   justifications
-   author names
-   scopes and file paths
-   repository names
-   any id that survives outside your workspace

Every field above is a token from a closed vocabulary defined in this repository, or a bucketed number. There is no parameter through which free text could be passed, the record is built server-side from your graph rather than accepted from a client, and contributing is off until a workspace turns it on.

08Audit

## Every edit is a delta.

The obvious way to change a decision is to replace it. That throws away the thread: the contradiction it was part of, who deferred, whether the resolution held. So the unit of change is one field, and the change itself becomes the record.

ONE FIELD, ONE REASON, ONE REVISION

```
$ mentat amend d-service \
    --scopes "src/routes/**" \
    --reason "the migration landed"

marcus@ amended d-service · revision 1
  the migration landed

  scopes
    - glob:src/**
    + glob:src/routes/**

2 of 21 pairs need re-deriving (91% skipped).
No live contradiction involves this decision now.
```

WHAT AN AUDITOR ASKS FOR

Not “what does this rule say” but “what did it say when that code shipped, and who changed it since.”

Lineage, not a changelog

“The graph changed” is not an audit trail. “marcus@ narrowed this scope on 12 March because the migration landed, and the contradiction with sarah@ went away as a result” is one.

An unexplained edit is refused

A reason is required. An edit to a governing rule with no stated why is a decision reversal nobody wrote down, and the one thing a trail cannot reconstruct afterwards.

Append-only, and inert

Nothing in the engine reads the log to decide anything. An audit trail that changes behaviour is one somebody has an incentive to edit.

Re-derivation gets cheaper

A field-level delta says exactly which decision moved, so only the pairs touching its scope need recomputing. The fraction skipped is reported, not claimed.

09Benchmark

## We published the number. It is low.

Given a decision and the graph around it, can a system tell whether that decision is about to be reversed? Nobody had a public answer, so here is ours, with both trivial baselines in the same table and Matthews correlation as the headline so that answering "nothing ever changes" scores exactly zero.

| Predictor | MCC | Precision | Recall | Accuracy |
| --- | --- | --- | --- | --- |
| **always-holds** | 0.000 | 0.000 | 0.000 | 0.600 |
| **always-reverses** | 0.000 | 0.400 | 1.000 | 0.400 |
| **mentat-graph-heuristic** | 0.612 | 1.000 | 0.500 | 0.800 |

Look at row two. Answering "nothing ever reverses" is 60 percent accurate while knowing nothing at all, which is why a benchmark that leads with accuracy on a skewed task is measuring the skew.

Ours never cries wolf and misses half the reversals. That is the honest shape of a first attempt, and it is the number a competitor now has to beat. The corpus, the scoring, and the baselines all ship in the CLI, and a pull request that makes the predictor worse fails a gate rather than quietly lowering the figure.

[The full benchmark](https://trymentat.pages.dev/benchmark)npx @mentatlabs/cli bench

10How it works

## Six moving parts.

Capture is the only unsolved one. Decision extraction is a thirty-year research field with a graveyard behind it, and every attempt died the same way: they built the graph and assumed the inputs would arrive.

capture

Decisions are extracted, not authored. Primarily from agent session transcripts, where a developer correcting a machine states the rule out loud because the machine does not share their context.

type

Every constraint carries its scope, its justification, and the assumptions it depends on. Infrastructure and intent-oriented statements are marked unenforceable, which is what keeps precision high.

derive

Conflicts are computed, never declared, in three stages cheapest first: scope arithmetic, then axis and direction, then a model on whatever survives.

resolve

An agent asks what governs a file and gets an ordered answer, or a hard stop naming the two people whose decisions disagree. It never picks a side.

expire

When an assumption breaks, every decision resting on it is questioned at once. A rule whose premise died stops being able to hold up work.

compile

A scoped, minimal, de-conflicted AGENTS.md per directory. Teams keep the standard they already have; Mentat makes it correct and small.

11The bet

## Why capture works now.

Previous rationale mining had to scrape Jira and chat logs, where humans assume shared context and never state the rule. Agent transcripts invert that, and the data is already on every developer's machine.

WHAT A DEVELOPER TYPES

“no, don't query the DB directly there, everything routes through the service layer, we had an incident”

Timestamped, attributed, attached to the exact files the agent just edited, in a machine-readable stream. They state the rule explicitly because they are correcting a machine that does not share their context.

WHAT MENTAT STORES

constraint All data access routes through the service layer.

why We had an incident.

rests\_on the service layer remains the single write path

governs src/routes/\*\*

type code\_inferable

status proposed

Extraction lands in proposed and stays there. Promotion is always one human click, and it is never automatic.

12Compile down

## AGENTS.md is the assembly language.

Instruction files were twenty lines in 2024 and are four hundred now, because the accepted practice is to add a rule whenever the agent misbehaves. Past roughly 150 to 200 instructions, models follow fewer of them. Mentat compiles down instead.

CLAUDE.md, hand-written0 lines

src/routes/AGENTS.md, compiled0 lines

compiling…

compiling

Infrastructure and intent-oriented statements are emitted as context rather than as rules, because 68 percent of automated violation-detection errors land in those two categories. A rule an agent cannot check is a rule that only burns context.

13Connect

## One line. No account.

Without a key you get the read-only demo graph, which already contains a real contradiction, so your first call returns a real block. Run mentat init when you want your own.

CLAUDE CODE

```
claude mcp add --transport http mentat https://trymentat.pages.dev/mcp
```

CURSOR, CODEX, WINDSURF, ANY MCP CLIENT

```
{ "mcpServers": { "mentat": { "type": "http", "url": "https://trymentat.pages.dev/mcp" } } }
```

YOUR OWN GRAPH, IN YOUR REPOSITORY

```
npx @mentatlabs/cli init
```

IN YOUR OWN CODE, NO NETWORK NEEDED

```
import { runLocally } from "@mentatlabs/sdk"; if (await runLocally({ graph }).blocked(path)) process.exit(1);
```

WHAT THE AGENT GETS

relevantWhat governs this file, resolved, or a block naming who disagrees

recordLog a rule the user just stated, with their reason, as proposed

conflictsEvery derived contradiction, with provenance

resolveSupersede, carve out with an expiry, or retire

assumptionsWhat the decisions stand on, and how stale each one is

break\_assumptionKill a premise and cascade to every dependent

watch\_assumptionPoint a premise at a metric so it can break itself

check\_assumptionsSample every monitor now and apply what it says

enforceCompile the checkable decisions into rules CI runs

queueOpen contradictions, with owners and an age

amendChange one field of a decision, with a reason on the record

historyWhat a rule said before, and who changed it

compileA scoped AGENTS.md for one directory

coherenceOne number, with the specific things costing points

[Full tool reference](https://trymentat.pages.dev/docs)

## Mentat never picks a winner.

It surfaces, it blocks, and it names both people. Never ranked by seniority, never quietly resolved to keep things moving. The leverage is that the only moment anyone will settle a contradiction they have happily ignored for months is when they are blocked on an answer they want. Mentat blocks the agent, not the human.

> A conflict a human can enter is a conflict a human has already resolved. So conflicts are derived only, recomputed on every write, and there is no field anywhere in the schema for typing one in.

[Connect an agent](#connect)[Read the evidence](https://trymentat.pages.dev/evidence)

---

Mentat: https://trymentat.pages.dev/ · Docs: https://trymentat.pages.dev/docs · Developers: https://trymentat.pages.dev/developers · API: https://trymentat.pages.dev/openapi.json · Index for agents: https://trymentat.pages.dev/llms.txt
