Skip to main content

The Imagine stage

Imagine is the first of Create's four stages (Imagine, Develop, Check, Make). It holds intent and concept capture: the concept studio an agent generates for each product, and the sketch tools. Develop, Check and Make are driven by the digital twin (exact CAD, KiCad, firmware, simulation, DFM, interface contracts, release); they show twin state and are not a second editor.

The studio is formgraph, merged into MetaForge from formgraph 2.7.0 and restyled to MetaForge's design tokens. The standalone formgraph plugin keeps its own copy; this one lives in api_gateway/imagine/ (provenance in its README.md).

Gateway/v1/twin/projects/{project_id}/imagine/... (api_gateway/imagine/)
Twin itemIMG-STUDIO, work product type imagine_studio (a definition: every config change or rework is its next revision)
MCPtwin.imagine_get_studio, twin.imagine_put_studio, twin.imagine_patch_studio, twin.imagine_handover_status, twin.component_thread, twin.imagine_adopt, twin.form_thread, twin.imagine_accept_form; under delegation only, twin.imagine_handover and twin.imagine_rework
Engineapi_gateway/imagine/engine/ (HTML, CSS and JS), three.js r128 vendored under engine/vendor/

Verification levels​

Every claim the studio makes carries a level, and the browser cannot reach past V2:

LevelNameWho reaches it
V0CapturedThe browser: the person said it, or the agent inferred it from the brief
V1ConsistentThe browser: the config passes the formgraph rules and agrees with itself
V2ScreenedThe browser: rules of thumb and simplified models ran in the engine
V3AnalysedMetaForge in the cloud: real solvers, bound to a twin revision
V4VerifiedMetaForge in the cloud: checked against exact CAD, the schematic or a test, bound to a revision
V5QualifiedPeople, with evidence
ReleasedReleasedThe release gate

Nothing from the browser is stored above V2. The gateway drops any field a page could use to claim more (verified, verification_level, authority, approved, released and the like) before anything is written; screening results are stored as preliminary guidance (dfm_status: preliminary_guidance, verification_level: V2) with the engine's rule version; decisions, requirements and entities are written at their default, proposed authority; manufacturing context fields are assumption or user_stated, never decision; interface contract values are estimated.

Screening an authored form. The enclosure checks (wall thickness, draft, fit, cost) are not run for an authored form, so the page screens it from what its drawn triangles measured: that every part draws, the tip angle against a 15 degree screening choice, the overhang share (an upper bound, reported without a limit) and whether components overlap. The stored entry also lists the enclosure checks as na, "not run", never as passed. Nothing is stored until a measurement exists.

The studio​

An agent writes the studio with twin.imagine_put_studio (or PUT /studio), and changes it with twin.imagine_patch_studio (or PATCH /studio): a list of edits (JSON Patch style, a list item named by its id) applied to the revision the agent read, then checked and written exactly as a full config is, so a one-line change is not a whole-config rewrite. The config is a formgraph product config, checked with the merged build_page and fg_context rules. One thing differs from the plugin: the product context (real parts, machines, options, models, scenarios, packed references, made parts) travels inline as config.context, never as a folder path, because the gateway never reads a path a browser or an agent names. A reference must arrive packed (a base64 image data URI, or an encoded mesh); a file is refused.

Each PUT is the next IMG-STUDIO revision. The person's earlier choices, scenarios and confirmations carry over. A handed-over studio refuses a PUT until a person reworks it.

The catalogue​

The processes are im (injection moulding), cnc, sls and fdm. fdm is desktop FDM on a Bambu Lab P1S-class printer (0.4 mm nozzle, 0.2 mm layers, 256 x 256 x 256 mm, enclosed chamber) with petg, pla, petgcf and asa, finishes asp, fine and sanded, and the insert and thread-forming fixings. It has its own screening rules, never the SLS ones: walls of 1.2 mm or more in whole perimeters of a 0.42 mm line, the closed top printed face down because it bridges only about 20 mm, a warp check on the footprint (150 mm for ASA and filled grades, 220 mm otherwise), heat-set inserts rather than thread-forming screws for repeat assembly, slots at least two lines wide, and holes that print undersize. Cost is filament plus machine time, with no tooling. The default fdm-generic machine uses the FDM rule book, and a context can no longer replace a built-in process with a ruleBase stand-in.

A library material named for its family, such as prusament_petg, bambu-petg-cf or polymaker_asa, is accepted for fdm: the page screens it with its family's figures (petg, petgcf, asa; the longest match wins) and the validator warns that it did. The stored config, and so the manufacturing context Develop reads, keep the name given.

The functions include e_ldrv, a constant-current buck LED driver dimmed by PWM from the board, for a product whose main light is a high-power LED (a lamp). e_led stays a status light.

From a prompt​

The chat builds the studio from what the person says. The project brief the chat agent gets carries one line on the studio (not started, draft, revision n or handed over at revision n), and the chat system prompt adds one rule when the studio tools are in reach: with no studio and a product described, read the imagine_studio playbook and build the studio; with the studio handed over and the person asking to proceed, read that playbook's After handover section and start Develop.

The playbook (mcp_core/plugin_skills/imagine_studio/SKILL.md, read with chat.read_playbook) is the formgraph new workflow rewritten for the twin tools:

  1. Work from what the person said, asking at most three questions.
  2. Call twin.imagine_put_studio with a config built from the playbook's skeleton, which passes the checks as written (engine: "formgraph@2", a product with a lowercase slug id, a form.template from the catalogue, requirements with pri of Must, Should or Off, a programme with the intent ledger, assumptions and markets, an environment block, scenarios, interfaces and the inline context with the manufacturing quantity). A test (tests/unit/test_imagine_studio_playbook.py) runs that skeleton through the same validator.
  3. Fix every reported error in one retry.
  4. Call twin.imagine_handover_status and tell the person what to do in the studio and what is still missing.

The agent never claims above V2 and does not hand over: the handover is the person's, in the studio, unless the owner delegates it (see delegated to an agent). After it, the playbook reads the handed-over records and starts Develop in order: the concept mesh, then exact CAD per made part with the DFM and manufacturing context, then electronics and firmware against the interface contracts. Approvals stay the person's.

In the dashboard, Ask the assistant on the empty studio and Start developing after the handover send these turns directly (see the Create view). The Claude Code plugins carry the same playbook as the imagine_studio skill and a /metaforge:imagine command; there, after handover, mechanical parts are written client side with the generate_cad_script skill (Claude Code writes the CadQuery and the server runs and renders it), rather than twin.design_cad_loop, which spends the gateway's model budget.

REST​

All under /v1/twin/projects/{project_id}/imagine. Authentication is the gateway's middleware, like every other route.

MethodPathBodyResponse
GET/studio{project_id, status: "none"|"draft"|"handed_over", revision, config_ref, engine_url, config, updated_at, handover: {...}|null, collections, warnings}
PUT/studio{config}the same; a new studio revision. 422 with errors, warnings and findings (the same finding objects POST /validate returns, no verdict) when the config fails the formgraph checks; 409 when handed over
GET/enginethe engine page with the project's config embedded (see below)
GET/engine/assets/{name}the engine's own CSS and scripts: engine.css, engine.js, three.min.js, OrbitControls.js, GLTFExporter.js
POST/events{event_id, kind, data}{accepted: true, mapped_to: [refs], duplicate}; idempotent per event_id
GET/handover{ready, items: [{id, label, status: "done"|"missing"|"assumed", detail}]}
GET/validationthe validation report for the head revision (see Validation)
POST/validate{config?, revision?, scope?, gates?}the same report as a dry run; 404 with no studio, 409 for a config on a handed-over studio, 422 for a non-head revision, an unknown scope ref (bad_refs) or an invalid config (the body is the report)
POST/handover{op_id}409 with {detail: {message, items}} (the whole checklist, the blocking ones missing) when not ready; otherwise {handed_over: true, revision, created: [refs]}
POST/rework{op_id, reason}the studio, the same shape as GET /studio, on its new revision, with stale: [refs]
POST/adopt{base_revision, thread}the studio on its new revision, with Develop's part for component thread thread taken in; 404 for an unknown thread, 409 when the thread has nothing to adopt, the studio moved past base_revision or is handed over, 400 for a board

