This page is generated from
docs/intent.md— edit it there.
The intent contract
ArchLang can read a plan back as facts — rooms, areas, adjacencies, access. The intent contract goes one step further: it lets you write down what a brief asked for as data, then checks that data against those facts. A brief like "a two-bedroom flat, one bathroom about 6 m², around 55 m² total" becomes an intent.json; archlang validate --intent measures a plan against it and tells you, code by code, which expectations the drawing meets and which it misses — without ever rendering an image.
One judge, two places. The same checker runs here and in the project's offline authorability eval. Lifting the eval's scoring core into the package (
src/intent.ts) means the contract a brief is measured against during research is the identical contract you can check while authoring. There is no second, drifting definition of "does this plan satisfy the brief".
What it is
An Intent is a brief's checkable expectations, as structured data. Every field is brief-grounded — derived from the prompt's words, not from any one reference drawing's labels or geometry. You give it room concepts, optional count/area/window bands, and optional adjacency/reachability, and the checker lowers that to a flat list of predicates, evaluates each against describe()'s facts, and returns typed, catalogued violations.
Two entry points, a gate and a meter:
archlang validate --intent intent.jsonis the gate — it fails (exit2) when any gating expectation is missed, the same way--strictgates on lint warnings.archlang score --brief intent.jsonis a continuous meter — it always succeeds (exit0) and reports a satisfaction fraction and per-dimension subscores, so you can watch a plan get closer to the brief across edits.
The shape
An intent is a small JSON object. The machine-readable schema is served at /intent.schema.json; a representative, annotated example:
json
{
"rooms": 4,
"roomsInclude": [
{
"concept": "bathroom",
"count": { "min": 1 },
"areaM2": { "min": 5.4, "max": 6.6, "source": "a bathroom of about 6 m²" }
},
{
"concept": "bedroom",
"count": { "min": 2 },
"windows": { "min": 1, "facing": "S" }
}
],
"totalAreaM2": { "min": 49.5, "max": 60.5, "source": "around 55 m² total" },
"adjacency": {
"requiredEdges": { "kitchen": ["living-room"] },
"source": "an open kitchen off the living room"
},
"reachable": true
}| Field | Meaning |
|---|---|
rooms | exact expected room count, over every storey — assert it only when the brief enumerates the rooms (see the count discipline below) |
roomsInclude[].concept | a room concept the plan must contain, on any storey, matched against produced rooms by label → room_type → uses |
roomsInclude[].count | how many rooms of the concept ({ min, max }; default at least 1), over every storey |
roomsInclude[].areaM2 | a per-room floor-area band, with a source quote from the brief that licensed the number |
roomsInclude[].windows | a required window count for the concept's rooms; optional facing (N/S/E/W) restricts the count to windows whose host wall faces that true compass direction (describe().windows[].facing — the page direction read against the plan's north, so facing: "S" means compass south, not "toward the bottom of the page"). facing also accepts the five names a plan's site block derives — street, back, equator_side, sunrise_side, sunset_side — each of which resolves to one of those letters through that plan's own site; see Symbolic facings |
totalAreaM2 | a total floor-area band, again with a source quote; on a plan with level blocks, the sum over every storey. The band is checked against the exact floor area, the rooms' areas read back from their unrounded floor_polygon (or floor_circle, πR²), summed, and rounded once to a whole mm², so a summary read back from JSON is judged the same way. describe().totals.floor_area_m2 prints the sum of the rounded room areas (Analysis), which can differ from it by up to 0.005 m² per room, so the verdict can differ from the printed figure either way: rooms of exactly 40.000 m² print 40.01 and pass a max of 40, and a room of 4040 x 9901 mm (40.00004 m²) prints 40 and fails it. When the printed figure alone would contradict the verdict, the assertion's detail prints the exact one in full ("total 40.00004 m² outside [0, 40]"). roomsInclude[].areaM2 is judged on each room's exact area the same way. A room whose exact area does not round to its area_m2, or a storey total that is not its rooms' printed sum, was changed by a caller and is judged as printed. grossInternalAreaM2 is judged on its printed 2 dp figure: the summary has no unrounded source for it |
adjacency | interior-door adjacency the brief licenses, { conceptA: [conceptB, …] }, on any one storey — advisory |
grossInternalAreaM2 | a band on the plan's gross internal area — the floor inside the exterior walls' inner faces (describe().totals.gross_internal_area_m2), which is what a client's "about 70 m²" means; totalAreaM2 runs to wall centrelines and reads several per cent larger. On a plan with level blocks it binds the building: the sum over every storey (totals.gross_internal_area_all_levels_m2). Same band rules and source |
roomDimensions[] | sizes the brief states, each bound to one room on any storey by room (its id, or its exact label): widthMm/depthMm bands on its centreline extent along x/y, or an exact sizeMm { w, h, tolerance? } in either orientation. See Brief-bound sizes |
reachable | assert every room is reachable from a modeled entrance — advisory. On a multi-storey plan every storey must also have a way in (its own exterior door, or a stair/lift/escalator from a room you can reach), and every room on it must be reached from where a person arrives there (unreachable on level 2: …); a door over a lower storey's footprint is no way in when its storey has another arrival (W_EXTERIOR_DOOR_ONTO_ROOF) |
Every quantitative band carries a source: the brief phrase that justified the number. When a band fails, the failure message cites it back, so a reader sees both the measured value and the words that set the target.
A brief describes a building, so the intent reads every storey: two bedrooms upstairs count toward rooms and roomsInclude, and their windows toward windows. describe --json reports it differently: its top-level rooms and totals are the lowest storey, and levels[] holds each storey's own (multi-storey plans).
Brief-bound sizes
A brief that says "about 70 m²", "the living room at least 4 m wide" or "a 3.2 × 3.6 m bedroom" binds those numbers and leaves every other one free to flex. Write each as an assertion, and an edit that breaks one fails the gate:
json
{
"grossInternalAreaM2": { "min": 67, "source": "about 70 m²" },
"roomDimensions": [
{ "room": "living", "widthMm": { "min": 4000, "source": "the living room at least 4 m wide" } },
{ "room": "Bedroom 1", "sizeMm": { "w": 3200, "h": 3600, "tolerance": 50, "source": "a 3.2 × 3.6 m bedroom" } }
]
}validate --intent --json reports each one under intent.measures: the value measured, the signed residual (mm or m²; 0 inside a band) and the verdict. Widths and depths are read on wall centrelines from the room's own rectangle (size), so a polygon or circular room is refused, as is a selector that names no room or more than one (an id and a label naming two different rooms included). An upper-storey room is found, and its message names the storey. A plan with no closed exterior wall ring has no gross internal area (totals.gross_internal_area_omitted says why). Each of these is E_INTENT_UNMEASURED: a refusal, never a silent pass.
Symbolic facings: naming a direction instead of a letter
Briefs rarely say "a west-facing window". They say "the living room should get the afternoon light", or "bedrooms at the back, away from the road". When the plan declares a site block, windows.facing can assert those directions by name:
json
{ "concept": "living-room", "windows": { "min": 1, "facing": "sunset_side" } }street, back, equator_side, sunrise_side and sunset_side each resolve to a compass letter through the plan's own site, and then the check runs exactly as it does for a letter. It is the same assertion, written the way the brief was: "facing": "equator_side" against a plan with site { street north } is "facing": "S". Nothing about the tier changes — windows gates either way.
Two things worth stating plainly:
- A symbolic facing against a plan with no
siteis a refusal, not a failure. It reportsE_INTENT_NO_SITEand gates. The question "does this window face the equator?" has no answer for a plan that never said where it is, and answering "no" would be a wrong answer rather than an unanswerable one. equator_side/sunrise_side/sunset_sideassert an aspect, not daylight. They are a drafting heuristic — see the note in the language reference. If the brief says "a sunny living room",equator_sideis a translation of that sentence into something checkable, and translating it is your judgement to state, not a measurement the compiler made. ArchLang has no sun model, latitude or date and will not acquire one.
Two normative disciplines
The whole point of a brief-grounded contract is that it does not invent expectations the brief never stated. Two rules — carried verbatim in the schema's field descriptions — keep it honest.
Area band conventions. Turn a brief's words about size into a band the same way everywhere:
- "about / around / ~N m²", or a bare "N m²" → set both bounds to ±10% of N.
- "at least N m²" → set
minonly (an open top). - Qualitative size words (compact, generous, large, spacious) → assert nothing — omit the band rather than invent bounds.
Count discipline. Assert the top-level rooms count only when the brief enumerates the rooms. Do not derive a count from under-determined wording ("a few rooms", "some bedrooms"). A surplus of one room per storey is tolerated only when it is pure circulation — see policy B below.
These are the two requirements Gate G1 cleared for the intent channel before it shipped: an NL→intent generator that follows them produces per-assertion judgments faithful to the brief. If you author intents by hand, following them keeps your checks measuring the brief and not a particular drawing.
Concept matching
roomsInclude names concepts, not literal labels, so "bathroom" matches a room labelled "Bath", "WC", or "Ensuite" without you enumerating synonyms. A small vocabulary maps common concept keys (bathroom, bedroom, living-room, hall, …) to the labels, room_types, and uses tags that satisfy them. An unknown concept falls back to a literal match — the plan's room id → label → uses → room_type — so a niche concept still works, it just matches by name.
Label words are a convenience, and a concept's label words are English, compared whole-word and exactly (an accent counts). uses is the language-neutral channel: a room's uses, and the room_type they imply, satisfy a concept whatever the label says, in any language. A room with no authored uses takes them from its label through the use classifier, which reads English and a small, closed set of Spanish and Portuguese room words and alone compares without accents ("Baño" and "Bano" are one word; see uses). So a room labelled "Dormitorio" reads as uses bedroom and satisfies bedroom.
Six concepts carry neither a room kind nor a room_type and match by their English label words alone: consulting-room, meeting-room, private-office, reception, suite and unit. A room labelled in another language never satisfies one of those; name such a requirement with a concept that has a room kind, or label the room in English. With labels in another language, write uses on every room.
Matching is a one-room-one-concept assignment: a room is credited to at most one concept. The assignment first gives every concept the number of distinct rooms its count asks for (a bipartite matching), wherever the plan's rooms allow it, then hands each spare room to the first concept in the brief that matches it. So the order of roomsInclude does not decide which concept passes: a storage room and a utility room that share a room_type satisfy both concepts, whichever the brief names first. A single "WC" room still cannot clear both a bathroom and a separate wc expectation, and a concept's area/window checks score over exactly the rooms it was credited with.
The room-count check applies policy B: an exact count passes; a count over the target by up to one room per storey passes only when the surplus rooms are pure circulation (a hall, landing or corridor) beyond what the brief's own circulation named. A surplus bedroom in a plan that already has its hall still fails — the extra room is not circulation.
Gating vs. advisory
Not every expectation gates. The split mirrors what the deterministic tools can and cannot resolve on their own.
Gating (a real deliverable miss — these fail validate --intent, exit 2):
| Code | Fires when |
|---|---|
E_INTENT_INFEASIBLE | the contract's own numbers cannot all hold, whatever the plan (see An impossible brief). Listed first |
E_INTENT_ROOM_COUNT | the room count is off (subject to policy B) |
E_INTENT_ROOM_MISSING | no room matches a required concept |
E_INTENT_ROOM_AREA | a concept's rooms fall outside their area band |
E_INTENT_TOTAL_AREA | total floor area is outside its band |
E_INTENT_GROSS_AREA | the gross internal area is outside its band |
E_INTENT_ROOM_DIMENSION | a bound room's width, depth or exact size misses what the brief states (the residual is in the message) |
E_INTENT_UNMEASURED | a brief-bound measure has no value on the plan: no room or two rooms match the selector, the room is not a rectangle, or the plan has no gross internal area. A refusal, like E_INTENT_NO_SITE |
E_INTENT_NO_WINDOW | a room the brief said needs a window (optionally facing a direction) doesn't have one |
E_INTENT_NO_SITE | a facing names a site-derived direction but the plan declares no site block. A refusal, not a miss: the assertion could not be evaluated at all, and reporting it as an absent window would answer a question that was never askable. Declare site, or assert a compass letter |
Advisory (gate: false — listed and scored as subscores, but they never drive the exit code):
| Code | Fires when |
|---|---|
E_INTENT_NOT_ADJACENT | a required interior-door adjacency is absent |
E_INTENT_NO_DOOR | reachable was asserted but the plan has no modeled entrance |
E_INTENT_UNREACHABLE | reachable was asserted but some room, or a whole storey, is cut off |
Adjacency and reachability are advisory on purpose. One-shot topology — which rooms open onto which — is exactly what v1.13's loop tools (archlang fix, archlang suggest, archlang validate --graph) exist to repair after the fact, not something a single generation pass is expected to nail. Whether iterating with those tools beats simply resampling the same generator under an equal token budget is unmeasured. The owner ratified one live run of that experiment on 2026-11-15, and it ran that day; its analysis was pre-registered before the run in eval/live-runs/2026-11-t3-preregistration.md, and its record is published in eval/live-runs/2026-11-t3-result.md. Nothing here claims the answer either way: the published record is the only statement of the result, and any other claim needs an owner decision. The run does not change this channel: these checks report and score the miss, but they never fail the gate (gate: false, permanently).
An impossible brief
Before any plan is judged, validateIntent adds up the contract's own numbers. Each roomsInclude[i].areaM2.min asks for count.min rooms (default 1) of at least that area, and those rooms are distinct, so the floors add. When they add to more than totalAreaM2.max, no plan can pass every gating assertion, and one E_INTENT_INFEASIBLE leads the violations with the sum written out:
text
E_INTENT_INFEASIBLE: intent /roomsInclude/0/areaM2 + /roomsInclude/0/count + /roomsInclude/1/areaM2 + /roomsInclude/2/areaM2 + /totalAreaM2: no plan can meet these numbers together: 3 "bedroom" × at least 12 m² = 36 m² + 1 "living-room" × at least 10 m² = 10 m² + 1 "bathroom" × at least 3.5 m² = 3.5 m² = 49.5 m² of rooms, above the total floor area of at most 40 m² (/totalAreaM2)Its feedback says to relax one of the named numbers (ask whoever wrote the brief which one gives); no edit to the plan clears it, and it carries no fix. The band misses it causes are still listed after it, and satisfied, total, the subscores and score --brief are what the assertions alone give, so the meter does not move. A floor above a ceiling on the same rooms is reported the same way. Every number in the message is printed exactly as written, and the products and the sum are exact (3 × 12.006 is 36.018). It is a brief-stage finding: validate --stage brief shows it, since it is decided before any room exists. In --json it carries conflicts, the intent paths it names.
It is called only with that arithmetic, never on a hunch. Concepts one room could serve together (a bathroom and a WC) count once, at their largest; a concept named by two entries keeps neither count; a sum is called impossible only when it passes the ceiling by more than 0.005 m² per room it counts plus 0.005 m², the bound of the 0.01 m² display rounding that a plan's total can fall back to. "Three bedrooms of at least 12 m², a living room and a bathroom, all inside 40 m²" with no stated floor for the living room or the bathroom is not reported: 36 m² leaves 4 m² that the contract does not forbid. The derivation is the eval's (eval/fidelity.ts re-exports it from src/intent-feasibility.ts), and nothing is solved: no layout is searched for.
From the CLI
Author the intent JSON, then check a plan against it.
Gate — archlang validate --intent (exit 2 on a gating miss). Against examples/studio.arch (four rooms, 42 m²) with an intent that over-asks — five rooms, a ~10 m² bathroom, a garage, ~80 m² total:
jsonc
// archlang validate examples/studio.arch --intent wrong.json --json → exit 2
{
"ok": false,
"intent": {
"ok": false,
"satisfied": 1,
"total": 5,
"subscores": { "rooms": 0.5, "labels": 0.5, "area": 0, "adjacency": null },
"violations": [
{ "code": "E_INTENT_ROOM_COUNT", "message": "intent /rooms: expected 5, got 4", "gate": true },
{ "code": "E_INTENT_ROOM_AREA", "message": "intent /roomsInclude/0/areaM2: only 0 room(s) matching \"bathroom\" within [9, 11] m² (needed 1) (about 10 m² bathroom)", "gate": true },
{ "code": "E_INTENT_ROOM_MISSING", "message": "intent /roomsInclude/1: no room matching concept \"garage\" (needed 1, found 0)", "gate": true },
{ "code": "E_INTENT_TOTAL_AREA", "message": "intent /totalAreaM2: total 42 m² outside [72, 88] (around 80 m²)", "gate": true }
]
}
}Each violation names the path into the intent (/roomsInclude/0/areaM2), the measured fact, and — for a band — the source phrase that set the target. subscores grades the four dimensions (rooms, labels, area, adjacency); a dimension the brief never asserts is null, not a zero.
--feedback — deterministic correction prompts. Add --feedback to append one actionable prompt per violation (advisory data in the sense of ADR 0005 — never auto-applied):
jsonc
"feedback": [
"Room count is off (expected 5, got 4). Add or remove rooms to hit the target; one extra circulation room (a hall/corridor) is allowed (policy B).",
"Resize the \"bathroom\" room(s) so their floor area falls in the target band (…).",
"Add a room for \"garage\" — a `room` whose label, `uses`, or type matches the concept (…).",
"Adjust room sizes so the total floor area lands in the target band (…)."
]Advisory misses don't gate. An intent whose gating expectations all pass but whose adjacency is unmet still exits 0 — the miss is reported and drags the adjacency subscore to zero, but ok stays true:
jsonc
// requiredEdges { bathroom: [bedroom] } — studio's bath opens off the hall, not the bedroom
{
"ok": true,
"intent": {
"ok": true,
"satisfied": 3,
"total": 4,
"subscores": { "rooms": 1, "labels": 1, "area": null, "adjacency": 0 },
"violations": [
{ "code": "E_INTENT_NOT_ADJACENT", "message": "intent /adjacency: \"bathroom\" not connected to \"bedroom\" (bathroom off the bedroom)", "gate": false }
]
}
}Meter — archlang score --brief (always exit 0). Where validate --intent is the gate, score is the continuous reading — a satisfaction fraction and the same subscores, so you can watch a plan approach the brief as you edit. It reports; it never fails:
jsonc
// archlang score examples/studio.arch --brief wrong.json --json → exit 0
{
"ok": false,
"satisfied": 1,
"total": 5,
"score": 0.2,
"subscores": { "rooms": 0.5, "labels": 0.5, "area": 0, "adjacency": null }
}validate --intent composes with the rest of the ship gate — it layers onto --strict and --graph, each contributing its own block and its own exit condition.
The library API
Everything the CLI does is exported from the package for programmatic use:
validateIntent(source, intent)→IntentCheckResult— compile the intent to predicates, check them againstdescribe(source), and return{ ok, satisfied, total, subscores, violations, assertions, diagnostics }.intentFromJson(value)→{ intent, errors }— a zero-dependency, no-throw walker that validates an untrusted intent shape and returns pathed error strings (e.g./roomsInclude/0/concept: expected a string).feedbackForResult(result)→string[]— the deterministic per-violation correction prompts--feedbackprints.INTENT_JSON_SCHEMA— the description-rich JSON Schema (2020-12) the generator is prompted with; the single source ofschemas/intent.schema.json(drift-tested).
ts
import { validateIntent, intentFromJson } from "@chanmeng666/archlang";
const { intent, errors } = intentFromJson(JSON.parse(raw));
if (intent) {
const res = validateIntent(source, intent);
// res.ok, res.subscores, res.violations[{ code, message, gate }]
}Like describe and lint, validateIntent is pure, synchronous, and deterministic — it renders nothing, so a text-only agent can hold a plan to a brief with no image in the loop.