An AI agent that can call tools has two separate questions hanging over it. The first is the one we already know how to answer: is this agent who it says it is, and is it allowed to use this tool at all? That’s authentication and permissions, and the same machinery that works for people and service accounts works here.

The second question is newer. The agent is logged in, it holds a valid credential, the tool is on its list, and it is about to send an email to the wrong 40,000 people because a web page it read told it to, or because it guessed. Nothing about its identity is wrong. The call is wrong. A permission system that only knows “this agent may send email” has nothing to say about that.

The Rabbit Hole Generator picked Lelu this week, an open-source engine built for the second question. Before an agent runs a tool, something asks Lelu, and Lelu answers allow, deny, send it to a human, or run a safer version instead. Every answer goes into a signed log.

The point of this post is a set of questions you can reuse on any product that says it “authorizes AI agent actions,” because there are a lot of them now and they all demo well. What does the check actually look at: the name of the action, or what the action will do? Who is able to approve, and what are they shown when they do? Is an approval good for one specific call, or for anything that happens afterwards? And what makes the agent ask in the first place? I ran Lelu in a container and tested each one. Some answers were better than I expected. One was not: the approval really is locked to the exact call, and the person approving it is shown a hash.


What is Lelu used for in AI agent security?

Lelu is a self-hosted authorization service for AI agent tool calls. An agent framework, a tool wrapper, or an editor hook sends Lelu the action the agent wants to take (who is asking, what the action is called, what it targets, and optionally its arguments), and Lelu returns one of four decisions: allow, deny, human_review (pause until a person approves), or compute (run a safer substitute, like a sandboxed write). It evaluates rules written in YAML or in Rego, the policy language from Open Policy Agent, adds a few agent-specific signals such as a confidence score, keeps a queue of actions waiting on a human, and writes every decision to a signed audit log. It’s MIT licensed and runs as one Go program with a SQLite database.


The Architecture: a decision point that needs an enforcement point

Two terms from the Zero Trust world make this design much easier to talk about, and they’re worth having even if you never touch Lelu. NIST’s Zero Trust Architecture document (SP 800-207) splits access control into two jobs:

  • A policy decision point (PDP) is the thing that decides. It takes a question (“may this caller do this?”) and returns an answer.
  • A policy enforcement point (PEP) is the thing that acts on the answer. It sits in the path of the request and actually lets it through or stops it.

A bouncer with a clipboard is both at once. Split them apart and you get a manager in the back office who says yes or no over a radio, and a person at the door who may or may not be listening to the radio.

Lelu is the manager. It is a decision point, and its own README says so in plain words: “It advises; it does not enforce. Lelu returns a decision. Something on the agent’s side must obey it.” That one sentence is the most important thing to understand about this whole category of tool, so here is the picture:

Diagram: on the left, the agent side, which you own: an AI agent wants to run a tool, an enforcement point (an SDK call, tool wrapper, gateway, or Claude Code PreToolUse hook) asks first and then obeys the answer, and below it sits the real tool such as a database, email API or shell. A dashed red arrow goes from the agent straight to the real tool, labelled as any path that skips the enforcement point, which Lelu never sees. In the middle, the Lelu engine, one Go process with SQLite, runs five checks: a rate limit of 6,000 calls a minute per tenant, an advisory phrase-matching injection screen, a confidence gate using a number the caller supplies, policy (YAML rules match the action name, Rego rules can also read the arguments), and a risk floor so high-criticality names never auto-allow. The strictest result wins. On the right are the four answers: allow, deny, human_review, and compute. Below, human review is three calls: queue (the item stores actor, action, resource and a hash of the full call, not the arguments), approve (ideally with a separate reviewer key), and redeem (the agent resends the exact call, which must match the hash, once, within 15 minutes). The redeem call is optional for the caller. Every event goes to an audit log on the engine’s standard output as one signed, hash-chained JSON line.

Where the enforcement point comes from. Lelu ships several, and they are not equally strong:

  • An SDK (TypeScript, Python, Go). Your code calls authorize() before it calls the tool. As strong as your code is disciplined.
  • An MCP server. MCP, the Model Context Protocol, is the standard way to hand tools to an AI model. Lelu’s MCP server gives the model a tool called lelu_agent_authorize. The model chooses whether to call it. That is asking the agent to police itself.
  • A Claude Code plugin that uses a PreToolUse hook: a script the editor runs before every tool call, outside the model’s control. This is the only one of the three where the agent doesn’t get a vote, which is why the README recommends it over the MCP tool.

I tested the engine itself, over its HTTP API, because that is the part every one of those integrations depends on. I did not test the Claude Code plugin; it deserves its own post.

What the engine checks. One request passes through several layers and the strictest result wins:

  • A rate limit per tenant (6,000 authorization calls a minute by default).
  • An injection screen that looks for known prompt-injection phrases in the request. The README calls it “a speed bump, not a defence,” and I’m taking that at its word; I didn’t test it.
  • A confidence gate. The caller sends a number between 0 and 1 for how sure the model was, and low numbers get blocked or sent to a human. More on where that number comes from below.
  • The policy: YAML rules that match on the action’s name, or Rego rules that can also see the arguments.
  • A risk floor. Action names containing words like delete, refund, or drop are scored as high criticality and, by default, can never come back as a plain allow, whatever the policy says.

How this differs from a general policy engine. Open Policy Agent (OPA) and Cedar are general-purpose decision points: you give them a question and a policy, they give you yes or no. Lelu embeds OPA for the rule evaluation and wraps it with the parts that are specific to agents: the human-review queue, a way to tie an approval to one exact call, and a signed record of each decision. The project’s own framing is that it “sits next to your policy engine, not in place of it.”

One thing I want to credit before the critique. Between the day the Rabbit Hole Generator picked Lelu (mid-October) and the day I ran it, the project acted on an outside security audit, closed its 17 findings, and on November 12 rewrote its README around a section titled “What Lelu does not do”. Several things I planned to “discover” are stated there in plain language. That changed the job from catching the project out to checking whether the fixes and the caveats are real.


The Reality Check: where this breaks

That’s the pitch. Each week the Rabbit Hole Generator also writes a critique of its pick: where it fails at scale, what it quietly assumes, and what security problem it might introduce. This week’s has six distinct points:

  • Points 1 to 3 are about scale. I tested 1 and 2 on a laptop, and I’m clear below about what a laptop does and doesn’t show. Point 3 I only measured in part.
  • Points 4 and 5 are assumptions. I tested both through the engine’s API.
  • Point 6 is the vulnerability the design could introduce. I tested it more thoroughly than anything else, and the result has two halves.

1. A check on every tool call is a latency cost and a single point of failure (tested)

Every tool call now waits on a network round trip to Lelu, and if Lelu is down, something has to decide what happens. The latency half turned out to be a non-issue on one machine: a third of a millisecond per call. The availability half is real in a way the critique didn’t predict. In lab step 10, a burst of calls ran into the engine’s own rate limit and nearly half came back as errors with no decision in them at all.

2. Human review doesn’t scale with the agents (tested for the queue, not for the humans)

