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 item | IMG-STUDIO, work product type imagine_studio (a definition: every config change or rework is its next revision) |
| MCP | twin.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 |
| Engine | api_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:
| Level | Name | Who reaches it |
|---|---|---|
| V0 | Captured | The browser: the person said it, or the agent inferred it from the brief |
| V1 | Consistent | The browser: the config passes the formgraph rules and agrees with itself |
| V2 | Screened | The browser: rules of thumb and simplified models ran in the engine |
| V3 | Analysed | MetaForge in the cloud: real solvers, bound to a twin revision |
| V4 | Verified | MetaForge in the cloud: checked against exact CAD, the schematic or a test, bound to a revision |
| V5 | Qualified | People, with evidence |
| Released | Released | The 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:
- Work from what the person said, asking at most three questions.
- Call
twin.imagine_put_studiowith a config built from the playbook's skeleton, which passes the checks as written (engine: "formgraph@2", aproductwith a lowercase slug id, aform.templatefrom the catalogue, requirements withpriofMust,ShouldorOff, aprogrammewith the intent ledger, assumptions and markets, anenvironmentblock, 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. - Fix every reported error in one retry.
- Call
twin.imagine_handover_statusand 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.
| Method | Path | Body | Response |
|---|---|---|---|
| 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 | /engine | the 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 | /validation | the 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 /handoverandPOST /reworkfrom the agent surface must carryX-MetaForge-AgentandX-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}andtwin.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 inmcp_core/annotations.py): no project approval policy approves them. An agent whose MCP connection sendsX-MetaForge-AgentandX-MetaForge-On-Behalf-Ofgets 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 itsassumptionentity carriesaccepted_by_agentandon_behalf_of; - a scenario is confirmed and marked
by: agentwith the agent and the person; its scenario requirement's source reads agenton 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
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:
- 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 withtwin.evaluate_dfm(it measures every part with no exact analysis yet) ortwin.measure_dfmwith itsitem_key; the gateway reads the STEP from the twin (measuring by reference). - Resolve the concept's components with
twin.resolve_concept_component: the illustrative components the handover seeded (CMP-...) arerealised_bythe CAD parts that make them, orretired, each with a reason;restoredundoes it (resolving concept components). It is the agent's own design decision, so a project policy approves it. - Run the structural load cases with
twin.run_item_fea(mesh, then solve) and record each result withtwin.record_document. - Run
kicad.run_ercandkicad.run_drcand record each result withtwin.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. - Put the product together and check it fits: commit each board's
kicad.export_3dSTEP withtwin.commit_geometry, build the assembly withtwin.build_assembly(every part and board at its placement, each hinge a revolute joint with its limits, and every screw and hinge pin infastenersby designation, such asISO 4762 M2.5x8orISO 2338 4x30, placed in the holes it goes through), and check it withtwin.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 asconnector_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). - 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 withtwin.record_design_files(work_product_type: bom): the board's fromkicad.export_bom, pinned to thePCB-...@n, and the assembly's, listing every made part and every fastener by designation and quantity, pinned to theASM-...@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. Thentwin.create_baseline, arelease_approvalrequest withtwin.record_engineering_entity, andtwin.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 setsMETAFORGE_ALLOW_AGENT_RELEASE=true, the delegated agent creates the baseline, approves the release withtwin.approve_releaseand 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 withtwin.accept_release_findingand 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):
| Studio | Twin |
|---|---|
| Intent ledger | An intent item per statement (INT-IMG-L<n>), with its ledger status and what it maps to |
| Requirements, custom requirements | The CS-IMAGINE constraint set: each with its source (limit_source) and verification method |
| Operating environment | Two 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 |
| Assumptions | An 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 choices | A 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 |
| Scenarios | Scenario requirements in CS-IMAGINE (verified by demonstration) |
| Context edits | Manufacturing 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 results | An 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:
ledger: the intent ledger is complete, every statement reviewed.assumptions: each assumption confirmed, or explicitly accepted as an assumption (then the item readsassumed; an agent's acceptance is named in the detail).scenarios: every scenario test confirmed by a person, or by a delegated agent for them (named in the detail, never as the person's).requirements: each requirement has a source and a verification method (assumedwhen the catalogue's default method is used).parts: one chosen part per function, each with a source, a retrieved date, interfaces and a 3D envelope.manufacturing_context: process, material and quantity recorded.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.interfaces: interfaces described, so contracts can be proposed.screening: screening results stored at V2.wiring: with a connection list, every power or ground input and every signal input is wired (or listed inconnections.unused) and each wire with awire.awgis thick enough for its peak current; any finding holds the handover. With no connection list it readsassumedwhen two or more parts have interfaces (they are wired in words only), anddoneotherwise. 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.