collections is the twin-backed state of each browser collection, keyed by document id (choices, scenarios, contextEdits, assumptions, requirements, ledger, screening). The host sends it to the engine as fg:snapshot.

kind is one of choice, scenario, context_edit, assumption_confirmed, requirement, ledger, screening. The dashboard sends the whole page write as data: {collection, id, data} with event_id evt-<uuid>; a flat document with its id is also accepted. An event for a handed-over studio is refused with 409; a twin write that fails returns 502 and the event can be retried with the same event_id.

The handover and the rework are a person's decisions: a request from an agent surface (X-MetaForge-Surface: agent) is refused with 403, as is an agent confirming an assumption or a scenario, unless the owner delegates (below). Both are idempotent per op_id. Each operation is published to the project's operations log (job:imagine-...). An agent-surface scenario event that does not confirm is stored as the agent's (by: agent), so it never reads as the person's own scenario. agent and on_behalf_of in any event body are dropped: only the delegated path sets them.

Delegated to an agent​

When the gateway owner delegates human-authority decisions (METAFORGE_ALLOW_AGENT_HUMAN_AUTHORITY=true, default off; see delegating approvals to an agent), an agent may hand over and rework, for fully autonomous runs:

  • REST. POST /handover and POST /rework from the agent surface must carry X-MetaForge-Agent and X-MetaForge-On-Behalf-Of; without either the call is a 422, as on the approvals API. With authentication on, the person must be the authenticated principal (403 otherwise). With the flag off nothing changes: 403.
  • MCP. twin.imagine_handover {op_id}, twin.imagine_rework {op_id, reason} and twin.imagine_accept {op_id, assumptions, scenarios} are always registered with the studio tools and are refused unless the flag is on in the process the call lands in (the gateway, or the MCP sidecar that serves the twin tools, so set it on both). They are human-authority tools (mcp_core/guardrails.py, and destructive in mcp_core/annotations.py): no project approval policy approves them. An agent whose MCP connection sends X-MetaForge-Agent and X-MetaForge-On-Behalf-Of gets a delegated approval on the ledger and the call runs at once, with no prompt; without them the call is held for a person (see delegated holds through MCP). The person it acted for comes from that approval, never from a name the model supplies.

Acceptance without a person. twin.imagine_accept accepts the studio's open assumptions and confirms its inferred scenario tests for the person the agent acts for. An unknown id is refused with the ids the studio has. Each is an ordinary studio event, idempotent per op_id and id:

  • an assumption is recorded as accepted, never confirmed: it stays an assumption, the manufacturing context field it names stays assumed, and its assumption entity carries accepted_by_agent and on_behalf_of;
  • a scenario is confirmed and marked by: agent with the agent and the person; its scenario requirement's source reads agent on behalf of .

The checklist then counts them (assumptions read assumed, scenarios done), and each item's detail says so: a-drop, a-qty accepted by agent claude-code-e2e on behalf of fidel; not confirmed by a person. The REST equivalent is POST /events with assumption_confirmed (confirmed or accepted) or scenario with confirmed: true from the agent surface: 403 with the flag off, 422 without both headers, and with authentication on the person must be the authenticated principal. An agent's "confirm" of an assumption is recorded as an acceptance there too.

The concept mesh without a person. The checklist's concept_assembly item is cleared by a person having seen the form, or by a concept mesh in the project: a GLB whose authority is illustrative or structured. The free way needs no provider: twin.render_concept_sketch draws the layout, then twin.render_structured_mesh builds a GLB with one node per real part at its read size. With a mesh provider configured, an agent can instead make an illustrative mesh with twin.render_concept_image and then twin.generate_concept_mesh from that image (a job; poll twin.job_status). Both are illustrative writes, so a project policy of auto_clean or auto approves them within the spend cap (3 meshes an hour by default). Both default to the MCP session's project when the call names none, and a mesh made from a concept image inherits the image's project, so the checklist counts the agent's mesh like a person's.

The record says an agent decided, for that person, never that the person did: the handover (and rework) record carries by: "agent:<name>", agent and on_behalf_of, and the operations log line ends decided by agent on behalf of . The imagine_studio playbook and the plugins' /metaforge:imagine command, in a delegated run, carry on without stopping: accept, make the concept mesh, hand over once the checklist is ready, then Develop, Check and Make, recording each delegated decision with twin.record_decision. Without delegation they ask the person.

After the handover, to a release. Check and Make use tools that take a reference, never file bytes:

  1. State the machine the parts are made on with twin.state_manufacturing_context (machine_or_supplier_profile, for example "Bambu Lab P1S"). A delegated agent states it for the person; a machine the library holds is linked, so DFM assesses each part against its limits (stating the manufacturing context). Then measure each validated part with twin.evaluate_dfm (it measures every part with no exact analysis yet) or twin.measure_dfm with its item_key; the gateway reads the STEP from the twin (measuring by reference).
  2. Resolve the concept's components with twin.resolve_concept_component: the illustrative components the handover seeded (CMP-...) are realised_by the CAD parts that make them, or retired, each with a reason; restored undoes it (resolving concept components). It is the agent's own design decision, so a project policy approves it.
  3. Run the structural load cases with twin.run_item_fea (mesh, then solve) and record each result with twin.record_document.
  4. Run kicad.run_erc and kicad.run_drc and record each result with twin.record_evidence, pinned to the schematic or board revision it checked (depends_on: ["PCB-...@n"]): the release needs a passing ERC and DRC on the current revisions.
  5. Put the product together and check it fits: commit each board's kicad.export_3d STEP with twin.commit_geometry, build the assembly with twin.build_assembly (every part and board at its placement, each hinge a revolute joint with its limits, and every screw and hinge pin in fasteners by designation, such as ISO 4762 M2.5x8 or ISO 2338 4x30, placed in the holes it goes through), and check it with twin.check_assembly (overlaps, hole patterns, the board outline in its pocket, each edge connector's mating axis against its slot's opening and a USB-C plug envelope through the slot, each fastener in its holes, washer stacks, joint sweeps, seated parts). A connector named by its reference (J1) takes its footprint and rotation from the board file; record each slot on its part as connector_slots. A hole pattern or hinge with no fastener is an unfastened joint unless it is a snap or a press fit. Fix each high and medium finding (design for assembly).
  6. Record the fabrication outputs, each with its source_ref (the revision it was made from: an output made from an older revision blocks the release), and two BOMs with twin.record_design_files (work_product_type: bom): the board's from kicad.export_bom, pinned to the PCB-...@n, and the assembly's, listing every made part and every fastener by designation and quantity, pinned to the ASM-...@n; an empty BOM, or one missing a bought part, blocks the release (BOM files). Record every board and schematic as its item's revision: one that is not is left out of the package and blocks it. Then twin.create_baseline, a release_approval request with twin.record_engineering_entity, and twin.create_release_package. The baseline and the approval wait for the person: neither is a human-authority tool, so the human-authority delegation does not reach them (release packages). When the owner also sets METAFORGE_ALLOW_AGENT_RELEASE=true, the delegated agent creates the baseline, approves the release with twin.approve_release and creates the package, each recorded as its decision on the person's behalf (delegating a release). A failing ERC, DRC or assembly finding, or a stray board left out of the package, that is truly acceptable is accepted with twin.accept_release_finding and a reason: held for the person, or, under the same release switch, recorded as the agent's decision for them (the release checklist).

Mapping into the twin​

Each event is written through the service the rest of MetaForge uses for that kind of record (api_gateway/imagine/twin_bridge.py):