Agents can ask for approval far faster than people can give it, and retries make it worse. In lab step 10, 1,500 identical requests became 1,500 separate items in the review queue in about half a second. I can’t put a team of tired reviewers in a container, so the human half of this is arithmetic, not a measurement.

3. State piles up and replicas can’t share it (measured in part)

Decision history, reputation scores, and review items all have to live somewhere and stay consistent if you run more than one copy. The README is blunt about the second half: “Single process… Do not run more than one replica.” I didn’t test replicas because the project tells you not to run them. I did watch the disk: details in lab step 10.

4. It assumes the confidence number means something (tested)

The confidence gate is only useful if the number is real, comparable between models, and honest. In lab step 5, the same call got four different decisions depending on which number I typed. In the stricter production mode, a made-up signal shaped like a real one was accepted.

5. It assumes every action goes through the check (tested at the API, not with a live agent)

If the agent can reach the database or the shell without asking, none of this applies. I can’t usefully “test” a path Lelu never sees. What I could test is how hard the check is to talk around when you do go through it: lab step 4 gets a DROP TABLE allowed by changing the action’s name, and lab step 8 uses the agent’s own API key to replace the entire policy.

6. Introduced Vulnerability: an approval that can be reused or raced (tested)

The critique predicted a time-of-check to time-of-use problem, usually shortened to TOCTOU: the gap between when something is checked and when it’s used, during which it can change. If a human approves “send this email” and the approval is just a flag that says approved, the agent can swap the recipient list, or use the same approval ten times. The critique said an approval needs to be bound to “a one-time execution, exact normalized arguments, caller identity, and short expiration.”

Lelu does exactly that. The repository history shows the binding was added on September 3, six weeks before the critique was written, so this is a prediction of a hole that had already been closed. It held up under everything I threw at it in lab step 6: changed arguments were refused, a second use was refused, 25 simultaneous uses produced one winner, and an approval went stale after 15 minutes. That’s the good half. The other half is in lab step 7: the reviewer’s view of the item doesn’t include the arguments, so the approval is tightly bound to something the approver never saw. And the binding only applies if the caller asks for it.

Four things went beyond the critique, and I’ll flag each where it comes up: the reviewer’s view (step 7), a setting documented as “0 disables” that doesn’t (step 10), a log wrapper that breaks an audit line under load, and the project’s own gap counter reporting missing events in a log that had all of them (both in step 11).


The 30-Minute Lab: probe the engine, then try to talk around it

The Rabbit Hole Generator’s challenge was a three-request probe: start the local engine with one command, then ask it about a destructive action, a low-confidence action, and a routine read, and compare the three decisions. That took about ten minutes, most of it fixing the probe. The rest of this section is me working through the critique above, and it took a good deal longer than 30 minutes.

All the lab files are in this post’s bundle: start with README.txt. The series works through a backlog, so this pick was six weeks old when I got to it, and the project moves fast. I ran lelu-mcp 0.0.36, which downloaded engine v0.3.1, and I read the source at commit 9072621 (November 27).

1. Building the lab

Diagram of the lab: a Mac host with only Docker Desktop holds a lab folder containing a Dockerfile, start.sh, env.sh, the probe scripts, numbered step scripts 03 to 11, allow-all.yaml, args.rego, direct-run.sh and verifychain.go. The folder is mounted at /lab in a single container named lelu-lab, built from node:22 with curl, jq, sqlite3 and ab. Inside the container, curl plays both the agent (with the engine’s API key) and the reviewer (with a separate reviewer key from step 8 on), and ab generates load. The engine is started three ways, one at a time: A, zero-config with npx lelu-mcp start, which downloads engine v0.3.1 on a random port and accepts self-reported confidence with one key for everything; B, production-style settings using three environment variables; and C, the engine binary run directly on port 8082 so audit events land in their own file, with an optional Rego policy. Engine state lives in the ~/.lelu directory: engine.json, engine.key, policy.yaml, lelu.db, signing.key.pem, audit-chain.json and the engine binary.

The pieces. One container. Lelu’s quick start is npx -y lelu-mcp start, where npx is the Node.js tool that downloads and runs a package in one step. I didn’t want that writing into my home directory, so the whole lab lives in a throwaway Node container with a handful of small tools added:

