Agents

Server instructions

The server states its working order once, in the instructions of its initialize result (the constant INSTRUCTIONS⁠): read catalogue guide once (it carries the setup batch and the shortest shape batch); set the design in one batch with setLook⁠, setFonts and addPage (a Google family goes in setFonts as { google: "Lato", weights: [400, 700] } and is then named up:lato⁠; an icon may be any Iconify set:name⁠); compose each section from kinds with add⁠, setStyle and setProps⁠, giving every section a decorative shape or a recipe (⁠hero⁠, split⁠, cta-band⁠, card⁠, divider⁠, buttons⁠); send many operations in one apply and skip plan for routine batches; save a repeated section with makeComponent⁠; end with measure and repair what it reports. The one-pass rule: fix each finding once on each node; if the same finding comes back on that node, try the other way its fix names once, then move on.

The default (compact) profile's instructions are the one-sentence constant MCP_POINTER (under 200 characters; it names describe and write⁠). The authoring guide (⁠JSON_GUIDE⁠: ops, ids, style keys, shorthands for shapes, charts and motion, and the measure⁠/⁠read line) comes back once in the describe {} reply, as guide after pages and outline⁠; describe {example} is unchanged. outline is what a bare find {} returns at that revision (each tree's top-level sections as id, kind and first words, read as find reads it, so a package component is opaque), so the first request gives the guide, the pages and the starting outline. It is in the reply only, never in a tool description. When the reply would pass the read cap, the outline is cut first, then the pages (⁠cut is true; find with a tree reads the rest); the guide is never cut. The reason is cost: in code mode Codex appends a server's instructions to the entry of every tool it lists, so a 2,500-character guide there was sent seven times in the tool listing. The --full and --sections profiles keep the working order in their instructions⁠.

Declared tools

What a declaration is, where one may sit and who may turn tools on: app/actions.md.

  • Default profile. update takes tool: { name, description, confirm? } (⁠null clears it), and a node given to insert may carry tool⁠. It has no op for the site's switch or an island's acts⁠, so an agent here can declare a tool and cannot turn tools on. A field's parameter description is props.description⁠. The authoring guide says this on every site.

  • --full⁠. setAgents { agents: { tools: true } | null }⁠, setTool { tree, id, tool } and setActs { tree, id, acts }⁠; null clears. The catalogue's guide and operations lists name them only for a site that has agents or a node with a tool (a site with acts alone does not list them); id finds each on any site. The instructions end the part about the operation tools with one pointer: "To declare a tool on a site that has none, read the catalogue entry for setTool."

  • find⁠. A match that declares a tool also has tool⁠, its derived entry: name, description, class, input schema, node⁠, and fire and confirm where they apply. A match in a component's own tree has none, and neither does an island node that offers acts⁠.

  • The guard. culm mcp refuses turning tools on unless culm.json holds "agents": { "mayTurnToolsOn": true }⁠, in every profile and on both transports (rule agents⁠).

What protect refuses

allow is the hook a product uses to add its own refusals; it runs on every operation, in plan⁠, apply and restore⁠. culm mcp passes protect (and, on a folder, the guard for packages below), and a host process can pass it too. Every refusal is POLICY_VIOLATION⁠, with the rule that refused it.

Text and required content.

  • taking the mark required off a node that has it (⁠setRequired with false or null⁠), rule protected⁠;

  • removing the site's text size range or widening it, rule textRange⁠.

Core's own rules refuse the rest, with no hook needed: a node marked required cannot be removed, hidden on any layout, emptied or shrunk below the range, and the same holds for its parent, its page, and a part of a component that an instance overrides. Together these mean an agent cannot delete required content. It also cannot get around the rule in the same batch: a setRequired and a remove in one batch is refused when protect is on. A batch or a restore also cannot put a required form or field into repeated rows, under a show condition or on a page that is off (overview.md).

So a repair cannot fix a clipped title by removing it, hiding it or shrinking it below the allowed size. It has to make the title fit.

What a site may call, keep and let a frame read (stage 5). These are a person's decisions about where data goes. The default guard refuses all of them to an agent:

  • setBackends and setOrigins⁠, whatever they say (rule backends⁠);

  • setValues that adds, changes or removes a secret binding, that is, marks a value as a key, unmarks it or sends it to another backend (rule secret⁠). A value that is not a secret stays open;

  • setGrants⁠, whatever it says (rule grants⁠);

  • setLiveSources that changes or removes a source that a grant names (rule grants⁠). Other sources stay open to the agent;

  • restore that changes any of these: backends or origins, the secret bindings, the grants, or the definition of a granted source. A restore changes them as surely as the operations do.