StudioTwin
Intent ledgerAn intent item per statement (INT-IMG-L<n>), with its ledger status and what it maps to
Requirements, custom requirementsThe CS-IMAGINE constraint set: each with its source (limit_source) and verification method
Operating environmentTwo typed requirements in CS-IMAGINE: every part rated down to environment.opMin (operating_temp_min_c <= opMin) and up to environment.opMax (operating_temp_max_c >= opMax), in degC on BOMItem, so Check can hold each chosen part's rating against them. They are not part of the handover checklist's requirements, which are the person's
AssumptionsAn assumption entity; the manufacturing context field it names, marked assumption. A person's confirmation records it as stated and flips the field to user_stated
Option choicesA design decision, with the other candidates as alternatives, pinned to the studio revision
Parts (at handover)A concept assembly decision: each chosen part gets its CMP- component id and keeps its studio part id (studio_part), role, order code and library entry, so Develop, Check and Make can follow it (Components across the stages); sources, retrieved dates and envelopes are in the record. Develop is also seeded with one candidate component selection per order code, linked to the studio parts it fills, so Develop confirms or replaces the concept's parts instead of typing them again; a part with no real order code or maker, or one Develop already has a selection for, is left out
ScenariosScenario requirements in CS-IMAGINE (verified by demonstration)
Context editsManufacturing context changes with provenance (imagine.studio, the actor, the studio ref)
Interfaces (at handover)Proposed interface contracts: IFC-CAD-EDA (each part's envelope) and IFC-EDA-FIRMWARE (each part's buses, and the firmware pin map from the connection list). One Develop already holds is left alone
Connections (at handover)A wiring decision: the wiring table, the harness BOM lines and the numbered wiring sequence (see Wiring at handover)
Screening resultsAn evidence record at V2: dfm_status: preliminary_guidance, the rule version, every rule's result

A handover after a rework writes CS-IMAGINE's next revision. A requirement stated exactly as before (same name, values, wording, source and parents) keeps its node and id: it is bound to the new revision too, so evidence and verification cases that name it stay linked and current. Only a changed or new requirement gets a new node, and only records that name a changed or removed requirement go stale; a record that names none goes stale only when the set itself changed.

The handover gate​

