Agents

Full editing API (--full)

Tool

Input

Output

Tool

describe

Input

none

Output

versions, site name and revision, ceilings, the read cap, required node count, text range, folder or host-supplied

Tool

read

Input

what (⁠site⁠, page⁠, node⁠, search⁠) with its arguments, cursor

Output

rows, revision, cut⁠, cursor

Tool

catalogue

Input

what (⁠guide⁠, kinds⁠, operations⁠, recipes⁠, blocks⁠, sources⁠, effects⁠), id⁠, cursor

Output

rows, cut⁠, cursor

Tool

plan

Input

baseRevision⁠, ops⁠, key⁠?

Output

revision⁠, counts⁠, roots⁠, changed⁠, pages⁠, notes⁠; or the refusal. Saves nothing

Tool

apply

Input

baseRevision⁠, key⁠, ops

Output

the new revision and from⁠, with the same fields as plan and a hint⁠; or the refusal

Tool

measure

Input

pages⁠, widths⁠, classes⁠, since⁠, cursor

Output

revision⁠, measured⁠, findings (merged rows), incomplete⁠, blocked⁠, skipped⁠, and fixed and unchecked when since is given

Tool

diff

Input

from⁠, to (default: the head), cursor

Output

the added, removed, moved and changed nodes and the affected pages, cut⁠, cursor

Tool

restore

Input

to⁠, baseRevision⁠, key

Output

the new revision, with the same fields as plan⁠; or the refusal

Tool

build

Input

none

Output

counts and lists of the manifest's pages, scripts and styles, and its build hash; UNSUPPORTED_CAPABILITY when the host passes no build function

Tool

add_package

Input

spec⁠: name@x.y.z or

git+https://host/repo.git#<40 hex>

Output

status: "waiting for approval"⁠, facts⁠, command⁠, a labelled note⁠; or the refusal. Offered on a folder, in the full and the six-tool profiles, not in --sections

describe

Returns framework⁠, schema (document version), pluginApi⁠, measureProfile⁠, site⁠, name⁠, revision⁠, ceilings (the page budgets, 2,000 nodes, 12 levels of nesting, 200 operations per batch, 1,000,000 characters per request), readCap⁠, required (how many nodes are required), textRange (or null), folder (true for a folder site), plugins: [{name, npmVersion}] and out⁠. Call it first.

plugins lists the code plug-ins of culm.json that loaded, each by name and installed version (⁠"unknown" when its package.json holds no plain one); it is empty when there are none. The default profile's describe {} reply has it too, and describe {example} does not. No path, refused plug-in or refusal reason is served.

read

  • what: "site"⁠: the site outline, one row per page and component with node counts, the styles and fonts, the text range and the required count.

  • what: "page"⁠: one row per node of the tree named by page (a page id) or tree (⁠"header"⁠, "footer" or { "component": id }⁠), with depth and from to choose a subtree. A row is { id, kind, depth, name?, hidden?, block?, required?, text?, children? } in depth-first order: depth 0 is the outlined root, name is left out when it is the id or the kind's label, hidden⁠, required and children when empty, false or 0, and text is cut to 60 characters.

  • what: "node"⁠: one node by id in page or tree⁠, without its children, and a block root's settings.

  • what: "search"⁠: text (case-insensitive substring), kind and block (exact); all the given conditions must hold.

No read returns the whole document. On a site at the 2,000-node limit every reply stays within the cap and paging reaches every node. read {format:'jsx'} is not paged: it returns the whole tree as JSX, and past the read cap it is refused with RESOURCE_LIMIT_EXCEEDED⁠.

catalogue

