Skip to main content
Version: 0.4.0

Govern the landscape

State your organization's architecture rules as policies in the model, grant the exemptions you agree to, and see every breach where you already see the model's own findings. 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: type it into model/ 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 Governance.

Start from the baseline​

How strictly your policies are checked is the policies setting in kanoniq.repository.json. A repository kq init makes names both recommended baselines under preset, and a baseline that preset names is checked as if it were written in the model. A preset baseline is free:

{
"policies": {
"enabled": true,
"preset": {
"model": "baseline-model-recommended",
"architecture": "baseline-architecture-recommended"
},
"no-policy": "info",
"exemptions": "info",
"hygiene": "info",
"policy-sets": {}
}
}

The recommended baselines ask, among other things, that a call to a SaaS states how it authenticates and that nobody calls one anonymously. The shop's calls each say how they authenticate, after auth:

ecosystem shop "Shop" { platform storefront "Storefront" { component web-shop "Web Shop" : user-facing-app { spa web-shop-ui "Web Shop" } component order-service "Order Service" : backend component payments "Payments" : saas web-shop -> order-service/orders-api over http auth user-token order-service -> payments/payments-api over http auth key } }

kq validate checks the model against its policies once it has no error, and lists each finding after the model's own, under policy findings:. On this model they are all KP001, at info: policies that have nothing in the model to check yet. See The baselines.

Grant an exemption​

The order service now books labels with a carrier that takes only an API key. A call with a key from one ecosystem into another breaks the recommended baseline's no-key-crossing, and a breach of a set your settings don't name is an error: kq validate lists it and exits with 1, and in VS Code the Problems panel lists it as you type. Where your organization accepts the breach, write an exemption. It lifts one policy from one subject, with your reason, and optionally until a date. for names the subject, here the connection as <source> -> <target>, and a baseline's policy is named <baseline>/<policy>:

ecosystem shop "Shop" { platform storefront "Storefront" { exempt baseline-architecture-recommended/no-key-crossing for order-service -> carrier/shipping/labels/labels-api because "The carrier takes only API keys" until 2027-06-30 component web-shop "Web Shop" : user-facing-app { spa web-shop-ui "Web Shop" } component order-service "Order Service" : backend component payments "Payments" : saas web-shop -> order-service/orders-api over http auth user-token order-service -> payments/payments-api over http auth key order-service -> carrier/shipping/labels/labels-api over http auth key } } ecosystem carrier "Carrier" { platform shipping "Shipping" { component labels "Labels" : saas } }

The lifted breach is still listed, at info, with your reason. Past until, the exemption no longer applies. See Exemptions.

Write a rule as a policy​

The baselines are Kanoniq's rules; write your own as a policy. A policy is a filter, an action and the clause the action is about, on one line. deny reports everything that matches every clause, and allow only lets through only the values it lists. A policy set groups policies under one Code, and its kind is model, what your model must state, or architecture, what your systems may do. Writing a policy is free, and so is checking that it makes sense; checking your model against the policy sets you write is Paid. Add a set whose one policy lets only a backend call a SaaS:

policy-set architecture security "Security" { policy saas-from-backends "Only a backend calls a SaaS" when to: saas -> allow only from: backend } ecosystem shop "Shop" { platform storefront "Storefront" { exempt baseline-architecture-recommended/no-key-crossing for order-service -> carrier/shipping/labels/labels-api because "The carrier takes only API keys" until 2027-06-30 component web-shop "Web Shop" : user-facing-app { spa web-shop-ui "Web Shop" } component order-service "Order Service" : backend component payments "Payments" : saas web-shop -> order-service/orders-api over http auth user-token order-service -> payments/payments-api over http auth key order-service -> carrier/shipping/labels/labels-api over http auth key } } ecosystem carrier "Carrier" { platform shipping "Shipping" { component labels "Labels" : saas } }

A set is the model's when it is written at the top of a file, as security is, and otherwise its ecosystem's. Without a license, the set is skipped and nothing fails: each run says once which sets it did not check, and VS Code says it as one warning on the model's .g.kq. policy-sets in the settings sets the severity of each set's breaches, error for a set it leaves out. See A policy and Policy sets.

Where next​

© 2026 Extenza Works. All rights reserved.