GET /handover (and twin.imagine_handover_status) checks, in order. The gateway still evaluates this checklist to gate POST /handover. The verification service decides the first nine items for the validation report (see Validation), and a parity test keeps the two equal. The tenth, wiring, is decided by the gateway alone for now:

  1. ledger: the intent ledger is complete, every statement reviewed.
  2. assumptions: each assumption confirmed, or explicitly accepted as an assumption (then the item reads assumed; an agent's acceptance is named in the detail).
  3. scenarios: every scenario test confirmed by a person, or by a delegated agent for them (named in the detail, never as the person's).
  4. requirements: each requirement has a source and a verification method (assumed when the catalogue's default method is used).
  5. parts: one chosen part per function, each with a source, a retrieved date, interfaces and a 3D envelope.
  6. manufacturing_context: process, material and quantity recorded.
  7. concept_assembly: a chosen part for every function, and the form seen: either a person has said "I have seen this form" for this revision (the studio's button; the server stamps the revision, so a form the agent changed since is not covered, and an agent cannot record it), or a concept mesh exists, illustrative or structured from the layout. The mesh is optional: nothing downstream reads it, it can never be evidence, and a paid provider should not decide whether a design is ready.
  8. interfaces: interfaces described, so contracts can be proposed.
  9. screening: screening results stored at V2.
  10. wiring: with a connection list, every power or ground input and every signal input is wired (or listed in connections.unused) and each wire with a wire.awg is thick enough for its peak current; any finding holds the handover. With no connection list it reads assumed when two or more parts have interfaces (they are wired in words only), and done otherwise. See Wiring checks.

ready is true when no item is missing. POST /handover then writes the requirements, the manufacturing context, the ledger, the concept assembly (with component ids) and the proposed contracts, freezes the studio revision read-only and returns every reference it created.

Validation​

GET /validation, POST /validate and twin.imagine_validate answer one question: is the Imagine phase done, and if not, what is left and who clears it. They are a dry run. Nothing is written, no assumption is accepted and nothing is handed over.

The verification service decides, not this gateway. Every rule that decides pass or fail lives in MetaForge-Verification (profile imagine-v1, POST /v1/validations). The gateway states the studio's facts and renders the report it gets back. The facts are the ledger rows, the assumptions, the scenarios, the requirements, the part chosen for each function with its source, date, interface count and whether it has an envelope, the manufacturing context, the markets, and whether a screening result and a concept mesh exist. The report is returned unchanged, with project_id, computed_at and stale added. A field the service adds later passes through. The studio never shows a pass the service did not compute.

SettingMeaning
METAFORGE_VERIFICATION_URLBase URL of the verification service. Unset means not configured. Read by the gateway and the MCP sidecar.
METAFORGE_VERIFICATION_TOKENBearer token the service issues. A secret.

When the service cannot answer (not configured, unreachable, refusing the credential, failing, or sending a report this gateway cannot read) the answer is 200 with verdict: blocked_external, level: V0, no gates and exactly one finding, verification.service, with resolver external and status not_assessed. It is never a local fallback: the studio is simply not assessed, and an agent reports that and does not retry in a loop. A request the service calls malformed is a 502, because that is a bug here and not an outage.

The report​

  • verdict says who acts next, first match wins: invalid (the config check failed), needs_agent, blocked_external, needs_person, ready_for_handover. The agent never declares the studio done.
  • level is V0 (captured), V1 (consistent) or V2 (screened), never higher.
  • gates lists config_valid, handover and define_exit, each with a decision of pass, fail or incomplete. A gate decision and a verdict are different answers: a gate can be incomplete while the verdict is needs_person.
  • findings each carry check_id, gate, severity (blocking or advisory), status (pass, fail, assumed, inconclusive, not_assessed), a target (kind, id, revision), generated message text, evidence refs, a resolver and an optional fix.
  • resolver is who can clear a finding: agent edits the config, person makes a decision only a person can, external needs something outside the project (a concept mesh, or the service itself).
  • fix is {op, pointer, needs}. It names what is needed and where it must come from, never a value. pointer addresses the submitted revision (for example /parts/0/source), not the formgraph config, so a client maps it to its own document.
  • debt lists the assumed findings: accepted as assumptions and not confirmed. They are never folded into a pass, and accepted_by names an agent that accepted one for a person.

Finding text is generated from ids and counts. It is data, not instructions.

Gates​

  • handover: the nine items above, as findings. The parts item is one finding per part per check (parts.source, parts.interfaces, parts.envelope) and one per function (parts.chosen), so a fix is addressable.
  • define_exit: the Programme view's exit from Define (ledger reviewed, assumptions confirmed, markets chosen, every requirement has a value, every requirement has a planned test). It is advisory for the handover and a gate of its own. It is stricter on purpose: an accepted assumption passes the handover and fails the Define exit. The last two checks need the studio engine's own answers, which the gateway does not send yet, so they read not_assessed rather than a guess.
  • config_valid: the formgraph check, which this gateway still runs. This is a labelled interim exception until those rules move into the service. The gateway sends the result as findings, one pass when the config is clean, and the service folds it into the verdict. It never assumes a config is valid.

Request and errors​

POST /validate takes config (check a draft instead of the head's), revision (only the head is validated), scope (re-check only the refs you changed, as {kind, id}) and gates (config_valid, handover, define_exit). GET /validation is the report for the head revision.

An invalid config is a 422 whose body is the service's report with verdict invalid. Over MCP, twin.imagine_validate returns that report, and the blocked report, as a result and not as an error. It is read-only, so it is never held for approval.

The form in the revision​

When the studio's form is authored (form.template is authored), the revision sent to the service carries form: kind: "authored" and each part's id, its kind (generated, primitive or component) and whether it is the body. The geometry code never leaves the studio. A studio from before the enclosure template was removed sends no form, because the service refuses fields it does not know. If an authored block has no usable parts, none is sent.

For an authored form the service adds advisory findings and no blocking one: form.enclosure_checks (not_assessed: the checks that need an enclosure were not run), form.confidence_mix (every part is a bought component) and, from what a look measured (see "Authored forms"), form.measured (not_assessed when nobody looked at this revision), form.balance (the tip angle against a stated 15 degree screening threshold, fail when it would tip over, not_assessed for a form with no flat base) and form.component_overlap (one fail per overlapping pair of components, or one pass). Overhang is carried and not judged. The measurement rides in the revision's form.measured only when it was recorded for that revision. Advisory findings cannot change the verdict, a gate or the level. The verification service must be a build that knows form; an older one refuses the request, so the pin MetaForge's CI installs has to move with this change.

Rework​

POST /rework opens the next IMG-STUDIO revision as a draft. Moving the item's head is what marks the records made for the frozen revision stale, through the twin's existing impact path: decisions are pinned to the studio revision and go stale with it, and the screening evidence is marked stale through the same staleness path. Develop and Check then show that evidence as needing a re-run.

Form changes from Develop​

A rework is for a change of intent. When Develop only changes the form (a longer case, a thinner lid), the studio can follow without one. twin.form_thread puts each part the studio draws beside the Develop CAD item that makes it. A part is paired with the item it names in develop_item, or else with the one CAD item whose name holds every word of the part's name ("Case base" pairs with "Flight controller case base"). If more than one item fits, nothing is paired. Both sizes are boxes on the studio's axes (millimetres, Y up). The studio side is what twin.imagine_look last drew, kept for that revision even after handover. The CAD side is the head revision's validated bounding box. Each row is same (every side within 0.5 mm), differs, accepted (the studio took that item revision's difference), unmeasured or unpaired. A brief studio's size limit is within or exceeds instead (Brief studios). Openings and mounts are not compared yet.

twin.imagine_accept_form takes one differs or exceeds row into the studio. Its changes replace form parameters only (/form/params/<name>, numbers, or a brief studio's /form/brief/envelope_mm); the caller picks them so the studio draws Develop's size. With no changes, the difference is recorded as known and the form stays as it is. The part is stamped develop_form with the item revision it took, and the studio keeps a list of these syncs. This is the one change allowed on a handed-over studio, and the studio stays handed over: only the form moves, so the requirements, interfaces and components the handover seeded stand, and nothing is marked stale.

The engine page and the host bridge​

GET /engine serves the fixed engine with the project's config embedded the way formgraph's build_page does it: the JSON with every </ escaped, in a <script id="fg-config" type="application/json"> block the page reads with JSON.parse. Asset URLs are relative (engine/assets/<name>?v=<hash>), so the page works behind the dashboard's /api proxy. ?theme=light or ?theme=dark sets the theme; otherwise it follows the system.

It is served with a strict Content Security Policy:

Output
default-src 'none'; script-src 'self'; style-src 'self';
style-src-attr 'unsafe-inline'; img-src 'self' data: blob:; worker-src blob:;
font-src 'self'; connect-src 'none'; object-src 'none'; base-uri 'none';
form-action 'none'; frame-ancestors 'self'

No inline script, no eval, no third-party origin. three.js r128 is vendored (engine/vendor/MANIFEST.json records the npm tarball's integrity and each file's sha256, and a test checks them). No web fonts are fetched: the page uses the MetaForge faces when installed, then the system UI font. The background solver is a blob: worker the engine builds from its own code, and reference images are data: URIs, which is all worker-src and img-src allow beyond the gateway. METAFORGE_IMAGINE_FRAME_ANCESTORS widens frame-ancestors when the dashboard is served from another origin.

The dashboard hosts the page in <iframe sandbox="allow-scripts">, without allow-same-origin. Messages carry {fg: 1, type, ...}:

DirectionMessageMeaning
page to hostfg:ready {engine}the engine booted
page to hostfg:write {collection, id, data, event_id}a write; the host forwards it to POST /events
page to hostfg:height {px}the height the page would like at its width (480 to 960 px); never the document's height
page to hostfg:select {component_id}a BOM line was selected
page to hostfg:download {name, mime, base64}a file to save (the sandbox cannot download)
host to pagefg:snapshot {collections}the twin-backed state of each collection
host to pagefg:readonly {value}after the handover: every edit control is disabled

The page detects it is hosted when window.parent !== window. It listens only to its parent frame, locks onto the origin of the first host message, queues writes until the first fg:snapshot, and never takes code from the host. In read-only mode every edit control is disabled (view, simulate, Try it and copy controls stay usable), graph editing is blocked, and any write is refused in the page as well as by the gateway. Standalone, with no parent frame, the engine keeps the plugin's claude.use('db') path, so the two copies can diverge cleanly.

The host validates every message's origin and shape, forwards fg:write to POST /events and never executes anything from the page.

The engine hosted in Create​

Hosted, the engine marks its root fg-hosted and fits the frame rather than a browser window:

  • Chrome. The product name and logo, and the side-panel handles, are hidden: Create shows the product, the stages, the Studio and Sketch tabs and the theme. The bar keeps Design / Programme, Simple / Engineer and the more menu. The 3D view's own first mode reads Model (standalone it is Studio), so it is not confused with Create's Studio tab.
  • Layout. At 900 px wide and more, the controls run down the left (36%, at least 280 px) beside the 3D view, which is min(560px, 60vh) tall with the panels under it; each part scrolls on its own and the frame's height is the host's. Below 900 px everything stacks in one column, the 3D view first at clamp(300px, 70vw, 440px), and the page scrolls inside the frame. Nothing scrolls sideways.
  • 3D view. A ResizeObserver on the view resizes the renderer and the camera's aspect. The camera frames the part's bounding box (its bounding sphere fits both the view's height and width, with a 15% margin, along a fixed three-quarter view), and frames it again whenever the view changes size, until the person moves the camera.
  • Height. fg:height reports the height the page would like from its width alone: the bar, the view (560 px wide, up to 440 px narrow) and room for the panels, between 480 and 960 px. It never reports the document's height, which follows the frame's own height and would grow the frame without end.
  • Only the configured product. The shell's section and part names come from the config: form.label when it is set, Fuselage shell for a multirotor airframe, Shell otherwise; never the template's own words. When the config sets no form.params, there is nothing of the product's own to draw: the 3D view shows No shape yet (no part, no floor grid, no dimensions or colour chips) until the person moves a size control in the studio. The embedded fg-config is the only config read; a sandboxed frame has no storage, so no earlier session's state can replace it.

The engine's tests are tests/unit/test_imagine.py (static checks that run in CI) and dashboard/e2e/imagine-engine.spec.ts, which hosts the real engine files in a sandboxed frame in Chromium and checks the empty state, the labels, the bounding-box fit through a resize, the one-column layout and the bounded height (npx playwright test imagine-engine).

Brief studios​

A studio has a depth. A full studio authors its form (the next section). A brief studio is for a product led by its electronics or function, where the form Develop designs is the real one and a drawn concept of it would only need keeping in step. Its form is a size limit:

JSON
"form": {"template": "brief", "envelope_mm": [130, 52, 22]}

envelope_mm is [length, width, height] in millimetres, Z up, as CAD gives it. Every other part of the config is the same as a full studio's: ledger, assumptions, scenarios, requirements, one chosen part per function, interfaces, manufacturing context and wiring, which is everything Develop is seeded from.

Before a brief config is checked or stored, the gateway expands it into an authored form with one generated part, size-limit, a box drawn from params env_l, env_w and env_h. The stored form keeps brief: {envelope_mm} and template: "authored", so the formgraph checks, the page, the look and the verification service work unchanged. Every write expands again from brief.envelope_mm, so patching /form/brief/envelope_mm resizes the box, and the box cannot drift from the limit. A brief form without a usable envelope_mm is refused with the formgraph errors (422).

At handover, a brief studio's concept item needs only a chosen part for every function. A person does not need to have seen the form, and no concept mesh is needed. The screening item is assumed, not blocking, because there is no drawn form to screen and Develop's CAD is checked instead.

After handover, the studio shows Develop's real design through a followed mesh reference (A supplier's model as a reference). The form thread pairs the size limit with Develop's newest assembly (or with its only CAD item when it has no assembly) and reports within or exceeds. To take a larger size, twin.imagine_accept_form replaces /form/brief/envelope_mm with [length, width, height].

Choose brief when unsure: a rework can turn a brief studio into a full one.

Authored forms​

Every form is authored. The enclosure template was removed: the checker refuses it with a message saying so, and a studio written before the removal stays readable but cannot be drawn (the engine page answers 410 and twin.imagine_look answers not_authored). Nothing deletes stored studios; write a new authored studio instead. A form sets form.template to authored and describes the form as parts, each carrying the body of a geometry function, build(p, g). A box around electronics is a form whose body part is a g.box. The agent skill (mcp_core/plugin_skills/imagine_studio/SKILL.md) is the reference for writing one, with the shape builder and a worked lamp; this section says how the gateway and the page treat it.

The config​

FieldMeaning
form.paramsThe dimensions, as numbers. A name is letters, digits and underscores, starting with a letter, 32 characters at most.
form.ranges[min, max] for the parameters a person may move.
form.authored.parts[]id (a slug), name, kind (generated, primitive or component), code, uses (parameters the code reads, each declared), body (at most one part), max_triangles (optional), make (optional; see below).
form.authored.parts[].makeHow the part is manufactured and how it looks: process (the product's process.id when left out), material and finish (of that process), color (a catalogue colour or #RRGGBB), source (proposed or person) and why (200 characters at most). Not on a component.

kind says how far to trust a part as geometry, and the page colours the three differently. A component is a stand in for a bought part drawn from its envelope, not the part's real mesh. form.template must be authored.

Each part is manufactured on its own, so each made part carries its own make: a printed PETG base, a machined aluminium arm and an ASA shade in one product. The agent proposes one for every generated and primitive part (source: "proposed", with a why); person means the person named it for that part. A part with no make takes the product's process and color.

Checks when it is written​

api_gateway/imagine/formgraph/authored.py is pure and runs inside the formgraph checks, so PUT /studio refuses the config, naming the part, when a part's code:

  • contains any of fetch, XMLHttpRequest, WebSocket, importScripts, import, eval, Function, document, window, self, globalThis, postMessage, constructor, prototype, __proto__, require, process, this, in code, a comment or a string;
  • contains a backslash escape or a backtick template string, which can hide a word;
  • is over 6000 bytes, or the parts together are over 40000;
  • declares more than 20000 triangles for a part or 100000 in all.

More than 24 parts, a duplicate id, an unknown kind, two bodies or a parameter the code uses but form.params does not declare are refused too. A part's make is refused, naming the part and listing the choices, when its process, material or finish is not in the catalogue for that process, its colour is neither a catalogue colour nor #RRGGBB, its source is missing or unknown, it has an unknown key or a why over 200 characters, or the part is a component. A proposed make passes with a warning naming the parts that wait for the person, and a made part with no make beside ones that have one is named in a warning too. With no body part the write passes and warns that the checks that need an enclosure will read not_assessed. This is the first of two layers: a word list is never the safety boundary.

The sandbox​

engine/authored.js is loaded before engine.js and runs the code on the page without trusting it:

  • Isolation. There is one worker per part, so a syntax error, a crash or an endless loop belongs to one named part and stops no other.
  • The sandbox first. Each worker's source removes the network, storage, timers, messaging and eval from its scope (18 names) before the part's code is placed in it. The code is the body of a function in the worker's source text, never passed to eval, so the page's Content Security Policy is unchanged: script-src 'self', worker-src blob: and connect-src 'none' still apply, and Function(...) inside a worker dies with an EvalError (checked in Chromium).
  • A time limit on the code, not the page. The page solves on its own thread, so a busy page cannot read a worker's reply for seconds. The limit (3 seconds) starts when the worker reports that it has started; a separate 20 second limit covers a worker that never starts.
  • Nothing it sends back is trusted. Every number must be finite and within 100000 mm, every index must point at a real vertex, and the triangle count must fit the part's budget, or the part reports an error.

What the page shows​

The page keeps the studio's own look and controls. The left pane is the engine's own controls panel, filled with the form's parameters: the same sections and sliders as any studio, with readable labels (slot_len reads "Slot len"), and a Parts list that gives each part's colour (its kind) and size, and under a part with a make its process, material, finish and colour, marked proposed until the person chooses. Each such part is drawn in its own colour, with the roughness of its finish and a metallic look for a metal, and the mass is summed from each part's own material. A part without one takes the product colour from the swatches. Moving a slider runs the code again with no model call. The enclosure's own node graph editor is hidden, because it edits parameters a form made of code has none.

Mechanical joins​

A part's interfaces are electrical: the page turns them into ports and wires them. How a part is held (screws, clips, slots, press fits) goes in its mechanical list, {id, kind, to, fastener, count, at, note}, which no wiring check reads. kind is one of screw, bolt, clip, snap, slot, press_fit, adhesive, magnet, strap, rest or other; a screw or bolt with no fastener is flagged. An interface whose bus is not electrical is refused with a pointer to this list, and an id that breaks the naming rule is refused with the id that would pass ("to-bracket-a" would be "to_bracket_a"). See formgraph/references/context.md.

A supplier's model as a reference​

A hosted studio reads no files, so a mesh reference arrives packed. twin.imagine_add_mesh_reference packs one from the twin: it reads a work product's STEP, GLB, STL or OBJ, converts a STEP with the OCCT converter the viewer uses (which keeps millimetres and Z up), reduces the mesh to at most 40,000 triangles for display, keeps the full mesh's size in stats, and writes it into context.references as the next revision. Use it for a model the studio cannot draw from primitives: an airframe the product mounts on (context), a space it must fit (envelope). A surface-only STEP, with no solids, still shows; it cannot be used for fit checks.

The engine centres the mesh on X and Z, puts its lowest point at Y = 0, then moves it to at (mm) and turns it by rotate (degrees about X, Y and Z). Studio axes are Y up, so a Z-up STEP point (x, y, z) is (x, z, -y). The reference records origin, the file point that lands on at, so an offset worked out from the full-resolution model is exact: at = W - (P - origin). opacity sets how see-through it is (1 for a solid model). With no color, a GLB, or a STEP through the converter, keeps its own material colours: the reduction orders the triangles by colour and records the runs in mesh.groups ([colour, first index, index count]), and the page draws each run in its colour. A color (hex) paints the whole mesh in one colour instead. STL and OBJ carry no colours. A board (a pcb_layout work product) shows as its populated 3D preview, the GLB twin.record_design_files made with every footprint's model in KiCad's colours (in metres, Y up); a board recorded with preview off has none and is refused.

With follow: true the reference stays linked to the work product's item (a CAD part, an assembly or a board). Each time the engine page is built, the gateway checks the item's current revision; when Develop has moved it on, the page shows the new head, packed the same way, and moves at by the change in origin so the model's own frame stays where it was. The title says which revision is shown ((live: ASM-...@3)). The stored studio is not rewritten, so a handed-over studio stays frozen while its picture follows the design. A head that cannot be read leaves the packed copy on the page, labelled as such.

Real parts and the component library​

A real part in context.components.parts can name its entry in the component library with library (the entry's name). The Imagine stage carries library.list_components, library.get_component and library.register_component, and the playbook tells the assistant to look a part up before researching it and to register a new one once. Each write warns, in one note, about the real parts with no library link, and about a link to an entry the library does not have (a registration can still be waiting for approval, or the name is wrong). Stand-ins are not asked. These are warnings, never a refusal. Code: api_gateway/imagine/library_link.py.

A part of kind component can name its real part with component_ref, the id of a part in context.components.parts, and say where it sits with at ([x, y, z] in millimetres, Y up) and optionally rot (degrees). With no code of its own, the studio writes the drawing code from that part's size on every write, so the shape and the sourced part cannot drift apart. The write names each part drawn this way in its warnings. A part with its own code keeps it, including a part drawn this way whose code the agent has since rewritten (for a real outline that is not a box), a reference to a part that does not exist is refused, and a component with no reference is flagged as a stand-in.

Wiring: connections between parts​

A studio records how its real parts are wired in context.connections: {schemaVersion: 1, connections: [{id, net, from, to, wire?, color?}]}, each end written part.interface or part.interface.pin against context.components.parts. An interface may list its pins (distinct names). Each write refuses an end that names no part, interface or pin, a connection id used twice, and a signal pin on two nets (power and ground may fan out). It warns when the buses differ, two outputs drive one net, nothing drives a net, a supply sits outside the receiving part's voltage window, a signal is below the input's high threshold (a 3.3 V output into a 5 V input, which needs a level shifter), or a multi-pin interface is wired without naming the pin. A tie-off, an input (dir: in, not power) wired to a power or ground interface, is not a bus mismatch: datasheets ask unused and enable inputs to be held at a rail. It warns only when the rail's voltage window lies outside a window the input states. The list reaches the page in the compiled context as _context.connections. Code: validate_connections in api_gateway/imagine/formgraph/fg_context.py.

An authored form draws each connection as a cable in the 3D view. A wire starts at the interface's at (mm from the part's centre) when the part has one, and at the centre of the form part that carries it (component_ref) when it does not. It rises 3 mm clear of the taller of its two parts, runs across and drops to the other end. When that would take it through the enclosure's lid (a part mounted under the lid, such as a light ring under a diffuser), it runs a bend allowance under the lid instead and climbs to an end that sits higher, such as a touch pad on the lid; the summary's route says which (over the parts or under the lid). Its colour follows the net: ground is black, power red, and each other net a colour of its own. Its size follows the template engine's harness rule: a power wire is the smallest gauge whose rating covers the lower recorded peak current (imax_mA) with 25 % headroom (22 to 28 AWG), and a signal is 28 AWG. Its length is the routed run plus 15 mm for stripping and a service loop. A wire whose end has no drawn part is not drawn; it is listed with the reason. Hiding a part hides its wires. The summary (window.FG_AUTHORED) carries wires (net, ends, length, gauge, what sized it, whether both ends were placed, whether it fits), unwired, wires_outside and wire_total_mm.

A wire fits when its whole route stays inside the enclosure, the box round the form's body parts, with each bend at least three times the wire's diameter in from every wall (its two ends sit on their parts' pins and need no allowance). A wire that leaves it glows red and is listed in wires_outside; with no body part, fits is null and nothing is judged. It is a box test: it says a wire leaves the enclosure, not that it clears every rib inside. Code: wireRoutes in api_gateway/imagine/engine/authored.js.

Wiring checks​

The write also checks the wiring as a whole, and reports each finding as a warning that starts with Wiring:. These checks run only when the studio has a connection list:

  • Unwired power. A power or ground input (bus: pwr, dir in or bi) that no connection reaches.
  • Floating inputs. A signal input (dir: in) that nothing drives. To leave one unconnected on purpose, list it as part.interface in context.connections.unused.
  • Wire size. A power connection whose wire: {awg} is rated below its peak current with 25 % headroom. The ratings are the template engine's harness table: 28 AWG 1.4 A, 26 AWG 2.2 A, 24 AWG 3.5 A, 22 AWG 7 A. The peak is the lower imax_mA of the two ends, and the finding names the gauge that fits. A gauge outside the table is also a finding.

Outputs, bidirectional signals and excluded parts are not findings when unwired, since a board has many spare pins. The same findings hold the handover's wiring item. Whether the wires fit inside the enclosure is measured in the page, where the geometry is. Code: api_gateway/imagine/wiring_checks.py.

Wiring at handover​

When the studio has a connection list, the handover turns it into what Develop builds from (api_gateway/imagine/wiring_outputs.py):

  • Firmware pin map. One parameter per wired interface end, named pin_<part>_<interface>[_<pin>], whose value is its net and whose note names what it joins, its bus and its direction. These lead the proposed IFC-EDA-FIRMWARE contract, ahead of the bus descriptions, so the contract's 60-parameter cap trims descriptions before pins.

  • Wiring table and harness BOM. One row per connection: net, ends, gauge, length and what sized the wire. The gauge is the connection's wire.awg when set, else the thinnest gauge rated for the lower peak current (imax_mA) with 25 % headroom, else 28 AWG for a signal and 26 AWG for power with no recorded current. A length is the connection's length_mm plus 15 mm for stripping; without one, the length the page drew for that wire (slack included), when the gateway's headless look measured this same revision (twin.imagine_look records each drawn wire's length and fit with its measurement); without either, it is listed as still to measure, never guessed. Each row says where its length came from. The BOM has one hook-up wire line per gauge with its number of cuts and, when every length is known, the total in metres.

  • Wiring sequence. Numbered steps: ground first, then power, then signals, then a continuity check of each net and a check for shorts between power and ground before the first power-up.

  • Firmware pin map. The controller's signal pins (the board part, role: board) in the firmware agent's pin_map shape: {signal, pin, peripheral, direction, to}, with the net as the signal, the board's own pin name (D1, D4) as the pin and the bus as the peripheral; power and ground are left out. It is listed in the wiring decision and kept with the handed-over studio, so firmware is generated against named pins rather than words.

  • Interconnect circuit. The wiring as a circuit for kicad.generate_schematic: each part a generic one-row connector (Connector_Generic:Conn_01xNN, up to 40 pins) with one pin per wired end in wiring order, a Pins field mapping each pin number back to part.interface[.pin], the part's MPN, and one net per net name, so power and ground fan out. Every pin is passive, so KiCad's ERC checks that each net joins two pins and that no pin is on two nets. The gateway does not run KiCad itself (agents reach tools over MCP): an agent passes the circuit to kicad.generate_schematic and reads the ERC result.

All four are recorded as one design decision, Imagine wiring: <product>, pinned to the studio revision, with V2 provenance; the circuit is in it as a JSON block.

Who the part is, from the library​

A part linked to a library entry needs only its id, role, library and interfaces in the studio. On each write its empty manufacturer, mpn, datasheet, name and retrieved are filled from the entry (retrieved is the date of the entry's current version), and the part records facts_from naming the entry, its version and the fields it took. A value the agent wrote is kept. Interfaces are not copied: a library entry's pin names are not always valid studio interface ids. Together with the size, model and price below, linking a part means the agent need not read the entry at all. An Imagine-stage design turn, which writes a whole studio, gets its own tool-call budget: 60 by default (METAFORGE_CHAT_IMAGINE_MAX_STEPS), never below the general chat budget. Code: api_gateway/imagine/library_facts.py.

Sizes from the library​

A real part linked to a library entry (library) takes its size from the entry on each write, before any other rung draws a body: geometry.envelope is the entry's length_mm, width_mm and height_mm, with size_basis: read (so the handover's parts item counts it), derived_from: "library", and a source naming the entry, its version and the specs' sources. The body is the entry's bounding box; a part whose entry has a form_code is still drawn with that model (see below). An exact or generated model already on the part (a measured STEP, a KiCad body) is kept. Any other size on a linked part is replaced, and the write's warnings name the typed size and the library's. An entry with only part of a size (a footprint with no height) is not used: the warnings name the missing field, and the next rung (KiCad, the datasheet, an approximation) draws the part. A size the library gave earlier is dropped when the entry no longer holds it, so the studio and the library cannot drift. Code: api_gateway/imagine/library_geometry.py.

Materials from the library​

When process.material names a material in the MetaForge material library (the catalogue's own id, such as pla, or a maker's grade named for its family, such as prusament_petg), each write puts its figures into context.machines.materials under the catalogue material it screens as. The engine merges that entry over its built-in material by id, so the library's figures replace the catalogue's and every other field stays the catalogue's: density from density_kg_m3, and E and str from the across-layer figures when the library has them (an FDM part is weakest across its layers), else youngs_modulus_mpa and ultimate_strength_mpa. Fields the library does not hold (costKg, k, ul94 today) are listed in the entry's defaulted and named in the write's warnings. The entry carries derived_from: "library", libraryMaterial and a source naming the library entry, its version and the datasheet. A material the library does not hold is left as the catalogue has it. Code: api_gateway/imagine/library_materials.py.

Machines from the library​

process.machine may name a machine in the MetaForge machine library: an in-house instance (the owner's own printer) or a vendor service's instance. Each write builds it into context.machines from the library, the instance's own values over its model's: buildVolume, and the limits the library holds (min_wall_mm as wallMin, min_feature_mm as featureMin, tolerance_mm as tolerance), with source naming the library entry and derived_from: "library". A figure the library does not hold comes, best first, from the library's process entry for that process (its sourced design-guide limits: minimum wall, feature and hole, and tolerance), listed in the machine's fromProcess with the guide's source in its note, else from the studio's default machine for that process, listed in the machine's defaulted and named in the write's warnings. The owner's other in-house machines for the studio's process are added beside it. A library machine of another process is not used and the write says so; an id the library does not hold is left for the formgraph validator to report. Machines derived earlier are rebuilt on every write; machines the agent wrote are kept. Code: api_gateway/imagine/library_machines.py.

Prices from the library​

A real part linked to a library entry (library) that has no cost of its own is priced on each write from the entry's supplier offers: the cheapest offer confirmed on a live page, at the price break that applies to the build quantity (process.qty, else 1), preferring pounds because the cost estimate adds only pounds. With no pound offer the cheapest confirmed offer is kept in its own currency, and the page says it is not added; no exchange rate is assumed. An offer marked confirmed: false (a search snippet or cached page) never sets a price. The derived cost carries derived_from: "library" and its source (library entry and version, supplier, SKU, the day it was read and how), and is derived again on every write; a cost the agent wrote is left alone. One warning lists the linked parts that have no confirmed price. Code: api_gateway/imagine/library_cost.py.

A part sold by the pack (a roll, reel, sheet or bag) is priced by what one unit uses. The library offer states its pack as pack: {amount, unit, note?} (units m, cm, mm, m2, mm2, kg, g, l, ml, pcs), and the studio part states its use in a unit of the same kind. The cost is the pack price at the break for the whole packs the build needs, times use over pack size, and its source names both amounts. A pack-sold part with no use, or a use in another kind of unit, is left out of the estimate and named in the write's warnings: a whole pack is never counted per unit.

Library models: g.model(name)​

A component library entry can carry form_code: the body of a function of g that draws the part once, in millimetres, centred on its body, with x its length, y its height and z its width. A studio part places it with g.model("name"), which returns one shape that takes .at, .rot, .scale and .name like any other. A component part linked to a real part whose library entry has a model is drawn with g.model(entry) instead of the part's bounding box.

The engine page has no network, so each studio write copies every model its parts name into form.authored.models as {name: {code, version, entry}}. The revision therefore holds the exact code it drew with; an update to the library entry reaches a studio on its next write. A name the library lacks, or an entry with no form_code, is a warning on the write, and the part shows the error on the page.

In the page each part's worker gets only the models its code names, placed after the sandbox is set up, like the part's own code. A model's triangles count against the part's budget, and a model may not call g.model itself. All models in one studio together are capped at 36,000 bytes. The library refuses form_code with the same words the studio refuses (twin_core/library/form_code.py). Code: api_gateway/imagine/library_models.py, g.model in api_gateway/imagine/engine/authored.js.

Not yet: a model from a maker's STEP file. Imported geometry is accepted only under a licence on the accepted list (twin_core/library/licences.py), which KiCad's 3D models (CC-BY-SA) and most makers' files are not, so that route needs a person's licence review first.

At the Engineer level the left pane shows the form's own graph instead: a column of parameter nodes (each with its slider), a column of part nodes, and the form node. A wire runs from a parameter to each part that uses it, and from each part to the form. Sliders here and in the Simple panel stay in step. Selecting a part (its title bar) lights its node, its wires and its mesh. Scroll zooms, dragging the background pans, and Fit frames everything. The page has three panes, the graph, the model and the summary, and the left and right panes each minimise with the edge buttons (or [ and ]), also when the page sits inside the dashboard's frame.

At the top of the right pane, a "Form drawn" card shows the measured envelope, volume, part count, triangles and mass as tiles, and a collapsed "Not assessed" card lists the checks the engine cannot make for a coded form. Both open and close like the engine's own cards.

The "Form drawn" card also shows what is measured from the drawn triangles, with uniform density: Overhang (upper bound), the share of the surface that looks steeply downward (more than 45 degrees from vertical) and does not rest on the floor; Tips over at, the angle at which the centre of mass would tip past the edge of the flat base the form stands on, or Balance: Would tip over when the centre of mass is already outside it, or No flat base, so not assessed for a form that hangs or rests on a point; and Fit, the pairs of parts that clash on their drawn shapes (see Fit below). overlaps, the pairs of component parts whose boxes overlap with the volume, is still measured for the concept revision. Overhang counts faces another part covers and the centre of mass counts overlapping parts twice, so both are estimates and the notes say so. Wall thickness and the gap between parts that do not touch are not measured. twin.imagine_look returns the same block as measured, and with set it reports in compare.measured_changed how the measurements moved. These are V2 screening measurements, never a verification.

When twin.imagine_look runs in the gateway, it records the measurements of the stored form (never the what-if of a set) against the revision it measured, on the twin item's state, without making a new revision. No route accepts a measurement, so a person's browser cannot send one; a newer write starts without it, so a stale figure is never carried forward, and a handed-over studio refuses it. The record is kept for the validation step to read.

Below the form card, a "Components" card lists every real part in context.components.parts (an excluded part is left out) with four yes or no readiness steps: Defined (an order code and a maker), Real size (an envelope that is not a typical or generic guess and not a placeholder), Sourced (a datasheet link and a date) and Drawn in the form (a form part names it with component_ref). Each row shows its fidelity, size basis and the basis in words. A function with no part chosen is listed as "no part", because the handover stays open on it. The card keeps its open or closed state when a slider redraws the form.

The right pane keeps what carries the person's controls and records, and labels what the engine cannot say about this form:

  • Readiness: gate 1 names the assumptions still to confirm. Gates 2 to 4 read "Not assessed for an authored form", because the engine decides them from checks of the enclosure.
  • Requirements: the priorities and values, the situations it must handle, and "Confirm these assumptions". Each requirement's chip reads "Not assessed", never Met, and the header says so.
  • Options, Context, Models and scenarios, Manufacturing process work as for any studio.
  • The Programme tab works as for any studio.

It hides what asserts something about the placeholder enclosure that the engine solves for every studio, which is not this product: validation in the background, assembly, where it lives, the manufacturing verdict, product tests (a drop test of the placeholder), electronics and wiring, checks, the bill of materials (a top shell and a lid the form does not have), part, cost, hand off, and Readiness's parts table. Giving the engine no shape instead would break the Programme tab, so the blocks are hidden and the verdicts relabelled.

The page also shows what was measured (size, volume of the shapes with overlaps counted twice, parts, triangles and the mass if solid in the process material) beside a list of what was not assessed: wall thickness and moulding, vents and heat, the manufacturing verdict and cost, assembly, product tests and the form's bill of materials. That list never reads as a pass. A form that fails shows "Form not drawn" or "Form partly drawn" with each part's error and gives no size.

The page publishes what it drew as window.FG_AUTHORED: status (running, ready or error), params, bbox, triangles, errors, and for each part its kind, triangles, bbox, volume and error. It dispatches an fg-authored event on every change.

A low-fidelity twin of the idea​

The studio shows more than the form's shape:

  • Behaviours. form.authored.behaviours says how the product moves, lights up and switches: rotate (about axis through origin, within range degrees), slide (along axis, within range mm), glow (in color) and toggle (shown or hidden), each acting on named parts. Try it shows a control for each and Play the motions, with the battery simulation folded beneath; with none, it offers to ask the assistant for them. Twelve at most; a behaviour that names a missing part, an axis of zeros or a range that is not a range is refused, naming it.
  • A calm panel. The left panel has three sections in one rhythm, Size and shape (open), Parts and Variants (closed), each naming what is inside; the right-hand cards start closed except the next step.
  • Parts, click to show. A part is one line (name and size). A click on the row, or on the part in the 3D view, opens what it is made of, its real part's specs, Hide/Show and pickers for its process, material, finish and colour from the catalogue. A picked value is previewed live on that part; Keep it puts a request in the conversation for the assistant to write it into the form, Reset drops the preview. Hiding is a view choice only; the part stays in the form, its measures and the handover.
  • Scene. form.authored.scene (at most eight) lists what the product lives with, a desk, a wrist, a hand or a wall, written as code like parts and run in the same sandbox with the same checks. It is drawn as matte grey context, listed in a closed Scene section with Hide, and never measured, costed or handed over; when present, the studio's own floor steps aside for it. Behaviours may act on scene objects. A light behaviour casts a real spot light from its part (at, direction, angle, color, intensity) that follows the part's motions, and Try it has Room light (Day, Evening, Night) so a beam can be seen.
  • Fit. The page tests every pair of parts on their drawn triangles, not their boxes: points about 0.5 mm apart on each part's surface where two parts' boxes meet, each tested for being inside the other part's closed shape by counting ray crossings. A Fit card lists each clash (Display into Round case, about 0.48 mm deep), deepest first, with Show to select the part, and each clash is outlined in red in the 3D view, seen through the other parts. The depth is an estimate on the sample spacing, at most half the thinner part; parts that only touch (within 0.02 mm) do not clash, and a shape that is not closed is listed and not tested as a solid. Parts meant to meet are declared in form.authored.joins ([{"parts": ["button", "case"], "why": "..."}], at most 24, two different parts with a reason, each pair once) and shown as joined, as declared. The result is measured.fit (returned by a look and kept with the revision's measurement) and the form.fit screening rules, one per pair. overlaps (components whose boxes overlap) is kept as before, because the concept revision sends it to the verification service.
  • Cut-away. Beside Try it: Solid, Section (one plane, side, front or top, moved with a slider) and X-ray (the product's own parts see-through, bought parts solid).
  • Live component specs. A component part linked to a record in context.components.parts shows its maker, part number, size (marked when a placeholder), power, buses, recorded price and the date its datasheet was read, in the parts list and on hover in the 3D view. A value the record does not carry is left out, never guessed.
  • Running cost. A Cost per unit (estimate) card: each made part as solid material at the catalogue's typical price per kg, each bought part at its recorded price when its cost.currency is GBP; anything else is listed as not counted, with the reason. Machine time, labour, assembly, finishing and shipping are not included.
  • One next step. A card at the top names the one thing to decide now: an assumption to confirm, a statement to check, a part to choose or a proposed make to keep. Confirming acts in the page; anything that changes the design puts a request in the person's conversation (fg:ask), never sends it.
  • Variants. form.authored.variants (two to four) set other params (within form.ranges) and/or makes on the same parts. Show side by side draws them in a row; Try it shows one in place; Use this one puts a request in the conversation.

A new revision in an open studio​

Create compares each new revision with the one on screen. A change to the authored form alone is pushed into the running page (fg:form) and redrawn in place, keeping the camera, panels, hidden parts and behaviour values; the page confirms with fg:applied, or the revision loads behind the page on screen and replaces it when ready. A strip above the studio lists what the revision changed, with Undo this change, which saves the revision before it as a new one. The undo is a PATCH /studio against the revision it undoes (each top-level section that differs replaced, added or removed), so if the assistant has written a newer revision in the meantime the gateway refuses it (409) and the strip says so, rather than overwriting the newer work.

Looking at it​

An agent looks with twin.imagine_look (see docs/mcp_spec.md). It renders the stored studio's engine page in headless Chromium inside the process: the page and its assets are answered from memory with the gateway's own Content Security Policy and every other request is aborted, so no gateway has to be running and it works in the stdio plugin. It returns the status, each part's size and error and the screenshots as images. set moves a parameter in the page and looks again, never saved; revision names the head after a write, so a repeat is not answered from the earlier result. It reads and writes nothing in the twin and is never held. playwright and a Chromium build are not installed with MetaForge (pip install playwright pillow && playwright install chromium): without them the result is unavailable with that line, and the agent must say it could not look. A studio from before the enclosure template was removed answers not_authored without starting a browser.

scripts/imagine_look.py is the same look from a shell. It opens an engine page in a real browser (it needs the playwright package and a Chromium build), waits for window.FG_AUTHORED, prints each part's size and takes a screenshot:

Terminal
python scripts/imagine_look.py --gateway http://127.0.0.1:8000 --project <id> \
--out look --set arm_len=400

With --set it moves that parameter's slider and looks again, and reports what changed, how much of the picture changed and every request the page made after the change: the sandbox workers start from blob: URLs, so a change that redraws the form shows no network request and no call to a model. It exits 0 when the form is drawn, 2 when a part failed and 3 when the page published no authored form.

What the verification service says​

The revision carries the form's parts (see "The form in the revision"), and the service adds advisory findings: form.enclosure_checks (not_assessed), form.confidence_mix (every part is a component), form.measured (not_assessed when nobody looked), form.balance and form.component_overlap. None can change a verdict, a gate or a level.

Limits​

  • The electronics are not placed in an authored form, so the fit of the electronics is not assessed. There are no component meshes yet: a component is a box.
  • Shapes compose and do not subtract: there are no boolean cuts.
  • The page's measured size is not sent to the service, so no fit check runs.
  • The look needs a browser. A client with none must say it could not look.

Observability​

metaforge_imagine_studio_total{operation, outcome} counts each put, event, validate, handover, rework and engine call as ok, duplicate, refused or failed, and a validate also as invalid, unconfigured, unavailable or error; the ImagineStudioTwinWritesFailing alert fires when more than a fifth of an hour's operations fail to write to the twin. Logs: imagine_studio_put, imagine_event_mapped, imagine_event_failed, imagine_handed_over, imagine_handover_failed, imagine_reworked, imagine_rework_failed, and for validation imagine_verification_unconfigured, imagine_verification_unreachable, imagine_verification_credential_refused, imagine_verification_failed, imagine_verification_request_refused and imagine_verification_report_unreadable. Spans: imagine.*, and imagine.verification.validate for the call to the service.

Authentication and the engine URL​

An iframe cannot send a bearer token. With authentication off (METAFORGE_AUTH_MODE=off, the local default) engine_url is the plain gateway path. With a provider installed, GET /studio returns engine_url with a t query parameter: a token signed with HMAC-SHA256 under the gateway's link secret (METAFORGE_LINK_SECRET), scoped to the project and expiring after ten minutes (api_gateway/imagine/engine_token.py). Its MAC is domain-separated, so it is never a valid signed link and a signed link is never a valid engine token. The auth middleware lets GET .../imagine/engine and GET .../imagine/engine/assets/{name} through (PUBLIC_GET_PATTERNS); the engine route checks the token itself and answers 401 without a valid one, and the assets carry no project data. The page is served with Referrer-Policy: no-referrer, so the token does not leave in a referrer. Read the studio again to get a fresh URL. Nothing here names a provider.

engine_url is a gateway path, which the dashboard resolves against its own gateway. An agent has no such base, so twin.imagine_get_studio and twin.imagine_put_studio also return two absolute links: studio_url, the dashboard's Create page on the Imagine stage (<METAFORGE_DASHBOARD_URL>/create/<id>?stage=imagine), which signs the person in and renews the engine token each time it loads, so it keeps working; and engine_page_url, the engine page itself (<METAFORGE_GATEWAY_PUBLIC_URL>, else METAFORGE_PUBLIC_URL, plus engine_url), which stops working when its token expires. Each is null when the MCP server does not have that variable: it never guesses a host.

Known limits​

  • The enclosure template was removed (see "Authored forms"). The engine page still carries the enclosure solver and its checks in engine/engine.js, which no new studio reaches; that dead code has not been deleted yet, and the catalogue still lists the template's data.
  • The concept assembly decision records each part's envelope in its text and the studio's handover record; a concept layout with sizes and positions is still drawn by twin.render_concept_sketch.
  • The handover gate (POST /handover) still evaluates the original nine-item checklist in the gateway. The verification service decides the same items for the report, and a parity test (it needs the service's package on the path, and skips without it) keeps the two equal. They differ in one deliberate place: a whitespace-only part source or date counts as present in the checklist and as missing in the service. Moving the gate to consume the service's verdict is follow-up work.
  • A part's source is checked for presence, not that it was read or says what is claimed. A template value such as <order code> still counts as present.
  • screening.stored has resolver person, because only the studio engine in the browser produces a screening result today. It becomes agent once the screening rules run in the service.
  • The config_valid check is the gateway's, not the service's (see Validation). While the service is unreachable the report omits those findings; PUT /studio still explains a config error.
MetaForge documentationGateway schema