FROM node:22-bookworm-slim
RUN apt-get update && apt-get install -y --no-install-recommends \
      ca-certificates curl jq sqlite3 procps apache2-utils \
    && rm -rf /var/lib/apt/lists/*
WORKDIR /lab

jq trims JSON down to the fields worth reading. sqlite3 is for looking inside the engine’s database. apache2-utils provides ab (ApacheBench), a small load generator that fires a fixed number of HTTP requests and reports timings.

docker build -t lelu-lab lab/
docker run -d --name lelu-lab -v "$PWD/lab:/lab" lelu-lab sleep infinity
docker exec lelu-lab /lab/start.sh

start.sh runs the quick-start command in the background and waits for it. There is no agent anywhere in this lab. curl plays the agent, and later curl with a second credential plays the human reviewer. That’s deliberate: I want to know what the engine does with each request, and a real model in the loop would only add noise.

What the first start does. It’s worth reading the log once, because the engine tells you a lot about its own defaults (timestamps removed and long lines trimmed):

[lelu-mcp] Starter policy (general) written to /root/.lelu/policy.yaml
[lelu-mcp] First run: downloading Lelu engine → .../engine-v0.3.1/lelu-engine-linux-arm64
[lelu-mcp] Engine cached at /root/.lelu/bin/lelu-engine-linux-arm64 (checksum verified)
[engine] WARNING: JWT_SIGNING_KEY is the published default. Tokens signed with it can be forged by anyone...
[engine] audit: drop-on-full (set LELU_AUDIT_BLOCK_ON_FULL=true to apply backpressure instead)
[engine] tenant rate limiter enabled (auth=6000/min, mint=600/min)
[engine] WARNING: human review has no reviewer credentials (LELU_REVIEWER_KEYS unset) — an agent holding an API key can resolve the reviews it triggered.
[engine] auth mode: single static admin credential — every authenticated caller has full admin authority
[lelu-mcp] Local Lelu engine ready on http://127.0.0.1:46833 (policy: /root/.lelu/policy.yaml)

lelu-mcp is a small wrapper. It writes a starter policy, downloads a 27 MB engine binary for your platform, checks it against the release checksums, generates an API key, and starts the engine on a random local port. Four of those log lines are warnings about defaults that are fine for a laptop and not fine anywhere else. Each one comes back later in this lab. I’d rather a tool warn me four times at startup than zero.

Setup nuances, in the order I hit them:

  • The port is random and so is the key. The wrapper writes both to ~/.lelu/engine.json and ~/.lelu/engine.key. Every script in the lab starts by sourcing env.sh, which reads them and defines two helpers: authz '<json>' sends an authorization request and prints the fields that matter, and api METHOD PATH calls any other endpoint and prints the HTTP status.
  • The first start downloads, later ones don’t. The engine binary is fetched once and cached in ~/.lelu/bin. After that a start took about one second here.
  • Engine state is a directory. Everything lives in ~/.lelu: the policy, a SQLite database, the signing key, and a small audit-chain.json file that turns out to matter in step 11. To get a clean engine, I recreated the container.

2. The Rabbit Hole Generator’s probe, as written

The suggested probe is a short script, lelu-probe.sh, that posts three JSON bodies to /v1/agent/authorize. I ran it exactly as given:

=== destructive ===
Request: {"agent_id":"lab-agent","action":"delete_all_records","resource":"customer_database","context":{"confidence":0.99}}
Response:
{"error":"unauthorized: invalid or missing API key"}
HTTP 401

All three came back 401. The local engine generates an API key on first start and requires it on every call, even from the same machine. I added the key as a bearer token and ran it again:

{"error":"json: cannot unmarshal string into Go struct field agentAuthorizeRequest.resource of type map[string]string"}
HTTP 400

A 400 this time, and a useful one: it names the field. The Rabbit Hole Generator anticipated trouble (“a 4xx response is also actionable: compare its validation message with repository examples”), so I read the request type in the engine’s source and found three differences:

The probe sent The engine wants What happens if you don’t fix it
"agent_id": "lab-agent" "actor": "lab-agent" Silently ignored. The audit log records an empty actor.
"resource": "customer_database" "resource": {"table": "customer_database"} 400, as above. Resource is a set of named values.
"context": {"confidence": 0.99} "confidence": 0.99 at the top level Silently ignored. The engine acts as if no confidence was sent.

My first guess was drift, since the pick was six weeks old. I checked the repository history and it isn’t: the request type had exactly these fields on the day of the pick, and the generated key has been there since July. The Rabbit Hole Generator wrote a probe for an API shape that never existed. It reads documentation and guesses, and this time it guessed wrong, which is one more reason these labs get run before they get written up.

Two of those three mismatches fail silently, and that’s worth a moment. Unknown fields are dropped without complaint, so a client written against an older version keeps “working” while sending no actor and no confidence. I confirmed it by fixing only the resource: the request was accepted, routed to human review for “no confidence signal detected,” and logged with a blank actor. If you write your own client against this API, check the audit log for the fields you think you’re sending.

The corrected script is lelu-probe-v2.sh. Trimmed to the interesting fields:

destructive     {"allowed":false,"reason":"Destructive operations are blocked by the starter policy."}
low_confidence  {"allowed":false,"reason":"confidence 31% is below hard-deny threshold (50%) ..."}
routine_read    {"allowed":true, "reason":"matched top-level rule \"allow-read\""}

That’s the challenge done: the destructive action is refused, the low-confidence one is refused for a different reason, and the read goes through. Every response is HTTP 200, by the way, including the denials. The status code tells you the engine answered. The allowed field tells you what it said. Code that checks only the status will treat a denial as a success.

3. How the pieces fit

Before testing anything, here is what each moving part is, because the rest of the lab is about the gaps between them.

The request. Seven fields matter:

Field Meaning Required?
actor Name of the agent asking. Self-reported unless the caller also presents a signed workload token. Yes, in practice
action Name of the thing it wants to do, like send_customer_email. Whatever string the caller chooses. Yes
resource What it targets, as named values: {"customer": "42"}. No
args The call’s actual arguments, as free-form JSON. Passed to Rego rules. Ignored by YAML rules. No
confidence A number from 0 to 1. Only honored in local development mode. No
confidence_signal The production form: raw token probabilities from the model provider. No
acting_for The human user the agent is working on behalf of. No

The response. One looks like this (hashes shortened, four risk-score fields left out):

{
  "allowed": false,
  "reason": "Destructive operations are blocked by the starter policy.",
  "trace_id": "de07f095-c75e-47d1-bdaa-60a47842da1c",
  "requires_human_review": false,
  "actor_verified": false,
  "confidence_used": 0.99,
  "provider_signal_present": false,
  "risk_criticality": 0.9,
  "input_hash": "4288d91a...",
  "output_hash": "9d72dbdf...",
  "policy_digest": "c7571d91..."
}

The four decisions are spread across three flags. allowed: true is allow. requires_human_review: true is review, and it comes with a review_id. compute: true is the safer-substitute case and comes with a safe_tool and safe_args. Everything else is deny. Three other fields are worth knowing how to read:

  • actor_verified: false means the engine is taking the actor’s name on faith. It stays false for this entire lab, because I never registered an agent identity.
  • provider_signal_present is honest naming. The source code has a comment explaining that this field used to be called confidence_verified until a reviewer pointed out that the name claimed more than the check establishes. It means “a signal in the right shape was attached,” nothing more.
  • policy_digest is a hash of the policy file that was in force for this decision. If someone swaps the policy, this value changes, and the audit log shows exactly which decisions were made under which rules. It earns its keep in step 8.

The policy file. The starter policy at ~/.lelu/policy.yaml is a flat list of rules, checked top to bottom, first match wins:

rules:
  - id: deny-delete
    match: "*delete*"
    decision: deny
    reason: "Destructive operations are blocked by the starter policy."
  # ... nine more deny rules: drop, wipe, destroy, truncate, purge, erase, remove_, rm_, unlink_
  - id: review-secret
    match: "*secret*"
    decision: human_review
    reason: "Actions that touch secrets, credentials or env files need human sign-off."
  - id: review-email
    match: "send_*"
    decision: human_review
    reason: "Outbound communication requires human sign-off."
  - id: compute-prod-writes
    match: "write_*_prod"
    decision: compute
    safe_tool: write_file
    safe_args:
      path: "/tmp/lelu-sandbox/{original}"
      sandboxed: true
  - id: allow-read
    match: "read_*"
    decision: allow
  # ... get_, list_, search_, view_, create_
  - id: default-deny
    match: "*"
    decision: deny

Each rule has an id (shows up in the reason), a match pattern, and a decision. match is a glob, the same wildcard style a shell uses for filenames: read_* is a prefix, *_prod a suffix, *delete* “contains.” reason is optional. safe_tool and safe_args only apply to compute. An optional actor pattern limits a rule to certain agents. Writing your own rule is four lines; to let an agent work with a ticketing system and nothing else, you’d add this above the default deny:

  - id: allow-jira
    match: "jira_*"
    actor: "support-bot"
    decision: allow

The file’s own header comment says what kind of control this is: “Matching is on the action name the agent supplies,” followed by advice to “list the synonyms you care about.” Order matters too. The secrets rules sit above read_* on purpose, so that read_secrets goes to a human instead of being allowed as a read. Keep both of those facts in mind for the next step.

4. Names, not arguments

This step tests Reality Check 5 from the inside: if the agent does ask, how much does the answer depend on what the call will actually do? 03-names.sh sends six requests. I’ve put the action and the telling detail on the left:

delete_all_records                               → denied   "Destructive operations are blocked by the starter policy."
create_cleanup_job  args: DROP TABLE customers   → ALLOWED  matched top-level rule "allow-create"
read_record         resource: /home/app/.env     → ALLOWED  matched top-level rule "allow-read"
read_dot_env        resource: .env               → ALLOWED  matched top-level rule "allow-read"
read_secrets        resource: .env               → review   "Actions that touch secrets, credentials or env files need human sign-off."
clear_all_records                                → denied   "Default-deny: no rule allows this action."

Read the second line slowly. An action named create_cleanup_job, carrying the argument DROP TABLE customers, is allowed, because create_* is on the allow list and nothing looked at the argument. Lines three and four read an environment file, the classic place for passwords and API keys, and both are allowed: the rules for secrets look for *secret*, *dotenv*, and *env_file* in the name, and neither read_record nor read_dot_env contains any of those.

The last line shows the control working as designed. clear_all_records isn’t on the deny list, but it isn’t on the allow list either, so the default deny catches it. That matters: the starter policy is an allow list with a deny list on top, so a renamed destructive action only gets through if the new name starts with one of six friendly prefixes. create_ is one of them.

None of this is hidden. The README says “YAML policy matches action names, not arguments… A deny list over names can be sidestepped by renaming the action.” What the lab adds is how little renaming it takes, and who does the naming. In most agent setups the action name is the tool’s name, which a developer chose once. But the arguments are chosen fresh by the model on every call, and they’re where an injected instruction ends up. A policy that reads the name and skips the arguments is checking the part the attacker doesn’t control.

So what, and how to do better: use Rego rules, which can see args. That’s step 9, and it closes all three of the holes above.

5. Confidence is whatever the caller says

Now Reality Check 4. 04-confidence.sh sends the same harmless read four times, changing only the confidence number, then once with no number:

confidence 0.31 → denied   "confidence 31% is below hard-deny threshold (50%) ..."
confidence 0.55 → ALLOWED  "confidence 55% downgraded to read_only (threshold 70%)"
confidence 0.75 → review   "confidence 75% requires human approval (threshold 90%)"
confidence 0.95 → ALLOWED  matched top-level rule "allow-read"
(none)          → review   "no confidence signal detected; routed to human review"

One call, four outcomes, and the only thing that changed is a number the caller typed. An agent that wants its call allowed sends 0.99. That isn’t a clever attack. It’s the default behavior of any integration where the developer hard-codes a value to make the review prompts stop.

(The 0.55 line has its own wrinkle: the response says "allowed": true with a downgraded_scope of read_only. A caller that only checks allowed proceeds at full scope. The project has an open issue to return allowed: false for downgrades.)

To be fair to Lelu, the zero-config mode I’m running is explicitly a development mode. The wrapper starts the engine with CONFIDENCE_ALLOW_UNVERIFIED=true, and the docs say production engines “never trust agent self-reports.” So I recreated the container with that turned off:

docker rm -f lelu-lab
docker run -d --name lelu-lab -v "$PWD/lab:/lab" \
  -e CONFIDENCE_ALLOW_UNVERIFIED=false -e CONFIDENCE_MISSING_MODE=review \
  -e LELU_AUDIT_BLOCK_ON_FULL=true \
  -e LELU_REVIEWER_KEYS="alice:$(cat lab/reviewer.key)" \
  lelu-lab sleep infinity
docker exec lelu-lab /lab/start.sh

(reviewer.key is 32 random hex characters from openssl rand -hex 16. The other two settings are for steps 8 and 11; I set them all at once so there’s only one restart.)

In this mode the engine wants a confidence_signal: the model’s log-probabilities. When a language model picks each word, it assigns a probability to it, and some providers will return those numbers alongside the text. Averaged, they’re a rough measure of how sure the model was of its own output. 04b-signal.sh:

## bare number
{"allowed":false,"review":true,"confidence_used":0,"provider_signal_present":false,
 "reason":"no confidence signal detected; routed to human review..."}

## made-up signal shaped like OpenAI log-probs
{"allowed":true,"review":false,"confidence_used":0.9900498337491681,"provider_signal_present":true,
 "reason":"matched top-level rule \"allow-read\""}

## the same numbers labelled anthropic
{"error":"confidence: provider \"anthropic\" exposes no token-level confidence data ..."}
HTTP 400

The bare number is now ignored, as promised. Then I typed five copies of -0.01 into a field called token_logprobs, labelled the provider openai, and got confidence_used: 0.99 and an allow. The engine can check that the signal is the right shape. It has no way to check that the numbers came from a model.

The third result is a nice touch and a real limitation at once. The engine knows Anthropic’s API doesn’t return token probabilities, so it refuses any signal that claims to be from Anthropic. That’s a sharp check against one specific lie. It also means that if your agents run on Claude, the confidence gate has nothing to work with, and every call falls through to whatever “missing signal” is set to do.

So what. The README’s own FAQ asks “Can’t the agent just lie about its confidence?” and answers “Yes, today.” What to key on in a response: provider_signal_present: true tells you a signal was attached, and nothing about who produced it. The fix the project describes is the right one: the number has to come from something the agent doesn’t control, like a gateway that sits between the agent and the model provider and sees the real reply. Until you have that, treat confidence the way the README says to, as something that can make a decision stricter and never as a reason to loosen one.

There’s a second half to this critique that no lab can settle: even an honest number may not mean what you want. A model can be very sure of its wording and completely wrong about whether the email should be sent. Token probability measures the first thing.

6. A human review, start to finish

This is the step for Reality Check 6. I ran it and step 7 on the zero-config engine (configuration A in the diagram), before switching to the stricter settings above, so the defaults are visible. 05-review.sh asks to send one email to one customer:

{"actor":"lab-agent","action":"send_customer_email","resource":{"customer":"42"},
 "args":{"to":"[email protected]","subject":"Your invoice"},"confidence":0.99}

The send_* rule routes it to a human, and the response includes a review_id. From there the script tries things in the order a misbehaving agent might:

## redeem before approval
{"allowed":false,"reason":"review is still pending human decision"}                    HTTP 403

## approve as the agent itself
{"error":"an actor cannot resolve its own human_review item"}                          HTTP 403

## approve with no name
{"error":"resolved_by is required and must name the human resolving this item"}        HTTP 400

## approve as a made-up human, same key
{"resolved_by":"alice","reviewer_authenticated":false,"success":true}                  HTTP 200

The first three are refused. The fourth is the startup warning from step 1 coming true: with the same API key the agent holds, I typed "resolved_by": "alice" and the review was approved. The check that stops an agent approving its own item compares two strings, and any other string passes. The response is honest about it (reviewer_authenticated: false), and that flag goes in the audit log too. Step 8 fixes this properly. For now, the email is approved, and the question becomes what that approval is good for.

Redeeming. An approval in Lelu isn’t a flag the agent reads. To act on it, the caller sends the whole original request again to a redeem endpoint, and the engine compares it to what was approved. This is the piece the critique asked for. The script tries three redemptions:

## redeem with CHANGED args          (to: [email protected])
{"allowed":false,"reason":"payload does not match what was approved"}                  HTTP 403

## redeem with the exact args        (to: [email protected])
{"allowed":true,"reason":"payload matches the approved request"}                       HTTP 200

## replay the redeem
{"allowed":false,"reason":"approval has already been redeemed"}                        HTTP 403

Swapping the recipient after approval: refused. The exact call: allowed. The exact call a second time: refused. That’s the two classic abuses of an approval, changing it and reusing it, both closed.

How it works is simple enough to explain. When the request is queued, the engine computes a fingerprint: a SHA-256 hash over the actor, action, resource, arguments, and scope. (A hash is a short fixed-length value computed from data; change one character of the input and the hash changes completely.) At redemption it hashes what the caller sent and compares. The refusal messages are deliberately vague. They say which check failed and never what the approved call was, so a caller can’t use the error to work out what would match.

Racing it. A one-time check is only one-time if two requests arriving together can’t both win. 05b-race.sh approves a fresh item and fires 25 redemptions at once:

      1 200
     24 403

One winner. I ran it four times with the same result.

Waiting it out. An approval is a judgment about a moment. The source sets a 15-minute lifetime, with a comment I liked: “Leaving that yes redeemable indefinitely means an agent can bank approvals and spend them much later against circumstances the reviewer never saw.” ttl-test.sh approves an item, sleeps 16 minutes, and tries to redeem it with the exact, correct call:

01:25:10 review_id=302b3cac-8d8f-40da-becc-22c09b69fc0b
{"resolved_by":"alice","reviewer_authenticated":false,"success":true}                  HTTP 200
01:41:10 redeeming
{"allowed":false,"reason":"approval expired (older than 15m0s)"}                       HTTP 403

So, of the four properties the critique said an approval needs, the engine delivers three by direct test: exact arguments, one-time use, and a short expiry. The fourth, caller identity, is only as strong as the actor name, which is self-reported here.

This is the same idea I tested in Oracle Patch Guard, where an approval is a signature over the exact facts being approved and gets checked again right before the risky step. Lelu does it with a stored hash and a database row where Patch Guard used a signature, but the principle is identical: approve this, not “something.”

Now the two catches.

7. What the reviewer is shown

The binding protects the reviewer’s decision. So I looked at what the reviewer decides on. 05c-reviewer-view.sh queues two emails that differ in exactly one way. One goes to [email protected]. The other goes to [email protected]. Then it fetches both items from the queue, which is the API a reviewer’s tooling reads:

{"actor":"lab-agent","action":"send_customer_email","resource":{"customer":"42"},
 "reason":"Outbound communication requires human sign-off.","status":"pending",
 "payload_fingerprint":"255b788673d6bf372ab07dc575a26efb380a4cd13fad2493d4259668a877bae2"}

{"actor":"lab-agent","action":"send_customer_email","resource":{"customer":"42"},
 "reason":"Outbound communication requires human sign-off.","status":"pending",
 "payload_fingerprint":"9eeb38729e9551179e3fab05335a6f7347157b45f5ec9d177f2446c288b4493c"}

Those are the complete items, minus the ID and timestamp. The only difference between “email one customer” and “email all of them” is the fingerprint, and a fingerprint is a one-way hash. A person cannot read a recipient out of it.

I didn’t want to report this off one API response, so I checked two more places. The row stored in the engine’s SQLite database is that same JSON and nothing more. And in the source, the function that queues a review takes the actor, action, resource, reason, and fingerprint as its parameters. The arguments are hashed into the fingerprint and then not kept anywhere.

To be precise about what I did and didn’t test: this is the engine’s queue API and storage. Lelu also has a web dashboard and Slack, Teams, and PagerDuty notifications, and I didn’t run those. But they read from this queue, and you can’t display what was never stored.

Put steps 6 and 7 together and you get the title of this post. The approval is cryptographically bound to the exact call, including every argument. The human approving it is shown the action name, the resource, and a hash. The reviewer is signing a sealed envelope, and the engine then faithfully guarantees that the envelope wasn’t swapped.

There’s a workaround, and it’s worth knowing. resource is stored and shown. An integration that puts the facts a reviewer needs into resource (say, {"customer": "42", "recipient_count": "1", "to": "[email protected]"}) gets them in front of the reviewer, and because resource is part of the fingerprint, they’re bound too. I’d treat that as the rule for anyone integrating today: anything the approver needs to see goes in resource, not args. I couldn’t find an issue tracking this in the project’s tracker when I looked.

The second catch: redeeming is optional. Look at the state of an item after it’s been approved and spent:

{"status":"approved","resolved_by":"alice", ..., "redeemed_at":"2026-11-28T01:33:28.86Z"}

status stays approved. An integration that polls the item until it sees approved and then runs the tool, without ever calling redeem, gets none of step 6’s protections: no argument check, no one-time use, no expiry. That’s not hypothetical. Lelu’s own MCP server works this way: its lelu_get_review tool returns the status to the model, and there is no redeem tool in it. (Its authorize tool doesn’t send args at all, so there’d be nothing for the fingerprint to protect.) The TypeScript and Python SDKs do have redeem support.

This is the decision-point limit from the Architecture section showing up in the details. The engine built a good lock. Whether the door uses it is up to the integration.

8. One key does everything, until you split it

Back to the production-style engine (configuration B). Two tests, both about what the agent’s own credential can do.

Who can approve. With LELU_REVIEWER_KEYS="alice:<secret>" set, the engine logs that reviewer credentials are configured for alice and that “resolver identity is taken from the credential.” 06-reviewer-keys.sh repeats the self-approval from step 6:

# agent key only, made-up name
{"error":"a valid reviewer credential (X-Lelu-Reviewer-Key) is required to resolve a human_review item"}   HTTP 403

# wrong reviewer key
{"error":"a valid reviewer credential (X-Lelu-Reviewer-Key) is required to resolve a human_review item"}   HTTP 403

# real reviewer key, body claims to be bob
{"resolved_by":"alice","reviewer_authenticated":true,"success":true}                                       HTTP 200

The agent’s key alone can no longer approve. And in the last case I presented Alice’s key while the request body claimed to be Bob; the engine recorded alice. The name comes from the credential and the body is ignored, which is the difference between an identity and a claim. One environment variable closes the self-approval hole. It should be the first thing anyone sets.

Who can change the rules. The README warns: “One API key does everything by default. In the default single-key mode the key an agent authorizes with can also change the policy.” 07-policy-put.sh tests it with a five-line policy, allow-all.yaml, that allows everything:

## before
{"action":"delete_all_records","allowed":false,"reason":"Destructive operations are blocked by the starter policy."}

## PUT /v1/policy with the same key the agent holds
{"digest":"5292f788cd01...","previous_digest":"c7571d91abc2..."}                       HTTP 200

## after
{"action":"delete_all_records","allowed":false,"review":true,"risk_criticality":0.9,"reason":"risk score 0.010 (criticality=0.90, ...) — floored to review"}
{"action":"tidy_all_records",  "allowed":true, "review":false,"risk_criticality":0.5,"reason":"matched top-level rule \"allow-everything\""}
{"action":"archive_customers", "allowed":true, "review":false,"risk_criticality":0.5,"reason":"matched top-level rule \"allow-everything\""}

The key the agent uses to ask permission replaced the rulebook, and the engine said 200. That’s the headline, but the three lines after it are more interesting, because they show the layers behaving differently:

  • The policy layer fell completely. It’s whatever the last writer says it is.
  • The risk floor held for the obvious name. delete_all_records still wasn’t allowed. The engine scores the action’s name for criticality on its own, separately from the policy, and anything scoring high can’t come back better than “review.” And with reviewer keys set, the agent can’t approve that review itself.
  • The risk floor is also name-based. tidy_all_records, carrying the argument DELETE FROM customers, scored 0.5 and went straight through. The floor has a keyword list (delete, drop, refund, transfer, and so on), and tidy isn’t on it.

Defense in depth worked here in the narrow sense that no single change opened everything. But two of the three layers read names, and step 4 already showed what names are worth.

What the audit log says about it. This is where policy_digest pays off. The log has a dedicated event for the swap:

{"seq":12,"actor":"lelu_loc","action":"policy:update","decision":"allowed","reason":"replaced c7571d91 → 5292f788"}

and every decision made afterwards carries policy_digest: 5292f788... instead of c7571d91.... So the trust-but-verify control is concrete: know the digest of your approved policy, and alert on any decision that carries a different one. One weakness in that record: the actor is the first eight characters of the API key (lelu_loc), which in single-key mode is the same for everyone.

The project knows about all of this. Splitting the one key into separate agent, reviewer, and admin credentials is issue #127 and the first item on its security roadmap. There’s also a deployment answer available today: the project’s own Docker Compose file mounts the policy directory read-only, and the engine then refuses policy updates outright. I read that code path and didn’t run it.

9. Rules that read the arguments

Step 4 ended with a DROP TABLE being allowed because of its name. The fix is the second policy language Lelu supports. Rego is Open Policy Agent’s language for writing rules over structured data. Instead of a list of name patterns, you write conditions over the whole request, and Lelu passes the request in as input, including input.args.

args.rego is 30 lines. The parts that matter:

package lelu
import rego.v1

default authz := {"allowed": false, "reason": "default deny (rego)"}

# True when any string anywhere in args carries a destructive SQL keyword.
destructive_arg if {
	walk(input.args, [_, value])
	is_string(value)
	regex.match(`(?i)\b(drop|truncate|delete)\b`, value)
}

# True when the action reads a file that looks like secrets, whatever the action is called.
secret_path if {
	some key in ["path", "file"]
	regex.match(`(^|/)\.env($|\.)|id_rsa|credentials`, input.resource[key])
}

authz := {"allowed": false, "reason": "argument contains a destructive SQL keyword"} if {
	destructive_arg
} else := {"allowed": false, "requires_human_review": true, "reason": "resource path looks like a secrets file"} if {
	secret_path
} else := {"allowed": false, "requires_human_review": true, "reason": "outbound email needs human sign-off"} if {
	startswith(input.action, "send_")
} else := {"allowed": true, "reason": "read/create with clean arguments"} if {
	regex.match(`^(read|get|list|create)_`, input.action)
}

Reading it top to bottom: the default is deny. destructive_arg uses walk, which visits every value nested anywhere inside the arguments, so the keyword can’t hide three levels down in a list. secret_path looks at where a read is pointed, not what it’s called. The final block is a chain: first matching condition wins, strictest first. Lelu expects the rule to be named authz in package lelu and to return an object with allowed, optionally requires_human_review, and a reason.

One thing to know before you load it. Setting REGO_POLICY_PATH doesn’t add Rego on top of the YAML rules. For agent requests it replaces them: the evaluator checks for a Rego policy first and returns its answer. The starter policy’s 35 rules stop applying the moment a Rego file is loaded, which is why args.rego carries its own default deny. If you add a Rego file with one extra rule in it expecting the YAML to still be there, you’ve deleted your policy.

This needs the engine started with one more environment variable, and by now I wanted the engine’s output without the wrapper in the way, so 11-rego.sh runs the downloaded binary directly (configuration C) and replays the requests from step 4:

rego policy loaded from /lab/args.rego (query: data.lelu.authz)
create_cleanup_job  args: DROP TABLE customers            → denied   "argument contains a destructive SQL keyword"
create_cleanup_job  args: steps[1].sql "delete from ..."  → denied   "argument contains a destructive SQL keyword"
create_cleanup_job  args: VACUUM                          → ALLOWED  "read/create with clean arguments"
read_record         resource: /home/app/.env              → review   "resource path looks like a secrets file"
read_record         resource: customer 42                 → ALLOWED  "read/create with clean arguments"
delete_all_records                                        → denied   "default deny (rego)"

All three bypasses from step 4 are closed, including one where the SQL was nested inside a list of steps. The honest caveat: my rule is a keyword match on arguments, which is better than a keyword match on names and still a keyword match. DROP written as DR/**/OP, or the same effect achieved through a stored procedure, would get past it. Rego gives you the ability to write rules about what a call does. Writing good ones is the actual work, and it’s specific to each tool. The project is also adding argument conditions to the YAML format (issue #143), which would make this reachable without learning Rego.

10. Load: latency, the rate limit, and a flooded queue

Three measurements for Reality Checks 1 to 3, with the usual warning: this is one laptop, with client and server in the same container. It tells you about the engine’s own overhead and its built-in limits. It tells you nothing about a network hop or a production box.

Latency. 08-load.sh, first with 1,000 calls one at a time:

Requests per second:    2774.18 [#/sec] (mean)
Time per request:       0.360 [ms] (mean)
  50%      0
  95%      1
  99%      7
 100%     10 (longest request)

About a third of a millisecond per decision. Against a tool call that takes a model seconds to decide on and an API hundreds of milliseconds to serve, that’s nothing. On the same host, the “latency multiplier” in the critique doesn’t show up. Put the engine across a network and you add that network’s round trip to every tool call, which is a deployment choice, not an engine cost.

A burst. Same script, 10,000 calls with 50 in flight at a time:

Complete requests:      10000
Non-2xx responses:      4781

Nearly half failed. Not slowly: the whole run took under two seconds. They failed because of that startup line, tenant rate limiter enabled (auth=6000/min). Past 6,000 authorization calls in a minute, the engine answers like this:

HTTP 429
{"error":"rate limit exceeded for tenant"}

429 is the standard “too many requests” status. The count of rejections moved between runs (3,985 on my first attempt, 4,781 on this one) depending on how much of the minute’s budget was already spent.

Is 100 calls a second a lot? For one agent, yes. For a few hundred agents running multi-step jobs behind one API key, it’s an afternoon. And notice what the rejection doesn’t contain: an allowed field. It isn’t a deny. It’s no answer, and what happens next is entirely up to the caller. The same is true when the engine is simply down: I stopped it and curl got “connection refused” and nothing else.

So every integration has to pick a side: if there’s no answer, does the tool run (fail open) or not (fail closed)? The alert triage copilot post was about a tool that failed open at every exit: unparseable replies and model outages all ended in “false positive.” Here it’s the availability half of Reality Check 1 in concrete form: a safety check that under load turns into “sometimes there is no check” is only safe if the caller treats silence as no. One loop like if (!response.allowed) handles this by accident, since a missing field is falsy. One like if (response.allowed === false) lets it through.

A setting that doesn’t do what three documents say. The obvious fix for a lab is to turn the limiter off. The project’s plan document says 0 = unlimited, the main Compose file defaults the variable to 0, and a comment in the engine’s source says “set either to 0 to disable deliberately.” So I did:

$ RATE=0 /lab/direct-run.sh zero false
Complete requests:      20000
Non-2xx responses:      13729
tenant rate limiter enabled (auth=6000/min, mint=600/min)

Still limited, and the log says why: it’s running at the default. The function that parses the setting treats zero and anything below it as “invalid, use the fallback,” so the value that’s documented as “off” quietly means 6,000. As failures go this is the safe direction, since you can’t accidentally disable the limiter. But anyone running the stock Compose file believing they have no limit has a 100-per-second ceiling they don’t know about. To raise it, set a large number. I couldn’t find an existing issue for this one either.

The review queue. For Reality Check 2, 09-flood.sh sends the same email request 1,500 times, as a retrying agent would:

Time taken for tests:   0.628 seconds
Complete requests:      1500
{"total":1502,"returned":500,"distinct_fingerprints":1}

Every one became its own queue item: 1,502 pending (two were left over from earlier steps), all with the same fingerprint. Nothing noticed that they were the same request. A reviewer opening that queue sees 1,500 identical rows, and somewhere among them might be the one that matters. From step 7 we know they couldn’t tell which, either.

This is a known gap with an open issue (#112), and the proposed fix is the natural one: return the existing review when an identical request is already pending, and cap pending items per actor. Until then, the control is on your side: don’t retry a human_review response, poll the review_id you were given.

Storage. For Reality Check 3 I only have observations. During the first 10,000-call burst, SQLite’s write-ahead log (a side file where changes are written first and folded into the main database later) grew from 0.8 MB to 105 MB, and it stayed at exactly that size through two more bursts and the ten quiet minutes after them. In a separate run that was shut down cleanly, 20,000 allowed decisions left a 2.5 MB database with the log folded in. So the lasting cost per decision is small and the working file can balloon under bursts. I didn’t run it for days to see where it settles, and I didn’t test multiple replicas because the project says not to run them.

11. The audit log: drops, backpressure, and checking the chain

Lelu’s other headline claim is “a signed, hash-chained record of every decision.” Three terms:

  • Signed means each log line carries a digital signature made with the engine’s private key. Anyone with the matching public key can check that the line wasn’t altered.
  • Hash-chained means each line also includes a hash of the line before it. Remove or reorder a line and the chain breaks at that spot. It’s the same trick a blockchain uses, minus everything else about blockchains.
  • A sequence number on every line, assigned before the line is queued for writing, so a missing number means a missing event.

A line looks like this (signature shortened):

{"seq":6,"trace_id":"0fe164ac-...","timestamp":"2026-11-28T01:23:39.847Z","actor":"lab-agent",
 "action":"read_record","resource":{"customer":"42"},"confidence_score":0.99,"decision":"allowed",
 "reason":"matched top-level rule \"allow-read\"","input_hash":"d7ac5486...","output_hash":"d79ebb97...",
 "policy_digest":"c7571d91...","prev_hash":"h5yDrq8d...","signature":"QFbChxXj...","kid":"qFjf2U-ibBA"}

Each authorization produced two lines in my runs: the decision, and a shadow_detected event noting that lab-agent isn’t a registered agent identity. So 20,000 calls is 40,000 events.

Is it every decision? The startup log already said no: audit: drop-on-full. Events go into an in-memory queue of 4,096 and a background writer signs and prints them. If the queue fills, new events are thrown away so that authorization calls never wait on the log. direct-run.sh runs the engine binary on its own, raises the rate limit out of the way, fires 20,000 calls, and counts:

##### drop-on-full (default)
Requests per second:    3639.75 [#/sec] (mean)
  50%     11
  99%     47
audit lines: 23624   chain state: {"chain_hash":"3DE3qnhv...","next_seq":40000}
independent count: seq 1..40000, lines=23624, absent=16376
WARNING: audit log is incomplete for this process lifetime: 16376 events dropped (queue full), 0 failed to write.

Of 40,000 events, 16,376 were never written. That’s 41% of the record gone, under a load of a few thousand calls a second. Two things are good about how it fails. The engine says so itself, with an exact count. And because sequence numbers are assigned before the drop, the holes are visible: my own count (sort the numbers, see which are absent) matched the engine’s figure exactly.

Then the same run with LELU_AUDIT_BLOCK_ON_FULL=true, which makes a decision wait when the queue is full:

##### backpressure
Requests per second:    2592.41 [#/sec] (mean)
  50%     18
  99%     52
audit lines: 40000   chain state: {"chain_hash":"sMuSB12p...","next_seq":40000}
independent count: seq 1..40000, lines=40000, absent=0

All 40,000 present. The price was throughput, 3,640 down to 2,592 calls a second, and the median call went from 11 to 18 milliseconds. That’s the trade in one table: a complete record costs about 30% of peak throughput on this machine. For a system whose selling point is the record, I’d take that trade every time, and I’d argue it should be the default.

Checking the chain. A signed log is only worth something if someone checks the signatures. The engine has the verification logic, as functions in its audit package, but I couldn’t find a command that runs it. So I wrote the thinnest possible wrapper, verifychain.go: about 100 lines that read a log file, fetch the public key, call the project’s own VerifyChainReportAt, and print the result. It has to be compiled inside a clone of the Lelu repository, because Go doesn’t let outside code import a package under internal/:

git clone https://github.com/Lelu-ai/lelu.git
docker run --rm -v "$PWD/lelu:/src" -v "$PWD/lab:/lab" -w /src/engine golang:1.27-alpine sh -c \
  'mkdir -p cmd/verifychain && cp /lab/verifychain.go cmd/verifychain/main.go &&
   CGO_ENABLED=0 go build -mod=vendor -o /lab/verifychain ./cmd/verifychain'

The public key comes from the engine’s /.well-known/jwks.json endpoint. A JWKS (JSON Web Key Set) is the standard format for publishing public keys so others can check signatures. The verifier also wants audit-chain.json, the small state file from step 1, which records how many events the engine has ever created.

First, does the verifier catch anything? 10-tamper.sh takes the 21-event log from step 8 and damages copies of it three ways:

## untouched
{"events":21,"first_invalid_index":-1,"missing":0,"truncated":0,"complete":true}
## (a) flip one decision from denied to allowed
{"events":21,"first_invalid_index":1,"missing":0,"truncated":0,"complete":false}
## (b) delete one event from the middle
{"events":20,"first_invalid_index":11,"missing":1,"truncated":0,"complete":false}
## (c) cut the last three events off the end
{"events":18,"first_invalid_index":-1,"missing":0,"truncated":3,"complete":false}
## (c2) same file, verifier not given the state file
{"events":18,"first_invalid_index":-1,"missing":0,"truncated":0,"high_water_known":false,"complete":false}

How to read it: first_invalid_index is the position of the first line whose signature or chain link fails, and -1 means none did. Editing one word in one line (a) breaks that line’s signature. Deleting a line (b) breaks the chain at the gap and shows up as a missing sequence number. Case (c) is the subtle one. Cut lines off the end and everything that’s left still verifies perfectly, because nothing remaining points at what was removed. The only way to catch it is to know how many events there should be, which is what audit-chain.json is for: with it, the verifier reports truncated: 3. Without it (c2), every link checks out and the verifier, correctly, still refuses to say complete. That’s careful design: a signature proves the lines you have weren’t changed, and says nothing about lines you weren’t shown.

Two catches, both about where the verifier’s inputs come from. The state file lives next to the log, on the same machine, writable by the same user. Someone who can truncate the log can edit the counter, so for the truncation check to mean anything the count has to be shipped somewhere the log’s owner can’t rewrite. And I fetched the public key from the same engine that wrote the log. That’s the lesson from the proofbundle post, where a forged receipt verified cleanly against the forger’s own key: a valid signature means “these bytes, this key,” and whose key counts is something you have to decide separately. Record the key ID (the kid field, qFjf2U-ibBA in the line above) somewhere outside the engine when you deploy it, and check logs against that.

Two things the verifier got wrong, neither of them the chain’s fault.

Run the verifier on the two load-test logs, and compare with my independent count:

Run Events really absent Verifier’s missing Verifier’s complete
drop-on-full 16,376 16,436 false
backpressure 0 79 false

The backpressure log has every one of its 40,000 events, every signature verifies, and the project’s gap counter says 79 are missing and the log is incomplete. The reason is ordering. Sequence numbers are handed out when an event is created, but under concurrency events reach the writer slightly out of order, so the file reads ..., 100, 150, 101, 102, .... The gap counter walks the file comparing each number to the one before it, sees 100 followed by 150, and counts 49 missing. It never notices that 101 through 149 arrive a few lines later. A complete log gets reported as incomplete, and an incomplete one gets over-counted. The fix on the reading side is what my independent check does: sort before counting.

The second one I caused by using the quick start. My first verification, on the log from the zero-config engine, failed outright at event 15,607. I assumed I’d found a broken chain. I hadn’t. lelu-mcp relays the engine’s output with an [engine] prefix, and it does that by splitting each chunk of output on newlines. When a chunk boundary lands in the middle of a line, that line comes out as two prefixed pieces:

[engine] {"seq":16879,"trace_id":"3d2efdea-...", ... "signature":"GCb9p9MDlg0y-oJTOleLdNd62xIMIqymZWvIn48CbojFw0NAfZAPWh_JjgWkCcAWbH2vfpyu7b
[engine] ROngdVyyhpdwhKRUKbSJpliOfMYArk0qGNCMnlz5xsAq53dJDp71YAypFWNK_dE7pD13HTF9GWBlpAeICi9OxRo-tWvmhcpLs0yGpAak_E0Nzzg...

One line out of 17,807, split through its signature, and the chain can’t be verified past it. The engine wrote a valid line; the wrapper broke it in transit. That’s why the load tests in this step run the binary directly with its output sent straight to a file. It’s also a reminder to rule out your own plumbing before calling something a broken chain. The quick-start wrapper is for trying Lelu, and its relayed log isn’t an audit record.

12. So what, and how to do better

When none of this matters. One developer, one laptop, an agent you’re watching. The zero-config engine is a real improvement over nothing: the starter policy refuses the obviously destructive names, sends email and anything named like a secret to a person, default-denies the rest, and writes down what happened. The weaknesses above all need either a hostile caller or a scale you don’t have.

When it does. The moment the thing asking permission is not fully trusted, which is the whole premise of putting an authorization layer in front of an agent. An agent that has read attacker-controlled text is an untrusted caller holding a valid key. Every finding above is some version of “the caller got to choose”: its own action name, its own confidence, its own reviewer name, its own policy, and whether to redeem.

A hardening order, from what I tested:

  1. Set LELU_REVIEWER_KEYS. One variable, and self-approval is gone (step 8).
  2. Keep the admin key away from the agent, or mount the policy read-only. Until role-separated keys land, the agent’s key is the admin key.
  3. Write Rego rules for anything that matters, and remember loading Rego replaces the YAML (step 9).
  4. Put what the reviewer needs to see in resource (step 7).
  5. Always redeem. Never act on status: approved (step 7).
  6. Set LELU_AUDIT_BLOCK_ON_FULL=true, send the engine’s output straight to durable storage, and ship the sequence high-water mark somewhere separate (step 11).
  7. Decide what “no answer” means in your integration, and test it by stopping the engine (step 10).
  8. Alert on policy_digest changes and on reviewer_authenticated: false in the audit log (step 8).

What no setting fixes. Lelu still never touches the tool. Reality Check 5 is a property of where it sits, not a bug. If the agent’s process holds the database password, the strongest policy in the world is a suggestion. The enforcement point has to be the only path to the credential: a gateway that holds the secret and calls Lelu before using it, or a hook the agent can’t skip. This is the same lesson as the KubeAPT post, where 176 policies were installed and none were enforcing. A policy existing and a policy being in the path of the request are different facts, and only the second one stops anything.


Where this fits in a real environment

Reach for it when you’re building or running agents that take actions with consequences (sending, paying, deleting, deploying) and you want three things without writing them yourself: a pause-for-a-human step, an approval that’s tied to one exact call, and a record of every decision. Those are the parts general policy engines don’t ship, and Lelu’s versions of the second and third are well made. The approval binding passed every test I had (step 6). The audit design is more careful than most: numbered before the drop, state that survives restarts, a verifier that won’t say “complete” when it can’t know (step 11).

It fits best behind a real enforcement point: the Claude Code hook for coding agents, or a gateway that holds the credentials for everything else. It’s a reasonable companion to an existing OPA or Cedar setup, since it runs Rego itself.

It stops being enough in four places. If your rules are YAML, you’re matching on names (Reality Check 5). If your reviewers work from the queue as it is today, they’re approving things they can’t fully see (step 7). If your agents run on a model that doesn’t expose token probabilities, the confidence gate is idle (Reality Check 4). And if you need more than one instance for availability, it’s single-process by its own description (Reality Check 3), with a rate limit that turns overload into missing answers (Reality Check 1).

I’d also keep expectations about its age in view. This is a young project (engine 0.3) that just went through an outside audit and is fixing things in public, with a roadmap and issue numbers. In the six weeks between the pick and this post it closed those findings and rewrote its README to lead with its limits. That’s a good sign about the maintainers and a reason to pin a version.


Actionable Takeaways

  • Ask what the check reads. A rule on the action’s name checks what the developer called the tool. The arguments are what the model, and anyone steering it, actually chose.
  • Look at the approval screen before trusting the approval. An approval bound to the exact call is only as good as what the approver was shown. Here, that was a hash.
  • Bind approvals to one call, one use, one short window. Lelu’s redeem step does all three, and it survived tampering, replay, a 25-way race, and a 16-minute wait.
  • Make spending the approval mandatory. If a caller can act on “status: approved” without redeeming, the binding is decoration.
  • Give the reviewer a different key from the agent. With one shared key, “approved by alice” is a string the agent typed.
  • Treat self-reported confidence as a way to tighten, never to loosen. The caller picks the number, and a made-up signal in the right shape passes.
  • Decide what silence means. A 429 or a refused connection has no allowed field. Fail closed, and test it.
  • Count your audit log from the outside. Sort the sequence numbers and look for holes, keep the expected count somewhere the log’s owner can’t edit, and turn on backpressure if the record is the point.
  • Check the enforcement point, not the policy. The best decision engine protects nothing on a path that doesn’t ask it.

An authorization layer for agents is worth exactly as much as the answer to one question: what happens when the agent doesn’t ask?