Skip to content

Factory · Layer 3 · Architecture variants

Compare ways to build it, then choose one.

An architecture turns the specification and data model into a buildable design. A project can keep several named variants side by side, for example a single application and an application with a separate API, and choose which one to construct.

What it holds

  • A component tree, each component with its responsibility.
  • Contracts: the data crossing a boundary, as JSON Schema.
  • Interfaces and the connections between them.
  • Scenarios that walk a requirement across components.
  • Obligations: the checks each component must pass.
  • Code ownership: which repository paths belong to which component.
  • The technology stack and open questions.

Why it exists

Construction needs boundaries an agent can work within: who owns which responsibility, what crosses each boundary, and how the whole is shown to work. Keeping alternatives as named variants lets you compare trade-offs without losing the road not taken.

A small example

Illustrative excerpt from one booking-app variant, abbreviated.

components:
  booking-service   parent: root   spec_refs: [book-appointment]   model_refs: [appointment]
interfaces:
  booking.reserve   component: booking-service   input: reserve-request
                    output: reservation   errors: [slot-taken]
connections:
  web-app → booking.reserve
scenarios:
  double-booking    two customers reserve the same slot; one gets slot-taken
ownership:
  booking-service   app/src/booking

Pinned to exact inputs

Each architecture revision records the exact specification and data model revisions it was designed against. Editing the spec later does not silently change an architecture; your agent adopts the new revision deliberately, and Factory reports anything that no longer fits.

How it is checked

  • Components form one tree; every interface, connection, scenario step and ownership entry points at something that exists.
  • Every spec and data model reference exists in the exact revisions the architecture pins.
  • Contracts are valid JSON Schema.
  • Changes name the head revision they build on, report every error with its location, and can be dry-run first.

Tools

  • mfm_factory_schemareadsRead Command Schemas. Without arguments, a compact index: the envelope fields and every command type with its summary and required fields.
  • mfm_factory_mutatewritesSubmit Factory Command. Submit one typed Factory command.
  • mfm_factory_readreadsRead Factory Record. Read an exact Factory record, its version and recorded provenance.
  • mfm_factory_graphreadsRead Design Graph. Read a bounded graph page at an exact design/run.

Your agent's step-by-step procedure for this layer is in references/formats.md of the mfm-factory skill. This page explains the concepts; the skill is the operating guide.

All Factory tools