Documentation

Docs

A Tour of Kanon

This tour builds one small module, a company's payroll, and asks it five questions. Every construct used here is defined in Syntax and given its meaning in Semantics.

1. Forms: What Can Leave

A decision in Kanon is not only yes or no. It also says how detailed the released data may be. The detail levels form a lattice, declared once per module:

scale form: metadata < count < aggregated < anonymised < pseudonymised < raw;
            aggregated < summarised < raw

Raw rows and written summaries are not comparable, so the scale is a lattice rather than a line. When two limits meet, Kanon takes their greatest lower bound (⊓): the meet of pseudonymised and summarised is aggregated.

2. Entities: What the Rules Talk About

Rules attach to the things in a request: persons, positions, groups, agents, assets, actions, use cases and recipients. Entities sit in one order, "above": a column is part of a table, a position is a member of a group.

entity payroll        : DataProduct label strictly_confidential owner position:cfo
entity payroll.salary : Column in payroll

The classification label sets the default when no rule applies: public and internal data allow, everything else denies.

3. Use Cases: Why Data Is Needed

A use case says who needs which data, at most in which form, for whom, and until when. It is approved by the data owner and the security officer.

usecase exec_salary_report
  owner      position:cfo
  positions  position:ceo
  needs      payroll.salary max aggregated min_group 10
  recipients group:executives
  valid      until 2027-06-30

4. Rules: Six Effects

A rule has anchors (the entities it touches), an optional guard, and one of six effects: permit up to, forbid, cap at, ask, boundary lifted by, and duty.

rule pay_boundary
  boundary lifted by exec_salary_report
  on asset payroll

rule ceo_report
  permit up to aggregated
  on position position:ceo, asset payroll.salary, action read
  when declared usecase(exec_salary_report) and grant(subject, exec_salary_report)
  test allow aggregated  ana does read on payroll.salary for exec_salary_report
  test deny              eva does read on payroll.salary

rule deputy_asks
  ask above(position)
  on position position:deputy_ceo, asset payroll

declared usecase(...) is a fact the requester states and answers for. A model's guess about the use case is written read usecase(...), and the parser accepts read only in ask and duty rules. A permit that depends on a reading is a syntax error.

5. How a Decision Is Made

  1. Find. Kanon collects every rule whose anchors are matched by the request or by something below them.
  2. Combine. A forbid wins. An unlifted boundary denies, or asks the owner. Each permit offers the meet of what was asked, what it permits and every cap; the highest offer is released.
  3. Bound the agent. An agent receives the lesser of its person's answer and its own.
  4. Audit. An auditor per requester refuses groups smaller than k and releases that differ from an earlier one by a few people.
  5. Explain. The answer names the rule that fixed the verdict and the form.

The order in which rules were written never matters; this is proved (same_rules_same_answer).

6. Five Questions

Request Answer Why
Ana (CEO) reads salaries for the executive report allow, aggregated the boundary is lifted and ceo_report permits totals
Ana asks for the raw rows allow, aggregated raw ⊓ aggregated = aggregated
Eva (analyst) reads salaries deny no use case lifts pay_boundary
Ben (deputy CEO) reads payroll ask the CEO deputy_asks
Ana's agent; the model reads "exec report" but Ana declared nothing ask Ana to confirm a reading cannot release

The same rules can be tried on the home page.

7. What Owners See

Data owners never edit rule text. They see one sentence per rule and the examples it decides:

Payroll is closed. Only the executive salary report, approved by the CFO, opens it.

The CEO may read salaries, at most as totals, for the executive salary report, until 30 June 2027.

Next

  • Syntax: the full grammar and the error messages.
  • Semantics: the decision function, step by step.
  • Theorems: what is guaranteed for every rule set.

Last built 2026-11-25