OpenEik.org

Draft OpenEik 0.8.0: draft, not final. From commit 03dd74d0 of 26 November 2026. Errata: the errata of 0.8. Raw text: /spec/0.8/agent-interface.md. Earlier: OpenEik 0.1, OpenEik 0.2, OpenEik 0.3, OpenEik 0.4, OpenEik 0.5, OpenEik 0.6, OpenEik 0.7, kept as they were.

On this page

OpenEik 0.8 specification

Part VII. Agent interface

An agent works on an OpenEik model as it works on a code base: it looks at the map, opens the few files that matter, asks questions instead of reading everything, changes a few records through checked commands, and looks at what it did. This part fixes the contract an agent host offers so that any agent, through any protocol, can do that. The Model Context Protocol (MCP) is the protocol the reference implementation uses; nothing here depends on it.

1. The operations

An agent host MUST offer these operations, under any names, and MUST describe each one's arguments to the agent in a machine-readable form:

OperationDoesSection
summarythe project at a glance: levels, counts by category and type, what to read next2
treeone folder of the model's layout per call2
readelements, in tiers, through the filter, paged3, 4
execute, execute_batchcommands, with dry runs (Part V)6
validatecheck the model as it is now, hand edits included6
guidethe conventions and topics, on demand7

and SHOULD offer:

OperationDoes
queryanswer a question (counts, sums, groups, a text search, what a line passes through) without shipping records
snapshot_2d, snapshot_3da labelled picture of a view or a 3D region, through the same filter
changeswhat changed since a sequence number or a version
report_problema structured report from the agent about the host or the model

Section 10, from 0.6, adds two: capabilities, what a host offers (10.1), and proposals, the proposals it keeps for a person's review (10.2).

From 0.6, and on a model of 0.5 with the proposal quantities, the sums query answers and the quantities a full read gives beside a record are those of Part XXI, by its names and in its units (Part XXI, 9). From 0.6, and on a model of 0.5 with the proposals costSchedules and workSchedules, a host SHOULD offer schedules: a cost schedule's items worked out, priced by a rate list the host holds beside the model, and a work schedule's tasks with their days and floats, and their progress, forecast and earned value to a status date (Part XXII, 7).

Reference: the request actions of automationRequest in src/automation.ts (summary, tree, read, query, execute, execute_batch, guide, snapshot_2d, snapshot_3d, changes, report_problem and others); the reference tool catalogue (src/core/automation/automationCatalog.ts, 53 tools) serves them over MCP, and the headless server adds eik_validate and eik_export_ifc (server/eikMcpServer.ts). In @openeik/tools: createAgentHost (src/agent-host.js) offers each operation of both tables under its name here, and section 10's, its arguments' JSON Schema in OPERATIONS (src/agent-operations.js), and openeik mcp <folder> serves each as an MCP tool of that name (src/mcp.js).

1.1 Following a system's network

Part of 0.6, with Part II, 6.9.1 and Part IV, 12.9. OpenEik 0.5 had it as the proposal systems (open questions, 145): a host applies it to a model of 0.6, and to a model of 0.5 that it reads with the proposal; for any other it refuses the question (arguments-invalid).

An agent that works on building services asks what a radiator is fed from, what a damper serves, where a drain goes: questions of a network, not of a filter. query answers them without shipping records.

  1. The question. query takes network, {elementId, direction?, through?}: the elements a model's network (Part IV, 12.9) reaches from the element elementId names, a pipe, a duct, a terminal with a port, or a component in a run, which starts from its run. direction is both, its default, along every stretch and join; downstream, along each stretch only the way its medium flows (Part IV, 12.9, rule 6); or upstream, only against it. A stretch whose flow is not derived is passed only where direction is both. Downstream it starts from a run's nodes its stretches flow to and from a terminal's ports that do not flow in; upstream from the others.
  2. Through a terminal. With through, it goes on through each terminal it reaches, from the port it reaches it at to its other ports: downstream from a port the medium enters by to one it leaves by, upstream the other way, and both ways with both. Without it, a terminal ends the way, as it ends a piece of network.
  3. The answer. Each element reached, once, with its id, its category, its name, the steps to it, the stretches and terminals passed on the way, and the element it was reached through (via), nearest first, then by id; a component with its run. The filter, where given, keeps the rows of the elements it keeps. It is paged as every list is (section 5).
  4. Unknown or apart. An elementId that names no element is refused as a filter's is (filter-unknown); one in no network (a run with no line, a terminal with no port) is refused (arguments-invalid).