What can be built, composition first. what is read in this order:

  • guide⁠: rows of plain sentences on composing a section (layering with behind and front⁠, gradients, display type, shapes, reuse, measure and repair). Read it first.

  • kinds⁠: one string per kind, kind(role): setting, setting⁠. id=<kind> gives the kind in full, with each setting's hint where it has one (the grammar of a shape's geometry⁠, fill and stroke⁠).

  • operations⁠: one string per operation, name(field:type, field?:type)⁠, and a legend for the long types (⁠T tree, N node, L layer, U object whose null unsets, V block setting value). id=<operation> gives its fields and an example.

  • recipes⁠: ready batches, rows { recipe, name, guide, ops } where ops is a count. id=<recipe> gives the batch itself, with its first operation aimed at the first page of the site. Recipes are hero⁠, split⁠, cta-band⁠, buttons⁠, divider and card (which ends with makeComponent⁠). hero sets its text beside a drawing, split is a two-column section, and hero⁠, split and cta-band hold their content in an inner column of max width 1120 with 80 px of side padding, so none trips the design findings. They use only site colours, add nodes without fixed ids (except card⁠'s) and are accepted by plan as they stand.

  • blocks⁠: rows { block, name, category, looks, guide }⁠, finished examples to insert, restyle or copy. id=<block> gives the settings and a ready insert.

  • sources⁠: each source with its fields. id adds a first sample row.

  • effects⁠: {name,tier} for each registered motion preset. When GPU support is enabled (⁠"features": { "gpu": true }⁠), this includes tier-3 shader effects (⁠contours⁠, ripple_field⁠, plus any site customEffects⁠). Detail returns each numeric or colour setting's range and default. With a site, it looks for a compatible authored owner on a page, in the header or in the footer (for example, text for a letter split, or a layout box with visible content for GPU). example is a setMotion operation using default settings. Without a site, self-only effects use the empty site's home root. If a suitable owner cannot be selected, requires describes the target to supply. Discovery uses the targets checked at registration; plan checks the actual invocation and site rules.

  • addCustomEffect validates and registers a site-local GLSL effect (⁠customEffects / effects/<name>.json + <name>.frag⁠) with checkEffectShader⁠, refusing private u_field or work past the approved GPU caps before touching disk.

  • rise accepts distance from 0 to 100 pixels (default 16). The catalogue tier is a minimum: a load rise uses CSS, while enter-view needs the timeline. A simple press on a rendered native button uses CSS :active (hold Space); a plain block or link needs the host to track a held key. The host leaves link navigation, form submission and click actions to the control.

id returns one entry; the guide has none. Every registered block, look, source, effect and kind appears. The five lists guide⁠, kinds⁠, operations⁠, recipes and blocks together are the first read, capped at 11,500 characters on the tests' fixture registry (9,273 today). The guide and the operations list name the live operations (⁠setValues⁠, setLiveSources⁠, setLive⁠, setGrants⁠, setBackends⁠, setOrigins⁠) only for a site that declares backends, live sources or values, and kinds lists island only when the registry has an island; id finds each of them on any site, and every operation stays checked. An unknown recipe or effect id is INVALID_OPERATION at id⁠, with the available ids.

plan and apply

A batch is a list of up to 200 operations, at most 1,000,000 characters of JSON, made from a known baseRevision⁠. plan runs it on a copy, validates once at the end, and returns what it would do. apply does the same and saves the result as the next revision, whole or not at all.

plan never generates an image: a generate request is only rewritten to its assets/gen/ path. apply generates it, once, after the batch has passed every check. Generation needs an images key in culm.json⁠.

key makes a retry safe. The same key with the same content applies once and returns the first result; the same key with other content is KEY_CONFLICT⁠. apply requires a key; plan does not.

A reply holds counts⁠, roots (created nodes whose parent was not created in the batch, as "<tree>:<id>"⁠, where tree is a page id, header⁠, footer or component:<id>⁠), changed the same way (each at most 20, with more counting the rest), pages and notes⁠. apply adds hint: "All ids: read, or diff(from, to)."⁠; there is no created list.

Operations for live data and islands (stage 5). Each takes the whole new list and replaces what the site has; the default guard refuses the ones marked, see "What protect refuses":

  • setBackends (refused), setOrigins (refused), setValues (refused when it adds, changes or removes a secret binding), setLiveSources (refused when it changes or removes a source a grant or a package binding names), setGrants (refused). The file forms are backends⁠, origins⁠, values⁠, liveSources and grants in site.json (live-data.md).

  • setLive { tree, id, live } sets or, with null⁠, removes the live setting of a node. It is open to an agent.

  • setSite { navigation: "swap" | null } turns in-place page changes on or off. It is open to an agent.

  • The node kind island (⁠props.island⁠, props.settings⁠, props.run⁠) is added like any other with add⁠, and its children are the fallback. An agent can draw an island that the registry knows; it cannot write one (⁠islands/ is not reachable) or install a package (below).

Refusals an agent should expect:

Code

Meaning

Code

INVALID_OPERATION

Meaning

the request or one operation is malformed or names something that does not exist; op is the index. The whole batch is refused

Code

INVALID_DOCUMENT⁠, INVALID_NODE⁠, UNKNOWN_KIND⁠, UNKNOWN_BLOCK⁠, UNKNOWN_SOURCE⁠, UNKNOWN_COMPONENT

Meaning

the result would not validate; nodeId⁠, path and allowed say where and what is allowed

Code

POLICY_VIOLATION

Meaning

a rule refused it: protected⁠, textRange⁠, backends⁠, secret⁠, grants⁠, agents or package (see "What protect refuses"); also a package that is not approved, or whose files changed, in a build

Code

REVISION_CONFLICT

Meaning

the head is not baseRevision⁠, including after a hand edit. Read again and plan again

Code

KEY_CONFLICT

Meaning

the key was used for another request

Code

SOURCE_CONFLICT

Meaning

a file changed between the plan and the write. Nothing was written

Code

RESOURCE_LIMIT_EXCEEDED

Meaning

more than 200 operations, a request over 1,000,000 characters, or a reply that could not be made to fit

Code

UNSUPPORTED_CAPABILITY

Meaning

the store does not hold that revision, or the site cannot be built here

Code

FETCH_FAILED

Meaning

a font or icon could not be fetched (a network error, a 404, a reply that is too big, a file Culm will not store): op and the family or icon name say which. The revision is unchanged. Send the batch again

measure

Renders the pages in Chrome and reports what is wrong with them in a form an agent can act on.

  • pages⁠: page ids (default: every page that is on). widths⁠: any of 1280, 834, 390. classes⁠: 1, 2 or 3 (default 1 and 2).

  • Class 1 is a compile problem (⁠invalid⁠). Class 2 includes layout/contrast defects (⁠off-screen⁠, overflow⁠, h-scroll⁠, overlap⁠, contrast⁠, tap-target⁠, shape-covers⁠, shape-complex⁠, raw-colour⁠, crowded-phone-row⁠) and design findings (⁠stretched-button⁠, header-edge⁠, hero-bare⁠, orphan-heading⁠, bleed-gutter⁠, all-stacked⁠, no-accent⁠, chrome-as-inserted⁠, side-stripe⁠, gradient-text⁠, glow⁠, emoji-icon⁠). Class 3 is taste (⁠column

    ⁠, alignment⁠, symmetry⁠, rhythm⁠, empty-band⁠, line-length⁠, heading-order⁠, duplicate-heading⁠, stacked-row⁠, phone-order⁠). Together with invalid⁠, runChecks produces 31 checks.

  • The profile is version 1: widths 1280, 834 and 390, themes light and dark, each direction the site's languages declare, the default state of each part. What it does not cover is listed in skipped⁠.

  • The MCP reply merges findings by page, check and nodes: a row is { page, check, nodes, at, message, fix?, file?, line? }⁠, where at lists the cells as "1280"⁠, with dark and rtl added when not light and left to right. fix is advice for a class 2 finding. culm check and the core Report keep one finding per cell, with theme⁠, dir⁠, observed⁠, expected and a key⁠; on a folder site a finding names a file and line from its first node.

  • since is a revision. findings then holds the still-failing rows and the new ones (⁠new: true⁠), fixed the rows no longer present, and unchecked a count. A repair is confirmed when its row is in fixed and no row is new.

  • Chrome is found from --chrome or CULM_CHROME⁠, then a Chromium already installed by npx playwright install chromium⁠, then the system Chrome. Missing, the result is MEASUREMENT_INCOMPLETE naming those three ways. A page that could not be measured is listed in incomplete⁠; a request the bundle could not answer is in blocked⁠.

  • On a folder site, measure drops an asset or font link that points outside the project without saying so, while culm check refuses it as a POLICY_VIOLATION and exits 1. After an agent measures, run culm check to see those links.

  • A cursor continues the report this server just made. It holds one report in memory, and a cursor for one it no longer holds is refused: run measure again without a cursor.

Measure never downloads a browser and never contacts an address outside the compiled bundle.

diff and restore

diff compares two revisions the store holds and lists the nodes added, removed, moved and changed, each in its own list, with the paths of changed fields and the pages affected. It is also what apply points to for ids it cut from its reply.

restore makes an earlier revision the new head, keeping the history. On a folder site it writes the stored file contents back, so comments and layout return exactly. It needs baseRevision and a key⁠. A revision older than the 200 a folder keeps is UNSUPPORTED_CAPABILITY⁠.

build

Builds the site to its output folder and summarises the manifest. It is the same build as culm build⁠, run on the files as they are now.

Edit this page on GitHub