Generate a metamodel
In this tutorial you’ll use Generate M2 to have FarkiBot design a modelling language for Farquind Yachts, read the result critically before it touches your project, import it, and then build a first model on it.
Prerequisites:
- FarkiBot is connected with a key. If not, start with Get started with FarkiBot.
- You’re an admin in the project. A metamodel shapes every model built on it, so only admins can add or change one. Contributors and viewers see Generate M2 dimmed in the task list, marked (needs admin access) or (needs contributor access). See Roles and access control.
- A model with a starred badge available in the LLM picker. Step 2 explains why.
What you’ll build: M2 Vessel Certification, or whatever name FarkiBot gives it: a metamodel for tracking how a Farquind yacht design gets certified against the marine safety standards in the Farquind Yachts case study. Then a first model on it.
1. Know what you’re asking for
Section titled “1. Know what you’re asking for”An M1 package is a model: the things you are describing, such as the Farquind 32 and its hull. An M2 package is a metamodel: the modelling language those models are written in. It says what kinds of things a model may contain and how they may be joined. If the idea is new to you, read What is metamodelling? first.
A Farkitect metamodel has these parts, and Generate M2 writes all of them:
| Part | What it is |
|---|---|
| Element types | The kinds of thing, such as Vessel Model or Test. Each sits in a layer, a group directly inside Element Types. The layer is also its group in the Palette |
| Relationship types | The kinds of link, such as verifies, each with words for both directions |
| Constraints | Which pairs of element types each relationship type may join. This is the part that stops nonsense later |
| Property types | The fields an element carries, such as Status or Test Date |
| Enumerations | Fixed lists of values for a property, such as Planned, Passed, Failed |
| Notation | How each type looks on a diagram: shape, colours and an icon |
Before you generate, check you need to. The Farketplace already has ready-made metamodels for well-known languages, such as ArchiMate, UML, C4, the Logical Data Model and the Business Model Canvas. Use one of those if it fits. Importing is quicker and free, and someone has already checked it.
Generate when the language you need doesn’t exist, or exists only as a document. Build by hand when it is small and you know exactly what you want. Creating Your First Metamodel shows how, and it is also the best way to understand what FarkiBot is making for you.
2. Choose a strong model
Section titled “2. Choose a strong model”- Open FarkiBot with View > FarkiBot (Ctrl+Shift+K)
- Set the task to Generate M2
- In the LLM picker, choose a model with a star
This is the one task where it’s worth paying for a strong model. Generate M1 fills in a structure FarkiBot already has. Generate M2 has to invent the structure, then draw its notation, including small SVG icons written inside the file, where one stray character makes the whole file invalid. Free models usually fail it.
There’s a second reason: you build a metamodel once, and every model after it builds on it. A weak design costs you every day you use it. The usual plan is a starred model for the metamodel, then cheaper or free models for the models on it. See How to choose an LLM.
Generate M2 doesn’t send your project. Unlike Ask, there is no Context chip, and FarkiBot sees only your brief and your attachments.
3. Write the brief
Section titled “3. Write the brief”The brief is the most important input. Describe the language you wish you had: what it is for, the things it covers, how they connect, and what it must forbid. Empty briefs aren’t sent.
Type this one for the worked example:
An M2 for tracking how a yacht design is certified.Vessel Models are made of Subsystems (hull and structure, rig and sails,propulsion and energy, interior, systems), and Subsystems of Components.Standards (such as ABYC, USCG and CE/RCD) contain Requirements.A Test verifies a Requirement against a Subsystem or a Component.A Certification Body issues Certificates, and a Certificate covers a Vessel Model.A Component can't satisfy a Standard directly, only through its Requirements.Tests need a Status (Planned, Passed, Failed, Waived) and a Test Date.Three layers: Product, Compliance, Organisation. About 12 element types.Notice what it does:
- It names the things and puts them in layers, so you get your words rather than the LLM’s
- It states the links, which become relationship types
- It says what’s forbidden. “Can’t satisfy a Standard directly” becomes a constraint. Rules like this are what make a metamodel useful
- It asks for properties and values, so Status becomes an enumeration rather than free text
- It sets the size. Without a size, FarkiBot aims for 10 to 30 element types. Fewer is usually better: every type is a choice every modeller has to make
Other briefs that work well:
A metamodel for a product roadmap: Themes contain Initiatives, Initiativesdeliver Features, Features are released in Releases. A Feature must belongto exactly one Initiative. Initiatives have a Priority (Must, Should, Could).A metamodel for a risk register like the board risk register in the attachedcase study: Risks, Controls, Owners and Mitigation Actions. Controls mitigateRisks; Owners own Risks and Controls. Risks have Likelihood and Impact(Low, Medium, High, Critical).A brief that names only a subject, such as Yacht certification, leaves every decision to the LLM. You’ll get a metamodel, but not yours.
4. Attach a standard or a specification
Section titled “4. Attach a standard or a specification”If the language comes from a published standard or your own spec, attach it with the paperclip below the brief, or drop the file onto the panel. FarkiBot follows what’s in front of it rather than reconstructing the standard from memory. That’s the difference between a metamodel that matches the standard and one that only resembles it.
Generate M2 accepts .md, .txt, .pdf, .docx and .farki. Word documents keep their headings and lists, which matters because a specification’s structure is part of its meaning.
Attaching an existing metamodel’s .farki file is a good way to say “like this one, but for another domain”. Export one with File > Export Package…, or download one from the Farketplace.
If the standard is public and you have no copy, turn on Web research instead. FarkiBot looks up the standard and uses its names, and marks each element it took from the web with its source. See How to generate a metamodel and Research the web.
For the worked example, no attachment is needed: the brief already says everything.
5. Generate and watch
Section titled “5. Generate and watch”Press Enter (or click Generate). The panel shows what’s happening:
- Thinking: a reasoning model writes its thinking first, in grey italics
- Generating: the
.farkifile arrives as it’s written - Validating: FarkiBot checks the file with the same importer that a hand-written file goes through
- Repairing: if the check finds problems, they go back to the LLM to fix, up to three attempts in all. (attempt 2) in the status line means a repair is under way
- Raising the output limit: if the file didn’t fit, FarkiBot asks for more room and tries again. The current limit shows as limit ~N tok beside the LLM
A metamodel is a large file, so a run takes noticeably longer than a question. Keep the tab open: a run lives in your browser tab, and a reload or close ends it. Stop ends it on purpose.
When it finishes, a summary opens with the LLM, time, tokens, cost and attempts. Click OK. A first-time success is a good sign. Three attempts means the LLM found it hard, so read the result even more carefully.
6. Review the staged metamodel
Section titled “6. Review the staged metamodel”The result is a staged card. Nothing is in your project yet. The card shows counts such as 14 Classes · 9 Properties · 2 Enumerations. Element types and relationship types are both counted as Classes.
Click Review. The Contents tab shows the package as a tree. Work through it:
| Check | What to look for |
|---|---|
| Names | Your words from the brief. An LLM’s synonym now is a rename later |
| Layers | Every element type in a sensible layer under Element Types. These become the Palette groups |
| Number of types | No near-duplicates, no types nobody will use. Remove extras now rather than once models use them |
| Superclasses | A row marked abstract or extends … is a shared parent. Abstract types can’t be created; they hold shared properties |
| Relationship types | Under Relationship Types, one for each link in your brief |
| Property types | On the right types, with the right data type. An enumeration’s values are listed beside it |
| Warnings | Under the counts. Open them: they are the validator’s notes on things it accepted but you may not want |
The tree doesn’t show constraints or notation. To check the allowed pairs before importing, open the Source tab and search for validPairs: each entry names a source and a target. In the example, look for a pair joining a Component to a Standard. There shouldn’t be one. You’ll see the notation once it’s imported.
If the design is wrong in a big way, the cheapest fix is a better brief. Click Discard, rewrite the brief to say what was wrong, and generate again. Click Save .farki… to keep a copy of the file whatever you decide.
7. Import it
Section titled “7. Import it”Click Import on the card. The metamodel appears at the root of the Explorer with Element Types, Relationship Types, Enumerations and Views inside it, and its notes name the LLM and the date it was made.
If a metamodel with the same name is already in the project, Package Already Exists asks what to do: Skip, Import as Copy or Replace. If models already use that metamodel, it can’t be replaced, and you’re offered Upgrade… instead. See How to upgrade a metamodel.
Now look at what the review couldn’t show you:
- Open a relationship type and its Constraints section. Each box ticked is an allowed pair. See How to create a relationship type
- Open the Palette and look at the icons and colours. Can you tell the types apart at a glance?
8. Try it out
Section titled “8. Try it out”A metamodel is only proved by modelling with it. Use the Generate M1 task to try it quickly:
- Switch the task to Generate M1
- Set the Metamodel chip to your new metamodel only
- Attach the Farquind Yachts case study, saved as Markdown or PDF
- Brief:
Model the certification of the Farquind 32 from the attached case study.
Review and import it as in Generate a model. Or build a small model by hand with File > New M1 Model…, ticking your metamodel under Import M2 metamodels, and drag a few types from the Palette onto a diagram.
As you go, notice friction: a link you can’t draw (a constraint too tight), one you can draw but shouldn’t (too loose), a field you keep wanting, a type you never use. That’s your list of changes.
9. Refine it in the M2 editor
Section titled “9. Refine it in the M2 editor”Make those changes directly in the metamodel, not by generating it again. Once models use a metamodel, a fresh generation would be a different metamodel with different types, and FarkiBot’s Modify M1 task deliberately doesn’t work on metamodels.
- Element types and layers: How to create an element type
- Relationships and constraints: How to create a relationship type
- Property types and enumerations: How to define properties and enumerations
- Shapes, colours and icons: How to configure notation
- Changing a metamodel that models use: How to use the M2 lifecycle
Common snags
Section titled “Common snags”- Generate M2 is dimmed. You aren’t an admin in this project. Ask an admin, or ask one to generate it.
- “Generation failed validation” after three attempts. Usually the LLM isn’t up to it. Click Try again with a starred model. Download raw output keeps what it produced.
- “…cut off at the output token limit”. The metamodel was too big for the LLM’s output. Ask for fewer types, or choose a model that can write more.
- “Generation interrupted”. The tab was reloaded or closed. Try again sends the same brief.
- It ignored the metamodels in your project. Generate M2 sees only the brief and attachments. Attach the
.farkiyou want it to build on. - Everything is allowed to connect to everything. The brief didn’t say what was forbidden. Add the rules and generate again, or set them in the Constraints section.
For every message and its fix, see FarkiBot Reference.
What you’ve learned
Section titled “What you’ve learned”- A metamodel is element types in layers, relationship types, constraints, property types, enumerations and notation, and Generate M2 writes all of them
- Check the Farketplace first; generate when the language you need doesn’t exist yet
- A good brief names the things, the links, the rules and the size
- Use a starred model: this is the hardest FarkiBot task, and its flaws last
- Review the tree, check
validPairsin the source, and check constraints and notation after import - Prove the metamodel by modelling with it, then refine it by hand
Next steps
Section titled “Next steps”- Research the web: the next page in this group
- Write reports
- Generate a model — build models on your new metamodel
- How to generate a metamodel — every option in one place
- Relationships and constraints — why allowed pairs matter