Reference: none in the reference implementation. In @openeik/tools: networkReach in packages/openeik/src/systems.js, which the agent host's query answers (queryOf, packages/openeik/src/agent-read.js) for a model of 0.6, and for one of 0.5 it reads with proposals: ["systems"].

2. Map first, then drill down

  1. tree with a path answers one folder of the layout (Part III): its sub-folders with a count and a one-line summary each, or its records as rows. Names MAY stand for ids in the path (a level's name for its id).
  2. Each tree answer MUST name its parent and SHOULD say what to call next.
  3. summary SHOULD stay small whatever the model's size: it counts, it does not list every record.

From the reference host on examples/one-storey-house, tree {path: "architecture/level-0"} answers four folders: door (1 record, "types: Door 1000 x 2100 1"), slab (1), wall (5, "types: Exterior wall 300 4, Partition 100 1") and window (2), with its parent architecture.

Reference: treeMap in src/core/versions/navigate.ts; summaryOf. In @openeik/tools: treeOf and summaryOf in src/agent-read.js, whose tree gives the example above with each sub-folder's path, and pages a folder's sub-folders and records as one list.

3. Read in tiers

  1. read MUST offer at least two tiers:
    • index: one row per element, as columns and rows (the reference columns are id, category, typeId, name, levelId, hostId, revision, bounds, with bounds as [xmin, ymin, zmin, xmax, ymax, zmax] in mm);
    • full: the records themselves. A host MAY add derived values beside a record (its quantities, its joined ends, its faces), and MUST keep them apart from the record's own members so that an agent never writes them back.
  2. Reads MUST be paged: offset and limit (at most 500, default 50), and optionally a byte budget.
  3. Every list answer MUST carry the honesty fields: total (how many match), returned, offset, nextOffset (or null), truncated (whether anything matching was left out), and the host's sequence.

Reference: the read action in src/automation.ts; indexColumns in src/core/model/modelSummary.ts; readBudgetSchema in src/core/model/modelFilterSchema.ts. In @openeik/tools: readRecords and INDEX_COLUMNS in src/agent-read.js, a record's derived values in derived beside records, by id.

4. One filter for reading and for looking

Reads, queries and snapshots MUST accept one filter, whose criteria combine with AND:

CriterionKeeps
elementIdsthese elements (at most 5000)
categorieselements of these categories
levelIdselements on these levels
hostIda host and every element hosted on it
box {min, max}elements whose bounds meet a world box, in mm
radius {elementId, mm}elements whose bounds come within mm of an element's bounds
viewIdwhat a view shows: its hides, category filters, section box and crop
selectionthe element selected in an interactive session, where there is one
changedSinceelements changed after a sequence number of this session

Reference: modelFilterSchema in src/core/model/modelFilterSchema.ts; applyModelFilter. In @openeik/tools: FILTER_SCHEMA (src/agent-operations.js) and filtered (src/agent-read.js), which answers selection with the code selection-none, a headless host having no selection, and keeps for viewId what the view's volume of Part XIV, 9.3 holds.

5. Budgets: cap what arrives unasked, never what can be asked for

  1. A host SHOULD hold every answer it sends into an agent's conversation under a budget (the reference uses 20 000 tokens, counted as 2.5 characters per token). An answer over the budget MUST NOT be cut off silently: the host answers with what the answer would have held and how to ask for less.
  2. A host MUST let an agent ask for a whole answer deliberately (whole: true), and MUST offer the whole model, as the folder or the single-file form, for agents that work on files with code.

Reference: ANSWER_TOKENS, CHARS_PER_TOKEN and the held answers in src/core/automation/answerBudget.ts. In @openeik/tools: the same names in src/agent-host.js, with the same values; read {form: "model"} answers the single-file form.

6. The write loop

  1. An agent writes through commands (Part V): a dry run first, then the real run, both with preconditions.
  2. Every accepted write answers with affected and verify (Part V, section 9), so that the agent can look at exactly what changed.
  3. A host that keeps a model in a folder MUST write every accepted change to the folder before it answers, and only the records that changed.
  4. A host MUST let an agent edit record files directly and MUST see those edits: the next request reads them and checks the whole model; a folder that no longer checks is reported, naming the file and the rule, and the last good model is kept.
  5. validate checks the folder as it is now and says either that it is valid or what is wrong. "Done" for an agent means validate reports no errors.

Reference: EikSession in server/eikSession.ts (request, validate, sync, save); eik_validate in server/eikMcpServer.ts. In @openeik/tools: createAgentHost in src/agent-host.js, which writes through applyCommands and writeFolder, looks at the folder's files before every request, and reports a folder that no longer checks in every answer (folder).

7. The guide

Knowledge an agent needs is served on demand, not all at once.

  1. A host MUST serve a guide core, read once at the start: the conventions of Parts I and II, the tiers, the filter, the budget and the write loop.
  2. A host SHOULD serve topics, one per feature (walls, roofs, framing, rebar …), read when needed. Each profile SHOULD ship its own topics.
  3. The core SHOULD stay under 41 270 characters and each topic under 25 000, so that a core and a topic fit an agent's context beside its work.
  4. Every folder carries AGENTS.md (Part III, 8.2), the conventions an agent cannot read off the files.

Reference: the guide action; guideCore and guideText in src/core/automation/guide/; the size limits are held by tests/guide-topics.test.ts. In @openeik/tools: guideCore and guideTopics in src/agent-guide.js; its core is guides/agents.md, its topics the other guides, each category's members and each command kind's schema, the guides bundled with the package (src/guides.js), and its tests hold the size limits.

8. The headless host

  1. An agent host MUST run without a screen or a browser: in a terminal, a CI job, a sandbox or a server.
  2. Operations that need a screen (views open on screen, renders) MAY answer that they need one; every operation of section 1's first table MUST work headless.

The reference implementation offers two headless hosts (informative):

ek export   <model> <folder>       write a model as a folder
ek import   <folder> <file.json>   read a folder back into the single-file form
ek validate <model>                check the model; its errors and their fixes
ek request  <model> '<json>'       any request (summary, tree, read, query, execute …);
                                   a write is validated, then saved back to the model
ek ifc      <model> <out.ifc>      the IFC export

ek-mcp <folder>                    the same requests as MCP tools, on stdio
ek-mcp <folder> --http             on a local endpoint

ek loads the model for each call. ek-mcp loads it once and keeps it in memory, writes only the records that change, sees hand edits, holds .eik/lock so that only one engine writes a folder, and answers one request at a time. In the reference host, 2D snapshots work headless; 3D snapshots need a screen.

Reference: server/ek.ts, server/ek-mcp.ts, server/eikSession.ts, server/eikMcpServer.ts.

@openeik/tools offers a second headless host (informative), over a folder:

openeik mcp <folder>                  the operations of section 1 as MCP tools, on stdio
            --read-only               hold no lock, and write nothing
            --person <id>             the person an envelope's by.person must name (Part XVII, 4.2)
            --require-envelope        an agent's commands only in an envelope (Part XVII, 8, rule 3)

and the same host as a library, createAgentHost(folder).request(operation, args), that any transport drives. It loads the folder once, looks at its files before every request and checks the folder whole when any changed, writes only the files that change, holds .eik/lock, and answers one request at a time. Its 2D snapshots are drawn from the compiled bodies by the generator that issues drawings (Part XIV, 17.2), as SVG with a legend of what each drawing shows and where; its 3D snapshots answer that they need a renderer (rule 2).

Reference: src/agent-host.js and src/mcp.js of @openeik/tools; openeik mcp in its bin/openeik.mjs.

9. The agent's file export (informative)

Besides the OpenEik folder itself, the reference host can export a folder made for agents that search with code: one file per record with a _derived block beside the record's members (its path, level, bounds, type name and neighbours by id), an _index.json table in every folder, spaces/ with each room and what stands in it, focus.json with the view a person has open, and a README with search recipes. That export is a view of the model, not a model folder: its derived blocks would break Part IV, section 1, if it were written back. The derived layer (Part IV, 1.1) is the place for derived data beside a model.

Reference: src/core/versions/modelFolder.ts.

10. Capabilities and review

Part of 0.6. OpenEik 0.5 had it as the proposal agentInterface (open questions, 146). It adds no member, no value and no file to a model: its rules bind an agent host and the agent that speaks to it, and a validator checks nothing of it. A host applies it whatever the version of the model it holds, since it binds a host and no model, as Part XVII, 4.2.1 does.

Section 1 asks every host for the operations of its first table and lets it offer the second's, and more, under any names; Part V lets a processor implement the documentation profile and the domain operations, or not; Part XVII lets a host require envelopes, refuse a mode and keep a proposal; and section 5 lets a host choose its budget. An agent learns none of that until a call fails. And a host that holds an agent's writes for a person to review has Part XVII, 6.3's proposals for it, but no operation of this part names them, so that an agent cannot see what became of its work. This section says how an agent asks a host what it offers (10.1), and how a host keeps an agent's batch as a proposal that a person accepts (10.2). Attribution of each write to the person and the agent is the command envelope's (Part XVII, 4): the person by an id, the agent beside them, and what a host checks of each.

It binds an agent host: one that holds an OpenEik model, a folder or the single-file form, and offers section 1's operations on it, the class Agent host of Conformance, 1. Such a host applies 10.1 whole, and 10.2 whole where it keeps proposals or holds writes for review; it claims neither in part. A server that is no agent host, such as an application's connector that works on a model of its own and reads an OpenEik model, or proposes changes to one, through operations of its own, claims no part of this section: its operations and its commands are its own, and none of its commands is a kind of Part V. It MAY offer an operation of its own named capabilities, and SHOULD NOT then give a member 10.1 names another meaning (10.1, rule 3): its own operations go in operations, and in commands only the kinds of Part V it runs on an OpenEik model it holds.

10.1 Capabilities

  1. The operation. A host that applies this section MUST offer the operation capabilities. It takes no arguments, and answers what the host offers, by these members:
    • format: the format the model the host holds states (Part I, 9.2), openeik/0.1-draft for a folder of 0.1 that states none (Part I, 9.2, rule 5), or null while it holds none; and reads and writes, the formats it reads and writes, each openeik/<major>.<minor>;
    • operations: each operation the host offers, {name, writes, available}: its name, as this part names it; whether it changes the model; and whether it answers here, false with why for one the host lists and cannot answer, a 3D picture on a host with no renderer (section 8, rule 2), each write of a host that reads only, or each write of a host that takes an agent's commands only in an envelope and takes no envelope (10.2, rule 1);
    • commands: each command kind its processor runs on the model it holds, sorted by code units (Part V, 2, and the kinds the parts that add commands add); and profiles, those of Part V, 2's three, core, documentation and domain, whose every kind it runs;
    • proposals: the proposals for a later version than the model's that the host reads the model by, beside the rules of its version, each by its name: none that the model's version makes a rule, and none that it cannot ask for, so that a host started with envelope, a rule from 0.2, lists it for a model of 0.1 alone, and one started with systems, a rule from 0.6, for a model of 0.5 alone;
    • envelopes: {taken, required, modes, person}: whether it takes an envelope of Part XVII on the model it holds, which it does not where the model's version takes none (a model of 0.1 read without the proposal envelope) nor, on a local transport, where it was started without a person's id (Part XVII, 4.2.1, rule 2); whether it takes an agent's commands only in one (Part XVII, 8, rule 3); the modes it implements (Part XVII, 6.4, rule 3), none where it takes no envelope; and the id of the person it serves, where it serves one by an id (Part XVII, 4.2.1), else null;
    • review: {held}: whether it holds every write of an agent for a person to review (10.2);
    • budget: {tokens, charsPerToken}, the budget it holds each answer under (section 5, rule 1), or null where it holds none; and pages: {most, default}, the most and the default limit of a page (section 3, rule 2).
  2. True and stable. A host MUST NOT list an operation, a kind, a mode or a proposal that it does not implement, nor leave out one that it offers. The answer is the same for every call while the host runs, but for format, commands and proposals, which follow the model it holds; it is small, whatever the model's size, and under any budget.
  3. Members not known. An agent MUST ignore a member of the answer that it does not know, and a host MUST NOT give a member this section names another meaning, so that a later version can add members.
  4. How an agent adapts. An agent reads capabilities once, at its start, with the guide core (section 7, rule 1). It then calls only the operations listed as available; sends only the kinds commands lists, and for another kind the core record operations that leave the same records (Part V, 2.3); sends its commands in an envelope in a mode envelopes.modes lists where envelopes.required is true, naming the person envelopes.person gives, and in the mode propose where review.held is true; asks for pages within pages; and keeps to the budget, asking for a whole answer only deliberately (section 5). What the answer says is what to try first: a refusal still decides.
  5. A host that does not offer it. An agent that finds no operation capabilities (a host of 0.5 that does not apply the proposal, or one that does not apply this section) takes what section 1 asks of every host: the operations of the first table, the core record operations (Part V, 2.1) and section 5's budget; it learns the rest from the operations' descriptions (section 1) and from refusals.
  6. Not the protocol's. A transport's own negotiation, MCP's initialize and its capabilities among it, says what the protocol carries, tools, resources and notifications; this operation says what the host does with a model, through any protocol. Neither stands in for the other.

From openeik mcp over examples/one-storey-house, its format made openeik/0.5, started with --review and --person person-7f3a, capabilities answers, its lists shortened here: 103 kinds, every kind of Part V, 2.1 and 2.2 among them and of 2.3 all but rebar.quick, so that domain is no profile it runs whole:

{"budget": {"charsPerToken": 2.5, "tokens": 20000},
 "commands": ["align", "areaAdjustment.delete", "areaAdjustment.upsert", …, "wall.join"],
 "envelopes": {"modes": ["apply", "dryRun", "propose"], "person": "person-7f3a", "required": false, "taken": true},
 "format": "openeik/0.5",
 "operations": [{"available": true, "name": "summary", "writes": false}, …,
                {"available": false, "name": "snapshot_3d", "why": "…", "writes": false}, …],
 "pages": {"default": 50, "most": 500},
 "profiles": ["core", "documentation"],
 "proposals": [],
 "reads": ["openeik/0.1", "openeik/0.2", "openeik/0.3", "openeik/0.4", "openeik/0.5", "openeik/0.6"],
 "review": {"held": true},
 "writes": ["openeik/0.1", "openeik/0.2", "openeik/0.3", "openeik/0.4", "openeik/0.5", "openeik/0.6"]}

10.2 Proposals as the unit of review

  1. A host that holds writes for review. A host MAY hold every write of an agent for a person to review, rather than apply it. It is then started so, and says so (review.held, 10.1). It refuses an envelope in the mode apply (mode-not-allowed, Part XVII, 6.4, rule 1) and a batch without an envelope that is no dry run (review-required), and says in each refusal that it takes the same commands in an envelope in the mode propose. It makes no proposal of an apply (Part XVII, 6.4, rule 2), and answers a dry run as any host does. Since it takes an agent's writes only in envelopes, it serves a person: one on a local transport MUST NOT be started for review without its person's id (Part XVII, 4.2.1, rules 1 and 2), with which it would take no envelope and so no write. While the model it holds takes no envelope (a model of 0.1 read without the proposal envelope), it takes no write of an agent: capabilities lists each operation that writes as not available, saying why (10.1, rule 1), and a batch that is no dry run is refused (review-required), saying that the model takes no envelope, in place of asking for one.
  2. One batch, one proposal. Each envelope in the mode propose whose batch passes its dry run (Part XVII, 6.3) is one proposal: its commands, its intent, its base and its by, whole. A proposal is its operation's (Part XVII, 3): the host records the operation with the proposal it keeps, so that the same envelope sent again is answered as it was, the same proposal and nothing kept again (operation.repeated), and its operation's id with another envelope is refused (operation-reused). Two operations make two proposals, but for rule 6's. A person reviews it whole: accepts it whole, or declines it whole, never a part of it, as a batch is applied whole or not at all (Part V, 7). An agent SHOULD make one proposal of one intent, a change that a person can review in one reading, and several proposals of several intents.
  3. Kept by the host. A host that applies this section keeps each proposal an envelope in the mode propose makes as Part XVII, 6.3.1 keeps one, outside the model, and answers it {id, ref, url?, file} (6.3.1, rule 3), with the proposal's state (rule 4) beside it in the answer: open when it is made, and as it is then when its operation is sent again. Its commands change nothing an agent reads: a read after it sees the model as it was. A proposal is made against its base, and a second proposal is made against the model as it is, not on the first.
  4. The operation proposals. A host that keeps proposals MUST offer the operation proposals. Without id, it answers the proposals it keeps, a row each, id, state, intent, agent, commands (how many) and made (when), paged with the honesty fields (section 3, rule 3), and only those of a state where the call gives one. With id, it answers that proposal: its kept form {id, ref, url?, file}, its state, when it was made, and, once a person decided it, by whom and when, and the sequence or the version its commands made. A proposal's state is open until a person decides it, then accepted or declined. One whose acceptance was refused stays open, and says why (refused), since a refused batch changes nothing (Part XVII, 6.3.1, rule 5). An id the host keeps no proposal of is refused (proposal-missing).
  5. A person decides. Only a person accepts or declines a proposal (Part VI, 8.7, rule 4; Part XVII, 6.3.1, rule 5), never the agent that made it nor any other: no operation of this part decides one. The host gives the person a way of its own to decide, outside the operations an agent calls. Which person decides follows from who reaches the host. A host on a local transport, started for one person (Part XVII, 4.2.1), is that person's: the person decides every proposal it keeps, their own agents' among them, which is the point of review there, a change seen before it lands; one started without a person's id decides none. A host that several people reach decides by its own rules who may accept a proposal, as a store decides who may write a ref (Part VI, 6.8.3, rule 8): it MAY let only the owners of the records a proposal changes, or a manager, accept it, and MAY forbid a person to accept a proposal their own agent made (Part XVII, 4.3, the note, tells of a host that does). To accept is to run the proposal's file.commands as one batch on the model the host holds, after a dry run where the person asks for one; the preconditions, made against file.base, decide; and an accepted batch is written as any accepted change is (section 6, rule 3), recorded as the person's, naming the proposal and its agent.
  6. What the agent reads back. An agent that made a proposal reads what became of it with proposals, and, once it is accepted, what it changed with changes since the sequence before it (section 1, the second table). A declined proposal changed nothing, and an agent SHOULD NOT make it again unchanged. A host that keeps proposals MUST refuse an envelope in the mode propose whose proposal is the same as one it keeps, made by another operation, its base, its by, its commands and its intent alike (proposal-same), naming that proposal and its state, so that an agent learns that a person declined it, or that it waits for one; a proposal changed in any of them is another.

Reference: none in the reference implementation, whose tool catalogue is its own and whose work orders keep proposed commands in a form of their own (Part XVII, 6.3.1, its reference). In @openeik/tools: createAgentHost(folder, {review, person}) and openeik mcp <folder> --review --person <id>, the operations capabilities and proposals (OPERATIONS, src/agent-operations.js), their answers held to schemas/0.6/agentInterface/capabilities.schema.json and proposals.schema.json, each proposal kept under .eik/proposals/ beside the folder, hidden and no part of the model (PROPOSALS_FOLDER), under an id its operation gives it and with the operation's id, digest and answer, and the person's way to decide one, host.decide(id, {accept, person, dryRun}) and openeik proposals <folder> [--accept <id> | --decline <id>] --person <id>, which a host started for no person refuses (src/agent-host.js); its cases are in conformance/agent-host/, those whose rule is section 10.