people own itAGENTS.md
How to work here
The first file an agent reads. The top part is about this repository: its commands, its owners, and who leads which decisions. The appendix is a short summary of CanonBall, the same in every repository that uses it.
### Read first
1. This file.
2. `spec/canon/tenets.md`: which good thing wins when two conflict. Cite a tenet when you recommend a choice.
3. `spec/canon/vocabulary.md`: every domain word, defined once. Use these words and no synonyms.
Read the chapter
changed only by a releasespec/
The system as it stands
What is true of the system today: the clauses it keeps, the design that keeps them, and the words they use. Nothing proposed lives here.
A release is the only thing that writes to it.
Read the chapter
people approvespec/canon/
Canon: what the system promises
The clauses people have approved, one per file, in plain language, each with examples. It is the only part people must read in full.
A clause the system does not keep yet is not canon. It waits in roadmap/ until its change is released.
Read the chapter
people approvespec/canon/vocabulary.md
Vocabulary
Each noun is defined once. Synonyms are not allowed, and a clause that uses an undefined word is blocked. Agents read this file before anything else, so the same words run from the promise to the code, the check and the incident report.
It grows whenever an open question about a word is answered.
## Order
One purchase by a customer: one or more items, paid for together.
## Dispatch
The carrier's collection of the last item of an order.
## Delivery
The carrier's delivered scan for the last item of an order. Not the dispatch.
## Refund
Money returned to the customer for an order. Each refund is separate; an order can have more than one.
## Refund amount
The money returned by one refund. Not the order total.
Read the chapter
people writespec/canon/tenets.md
Tenets
Which good thing wins when two conflict. A handful of lines, in priority order. An agent cites one when it recommends, so its recommendations lean the way the team would.
A tenet is not a clause. It is never checked and never appears in the Verification Record.
1. A person's review over speed, when money moves.
2. A slow refund over a wrongly refused one.
3. A rule support can explain over a rule that approves more.
Read the chapter
people approvespec/canon/REQ-012-refund-window.md
A promise
What the system does for someone. Everything below it in the repository exists because of a promise like this one.
---
id: REQ-012
kind: promise
title: Refund window
traces: []
terms: [customer, refund, delivery]
owner: product manager
tier: 1
---
A customer can request a refund within 30 days of delivery.
Read the chapter
people approvespec/canon/INV-004-no-double-payout.md
An invariant
What must always be true. People approve its worked examples, and the examples fix the meaning: here, that "twice" means the same request paid two times. A second, separate refund on an order is a new refund.
---
id: INV-004
kind: invariant
title: No double payout
traces: [REQ-012]
terms: [refund, order]
owner: refunds owner
tier: 2
---
A refund is never issued twice for the same order.
"Twice" means the same request paid two times: a request sent again, retried, or delivered in two copies.
A second, separate refund on the same order is a new refund, with its own request key, and is allowed.
## Examples
### satisfies/1: The same request sent twice pays once
Given order 4471 and a refund request with request key K
When the same request, with request key K, is sent a second time and both are reviewed
Then one payout is made for order 4471
### satisfies/2: A retry after a lost reply finds the original payout
Given a reviewed refund whose payout reaches the payment gateway, which pays it, and whose reply is lost
When the service retries the payout
Then the retry finds the original payout and nothing more is paid
### violates/1: Two concurrent copies of one request both pay out
Given two copies of one refund request, with the same request key, arriving at the same time
When both copies are processed and reviewed
Then two payouts are made for the order
Read the chapter
people approvespec/canon/DEC-031-auto-approve-under-100.md
A decision
A choice that could have gone another way, written down. This one is proposed by the change in roadmap/. It becomes canon only when that change is released.
Follow the change to watch it arrive.
---
id: DEC-031
kind: decision
title: Auto-approve under $100
traces: [REQ-012]
cites: [tenet 1]
terms: [refund, refund amount, order, review]
owner: product manager
tier: 2
---
A refund is approved automatically while the total refunded on the order stays under $100.
The limit applies to the total refunded on the order, this refund included, and not to each refund amount on
its own, so that a refund split into small pieces still goes to review. Settled by tenet 1: a person's review
over speed, when money moves. Every other refund inside the window goes to review, as before.
## Examples
### satisfies/1: A $40 refund, nothing refunded before
Given an order on which nothing has been refunded
When the customer requests a refund of $40
Then the refund is approved without review
### satisfies/2: Two $60 refunds on one order
Given an order on which a refund of $60 has already been paid
When the customer requests a second refund of $60
Then the second refund goes to review
### violates/1: A $250 refund approved without review
Given an order on which nothing has been refunded
When the customer requests a refund of $250
Then the refund is approved without review
Read the chapter
its own owner, with a vetospec/canon/ENV-003-no-payout-above-10k.md
A constraint
What is never allowed, whatever the goal. It protects people, money and actions that cannot be undone. If the answer to "can the product team change this?" is "not our call", it is a constraint. Safety engineers call these safety constraints.
---
id: ENV-003
kind: constraint
title: No payout above $10,000 without review
traces: []
terms: [payout, review]
owner: finance
tier: 2
---
No payout above $10,000 without review.
Read the chapter
people approvespec/canon/ASM-011-gateway-request-keys.md
An assumption
A fact about the outside world the system relies on. No test can prove it about someone else's system, so it is watched in production by a monitor.
---
id: ASM-011
kind: assumption
title: The gateway honors request keys
traces: [INV-004]
terms: [request key]
owner: refunds owner
tier: 2
monitor: verify/monitors/duplicate-payouts.md
---
The payment gateway pays at most once per request key.
The gateway's documentation says so, and the refunds service depends on it whenever it retries a payout. No
check inside this repository can show it, so a monitor watches for it in production.
Read the chapter
people onlyspec/canon/policy/
What counts as evidence
The rules that turn evidence into a status, say when a person must accept a release, and set how far each kind of decision is handed to agents. No agent may write here.
This is where the dial is kept.
Read the chapter
agents writespec/blueprint/
Blueprint: how the clauses are kept
The agents' design: the architecture, an assurance case for each clause that needs an argument, and the declaration of each verification environment. Agents may revise it freely as long as it never contradicts canon.
A person can promote any design choice to a decision. From then on it is theirs.
Read the chapter
planner agentspec/blueprint/cases/INV-004.md
The case for one clause
It splits the clause into parts, names the environment that checks each part, and argues why the parts are enough. Cases about money and safety are reviewed by a person. This is the argument of the case for INV-004.
## Argument
A refund is paid twice only if the gateway transfers money twice for one request. The service sends every
payout for a request under that request's key (P1), and the gateway transfers at most once per key (P2). So
for the same request, at most one transfer happens. P1 covers everything the service controls, on both paths;
P2 is the one thing it does not, which is why it is an assumption with a monitor rather than a check.
The automatic path adds no new way to reach the gateway: it calls the same `pay`, whose retry and request-key
handling DEC-031 does not change. The check on the automatic path shows this rather than assumes it.
VE-002 cannot show whether the real gateway honors request keys. That is the residual risk, and it is the
risk the monitor watches.
Read the chapter
verifier agentspec/blueprint/environments/VE-002.md
An environment, declared
Every verification environment states what it is, what it controls, and what it cannot show. Evidence counts only inside those limits.
id: VE-002
name: payments-sandbox
boundary: the refunds service, at this commit
world: real local store; a fake payment gateway
control: seeded; one command up, one command down
## Starting states it can set up
- an order, with its day of dispatch and day of delivery
- a refund waiting for review, or approved and waiting for payout
- an order that has already been partly refunded
## Failures it can simulate
- a refusal
- a duplicate request
- a lost reply (the gateway pays and the reply never arrives)
## What it cannot show
Real gateway timing. Whether the real gateway honors
request keys. Production request shapes.
Read the chapter
people rank itroadmap/
Everything proposed
One folder per change. spec/ is the system as it stands. This is what might become it.
Read the chapter
anyone asks, the elicitor filesroadmap/notes/
Requests as they arrive
Every request is a card: a complaint from support, a number from finance, a worry from risk. Related cards are gathered into one milestone.
finance-review-time-under-100.md Most review time goes to refunds under $100
risk-split-refunds.md Split refunds must not slip past review
store-credit.md Refunds as store credit
support-small-refunds-wait.md Small refunds wait two days in review
Read the chapter
people rankroadmap/index.md
The order of work
The list of changes in priority order. Ranking it is the recurring human act. Agents build what has been agreed while people shape what comes next.
| Milestone | What changes |
|---|---|
| [M2 faster small refunds](M2-faster-small-refunds/change.md) | Refunds under $100 are approved automatically. |
| M3 refunds as store credit | A customer can take a refund as store credit (roadmap/notes/store-credit.md). |
## Released
| Milestone | What changed | CanonBall |
|---|---|---|
| M1 refund window | A customer can request a refund within 30 days of delivery (REQ-012). | 12 |
| M0 first clauses | Refunds go to review and are paid once (INV-004), payouts above $10,000 need review (ENV-003), the gateway's request keys (ASM-011). | earlier |
Read the chapter
agents draft, people agreeroadmap/M2-faster-small-refunds/
One milestone
A folder for one milestone: its page, the files it proposes, and the agents' tasks. An incident repair has the same shape, only smaller.
Read the chapter
people agreeroadmap/M2-faster-small-refunds/change.md
What changes in the system?
The change proposal: one page, drafted by an agent from conversations and agreed to by a person. People approve its examples. They do not review its code.
# M2: Faster small refunds
What changes: a refund is approved automatically while the total refunded on the order stays under $100.
Nothing else changes.
Gathers: 3 requests: roadmap/notes/support-small-refunds-wait.md, finance-review-time-under-100.md,
risk-split-refunds.md
Why now: the review queue is the slowest step for small refunds. Support handles complaints about the
wait every day, and reviewers spend most of their time on refunds they almost never turn down.
Adds: DEC-031 auto-approve under $100; "refund amount" in vocabulary.md
status: agreed (written by canonball)Read the chapter
agents draftroadmap/M2-faster-small-refunds/diff/
The proposed files
Whole files in final form: the clauses this change adds and the design for them. The plan for evidence, in change.md, is fixed before any code exists. Checks run against the release candidate: spec/ with these files applied.
Copied into spec/ at release, never before.
Read the chapter
agentsroadmap/M2-faster-small-refunds/tasks/
The agents' breakdown
The planner slices the change into named tasks. Each task says where it works, what it traces to, and when it is done: a check that passes. Nobody marks a task done.
Read the chapter
agents draftroadmap/unplanned/
Unplanned work
The express belt: incident repairs, bug fixes, refactorings and upkeep. Work that restores a promise or changes none. Each gets a small page and a few proposed files, skips the batching, and passes the same stations as a milestone.
Read the chapter
builder agentsrc/
What runs
The code. CanonBall does not dictate its layout. It does recommend one habit: keep decision logic apart from the code that touches the outside world. Logic with no side effects can be checked for every input. The thin layer that calls a database or a payment gateway is where people still read code.
You may know this as functional core, imperative shell, or as ports and adapters.
Read the chapter
verifier agentverify/
Verification engineering
This is where most of the engineering now goes. Writing the change is the small part. The work is building a place where a clause can be shown to hold, and shown to fail when it should. The builder can run everything here and change none of it.
Making an environment stricter is free. Making it weaker is reviewed.
# verify
Written by the verifier agent. The builder may run everything here and may change none of it.
- `envs/` the verification environments: the system, its real local stores, and a fake for each outside dependency.
- `checks/` one check per example, marked with the example it encodes (`verify/canonball_check.py`).
- `checks/red/` the kept failing runs that show each check can fail. Written by `tools/canonball fault`.
- `faults/` injected faults: small patches that break one thing on purpose.
- `monitors/` what watches the assumptions and invariants in production.
Read the chapter
verifier agentverify/envs/ve002.py
The environment
VE-002 itself. Constructing a World starts it and close() destroys it: the service, its real local store, and a fake payment gateway. It drives the system and observes it. It never judges.
"""VE-002 payments-sandbox: the refunds service, a real local store, and a fake payment gateway.
The declaration is spec/blueprint/environments/VE-002.md. One command up, one command down:
with World() as world: # up: an empty store, a fresh gateway, a decision log
order = world.rig.order(total_cents=12000, dispatched_on=dt.date(2026, 3, 1))
refund = world.act.request_refund(order, 12000, key="r-1")
paid = world.observe.gateway.payouts(order=order)
# down: the store and the log are gone
The four verbs:
rig starting state: orders, existing refunds, partly refunded orders, today's date
act the service API (refunds.service.Service)
perturb failures: perturb.gateway.refuse(), .duplicate(), .lose_reply()
observe what happened: observe.gateway.payouts(), observe.store, observe.decisions()
"""Read the chapter
verifier agentverify/checks/
One check per example
Each check names the example it encodes. An example with no check is visible, and so is a check with no example. This one is in test_inv004_no_double_payout.py.
@example_of("INV-004#violates/1", "Two concurrent copies of one request both pay out")
def test_two_concurrent_copies_pay_once(self):
world = self.world
order = world.rig.order(total_cents=12000)
def one_copy():
refund = world.act.request_refund(order, 12000, key="concurrent-1")
return world.act.approve(refund.id, reviewer="support lead")
at_once(one_copy, one_copy)
paid = world.observe.gateway.payouts(order=order)
assert len(paid) == 1Read the chapter
verifier agentverify/checks/red/
Proof that a check can fail
A check that has never failed proves nothing. Each one is run against an injected fault by tools/canonball fault, and the failing run is kept here. Only then does its pass count.
{
"check": "verify.checks.test_inv004_no_double_payout.NoDoublePayout.test_two_concurrent_copies_pay_once",
"example": "INV-004#violates/1",
"fault": "verify/faults/request-key-ignored.patch",
"outcome": "failed",
"at": "2026-11-25T01:23:15+00:00"
}Read the chapter
verifier agentverify/faults/
Injected faults
Fault injection: small patches that break one thing on purpose, applied to a scratch copy. An environment must also catch faults it was not tuned on, or its evidence is discounted.
Read the chapter
verifier agentverify/monitors/
Monitors
They watch, in production, the assumptions the evidence rested on. When one fires, an incident opens. This is how operating the system feeds back into building it.
Read the chapter
builder and verifier agentsobserve/
Observability
What the system emits, and the commands agents use to read it. Agents build, verify and operate by looking inside the system. Without this they guess.
The same tools work in the verification environment and, read-only, in production. People see the same view.
signals.md what the service emits, field by field
tools/observe decisions --order N, replay --order N
$ observe/tools/observe decisions --order 5512
REQ-012 refund window
result refused
reason day 31 of 30
counted from dispatch, 2 March
delivered 4 March
Read the chapter
kept permanentlyincidents/
Incidents
Each incident adds an example, and usually proposes a new invariant, before the fix is released. The set of guarded failures only grows, so the same failure does not happen twice.
# INC-007 Refund refused on day 29
Detected: a support report. The customer of order 5512 asked for a refund on 2 April 2026, 29 days after
delivery, and was refused as too late. No monitor fired: none watches refusals.
Diagnosis: the on-call agent read the decision log for the order (below). The REQ-012 decision was
"day 31 of 30", counted from dispatch on 2 March 2026. Delivery was 4 March 2026.
Cause: the refund window was counted from the day of dispatch, where REQ-012 says delivery.
Repair: inc-007-window-from-delivery (roadmap/unplanned/ until released, then roadmap/archive/)
Example added: REQ-012 satisfies/2. Given an order dispatched on 2 March and delivered on 4 March, when
the customer requests a refund on 2 April, then the request is accepted.
Proposed: INV-009 The refund window is counted from delivery, never from dispatch.Read the chapter
computed by the orchestratorVerification Record
The Verification Record
The status of every clause, computed from evidence under rules that people own. No person and no agent writes "done". The weakest link is named, not averaged away.
$ tools/canonball record
Verification Record for spec/
REQ-012 accepted checks 2/2 seen to fail 2/2
INV-004 accepted checks 4/4 seen to fail 4/4
DEC-031 accepted checks 3/3 seen to fail 3/3
ENV-003 accepted checks 2/2 seen to fail 2/2
ASM-011 accepted, with stated risk monitored by verify/monitors/duplicate-payouts.md
4 accepted, 1 accepted, with stated risk
Read the chapter
fixed at every releaseCanonBall 13
A CanonBall
What each release ships: the canon as it now stands, the build that keeps it, and the Verification Record that shows it. It answers "what does this system promise, and how do you know?" without anyone reading code.
Progress is a sequence of them. tools/canonball release writes each one's entry in CANONBALLS.md, shown here.
## CanonBall 13
- released: 2026-03-10
- from: roadmap/archive/M2-faster-small-refunds
- build: 8ca1c6a
- record: 4 accepted, 1 accepted, with stated risk
- adds or changes: DEC-031 Auto-approve under $100
Read the chapter