Work on a large model
Keep a model of hundreds of systems readable: split it into files that follow its structure, and let Kanoniq keep the layout. The guide grows one small model, a shop, a step at a time, and every step is a whole model that builds with no error or lint, here in more than one file: type each file into model/, at the path it names, in a repository kq init made, and check it with kq validate or in VS Code as you type. Every statement used here is described in full in Splitting a model.
Split it into files
A model can be split across as many files and folders as you like, and no keyword marks it. Which file a declaration sits in means nothing: a connection in one file may name a component declared in another. Declare the shop's domains and systems in shop.kq:
Then write how they call each other, and which function each realizes, in calls.kq. It reopens the ecosystem and the platform, each with its keyword, its Code and a block:
The declaration and every reopening are one element, with one Id, and the name goes on the declaration only. Reopening something declared nowhere is an error, so a mistyped Code never creates an element. See Reopening an element.
Write a file inside its element
A file whose first line is scoped is read inside the element its folder names, so it needs no wrapping: the folder shop/storefront/ is the platform storefront in the ecosystem shop. The element must be declared in another file, here shop.kq, which stays as it was. Move the calls into shop/storefront/calls.kq:
Its references resolve from the platform, so web-shop is the storefront's web shop. See Scoped files.
Let kq arrange keep the layout
kq arrange sorts a model into one layout: a file per ecosystem at the root, a folder per ecosystem holding its domains and a file per platform or monolith, and a folder per platform or monolith holding each domain's software, data, and identities and roles in files of their own. Every file in a folder is scoped. Run kq arrange in the repository, and the shop's two files become five. shop.kq keeps the ecosystem:
shop/domains.kq holds its domains:
shop/storefront.kq holds the platform:
A component goes with the domain it realizes, and a connection with the component it starts from. shop/storefront/selling.s.kq holds Selling's software:
shop/storefront/finance.s.kq holds Finance's:
The first run marks the model arranged, with "arranged": true in kanoniq.repository.json, and from then on anything out of place is an error until you run kq arrange again. kq arrange --check writes nothing and exits with 1 if anything would change, so a pipeline can hold the layout. See The conventional layout.
Where next
- Change a model safely: rename and move without losing an Id.
- Govern the landscape: your architecture rules as policies.
- Views and notation: look at one part at a time.
© 2026 Extenza Works. All rights reserved.