An agent asked to write an investor slide will produce a founding date, a price and a customer count whether or not it knows them. The canon exists so that it does not have to guess, and so that the difference between "decided internally" and "true in public" is checked by a program and not by the agent's judgement.

The problem

Company facts used to live in long narrative documents. Three things went wrong with that.

  • The same number appeared in several documents, and an edit to one left the others stale.
  • A plan that had been decided but not shipped sat next to facts that were live, in the same tone. An agent could not tell them apart and neither could a tired person.
  • An agent that could not find a fact wrote a plausible one.

The third is the dangerous one, because the output reads exactly like the output of an agent that did find the fact.

Three layers

Diagram. In docs/company there are three layers: sources, raw originals that are added to and never edited; facts, with one concept per file and provenance in the front matter, which cite sources by id; and narrative documents, which link to a fact and never restate its number. Below, any agent, before writing a sentence about the company, runs find and then get. canon.py get prints the fact and a verdict. The verdict is either external use allowed, when the fact is stable, live and reviewed by a person, or external use not allowed, when it is a draft, retired, not yet shipped, or not reviewed by a person. A missing or blocked fact becomes a FACT NEEDED marker that goes to the founder, and nothing is invented. canon.py lint must report zero errors before a commit. A note says trust is computed at read time from who verified the fact, and an agent may not mark its own document as reviewed by a person.
Figure 1. The canon. Raw sources are cited by facts, facts are linked by narrative documents, and every lookup returns a verdict on external use.
LayerWhat it holdsRule
sources/raw originals: a transcript, a registry extract, a measurementadded to, never edited
facts/one concept per file, in a structured knowledge format with front matterthe only place a company number is written
narrative documentsthe story, the messaging, the glossary, the FAQlink to a fact; do not restate its number

Company numbers live in the middle layer only. A narrative document that needs a price links to the price’s fact file. A checker refuses a narrative document that writes the number itself, so the duplication that caused stale copies cannot come back.

Each fact file has front matter that says what kind of thing it is and where it came from.

FieldMeaning
statusdraft, stable or deprecated
lifecycledecided, building, live or retired
sourcesthe originals this fact cites, each with a fixed id
generatedwho or what wrote the file, and when
verifieda list of verifications, each by a person or by a named process
stale_afterthe date after which the fact should be re-checked
valuesthe numbers, in a form the checker can compare with the text
pendingopen questions attached to this fact

Sources are cited by a fixed id and not by a footnote number. The schema records why: when an agent rewrites a list, the order changes, and numbered footnotes silently attach to the wrong sentence.

A lookup that returns a verdict

Agents do not read the whole canon. They look up one concept.

$ python3 scripts/canon.py find <word>
$ python3 scripts/canon.py get <concept id>

[canon] <concept id>  type=…  status=stable  lifecycle=building  trust=human-reviewed
[canon] external use: not allowed. lifecycle=building, not yet a public fact

The second command prints the fact and, above it, a verdict. The output above is translated and the concept id is left out. The verdict follows a table in the schema.

ConditionExternal use
lifecycle is decided or buildingnot allowed: decided internally, not yet true in public
lifecycle is retired, or status is deprecatednot allowed: on the list of things not to say
status is draftnot allowed: still being written
trust is not human-reviewednot allowed: report it as a fact that needs confirming
the requested value is blocked by an open questionnot allowed
none of the aboveallowed, with a re-check note if stale_after has passed

Trust is computed when the fact is read. It is not a stored field. A fact with no verification is unverified. A fact verified only by a process is machine-confirmed. A fact with a verification by a person is human-reviewed. An agent may not add a human verification to a document it wrote, which closes the obvious loophole.

This is what separates “we decided to do this” from “this is what a customer would find”. Both are true statements about the company. Only one of them belongs on the website, and the lifecycle field carries the difference.

When the fact is not there

An agent that cannot find a fact, or gets a verdict of not allowed, does not write around it. It leaves a marker in its draft and lists the missing fact in its report to me. The rule is that a draft containing a marker does not go out, and the gate that checks these portfolio pages fails on one. The registry of open questions can be listed with one command, so I can answer a batch of them at once instead of being interrupted for each.

The agent that writes long company documents stamps its output with the canon’s version at the top and ends with three blocks: where each fact came from, which questions are open, and which audience the piece was written for.

Lint

A lint runs before any canon commit and must report zero errors. Its exit code is 0 for a pass, 1 for errors and 2 if the tool itself failed, so a script can tell “the canon is wrong” from “the checker broke”. Two of its rules came from specific failures.

  • An unquoted comma once truncated a value in the front matter, because the hand-written parser and a standard YAML parser disagreed. The lint now rejects front matter that is not in normal form, a formatter rewrites it, and a regression test parses every file with a standard parser.
  • An amount in an analysis file once collided with an identical number in the facts, and the checker treated one as a copy of the other. Analysis values now carry a suffix that keeps them out of the comparison.

A second mode compares facts against the product code, for values such as prices and plan limits that exist in both.

When the canon and reality disagree

The schema ranks its own files for the case where two of them disagree. It also says what wins when the canon disagrees with the running product: the measurement does. A value that drifts is not copied into an external document. It goes onto the queue of things to reconcile.

This portfolio hit that rule while it was being written. One fact file described a product migration as still in progress and not deployed, with a re-check date that had passed, while the old address was already redirecting to the new one. The page on that product was written from the measurement, and the fact file went onto the queue.

Limits I know about

The verdict is advice printed to an agent. Nothing prevents an agent from ignoring a “not allowed” line except the instruction to obey it and the check for markers before publishing. A stricter design would have the publishing tools refuse any text that cites a fact whose verdict is negative. That needs the text to cite facts by id, which the narrative documents do and free-form drafts do not.

Human review is the scarce resource. Every fact that may be used externally was read by me, and a fact that has not been read stays unusable however correct it is.