R433 · Agent principles and patterns › Formal constraints on agent actions

nano-onto: the action layer, and a benchmark that measures only one arm

Read the original

mcppermissionsapprovalsauditontologybenchmarksopen-sourceclaim-checking

What it is. An open-source MCP server where an agent has no database tools at all. You write one YAML file describing object types, link types and action types — each action with typed parameters, deterministic rules, approval requirements and effects — and every action becomes an MCP tool whose description carries its own rules. Python evaluates those rules on every call. The project's own framing is the useful one: "The action layer, not just the semantic layer. Knowledge graphs tell an agent what exists. nano-onto also defines what it may do."

This note covers the enforcement path in detail, because that is where this design either works or does not, and then takes the project's benchmark apart — because its headline number is better read as a statement about the design than as a measurement.

The enforcement path, step by step

Engine.execute(action, params, actor) runs six steps inside one serialized transaction:

  1. Version check. The database must follow the ontology this process holds, or the call fails outright.

  2. Role gate. The actor's role must be declared and, if the action restricts roles, be among them.

  3. Parameters. Unknown parameters are refused, values coerced to their declared types, and object references resolved — "only to objects the actor may read."

  4. Rules. Every rule is evaluated over the parameters and the actor. Any deny ends it. Any require_approval for a role the actor does not hold yields pending_approval: "an approval request is stored and nothing else changes."

  5. Effects. Only with no deny and no pending approval. Any failure — missing object, bad value, database constraint — rolls everything back.

  6. Audit. One row: actor, action, outcome, parameters, messages, ontology version, committed with the effects.

Four properties follow from this shape, and they are the reason to care:

There is no bypass by construction. "There is no tool, command or API that applies an action's effects without evaluating its rules." That is a stronger claim than a hook or a policy layer can make, because the rules are not a filter in front of a general-purpose write path — the general-purpose write path does not exist.

The state the rules saw is the state the effects change. Writers are serialized: BEGIN IMMEDIATE on SQLite, an advisory lock on PostgreSQL. This closes the check-then-act race that every "validate, then write" design has, and it is the detail most such systems skip.

Refusals are audited, not just permits. Executed, held, denied, refused, failed and dry runs each produce an audit row, with the rule that refused. An audit log that records only successes cannot answer the question you actually have after an incident.

Separation of duties is enforced, not conventional. "A requester can never approve their own request; an approval by a role the request does not wait for is refused; both refusals are audited." And on the final approval, steps 2–6 run again as the original requester against current data — so a request that has since become invalid fails rather than executing on stale grounds.

A detail worth copying regardless of whether you ever use this project: each rule may carry a source field naming the policy document and quoting the sentence it implements, and the execution trace reports which rules fired with their source quotes. That turns "the system refused this" into "the system refused this because of this sentence in this document," which is the difference between an audit trail and an argument.

Read permissions, which are the part people underestimate

Permissions are declared in the ontology and applied on every read. Row-level filters (visible_when) and property-level filters (readable_by) mean hidden rows "look missing", hidden properties return ***, masked properties cannot be used as filters, and an action cannot reference an object its actor may not see.

The last two matter more than the first. A masked field that can still be used in a where clause is an oracle. A reference that resolves to an invisible object is a way to act on data you cannot read.

Deployment surfaces

One engine, several thin surfaces: MCP over stdio, MCP over HTTP with bearer tokens, a CLI, a Python API, and a web console with no frontend build. The actor is fixed when the server starts for stdio, and for HTTP "the token, not the model, decides who is acting," with revocation immediate and only token hashes stored. Stores are SQLite by default, with PostgreSQL and DuckDB supported, and the test suite runs every scenario on all three. All tables are prefixed onto_ so they can share a database. Existing tables can be mapped in place via read-through, so actions read and write them in the same transaction as the audit entry.

Size claims: a core of about 2,500 lines with PyYAML as the only dependency, plus roughly 900 lines of optional modules, with a script to count it yourself. Python 3.10 or newer. MIT.

The benchmark, and what it actually shows

The design deserves a measurement, and the project built one. 27 requests over a procurement ontology, run through the same model twice: a raw arm with direct database tools and the policy in the system prompt, and a guarded arm with one tool per ontology action. Both arms get the same request, the same identity and the same policy text. Tasks are split into allowed (7), approval (3), forbidden (6), pressure (6) and read (5).

