canon-cli 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- canon_cli-0.1.0/LICENSE +21 -0
- canon_cli-0.1.0/PKG-INFO +360 -0
- canon_cli-0.1.0/README.md +337 -0
- canon_cli-0.1.0/canon/__init__.py +3 -0
- canon_cli-0.1.0/canon/__main__.py +6 -0
- canon_cli-0.1.0/canon/activate.py +143 -0
- canon_cli-0.1.0/canon/audit.py +418 -0
- canon_cli-0.1.0/canon/brief.py +235 -0
- canon_cli-0.1.0/canon/cli.py +1143 -0
- canon_cli-0.1.0/canon/gitx.py +263 -0
- canon_cli-0.1.0/canon/ledger.py +418 -0
- canon_cli-0.1.0/canon/mcp.py +337 -0
- canon_cli-0.1.0/canon/prompt.py +45 -0
- canon_cli-0.1.0/canon/scope.py +589 -0
- canon_cli-0.1.0/canon/select.py +173 -0
- canon_cli-0.1.0/canon/verify.py +399 -0
- canon_cli-0.1.0/canon_cli.egg-info/PKG-INFO +360 -0
- canon_cli-0.1.0/canon_cli.egg-info/SOURCES.txt +25 -0
- canon_cli-0.1.0/canon_cli.egg-info/dependency_links.txt +1 -0
- canon_cli-0.1.0/canon_cli.egg-info/entry_points.txt +2 -0
- canon_cli-0.1.0/canon_cli.egg-info/top_level.txt +1 -0
- canon_cli-0.1.0/pyproject.toml +47 -0
- canon_cli-0.1.0/setup.cfg +4 -0
- canon_cli-0.1.0/tests/test_activate.py +203 -0
- canon_cli-0.1.0/tests/test_guarantees.py +375 -0
- canon_cli-0.1.0/tests/test_scope.py +173 -0
- canon_cli-0.1.0/tests/test_team.py +169 -0
canon_cli-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 canon contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
canon_cli-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,360 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: canon-cli
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: The rulebook, compiled: scoped, verifiable repository rules for AI agents.
|
|
5
|
+
Author: canon contributors
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/Infrasynth-org/canon
|
|
8
|
+
Project-URL: Documentation, https://github.com/Infrasynth-org/canon/blob/main/SPEC.md
|
|
9
|
+
Keywords: ai-agents,coding-agents,agents-md,rules,policy-as-code,constraints,context-engineering,mcp
|
|
10
|
+
Classifier: Development Status :: 3 - Alpha
|
|
11
|
+
Classifier: Environment :: Console
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Topic :: Software Development :: Quality Assurance
|
|
19
|
+
Requires-Python: >=3.10
|
|
20
|
+
Description-Content-Type: text/markdown
|
|
21
|
+
License-File: LICENSE
|
|
22
|
+
Dynamic: license-file
|
|
23
|
+
|
|
24
|
+
# canon
|
|
25
|
+
|
|
26
|
+
**The rulebook, compiled.**
|
|
27
|
+
Your repository's rules are a database, not a document.
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
canon brief --task "add a refund endpoint" # what governs this work
|
|
31
|
+
canon check # prove the change satisfies it
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
## The problem is not that agents don't read `AGENTS.md`
|
|
37
|
+
|
|
38
|
+
They read it. Then they stop applying it. The evidence is unusually clear:
|
|
39
|
+
|
|
40
|
+
- Instruction compliance decays with conversation length even when the
|
|
41
|
+
instruction is still in context — omission constraints fall from **73% at
|
|
42
|
+
turn 5 to 33% at turn 16** ([ICML 2026](https://icml.cc/virtual/2026/67826)),
|
|
43
|
+
and failures are behavioural drift, not forgetting
|
|
44
|
+
([EMNLP 2026](https://aclanthology.org/2026.emnlp-main.583/)).
|
|
45
|
+
- When two rules conflict, **"no order holds throughout… where the hierarchy
|
|
46
|
+
fails, position decides"** — across 10,835 trials
|
|
47
|
+
([NeurIPS 2026 workshop](https://openreview.net/forum?id=m4UggOsCBV)).
|
|
48
|
+
- Models notice contradictions and **stay silent**: 73% of runs noticed a
|
|
49
|
+
disagreement, 0% of 110 unprompted runs mentioned it
|
|
50
|
+
([Google AI](https://dev.to/googleai/how-context-drift-impacts-your-ai-agents-1iph)).
|
|
51
|
+
- Context files **do not generally improve task success** while raising
|
|
52
|
+
inference cost over 20% ([arXiv:2602.11988](https://arxiv.org/abs/2602.11988)),
|
|
53
|
+
and no agent in a 4-week study repaired a stale one
|
|
54
|
+
([arXiv:2611.09802](https://arxiv.org/abs/2611.09802)).
|
|
55
|
+
- The harness vendors say it outright: `CLAUDE.md` "files are naively dropped
|
|
56
|
+
into context up front", "they aren't enforced configuration", and "no matter
|
|
57
|
+
how strongly you word it… it is still Claude's call"
|
|
58
|
+
([memory docs](https://code.claude.com/docs/en/memory),
|
|
59
|
+
[best practices](https://code.claude.com/docs/en/best-practices)).
|
|
60
|
+
|
|
61
|
+
So the file is not the problem. **Prose is the problem.** It has no scope, no
|
|
62
|
+
precedence, no predicate, and no failure mode. A `MUST` in markdown is a wish
|
|
63
|
+
with formatting.
|
|
64
|
+
|
|
65
|
+
## The one idea
|
|
66
|
+
|
|
67
|
+
> **A rule is not a paragraph. It is a predicate over a set of changes.**
|
|
68
|
+
|
|
69
|
+
Give each rule three things and everything else follows:
|
|
70
|
+
|
|
71
|
+
| | |
|
|
72
|
+
|---|---|
|
|
73
|
+
| a **scope** — which paths and operations it governs | a *set*, so set algebra applies |
|
|
74
|
+
| a **predicate** — how to tell whether it holds | pass / fail / *unknown* |
|
|
75
|
+
| a **location** — which version of the rule | content-addressed, so merges converge |
|
|
76
|
+
|
|
77
|
+
Once a rule has a scope, "which rules apply to this change?" is not a retrieval
|
|
78
|
+
problem, it is a **membership test**. The diff already tells you the change. No
|
|
79
|
+
embeddings, no top-k, no similarity threshold, no luck.
|
|
80
|
+
|
|
81
|
+
Once a rule has a predicate, "did the agent comply?" is not a judgement, it is
|
|
82
|
+
a **verdict** — and `unknown` is a verdict, not a pass.
|
|
83
|
+
|
|
84
|
+
Once scopes are sets, you can *analyse the rulebook itself*: two rules that
|
|
85
|
+
contradict are two sets that intersect, and the intersection yields a **witness
|
|
86
|
+
path**. Dead rules are rules whose scope matches no file. Coverage is a
|
|
87
|
+
percentage. None of that is possible over prose.
|
|
88
|
+
|
|
89
|
+
## See it
|
|
90
|
+
|
|
91
|
+
```console
|
|
92
|
+
$ canon lint
|
|
93
|
+
ERROR CONTRADICTION R4k9x2/R9c1de money.repr='integer-minor-units' vs 'decimal'
|
|
94
|
+
both govern `backend/ledger/x` — R4k9x2: 'Money is integer minor units…' / R9c1de: 'Money is a Decimal…'
|
|
95
|
+
WARNING DEAD R7m2fp scope frontend/** [write] matches none of 3 tracked files
|
|
96
|
+
|
|
97
|
+
$ canon brief --task "add a refund endpoint"
|
|
98
|
+
# canon brief
|
|
99
|
+
snapshot 1453129c7e20f64f · 2 rule(s) · 1 changed
|
|
100
|
+
task add a refund endpoint
|
|
101
|
+
change backend/api/views.py
|
|
102
|
+
|
|
103
|
+
## HARD — the change is rejected if these fail
|
|
104
|
+
Rap1x4 An API view never reads a tenant id from the request.
|
|
105
|
+
why The workspace comes from the session; a client id is an escalation.
|
|
106
|
+
when backend/api/** [write]
|
|
107
|
+
check grep 'tenant_id' in changed files (expect no-match)
|
|
108
|
+
|
|
109
|
+
$ canon check
|
|
110
|
+
FAIL Rap1x4 An API view never reads a tenant id from the request.
|
|
111
|
+
why The workspace comes from the session; a client id is an escalation.
|
|
112
|
+
when backend/api/** [write]
|
|
113
|
+
check grep 'tenant_id' -> found in 1 file(s)
|
|
114
|
+
| backend/api/views.py:2: tid = request.GET["tenant_id"]
|
|
115
|
+
fix the change; `canon explain Rap1x4` for the history.
|
|
116
|
+
|
|
117
|
+
canon check · snapshot ea8ea32935f95c94 · 1 fail
|
|
118
|
+
refusing: the change does not satisfy the rulebook.
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
The brief is **hundreds of tokens, not hundreds of thousands** — the reported
|
|
122
|
+
monorepo case is 600k of always-on rules
|
|
123
|
+
([Cursor forum](https://forum.cursor.com/t/cursor-loads-all-rules-from-all-folders-in-monorepo-and-blasts-past-context-limits/165337)).
|
|
124
|
+
Only rules whose scope meets this diff are in it, ordered by a declared total
|
|
125
|
+
order, under a budget that can never silently drop a hard rule.
|
|
126
|
+
|
|
127
|
+
## How it works
|
|
128
|
+
|
|
129
|
+
Five mechanisms, each doing one job.
|
|
130
|
+
|
|
131
|
+
**1. A log, not a file.** `.canon/ledger.jsonl` — one content-addressed record
|
|
132
|
+
per line, append-only. Add
|
|
133
|
+
|
|
134
|
+
```
|
|
135
|
+
.canon/.gitattributes: *.jsonl merge=union
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
and two agents editing the rulebook **cannot produce a merge conflict**: git
|
|
139
|
+
concatenates, canon normalises. Within an id the winner is `max(lamport, rev,
|
|
140
|
+
hash)` — a total order that depends only on the records, never on arrival
|
|
141
|
+
order. Merge is pointwise max: commutative, associative, idempotent. Any
|
|
142
|
+
permutation of any partition converges to the same state (tested).
|
|
143
|
+
Losing revisions are **retained**, so a concurrent edit surfaces as `DIVERGED`
|
|
144
|
+
instead of vanishing.
|
|
145
|
+
|
|
146
|
+
**2. Scopes are automata.** A scope is a segment glob compiled to an
|
|
147
|
+
epsilon-NFA. "Do these two rules overlap?" is a product construction; when it
|
|
148
|
+
finds an accepting pair it returns the **path it walked**. That is why canon
|
|
149
|
+
says *"both govern `backend/ledger/x`"* and not *"possible conflict"*.
|
|
150
|
+
`**` matches zero or more segments; `*` never crosses `/`.
|
|
151
|
+
|
|
152
|
+
**3. Verdicts are three-valued.** `PASS`, `FAIL`, `UNKNOWN`, `WAIVED`. A rule
|
|
153
|
+
with no predicate is `UNKNOWN` — reported as a number, never rounded up to
|
|
154
|
+
success. `--strict` makes unknown block. A waiver is a ledger record, so
|
|
155
|
+
every dispensation is auditable and can expire.
|
|
156
|
+
|
|
157
|
+
**4. Freshness is checked, not hoped for.** A rule may carry a `probe` (is
|
|
158
|
+
this still true?) and `anchors` (the files its rationale rests on, by hash).
|
|
159
|
+
A rule whose probe fails is `STALE`; one whose anchor changed is `ANCHOR-DRIFT`;
|
|
160
|
+
one whose scope matches nothing is `DEAD`. **Probes run at most three at a time,
|
|
161
|
+
during normal use** — no daemon, no cron, O(1) amortised maintenance.
|
|
162
|
+
|
|
163
|
+
**5. Proof lives outside the tree.** `canon check --note` writes the
|
|
164
|
+
certificate to `refs/notes/canon`. `git status` stays clean. A commit can carry
|
|
165
|
+
what was checked, against which snapshot, with which verdicts — and anyone can
|
|
166
|
+
re-run it.
|
|
167
|
+
|
|
168
|
+
## Working with people
|
|
169
|
+
|
|
170
|
+
The rulebook is a normal git artifact: reviewed in PRs, line-granular diffs,
|
|
171
|
+
`git log -p .canon/ledger.jsonl` as its history, `git blame` as attribution.
|
|
172
|
+
|
|
173
|
+
Three things are enforced rather than hoped for:
|
|
174
|
+
|
|
175
|
+
- **Two people add rules offline.** They get ids generated at creation, so
|
|
176
|
+
neither can shadow the other. (The first implementation used `R3`, `R4`; two
|
|
177
|
+
clones both computed `R3` and one rule silently vanished on merge. That bug
|
|
178
|
+
is why ids are random.)
|
|
179
|
+
- **Two people edit one rule offline.** The ledger converges, both texts are
|
|
180
|
+
retained, and `canon lint` **exits 1** until a human reads them with
|
|
181
|
+
`canon history` and acknowledges with `canon resolve`. A CRDT converges but
|
|
182
|
+
can drop intent; failing the build is how intent gets a human.
|
|
183
|
+
- **An agent learns something.** `canon remember` stores it `unreviewed`, marks
|
|
184
|
+
it in every brief, and queues it for `canon review`. A rule that can fail a
|
|
185
|
+
build is a commitment; a fact an agent inferred is a rumour. They must not
|
|
186
|
+
look the same.
|
|
187
|
+
|
|
188
|
+
The long version, including what canon does *not* solve, is in
|
|
189
|
+
[docs/TEAM.md](docs/TEAM.md).
|
|
190
|
+
|
|
191
|
+
## What prose cannot give you
|
|
192
|
+
|
|
193
|
+
| | `AGENTS.md` | canon |
|
|
194
|
+
|---|---|---|
|
|
195
|
+
| Applies only where relevant | ✗ whole file, always | ✓ scope ∩ diff |
|
|
196
|
+
| Conflict between two rules | silent, position decides | **error, with a witness path** |
|
|
197
|
+
| Rule that governs nothing | invisible forever | `DEAD`, computable |
|
|
198
|
+
| Rule whose rationale rotted | invisible | `ANCHOR-DRIFT` |
|
|
199
|
+
| Predicate failed | nothing happens | exit 1, commit refused |
|
|
200
|
+
| Not mechanically checkable | looks identical to one that is | `UNKNOWN`, counted as **debt** |
|
|
201
|
+
| Concurrent edits | merge conflict | converges (union + LWW) |
|
|
202
|
+
| Token cost | grows with the file | bounded by budget, omissions named |
|
|
203
|
+
| Which rules applied to commit X | unknowable | certificate in `refs/notes/canon` |
|
|
204
|
+
| Per-rule value | guessed | hits vs. catches, per rule |
|
|
205
|
+
|
|
206
|
+
That last row is the quiet one. Because every evaluation is recorded, canon can
|
|
207
|
+
tell you which rules have **never once prevented anything**. The research says
|
|
208
|
+
context files cost 20% more inference for no measurable gain; the only honest
|
|
209
|
+
response is to make each rule justify itself and delete the rest.
|
|
210
|
+
|
|
211
|
+
## Install
|
|
212
|
+
|
|
213
|
+
```bash
|
|
214
|
+
pip install canon-cli # provides the `canon` command; stdlib only, no deps
|
|
215
|
+
# or, from a checkout:
|
|
216
|
+
python3 -m canon --help
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
Python 3.10+. No runtime dependencies. No server. No API key.
|
|
220
|
+
|
|
221
|
+
```bash
|
|
222
|
+
cd your-repo
|
|
223
|
+
canon init # creates .canon/, prints one block to paste
|
|
224
|
+
canon add "Money is integer minor units; never floats." \
|
|
225
|
+
--scope 'backend/ledger/**' \
|
|
226
|
+
--why "Float drift breaks reconciliation." \
|
|
227
|
+
--check-kind grep --check '/ *100\.0' --expect no-match
|
|
228
|
+
canon activate # write the block every harness already reads
|
|
229
|
+
canon hook install # pre-commit gate (chains an existing hook)
|
|
230
|
+
canon remember "…" # capture knowledge; unreviewed until `canon review`
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
### The entire integration
|
|
234
|
+
|
|
235
|
+
Paste this once, into whatever your harness already reads. It is the only
|
|
236
|
+
prose canon adds to your repository, and it is deliberately small enough that
|
|
237
|
+
the cost of ignoring it is visible:
|
|
238
|
+
|
|
239
|
+
```markdown
|
|
240
|
+
## Rules
|
|
241
|
+
|
|
242
|
+
This repository's rules are a database in `.canon/ledger.jsonl`, read with `canon`.
|
|
243
|
+
|
|
244
|
+
- Before your first edit: `canon brief --task "<the task you were given>"`
|
|
245
|
+
- Before you commit: `canon check`
|
|
246
|
+
|
|
247
|
+
Every line `canon brief` prints is binding. A HARD rule that fails makes the
|
|
248
|
+
change invalid: fix the change, never the rule. If `canon` is not installed,
|
|
249
|
+
use `python3 -m canon`. For a rule's reason: `canon explain <id>`.
|
|
250
|
+
To keep a durable rule: `canon add "<one sentence>" --scope '<glob>' --why "<why>"`.
|
|
251
|
+
|
|
252
|
+
Never edit `.canon/ledger.jsonl` by hand, and never bypass the check.
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
That is the whole harness-agnostic move: **a CLI, and a block small enough to
|
|
256
|
+
paste.** Anything with a shell can use it — Claude Code, Codex, Cursor, Aider,
|
|
257
|
+
Goose, OpenHands, a bash script, a Makefile, your own agent next year. No
|
|
258
|
+
protocol, no plugin, no vendor cooperation. (This delivery model is borrowed
|
|
259
|
+
with admiration from [OptMem](https://github.com/VictorTaelin/OptMem), which
|
|
260
|
+
proved that a 426-token block plus a CLI is enough. canon adds the part OptMem
|
|
261
|
+
deliberately omits: rules that are scoped, checkable, and merge-safe.)
|
|
262
|
+
|
|
263
|
+
## Making future sessions use it
|
|
264
|
+
|
|
265
|
+
A fresh session starts with three channels and only three: context the harness
|
|
266
|
+
injects, tools the harness offers, and commands it must run to finish. So
|
|
267
|
+
activation is layered by what each layer *guarantees*:
|
|
268
|
+
|
|
269
|
+
| tier | mechanism | guaranteed? |
|
|
270
|
+
|---|---|---|
|
|
271
|
+
| 0 | `canon hook install` — the commit gate | **yes**, every agent commits |
|
|
272
|
+
| 1 | CI — `check --strict`, `lint`, `activate --check` | **yes** |
|
|
273
|
+
| 2 | `canon mcp` — tools in the list + `initialize.instructions` | no, but very likely |
|
|
274
|
+
| 3 | `canon activate` — the `AGENTS.md` block | no, but universal |
|
|
275
|
+
|
|
276
|
+
Two details make tier 2 better than another markdown file: tool descriptions are
|
|
277
|
+
re-sent on **every turn** (so "call `canon_brief` before editing" stays salient
|
|
278
|
+
instead of decaying), and MCP's handshake has an `instructions` field that canon
|
|
279
|
+
fills with the hard rules at startup — protocol-level context injection, not a
|
|
280
|
+
vendor feature. `canon_check` returns `isError: true` on a violation so the
|
|
281
|
+
harness treats it as a failure rather than a paragraph.
|
|
282
|
+
|
|
283
|
+
The block itself is delimited and generated:
|
|
284
|
+
|
|
285
|
+
```markdown
|
|
286
|
+
<!-- canon:begin — generated by `canon activate`; edit rules with `canon add` -->
|
|
287
|
+
## Rules
|
|
288
|
+
…
|
|
289
|
+
<!-- canon:end -->
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
Everything outside the markers is yours; everything inside is rebuilt by
|
|
293
|
+
`canon activate`, and `canon activate --check` fails CI when it drifts. That is
|
|
294
|
+
the answer to "it goes stale": it is not maintained, it is regenerated.
|
|
295
|
+
|
|
296
|
+
Full tier-by-tier guide, including the session-hook shape canon deliberately
|
|
297
|
+
does *not* generate: [docs/ACTIVATION.md](docs/ACTIVATION.md).
|
|
298
|
+
|
|
299
|
+
## The design in one line
|
|
300
|
+
|
|
301
|
+
> A rulebook is a **set of scoped predicates**; a change is a **footprint**;
|
|
302
|
+
> compliance is **membership plus evaluation**; the store is a **join-semilattice**;
|
|
303
|
+
> the text is a **projection**.
|
|
304
|
+
|
|
305
|
+
Each of those is a well-understood object, which is why the guarantees are
|
|
306
|
+
provable rather than aspirational. See [SPEC.md](SPEC.md) for the model, the
|
|
307
|
+
seven guarantees, and their proofs; [docs/WHY.md](docs/WHY.md) for the research
|
|
308
|
+
this is built on; [docs/MIGRATION.md](docs/MIGRATION.md) for the zero-risk path
|
|
309
|
+
off `AGENTS.md`, and [docs/DESIGN-RULES.md](docs/DESIGN-RULES.md) for the
|
|
310
|
+
judgement-heavy case (design rules: structural, judged, and taste).
|
|
311
|
+
|
|
312
|
+
## Honest limits
|
|
313
|
+
|
|
314
|
+
- **canon does not make a model smarter.** The evidence says context files
|
|
315
|
+
barely move success rates. canon's claim is narrower and stronger: it makes
|
|
316
|
+
rules *enforceable, complete, auditable and cheap*, and it gives you a number
|
|
317
|
+
for how much of your rulebook is still unproven prose.
|
|
318
|
+
- **Commit-time enforcement is bypassable** (`--no-verify`). That is what CI is
|
|
319
|
+
for: `canon check --range origin/main..HEAD --strict` in a pipeline is not
|
|
320
|
+
bypassable.
|
|
321
|
+
- **`UNKNOWN` is common at first.** That is the point — `canon audit` reports
|
|
322
|
+
normative debt, and the number is supposed to fall.
|
|
323
|
+
- **Conflict detection needs a declared `key`.** Two rules conflict when they
|
|
324
|
+
claim the same `key` with different `value` and their scopes intersect. That
|
|
325
|
+
one extra field buys decidability; without it, "these rules disagree" is a
|
|
326
|
+
natural-language judgement.
|
|
327
|
+
- **Subset checks are repo-relative**, over tracked files, not over all
|
|
328
|
+
possible strings. Checking language inclusion in general is PSPACE-complete;
|
|
329
|
+
checking it over the files that exist is a loop.
|
|
330
|
+
|
|
331
|
+
## Prior art, and why this is different
|
|
332
|
+
|
|
333
|
+
`AGENTS.md` and friends are the *interface*; canon is the *substrate*. It does
|
|
334
|
+
not compete with them — it compiles to them.
|
|
335
|
+
|
|
336
|
+
| | what it is | why it isn't this |
|
|
337
|
+
|---|---|---|
|
|
338
|
+
| AGENTS.md / CLAUDE.md | prose dropped into context | advisory by construction; no scope, predicate, or failure mode |
|
|
339
|
+
| Cursor / Continue / Cody rules | per-vendor glob-activated rules | re-implements precedence per vendor; no cross-harness semantics, no proof |
|
|
340
|
+
| OPA / Rego, Cedar | policy engines over structured input | needs an integration point and a policy language; "the agent edited a file" is not an input |
|
|
341
|
+
| pre-commit, linters | deterministic checks | no notion of *which rule*, no scope algebra, no audit trail, no brief |
|
|
342
|
+
| ADRs | decisions with rationale | rationale, not obligation; rots identically |
|
|
343
|
+
| OptMem, mem0, Zep, Letta | agent memory | descriptive (what happened), not normative (what must hold); no verdicts |
|
|
344
|
+
| Cline memory bank | agent-maintained markdown | agent-authored prose self-reinforces drift; nothing verifies it |
|
|
345
|
+
|
|
346
|
+
The gap none of them fill: **in-repo, agent-agnostic, scoped, verifiable,
|
|
347
|
+
merge-safe rules with a certificate.**
|
|
348
|
+
|
|
349
|
+
## Status
|
|
350
|
+
|
|
351
|
+
`0.1.0` — the core is complete and tested. The 66-test suite covers convergence
|
|
352
|
+
under permutation, witness soundness and completeness against a finite universe,
|
|
353
|
+
budget invariants, clean-tree behaviour, determinism, the hook gate refusing then
|
|
354
|
+
certifying, and the multi-person cases: concurrent adds keeping both rules,
|
|
355
|
+
concurrent edits surfacing both texts and failing the build, and agent-learned
|
|
356
|
+
facts staying unreviewed until a human confirms them, plus activation idempotency, drift detection, the MCP handshake, and the severity dial that keeps a soft rule advisory instead of a gate. Next: `canon prompt` for per-harness
|
|
357
|
+
renderings, an `ablate` command that measures a rule's causal value, and a
|
|
358
|
+
`--judge` adapter presets file.
|
|
359
|
+
|
|
360
|
+
MIT.
|