Capability requirements · vocabulary and the verify gate in all five ports
Check what your AI actually built.
Tests only exercise code that exists. That's why a suite can pass on top of an
unfinished feature: no test fails because nobody wired up a column, and no linter flags
a handler you meant to add. MetaObjects lets you declare the capability in the same model
as your entities and name the field or route that implements it. verify
checks that the name exists; if it doesn't, the build stops.
The failure that comes after drift
Drift is when your code stops agreeing with your model. MetaObjects already turns that into a build error across your code, your prompts and your schema.
This is the other one. Your code can agree with your model perfectly, and the model can still describe a capability your software does not have. Agent-written work fails that way in three recognisable shapes:
Duplicate
It builds a capability that already exists, because nothing in the repo told it the capability was there.
Missing
It reports the feature done. Every layer is present and nothing ever writes the value. Nothing is wrong enough to fail.
Partial
It ships the legible 80% and reports done. The recovery path, the rollup, the retire operation — invisible to everyone.
In all three, nothing is wrong. No exception, no failing assertion, no type that stopped lining up — so every gate you own stays green and reports that it checked. Your test suite can't see these three shapes, which is why the fix has to live somewhere else: in the model, next to the entities, where a claim can be resolved instead of read.
Declaring a capability
A requirements document does not help — prose goes stale silently and nothing in your build has an opinion about it. Neither does a requirements tool, where the link from a claim to the code is a string: rename the class and the link still looks fine.
A capability declared in MetaObjects is a node in the same model as your entities, so its
link is checked by verify:
- requirement.functional:
name: subscriberCanBePausedWithoutErasingHistory
title: Pausing preserves history
level: 5
status: live
statement: "A subscriber's participation is switched by their own status, so they
can be paused while everything they did stays on the record."
counterexample: "A subscriber who can only be stopped by deletion, taking every
record of their activity with them."
description: >-
A status on the subscriber rather than a deletion, so withdrawing an
account leaves its history intact.
implementedBy: [acme::Subscriber.status]
titleis the short label,statementis what the capability is in a sentence, anddescriptionis the longer form. Three fields because an index, a doc page and a test each want a different one.- The counterexample says what a violation looks like. That single line is what an assertion gets written against.
implementedBynames the member — the real field in the real model — that carries it. Rename or delete that field and the build tells you which capability just lost its implementation.
That entry is on this page because it is checked: it lives in the repository that
builds this site, acme::Subscriber.status is a real field of a real entity,
and every release resolves the link before the page ships. Delete the field and the block
you just read stops building.
Which is exactly as far as a structural check goes, and that limit is the reason this page exists. A near-identical entry in a live product was wrong: the field it named existed, so the link resolved and every structural check passed. Nothing in the codebase ever wrote that column, so every row held the default forever. The capability could not be exercised at all.
Knowing where a capability is supposed to live is what lets you ask the only question that finds these: what would I have to break to make this claim fail?
What it found
Declared across three shipping products — roughly 700 capabilities — against suites that were passing at the time. A sample:
status column with no writer
anywhere. Every bot held the default, permanently.These were found in a codebase with 1,280 tests passing and zero failures, and the deepest retrofit of the three — a codebase where 93% of the history predates its requirements — produced the most of them. You do not need a greenfield project. This works on the code you already have, and best on the parts you are least sure about.
What you get, and what you build
The last part is the important one, and it is not in the box yet.
MetaObjects ships
- Capabilities as registered vocabulary in all five language ports — a project that declares none sees no change at all.
implementedByresolved bymeta verify. Dangling on a live or partial claim is an error, not a note; a live claim that names nothing is a warning.meta verifyreporting claims whose implementation vanished, entities no claim covers, and gaps recorded versus gaps nobody has ruled on — with a summary on every run.requirementTests()scaffolding a test stub per claim, statement and counterexample carried in, kept from rotting byverify --codegen.meta docsrendering the ledger for humans and for agents — including a machine-readable index carrying a declared count.
You write
- The assertion. A generated stub is a place to put a proof and a guarantee it stays in step with the claim. It is not a proof.
- The proof that the assertion bites — a declared edit to your source that must turn that test red. If it survives, the test is decoration.
That second one is not a MetaObjects feature today. Two projects built their own independently, which is the best argument for moving it into the library — and the reason we would rather tell you now than have you find the gap.
Here is what the scaffold hands you for the entry above — generated by
requirementTests() from the claim itself, so the statement, the
counterexample and the member it claims arrive with it and cannot rot away from it.
The name is the link, and the body below it is yours:
// @generated by @metaobjectsdev/codegen-ts.
// The test IDENTITY is generated from the requirement; the BODY below is yours.
// Do not rename the test — the name is the link.
…
import { test, expect } from "bun:test";
…
/**
* A subscriber's participation is switched by their own status, so they can be paused while everything they did stays on the record.
*
* Counterexample: A subscriber who can only be stopped by deletion, taking every record of their activity with them.
*
* Claims:
* - acme::Subscriber.status (field.enum)
*/
test("subscriberCanBePausedWithoutErasingHistory [field.enum]", () => {
…
Show the whole generated file (23 lines)
// @generated by @metaobjectsdev/codegen-ts.
// The test IDENTITY is generated from the requirement; the BODY below is yours.
// Do not rename the test — the name is the link.
// Your body is never overwritten: MERGED where .metaobjects/.gen-state/ holds this
// file's snapshot body, REFUSED (run exits 1, body kept) where it does not. Those
// bodies are gitignored, so a fresh clone or CI is always the second case — see
// docs/features/own-your-codegen.md for the recovery.
import { test, expect } from "bun:test";
/**
* A subscriber's participation is switched by their own status, so they can be paused while everything they did stays on the record.
*
* Counterexample: A subscriber who can only be stopped by deletion, taking every record of their activity with them.
*
* Claims:
* - acme::Subscriber.status (field.enum)
*/
test("subscriberCanBePausedWithoutErasingHistory [field.enum]", () => {
expect.unreachable(
"unimplemented requirement stub: subscriberCanBePausedWithoutErasingHistory [field.enum] — " +
"replace this with an assertion that fails when: A subscriber who can only be stopped by deletion, taking every record of their activity with them.",
);
});
The example above is TypeScript. Since 1.1.0 the vocabulary loads and validates in
all five ports, the requirement gate runs in every port's verify, and every port
ships a requirement-tests generator. Only the authoring lint is TypeScript-only.
Where it sits
- Codegen turns a model change into a compile error on the exact line your own logic needs updating.
meta verifyturns divergence between your code, prompts, schema and the model into a failed build.- Capabilities put what you said the software does on that same model: resolved links, coverage reporting, and a generated check per claim.
The same verify run that checks your code against the model also checks that
each declared capability points at something that exists.
Start with one capability you are not certain is fully built. Write down what it means and what a violation would look like, link it to the field or endpoint that carries it, then try to write a test that would fail if it were false. In three codebases, that exercise is where every finding above came from.
Get started · Full reference · Spec npm i @metaobjectsdev/cli && npx meta init