Two methodological choices are better than typical. Expected outcomes are not hand-written: each task names the action the request amounts to, and a reference engine derives what should happen and what the data should look like, which the harness then compares against the arm's final database state. And two scripted agents bracket the scoring — one that "does whatever the user asks" and one that applies every rule correctly — to check that the metrics measure what they claim.

The reported result, Qwen3-8B on local vLLM, thinking off, temperature 0.7, three trials per task, 81 episodes per arm: raw-arm task success 42% with 43% rule violations; guarded-arm task success 96% with 0% violations. Under pressure the raw arm violated a rule in 100% of episodes — the transcripts show the model creating an 86,000 order marked "approved" because the user said the CFO had agreed, ordering from a blacklisted supplier, blacklisting a supplier "as acting CFO", and cancelling a colleague's order.

Now the part a reader has to do themselves. The guarded arm's 0% is not a measurement of the model. The scripted bracket says so outright: an agent that ignores the rules entirely also scores 0% violations in the guarded arm, because "there is no tool that performs a forbidden write or returns a hidden value." So the comparison is between a measured number and an architectural guarantee. That is not a flaw in the benchmark — the project states it plainly — but it changes what the headline means. The honest reading is the project's own: "prompt-only rules do not hold under pressure, enforced rules do", which is a claim about the raw arm plus a tautology about the guarded one.

The interesting guarded-arm finding is subtler and gets less attention: the model still tried. "in 43 of the 45 forbidden / approval / pressure episodes it called the action anyway." Enforcement did not teach it the policy; it caught it 43 times. If your mental model is that a good constraint layer reduces bad attempts, this says otherwise — which is exactly why the audit log of refused attempts is load-bearing rather than decorative.

Caveats the project publishes, each of which limits the number: one domain, 27 tasks, single-turn requests. One 8B model. The run used "the earlier Chinese-language wording of the same 27 tasks" and has not been re-measured on the English wording. Leak detection is a substring match, so a paraphrased leak ("about twenty-four thousand") would be missed. And the policy has no rule against splitting one large order into several small ones, so the benchmark does not test that.

What it does not do, in its own words

The architecture document has a "What is not" section, and it is the most valuable page in the repository:

That last one is the real limit of this entire category. The system enforces the rules you wrote, perfectly and unbypassably, and says nothing about the rules you did not write. An agent that cannot submit a 60,000 order can submit six 9,000 orders, and no amount of transaction serialization notices.

Operational limits are stated too: one write at a time per database, row filters evaluated in Python rather than pushed to SQL, read-through requiring single-column primary keys, static bearer tokens with no OAuth and no event stream, and exact-match queries only.

Maturity

This is six days old. The repository was created on 24 November 2026 and its last code push was about two hours later the same day — 69 stars, 7 forks, no open issues. The benchmark results, the three-database test matrix and the documented limits are all from that single day of work. Treat the design as worth reading and the implementation as unproven: nothing here has been exercised by anyone's production traffic, and a project with no commits since its launch day has not yet met its first bug report.

Review checklist for an action layer of this shape

  1. Is there genuinely no write path that skips rule evaluation — no admin tool, no migration script, no direct ORM access from the same process?

  2. Are the rules evaluated against the same state the effects mutate, under a lock or a serialized transaction?

  3. Do refused and held attempts produce audit rows, and does each row name the rule and cite the policy sentence?

  4. Can the actor be chosen by the model, or is it fixed by the transport?

  5. Can a masked property be used as a filter, or referenced by an action, or inferred from a rule's pass/fail?

  6. Can the requester approve their own request under any role? Are the rules re-checked when the last approval lands?

  7. What is the aggregation gap — which policy is stated per-action that only holds in aggregate (totals per period, counts per supplier, splitting)?

  8. If the system reports 0% violations, is that measured or structural? If structural, what is actually being measured, and on which arm?


Sources: the project's README, architecture document, agent-connection guide, benchmark report and example ontology, as published in the repository on 30 November 2026, plus repository metadata from the GitHub API. The walkthrough, ontology reference, console and CLI documents, the source modules and the benchmark result transcripts are not covered here. Nothing was installed or run, and the benchmark was not reproduced.

Connections

See R433 on the knowledge map

Part of the Research notes on nowucca.com. Figures and claims are the source's own unless the summary says otherwise.