An agent can still write live nodes, ordinary values, and sources that no grant and no package binding names, and it can set navigation⁠. Those are the project's own content.

Packages (folder sites, lockPackages⁠). A package's pieces are the package's, as a person approved them:

  • no operation changes, moves into, removes, detaches or makes a component from a component of an approved package, or from a tree that holds a use of one: detach and makeComponent on a package instance are refused (rule package⁠). A use of a package component on a page is the project's own and stays open;

  • a setLiveSources (or a restore⁠) that drops, renames or changes the backend, path, method or cookies of a source that culm.json binds for a package is refused, naming the source and the package (rule package⁠).

Turning tools on is not protect⁠'s: it is toolsOnGuard⁠, a second guard that culm mcp chains after protect⁠. A host that passes protect alone has no guard on it. It refuses a setAgents that turns tools on and a restore to a revision with tools on when the site has them off (rule agents⁠). culm mcp skips it when culm.json allows (app/actions.md).

Files no tool writes. An agent has no way to write islands/⁠, packages/⁠, culm.lock.json or culm.json⁠: no operation names a file, the revision store holds only site.json⁠, pages/⁠, pieces/⁠, blocks/⁠, shader pairs and (as a record only) culm.json⁠, and a restore never writes culm.json back. render and build refuse an out under islands⁠, packages⁠, culm.lock.json or any source folder. Nothing in tools/list has the word approve or trust in its name, and a test fails if one is added. That is what the tools hold; a caller with file access is outside it (folder-sites.md, "What this does not protect").

The local port

culm mcp --port n opens the SDK's HTTP transport with three checks on every request. All three must pass, or the request is answered 403 (a repeated Host header is 400).

  1. Address. The listener binds 127.0.0.1 and there is no option to bind another address.

  2. Host⁠. The header must be 127.0.0.1:<port> or localhost:<port> with the chosen port. This stops a web page that rebinds a name to the local machine.

  3. Origin⁠. A request that carries any Origin header is refused. Browsers send one; command-line clients and agent runners do not.

On top of those, the server requires a random token (32 bytes, new on every start) in the Authorization: Bearer <token> header. It is printed to standard error when the server starts, because standard output carries the protocol:

MCP token: 9f2c...
MCP listening on http://127.0.0.1:3333/

The token is not a sign-in and identifies nobody. It exists so that another program on the same machine cannot call apply by guessing the port. The server keeps one session per client, so an editor can reconnect. A request body is limited to 8 MiB.

What this does not do

  • No accounts, no identity, no audit of who called. A revision records that it came from Culm (or from a hand edit), not from whom.

  • Remote access: supported by the hosting recipe only. culm mcp itself listens on standard input and output and on 127.0.0.1⁠.

  • protect is a rule for callers that use the tools. It does not stop a caller that can write the files (see "What this does not protect" in folder-sites.md).

Fonts, icons, borders and aliases

  • setFonts takes "sys:sans"⁠, a catalogue name or { google: "Lato", weights: [400, 700] } (weights 100 to 900; family letters, digits and spaces). On a folder site plan and apply fetch the latin subset from Google Fonts into fonts/<slug>/ (the slug is the family in lower case with dashes); a look then names it up:lato⁠. A failed fetch is FETCH_FAILED and changes nothing.

  • An icon or button icon name is a built-in name (⁠star⁠) or an Iconify set:name such as lucide:camera⁠. On a folder site the SVG is fetched into assets/icons/<set>/ with the set's licence. Only sets licensed MIT, Apache-2.0, ISC, CC-BY-3.0 or CC-BY-4.0 are accepted (⁠POLICY_VIOLATION⁠, rule icon-licence⁠). A batch fetches at most 60 icons, counting only icons not already held, and at most 4 font families; more is RESOURCE_LIMIT_EXCEEDED⁠.

  • Aliases, rewritten by plan before checking: align on a text is textAlign⁠; display: "none" in a layer is hidden: true⁠, and display with another value is hidden: false there (an explicit hidden wins); a style radius on a rect shape moves to its geometry.radius (a radius already there wins). A value with no mapping is refused with a hint.

  • Borders: border and borderTop⁠, borderRight⁠, borderBottom⁠, borderLeft take { width, color } (style optional, solid by default); borderWidth takes a number or four numbers; borderColor takes a colour name. Width is 0 to 64.

  • menu takes foldOn: "phone"⁠: on a phone the links fold into a button that opens them (native details⁠, no script).

Edit this page on GitHub