@journeykit/canon 0.46.0 → 0.47.0

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.
Files changed (124) hide show
  1. package/dist/skills/SKILL.src.md +15 -18
  2. package/dist/skills/reference/canon-gate.md +17 -24
  3. package/dist/skills/reference/canon-inventory.md +1 -1
  4. package/dist/skills/reference/canon-plan-import.md +1 -1
  5. package/dist/skills/reference/canon-policy.md +1 -1
  6. package/dist/skills/reference/canon-report-dashboard.md +2 -6
  7. package/dist/skills/reference/canon-review.md +3 -3
  8. package/dist/skills/reference/canon-storage.md +76 -155
  9. package/dist/skills/reference/canon-subject.md +1 -8
  10. package/dist/skills/reference/role-implementer.md +6 -8
  11. package/dist/skills/reference/role-orchestrator.md +9 -27
  12. package/dist/skills/reference/role-planner.md +1 -4
  13. package/dist/skills/reference/role-reviewer.md +1 -1
  14. package/man/canon-adapter-authorize.1 +2 -2
  15. package/man/canon-adapter-validate.1 +2 -2
  16. package/man/canon-adapter.1 +2 -2
  17. package/man/canon-artifacts-prune.1 +4 -4
  18. package/man/canon-artifacts-store.1 +6 -4
  19. package/man/canon-artifacts-verify.1 +7 -7
  20. package/man/canon-artifacts.1 +5 -8
  21. package/man/canon-brief-approve.1 +2 -2
  22. package/man/canon-brief-check.1 +2 -2
  23. package/man/canon-brief-show.1 +2 -2
  24. package/man/canon-brief.1 +2 -2
  25. package/man/canon-change-defer.1 +3 -4
  26. package/man/canon-change-drop.1 +2 -2
  27. package/man/canon-change-new.1 +2 -2
  28. package/man/canon-change-reopen.1 +2 -2
  29. package/man/canon-change.1 +2 -2
  30. package/man/canon-completion.1 +2 -2
  31. package/man/canon-context-pack-add.1 +2 -2
  32. package/man/canon-context-pack-show.1 +2 -2
  33. package/man/canon-context-pack-verify.1 +2 -2
  34. package/man/canon-context-pack.1 +2 -2
  35. package/man/canon-context.1 +2 -2
  36. package/man/canon-dashboard.1 +2 -2
  37. package/man/canon-demo-init.1 +2 -2
  38. package/man/canon-demo-review.1 +2 -2
  39. package/man/canon-demo.1 +2 -2
  40. package/man/canon-dispatch-begin.1 +2 -2
  41. package/man/canon-dispatch-diff.1 +2 -2
  42. package/man/canon-dispatch-end.1 +2 -2
  43. package/man/canon-dispatch.1 +2 -2
  44. package/man/canon-divergence-accept.1 +2 -2
  45. package/man/canon-divergence-add.1 +2 -2
  46. package/man/canon-divergence-defer.1 +2 -2
  47. package/man/canon-divergence-list.1 +2 -2
  48. package/man/canon-divergence-resolve.1 +2 -2
  49. package/man/canon-divergence.1 +2 -2
  50. package/man/canon-evidence-add.1 +2 -2
  51. package/man/canon-evidence-approval-payload.1 +2 -2
  52. package/man/canon-evidence-audit.1 +2 -2
  53. package/man/canon-evidence.1 +2 -2
  54. package/man/canon-export.1 +2 -2
  55. package/man/canon-feature-new.1 +2 -2
  56. package/man/canon-feature.1 +2 -2
  57. package/man/canon-finding-add.1 +2 -2
  58. package/man/canon-finding-close.1 +2 -2
  59. package/man/canon-finding-list.1 +2 -2
  60. package/man/canon-finding.1 +2 -2
  61. package/man/canon-format.1 +2 -2
  62. package/man/canon-gate-check.1 +2 -2
  63. package/man/canon-gate-install-hooks.1 +2 -2
  64. package/man/canon-gate-promote.1 +2 -2
  65. package/man/canon-gate.1 +2 -2
  66. package/man/canon-ingest-plans.1 +2 -2
  67. package/man/canon-ingest-records.1 +2 -2
  68. package/man/canon-ingest.1 +2 -2
  69. package/man/canon-init.1 +2 -2
  70. package/man/canon-inventory-sync.1 +2 -2
  71. package/man/canon-inventory.1 +2 -2
  72. package/man/canon-ledger-compact.1 +2 -2
  73. package/man/canon-ledger.1 +2 -2
  74. package/man/canon-migrate.1 +3 -3
  75. package/man/canon-plugin-sync.1 +2 -2
  76. package/man/canon-plugin.1 +2 -2
  77. package/man/canon-policy-approve.1 +2 -2
  78. package/man/canon-policy-show.1 +2 -2
  79. package/man/canon-policy.1 +2 -2
  80. package/man/canon-prompt-add.1 +2 -2
  81. package/man/canon-prompt-show.1 +2 -2
  82. package/man/canon-prompt.1 +2 -2
  83. package/man/canon-purge.1 +2 -2
  84. package/man/canon-query.1 +4 -4
  85. package/man/canon-regime-show.1 +2 -2
  86. package/man/canon-regime.1 +2 -2
  87. package/man/canon-report-build.1 +2 -2
  88. package/man/canon-report-check.1 +2 -2
  89. package/man/canon-report-snapshot.1 +2 -2
  90. package/man/canon-report.1 +2 -2
  91. package/man/canon-retrieve.1 +2 -2
  92. package/man/canon-review-brief.1 +2 -2
  93. package/man/canon-review-change.1 +2 -2
  94. package/man/canon-review-scenario.1 +2 -2
  95. package/man/canon-review.1 +2 -2
  96. package/man/canon-scenario-new.1 +2 -2
  97. package/man/canon-scenario.1 +2 -2
  98. package/man/canon-schema.1 +2 -2
  99. package/man/canon-search.1 +2 -2
  100. package/man/canon-selftest.1 +2 -2
  101. package/man/canon-skills-check.1 +2 -2
  102. package/man/canon-skills-doctor.1 +2 -2
  103. package/man/canon-skills-install.1 +2 -2
  104. package/man/canon-skills-show.1 +2 -2
  105. package/man/canon-skills.1 +2 -2
  106. package/man/canon-status.1 +2 -2
  107. package/man/canon-strategy-approval-payload.1 +2 -2
  108. package/man/canon-strategy-promote.1 +2 -2
  109. package/man/canon-strategy-rollback.1 +2 -2
  110. package/man/canon-strategy.1 +2 -2
  111. package/man/canon-subject-adopt.1 +2 -2
  112. package/man/canon-subject-move.1 +2 -2
  113. package/man/canon-subject-new.1 +2 -2
  114. package/man/canon-subject-show.1 +2 -2
  115. package/man/canon-subject-unadopt.1 +2 -2
  116. package/man/canon-subject.1 +2 -2
  117. package/man/canon-task-done.1 +2 -2
  118. package/man/canon-task.1 +2 -2
  119. package/man/canon-trace.1 +2 -2
  120. package/man/canon.1 +4 -7
  121. package/package.json +5 -5
  122. package/man/canon-artifacts-move.1 +0 -63
  123. package/man/canon-tier-age.1 +0 -50
  124. package/man/canon-tier.1 +0 -39
@@ -168,22 +168,20 @@ what its own write names: evidence carries nothing forward from an earlier
168
168
  record, and a review stays current while the verdict and checks of the
169
169
  evidence it saw are unchanged and the code tree is the one it saw.
170
170
 
171
- Where artifact bytes live is the repo's choice: `canon.yaml`'s `artifact_store:`
172
- block defaults to the local, git-tracked `.canon/artifacts/sha256/`, or names
173
- an object-store tier, in which case `evidence add`, `review scenario`, `review change` and
174
- `artifacts store` upload by digest and keep nothing locally. The gate and
175
- `canon artifacts verify` (`--full` re-hashes every blob) ask the store and
176
- refuse, never pass, when it cannot be reached. Moving an existing store with
177
- `canon artifacts move --tier <tier>` is the repo owner's decision, not a step
178
- of the loop. So is `canon artifacts prune`, which deletes the blobs no record
179
- binds any more (the store only grows: a report written anew on every run adds a
171
+ Evidence attachment bytes live in `.canon/artifacts/sha256/`, git-tracked. With
172
+ `storage: { attachments: lfs }` in `canon.yaml` git LFS stores them, and
173
+ `evidence add`, `review scenario --artifact` and `artifacts store` write bytes
174
+ only when git-lfs is installed (`ARTIFACTS_STORE_REQUIRED` otherwise). The gate
175
+ and `canon artifacts verify` (`--full` re-hashes every blob) read that
176
+ directory. `canon artifacts prune` is the repo owner's decision, not a step
177
+ of the loop. It deletes the blobs no record binds any more (the store only
178
+ grows: a report written anew on every run adds a
180
179
  blob per run). A blob stays while the latest evidence or a current review binds
181
180
  it (what the gate and `artifacts verify` read), while a record not promoted yet
182
181
  binds it, and, with `--keep-days N`, while any evidence or review of the last
183
182
  `N` days binds it; the bare run previews the blobs it deletes and why the rest
184
- stay, and `--commit --plan-digest` deletes. A deleted local blob stays in git
185
- history (shrinking that history is the repo owner's call, not the command's); a
186
- deleted object of an object-store tier is gone for good. The preview and the
183
+ stay, and `--commit --plan-digest` deletes. A deleted blob stays in git
184
+ history (shrinking that history is the repo owner's call, not the command's). The preview and the
187
185
  commit also cover the stale temp files a killed blob write leaves in
188
186
  `.canon/artifacts/sha256` (`.tmp-<sha256>-<pid>-<nanos>`, a regular file
189
187
  modified over five minutes ago): the plan lists them in `data.staleTemps`, and
@@ -207,8 +205,7 @@ fix, re-review and evidence chain of a loop in time order, the archive's
207
205
  earlier versions included. Both read, and first refresh, a derived index,
208
206
  `.canon/index/search.db`: gitignored, never a source of records, safe to delete
209
207
  (the next run rebuilds it, and only `data.index.rebuilt` differs). Records still
210
- staged, and those in postgres or an object store, are not in it; `data.index`
211
- names the stores not read.
208
+ staged are not in it.
212
209
 
213
210
  ## Know your role
214
211
 
@@ -358,9 +355,9 @@ leaves below take one object only.
358
355
 
359
356
  ### Preview, then `--commit`
360
357
 
361
- The six commands that delete or rewrite existing data (`canon purge`,
362
- `canon tier age`, `canon ledger compact`, `canon artifacts move`,
363
- `canon artifacts prune`, `canon migrate`) act in two steps. The bare run previews: it writes nothing,
358
+ The four commands that delete or rewrite existing data (`canon purge`,
359
+ `canon ledger compact`, `canon artifacts prune`, `canon migrate`) act in
360
+ two steps. The bare run previews: it writes nothing,
364
361
  exits 0 and prints the effects and a `planDigest`. Read the effects, then act
365
362
  with `--commit --plan-digest <planDigest>`. It refuses (`PLAN_STALE`) when
366
363
  the plan differs from the one you previewed, so run the preview again. Appends
@@ -473,7 +470,7 @@ current step needs.
473
470
  | `canon-review` | Findings and reviews. |
474
471
  | `canon-artifact-ingest` | `canon ingest records`: artifacts into verdict trajectories. |
475
472
  | `canon-plan-import` | `canon ingest plans`: plan state into change and task records. |
476
- | `canon-storage` | Storage rungs, tiers, retention, export, purge. |
473
+ | `canon-storage` | Where records live, the `storage:` block, retention, export, purge. |
477
474
  | `canon-policy` | The policy and the CEL expressions behind it. |
478
475
  | `canon-plugins` | Plugin overlays on core records. |
479
476
  | `canon-learn` | Strategy memory: promote, approve, roll back. |
@@ -209,18 +209,13 @@ A present section, even `require_evidence: false` or a malformed one
209
209
  The ship guard and `canon status` read the same decision, and
210
210
  `--override-reason` does not waive it. Keys: `canon-policy`.
211
211
 
212
- Two refusals rather than a silent pass, both surfacing as
213
- `uncovered-cell` on the subject `spec_coverage`:
214
-
215
- - A **malformed section** (unknown key, unknown `scope` status, or a
216
- malformed `require_cases`/`require_review`/`require_audit`/`require_ci_run` — unknown
217
- key, bad status, `null`, non-mapping, a missing or out-of-range
218
- `rate`, a `min_cases` that is not an integer of 1 or more) refuses at check time (`uncovered-cell spec_coverage — ...
219
- unusable`). It is never treated as
220
- absent — a typo must not be silently equivalent to not opting in.
221
- - A **corpus kind routed off the gate's rung** (`scenario`,
222
- `divergence`, or `subject` sent anywhere but `local`) refuses, because
223
- the gate reads one tier and would otherwise pass by seeing nothing.
212
+ A **malformed section** refuses rather than silently passes, and surfaces as
213
+ `uncovered-cell` on the subject `spec_coverage`: an unknown key, an unknown `scope` status, or a
214
+ malformed `require_cases`/`require_review`/`require_audit`/`require_ci_run` — unknown
215
+ key, bad status, `null`, non-mapping, a missing or out-of-range
216
+ `rate`, a `min_cases` that is not an integer of 1 or more — refuses at check time (`uncovered-cell spec_coverage — ...
217
+ unusable`). It is never treated as
218
+ absent — a typo must not be silently equivalent to not opting in.
224
219
 
225
220
  Unparseable rows in those three kinds do NOT surface as
226
221
  `malformed-evidence`; they are kept off the evidence violation set on
@@ -730,21 +725,19 @@ again. The directory is tracked in git (`canon init` never ignores it):
730
725
  commit it with the ledger. A file larger than 25 MiB is refused (exit 2);
731
726
  raise the limit with `--max-artifact-mib <N>`.
732
727
 
733
- Where those bytes live is `canon.yaml`'s `artifact_store: { backend: local |
734
- <s3 tier>, prefix: artifacts/ }` (default `local`: the directory above,
735
- git-tracked, no credentials). With an object-store tier, `evidence add`,
736
- `review scenario` and `artifacts store` upload each blob under
737
- `<prefix>sha256/<digest>.zst` (one zstd frame of the bound bytes; the digest is
738
- that of the bytes before compression; a plain `<prefix>sha256/<digest>` object
739
- of an older canon is still read) and keep nothing locally. `canon gate check` and
740
- `canon artifacts verify [--full]` ask the store (a HEAD per digest; `--full`
741
- downloads and re-hashes) and refuse, never pass, when it cannot be reached.
742
- `canon artifacts move --tier <tier>` (a preview; `--commit --plan-digest` acts) moves an existing local
743
- store; it is the repo owner's decision. `canon artifacts prune` (a preview;
728
+ Where those bytes live is `canon.yaml`'s `storage.attachments`: `git` (the
729
+ default) keeps the directory above git-tracked, `lfs` has git LFS store the
730
+ blobs. With `lfs`, `evidence add`, `review scenario --artifact` and `artifacts
731
+ store` write bytes only when git-lfs is installed and exit 2 with
732
+ `ARTIFACTS_STORE_REQUIRED` otherwise. `canon gate check` and `canon artifacts
733
+ verify [--full]` read the directory (`--full` re-hashes every blob). A blob file
734
+ that is an LFS pointer is bytes not received: `artifacts verify` reports it as
735
+ `lfs_pointer` and the gate counts the attachment as a violation; run `git lfs
736
+ pull`. `canon artifacts prune` (a preview;
744
737
  `--commit --plan-digest` acts) deletes the blobs no record binds any more and
745
738
  leaves what `gate check` and `artifacts verify` read, so their answers do not
746
739
  change (it also deletes the stale `.tmp-` files a killed blob write left, which
747
- `artifacts verify` counts without deleting); it is the repo owner's decision too. See `canon-storage`.
740
+ `artifacts verify` counts without deleting); it is the repo owner's decision. See `canon-storage`.
748
741
 
749
742
  `canon gate check` re-checks every file bound to a LATEST evidence record
750
743
  (the latest per task and per `(project_id, scenario_id)`):
@@ -115,7 +115,7 @@ Per configured root, in order:
115
115
  visible; plain tags (`@p2`) are ignored. The index derives from the
116
116
  `.feature` corpus alone. See `canon-authoring` for the organizing rule.
117
117
  3. **Materialize** — upserts ONE scenario index record per
118
- `(project_id, scenario_id)` via the append-only git-tier write.
118
+ `(project_id, scenario_id)` via the append-only ledger write.
119
119
  Logically idempotent: an unchanged `source_digest` is a no-op; a
120
120
  changed `.feature` file appends exactly one new record. A `.feature`
121
121
  edit re-materializes every scenario in that file (file granularity).
@@ -74,7 +74,7 @@ canon ingest plans --repo ../svc
74
74
 
75
75
  Per source the summary reports `changes_parsed`/`tasks_parsed`,
76
76
  `changes_persisted`/`tasks_persisted`, `changes_unwritten`/
77
- `tasks_unwritten` (an unreachable tier — printed, never silently
77
+ `tasks_unwritten` (a store that cannot be written — printed, never silently
78
78
  dropped), `duplicate_change_id` (two sources producing the same
79
79
  `change_id` this pass — the LATER is skipped and counted, never merged),
80
80
  the adapter's `unmapped` drop counts, and `malformed` (structurally
@@ -1,7 +1,7 @@
1
1
  # canon-policy
2
2
 
3
3
  Canon uses ONE expression language — CEL — for every conditional knob a
4
- spec needs: policy-routing predicates, tier-aging thresholds, verdict-
4
+ spec needs: policy-routing predicates, verdict-
5
5
  mapping guards, retrieval filters, and a template's `applies_when:`
6
6
  section. Wherever a `policy.yaml` predicate or an `applies_when:` string
7
7
  appears, it is a CEL expression evaluated against the target record.
@@ -44,12 +44,8 @@ canon report build
44
44
  canon report build --repo /path/to/repo
45
45
  ```
46
46
 
47
- Between the digest header and the first panel, the report may also
48
- render a `## Kinds not read directly` section. It is config-derived
49
- (`canon.yaml`'s static `routing`/`tiers` tables), not a live backend
50
- probe, and an empty set renders NO section at all — so a repo routing
51
- nothing to a not-directly-readable backend renders exactly as before
52
- the section existed.
47
+ The report reads every record directly: the ledger, `.canon/hot.db` and the
48
+ learn parquet under `.canon/learn/`. No section lists kinds it did not read.
53
49
 
54
50
  **Done when:** `canon report build` exits `0` and `canon report check`
55
51
  then exits `0` (no `DRIFT`).
@@ -249,9 +249,9 @@ screenshot, a recording, a trace — exactly as `canon evidence add
249
249
  --artifact` binds one: the path must resolve to a file inside the
250
250
  repository, a file over 25 MiB is refused unless `--max-artifact-mib <N>`
251
251
  raises the limit, and the bytes are stored by digest (in
252
- `.canon/artifacts/sha256/<hex>` unless `canon.yaml`'s `artifact_store:` names an
253
- object store, where they are uploaded and nothing is kept locally; commit
254
- the local store with the ledger) before the
252
+ `.canon/artifacts/sha256/<hex>`; commit the store with the ledger; with
253
+ `storage.attachments: lfs` the review is refused with `ARTIFACTS_STORE_REQUIRED`
254
+ when git-lfs is missing) before the
255
255
  review is written. Any refusal exits 2 and writes and stores nothing. The
256
256
  review records each distinct file once, in the order given:
257
257
 
@@ -1,103 +1,57 @@
1
1
  # canon-storage
2
2
 
3
- canon stores every record in one of three capability **rungs**:
3
+ canon keeps every record in one place per record kind, on the disk of the working tree. The place follows from the kind and is not a setting. The only storage setting in `canon.yaml` is the optional `storage:` block.
4
4
 
5
- - `local` — diffable files in the repo (git-backed), zero network.
6
- - `hot` — live-queryable state (sqlite or postgres).
7
- - `cold` — bulk archive (s3).
5
+ ## Where each record lives
8
6
 
9
- A rung is a *role*; which backend implements it is a separate
10
- declaration. `routing:`/`aging:` name a rung (`local`/`hot`/`cold`),
11
- never a backend name. `tiers.<rung>.backend:` names the backend.
7
+ | record | place | in git |
8
+ | --- | --- | --- |
9
+ | `task`, `handoff`, `run` | `.canon/hot.db` (sqlite, one per working tree) | no |
10
+ | the other ten kinds (`change`, `evidence`, `strategy_item`, …) | `.canon/ledger/` (latest version) and `.canon/archive/` (superseded versions) | yes |
11
+ | evidence attachment bytes | `.canon/artifacts/sha256/<digest>` | yes; through git LFS with `attachments: lfs` |
12
+ | learn parquet | `.canon/learn/` | no |
12
13
 
13
- ## Backends and their config
14
+ `.canon/hot.db` is a sqlite file in WAL mode with a busy timeout: one writer at a time. canon creates it with mode `0600`, and the `-wal` and `-shm` files beside it too. No command needs an environment variable or a service.
14
15
 
15
- | backend | rung role | `tiers.<rung>` config | credentials / network |
16
- | ---------- | --------- | ---------------------------------- | --------------------- |
17
- | `git` | local | `root:` (relative to canon.yaml) | none — zero network |
18
- | `sqlite` | hot | `path:` (relative to canon.yaml) | none |
19
- | `postgres` | hot | `dsn_env:` + `schema:` | live network + creds |
20
- | `s3` | cold | `bucket_env:` + `prefix:` | live network + creds |
21
-
22
- `canon init` scaffolds `sqlite` as the zero-dependency `hot` default
23
- (WAL journal + busy timeout, fine for one operator's batch ingest).
24
- sqlite is a **single-writer store**: for heavy multi-agent concurrent
25
- writers, swap the `hot` rung to `postgres` — same hot role, a one-block
26
- canon.yaml swap (the scaffold ships the postgres stanza commented right
27
- beside the sqlite one). A postgres/s3 rung that can't attach fails loud
28
- at startup — never a silent fallback to local files.
16
+ ## The `storage:` block
29
17
 
30
18
  ```yaml
31
- tiers:
32
- local: { backend: git, root: .canon/ledger }
33
- hot: { backend: sqlite, path: .canon/hot.db }
34
- # hot: { backend: postgres, dsn_env: CANON_PG_DSN, schema: canon }
35
- cold: { backend: s3, bucket_env: CANON_BUCKET, prefix: canon/ }
19
+ storage:
20
+ mode: local # the only value, and the value when the key is absent
21
+ attachments: git # git (default) or lfs
36
22
  ```
37
23
 
38
- Using a backend name (`git`/`pg`/`s3`) where a rung is expected is
39
- rejected with a hint:
24
+ `canon init` writes the block. Both fields take a closed set of values: `mode` is `local`, `attachments` is `git` or `lfs`. Any other value (`mode: remote` included) and any other key under `storage:` is refused with `CONFIG_INVALID`, reason `STORAGE`, and the field names the key.
40
25
 
41
- ```
42
- canon.yaml TierPolicy: `git` is a BACKEND name, not a rung — canon.yaml's
43
- `routing`/`aging`/`tiers` keys now name a capability rung
44
- (local/hot/cold); declare the backend separately via
45
- `tiers.<rung>.backend: git`
46
- ```
26
+ ## An old canon.yaml is refused, and `canon migrate` fixes it
47
27
 
48
- ## Routing a record kind
28
+ The keys `tiers:`, `routing:`, `aging:` and `artifact_store:` are gone. A command that opens the record store and finds one of them exits `2` with `CONFIG_INVALID`, reason `STORAGE`, the field naming the key, and writes nothing. `canon migrate`, `canon format`, `canon brief check` and `canon schema` do not open the store and do not refuse. Run the preview, then commit it:
49
29
 
50
- `routing:` is the only place a kind's rung is decided. Keys are the
51
- stable snake_case kind wire strings (`change`, `evidence`,
52
- `strategy_item`, …) — the same string the record's own `kind` field
53
- serializes to. Values are `local`/`hot`/`cold`.
54
-
55
- ```yaml
56
- routing:
57
- scenario: local # change this to move FUTURE `scenario` writes
30
+ ```bash
31
+ canon migrate
32
+ canon migrate --commit --plan-digest "$PLAN_DIGEST"
58
33
  ```
59
34
 
60
- Changing a routing value moves future writes only; re-run reads
61
- resolve the policy live. An unknown kind or rung name is a loud config
62
- parse error. Every record kind needs a `routing:` entry — an unrouted
63
- kind fails hard at its first write/query, never silently dropped.
64
-
65
- ## Aging a kind to another rung
66
-
67
- `aging:` moves records from their routed rung to a `to:` rung once
68
- their age exceeds `after:`:
35
+ The commit removes the four blocks and the comment right above each, writes `storage:` where `tiers:` was (at the end of the file when there was none) and keeps every other byte of `canon.yaml`. `--revert` restores the file from `.canon/migrate-backup/`. A second run finds nothing to do. Migrate moves no file: `.canon/hot.db` and `.canon/ledger` stay where they are.
69
36
 
70
- ```yaml
71
- aging:
72
- handoff: { after: 30d, to: cold } # <n>d/h/m/s — one integer, one unit
73
- ```
37
+ Migrate reads the old values and does this with them:
74
38
 
75
- `canon tier age` applies every `aging:` rule once. It is
76
- content-digest idempotent: re-running finds nothing left to move
77
- (`moved == 0`); a partial run (destination written, source not deleted)
78
- re-selects the record but the destination write is a no-op. A kind
79
- split across two rungs (some aged, some not) still reads correctly —
80
- `canon query` fans out.
39
+ | old setting | migrate |
40
+ | --- | --- |
41
+ | `tiers.hot` on postgres, `tiers.cold` on s3, or a `routing` or `aging` entry that points at either | applies, and the preview warns `STORAGE_ROWS_NOT_CARRIED` naming the schema, the bucket or the entry. canon reads no Postgres rows and no S3 objects: they stay where they are, and `.canon/hot.db` starts empty |
42
+ | `tiers.local.root` other than `.canon/ledger`, or `tiers.hot.path` other than `.canon/hot.db` | refuses (exit `2`, `CONFIG_INVALID`/`STORAGE`, the field is the key). Move the directory to the default place and run again |
43
+ | a `routing` or `aging` entry that sends a ledger kind to a local place other than its own (`evidence: hot` on sqlite, `task: local`) | refuses, the field is the entry. The rows are local, and removing the entry would hide them |
44
+ | `routing.trajectory`, `aging.trajectory` | removed without a warning |
45
+ | `artifact_store` on an object store | refuses: the bytes the gate reads are not on disk. Download them into `.canon/artifacts/sha256/` first (the CHANGELOG has the steps) |
46
+ | `artifact_store: { backend: local }`, or no `artifact_store` | applies |
81
47
 
82
- **Done when:** after `canon tier age --commit --plan-digest <digest from the
83
- preview>`, a bare `canon tier age` previews no effect (`moved` is `0`).
48
+ ## Reading records
84
49
 
85
- ## Running `canon tier age` / `canon query`
86
-
87
- Both read the `canon.yaml` of `--repo <dir>` (default: the nearest ancestor
88
- directory holding one).
50
+ `canon query --kind <kind>` opens only the store of that kind. A damaged `.canon/hot.db` stops `--kind task`, `--kind handoff` and `--kind run` and leaves every ledger kind readable. A `.canon/hot.db` that does not exist yet reads as empty, and a read does not create it.
89
51
 
90
52
  ```bash
91
- # Preview what would move (the bare run is read-only; writes/deletes nothing).
92
- canon tier age
93
-
94
- # Apply every `aging:` rule once (the destructive move+delete), with the
95
- # `planDigest` the preview printed.
96
- canon tier age --commit --plan-digest "$PLAN_DIGEST"
97
-
98
- # Read a kind, fanning out across its routed rung AND its aging
99
- # destination, merged by time. --kind is the kind wire string — the
100
- # same vocabulary as routing:/aging: (`change`, `handoff`, …).
53
+ # Read a kind. --kind is the kind wire string (`change`, `handoff`, …):
54
+ # the stable snake_case name the record's own `kind` field holds.
101
55
  canon query --kind handoff --since 2026-06-01T00:00:00Z
102
56
 
103
57
  # Machine-readable output instead of the human table.
@@ -114,7 +68,7 @@ canon query --kind trajectory --json --limit 50 --fields at,kind --cursor <nextC
114
68
 
115
69
  ## The ledger is latest-only; the archive holds history
116
70
 
117
- The `local` rung's directory (`.canon/ledger`) holds the current record of
71
+ The directory `.canon/ledger` holds the current record of
118
72
  each key. Appending a newer version (evidence for a scenario and role, a
119
73
  closed finding, a rewritten scenario, a subject's next status) moves the
120
74
  versions it supersedes to `.canon/archive`: same `kind=<kind>/…` layout and
@@ -131,9 +85,7 @@ canon ledger compact --commit --plan-digest "$PLAN_DIGEST"
131
85
  ```
132
86
 
133
87
  A crash between the write and the move leaves a readable ledger that the next
134
- append or `canon ledger compact` finishes. The archive is local, not routed
135
- through `tiers:`; a `tiers.local.root` whose directory is not named `ledger`
136
- has no archive and keeps every version.
88
+ append or `canon ledger compact` finishes.
137
89
 
138
90
  **Done when:** after `canon ledger compact --commit --plan-digest <digest
139
91
  from the preview>`, a bare `canon ledger compact` previews no effect.
@@ -155,31 +107,18 @@ is `evidence` everywhere (the 0.29 spelling `evidence_record` is gone). A
155
107
  then `canon migrate --commit --plan-digest <digest>`, moves it. Full rule:
156
108
  `docs/design/ledger-layout.md`.
157
109
 
158
- ## Where artifact bytes live (`artifact_store:`)
110
+ ## Where artifact bytes live (`attachments:`)
159
111
 
160
- ```yaml
161
- artifact_store: { backend: local } # default
162
- # artifact_store: { backend: cold, prefix: artifacts/ } # an `s3` tier of `tiers:`
163
- ```
112
+ Evidence attachment bytes are plain files at `.canon/artifacts/sha256/<digest>`, tracked by git. The digest is the sha256 of the bytes. A `<digest>.zst` in that directory is no blob: the store reads the digest as missing, `canon artifacts verify` skips it and `canon artifacts prune` does not delete it. The gate and `canon artifacts verify [--full]` read these files; `--full` hashes the bytes again.
164
113
 
165
- `local` is `.canon/artifacts/sha256/`, git-tracked and credential-free. An
166
- object-store tier gets `evidence add`, `review scenario` and `artifacts store`
167
- uploads under `<prefix>sha256/<digest>.zst` and keeps nothing locally. The
168
- `.zst` object is one zstd frame (level 19) of the bound bytes; the digest is
169
- the sha256 of the bytes before compression, so a record's digest means what
170
- it always did. To read a blob without canon, download it and run
171
- `zstd -d <digest>.zst` (`zstd -t` checks it). An object an older canon wrote
172
- at `<prefix>sha256/<digest>` (plain bytes) stays valid: the gate, `verify`,
173
- `move` and `prune` read both names; canon writes only `.zst`. A canon 0.39 or
174
- older reads a `.zst` blob as missing, so upgrade every canon that reads the
175
- tier before the first `.zst` is written. The local `.canon/artifacts/sha256/`
176
- is never compressed (git's own delta compression works on plain blobs). The
177
- gate and `canon artifacts verify [--full]` ask the store and refuse, never
178
- pass, when it cannot be reached. `canon artifacts move --tier <tier>` (a preview; `--commit --plan-digest <digest>` acts)
179
- uploads, reads back and verifies every local blob, then writes the
180
- `artifact_store:` block, removes the local copies and ignores
181
- `.canon/artifacts/`; commit the removals, `.gitignore` and `canon.yaml`. It is
182
- resumable and a second run finds nothing to do.
114
+ `attachments: git` (the default) leaves the files to git. `attachments: lfs` stores them with git LFS. canon does not speak the LFS protocol: it writes the real bytes to the same path, and git's LFS filter turns them into a pointer on `git add`. canon adds four things:
115
+
116
+ - **The filter file comes first.** Before it writes bytes, canon writes `.canon/artifacts/.gitattributes` with the line `sha256/* filter=lfs diff=lfs merge=lfs -text` when that line is missing. `canon migrate` adds the line too. `canon init --check` fails when it is missing and names `canon migrate` as the fix.
117
+ - **No git-lfs, no write.** `evidence add`, `review scenario --artifact` and `artifacts store` write bytes only when `git lfs version` succeeds and `git config filter.lfs.clean` has a value. Otherwise they exit `2` with `ARTIFACTS_STORE_REQUIRED` and write nothing, so no bytes reach git as plain text. Install git-lfs and run `git lfs install`.
118
+ - **A pointer is bytes not received.** A blob file of 1 KiB or less that starts with `version https://git-lfs.github.com/spec/v1` and whose `oid sha256:` is the blob's own digest is an LFS pointer. `canon artifacts verify` reports it with the state `lfs_pointer` (exit `1`) and `canon gate check` counts the attachment as a violation. Run `git lfs pull`.
119
+ - **Reads need no git-lfs.** `gate check`, `artifacts verify` and `query` run without it.
120
+
121
+ A blob already committed as plain bytes stays plain. `git add --renormalize` and `git lfs migrate` are your git commands, not canon's.
183
122
 
184
123
  The store only grows: a report written anew on every run adds a blob per run.
185
124
  `canon artifacts prune [--keep-days N]` (a preview; `--commit --plan-digest
@@ -189,9 +128,7 @@ evidence per task and per `(project_id, scenario_id)` binds it, what the gate an
189
128
  `artifacts verify` read), `current-review` (a review still in effect binds it),
190
129
  `staged` (a record not promoted yet binds it) and `within-keep-days` (with
191
130
  `--keep-days N`, evidence or a review of the last `N` days, in the ledger or its
192
- archive, binds it). Everything else in the configured store goes: the local
193
- directory, or the objects of the tier `artifact_store:` names by the same rule
194
- (a copy left in the local directory of such a repo is judged by it too). The
131
+ archive, binds it). Everything else in `.canon/artifacts/sha256/` goes. The
195
132
  preview counts the blobs and bytes that go and stay, lists the blobs to delete
196
133
  a page at a time (`--limit`, `--cursor`, `--all`) and offers no `--commit` when
197
134
  there is nothing to delete. The plan digest covers the blobs to delete, the
@@ -199,13 +136,11 @@ blobs to keep with their reasons and every record read, so evidence added since
199
136
  the preview is `PLAN_STALE` and nothing is deleted. A repo whose records,
200
137
  staging area or archive cannot be read in full is refused: a blob is never
201
138
  deleted on a guess. After a prune, `artifacts verify` and `gate check` answer as
202
- they did. A deleted local blob leaves the working tree: commit the removal. It
139
+ they did. A deleted blob leaves the working tree: commit the removal. It
203
140
  stays in git history, and shrinking that history is the repo owner's call, not
204
- the command's. A deleted object of a tier cannot be undone, and the preview says
205
- so with the object count. A delete that fails stops the run: with nothing deleted yet
206
- it is `ARTIFACTS_STORE_FAILED` (an object) or `WRITE_FAILED` (a local file); after
207
- some, `ARTIFACTS_PRUNE_INCOMPLETE` names what was deleted, and a new preview
208
- lists what remains.
141
+ the command's. A delete that fails stops the run: with nothing deleted yet it is
142
+ `WRITE_FAILED`; after some, `ARTIFACTS_PRUNE_INCOMPLETE` names what was deleted,
143
+ and a new preview lists what remains.
209
144
 
210
145
  A blob write stages `.canon/artifacts/sha256/.tmp-<sha256>-<pid>-<nanos>` and
211
146
  renames it when it is complete; a write killed in between (SIGKILL, a power
@@ -227,23 +162,15 @@ file is no finished blob, so deleting it changes no record. One that was
227
162
  already committed is a tracked file: take it out of the commit (`git rm`, then
228
163
  commit); the preview's `staleTemps.gitNote` says so.
229
164
 
230
- ## What `canon report build` does and doesn't read
165
+ ## What `canon report build` reads
231
166
 
232
167
  canon exposes layered `stg_`/`int_`/`mart_` query views; `canon report build`
233
- builds its numbers from the `mart_` views. Those read ONLY local roots
234
- — the git ledger, the sqlite `hot` db file (local, no credential; read
235
- since 0.18) and a LOCAL `.canon/r2` parquet mirror. `canon report build`
236
- never opens a live DB connection or the live bucket, so:
237
-
238
- - Kinds routed to a postgres `hot` rung do NOT appear in `canon report
239
- build`; kinds routed to `canon init`'s default sqlite `hot` rung do.
240
- - Kinds routed to `cold` (s3) appear only if a local `.canon/r2` mirror
241
- has been separately materialized — there is no automatic sync.
242
-
243
- These kinds are not lost: read them with `canon query --kind <kind>`.
244
- The gap is named loud, not under-counted — when any routed kind isn't
245
- report-readable, `canon report build` renders a `## Kinds not read directly`
246
- section listing them and emits a matching stderr `WARN`.
168
+ builds its numbers from the `mart_` views. They read every record directly: the
169
+ ledger (`source_tier` `git`), `.canon/hot.db` (`source_tier` `hot`) and the
170
+ learn parquet under `.canon/learn/`. A record held by both the ledger and
171
+ `.canon/hot.db` is counted once. A `.canon/hot.db` that does not exist reads as
172
+ no rows and is not created; one that is no database fails the report, exit `1`,
173
+ naming the path. `canon report build` opens no network connection.
247
174
 
248
175
  ## Retention, export, and access audit
249
176
 
@@ -254,24 +181,20 @@ the plan recomputed now has the same digest (`PLAN_STALE`, exit 2, when the
254
181
  data moved). The only purgeable kinds are
255
182
  `run` and `trajectory`, plus the retired `session` and `event` (kept for this
256
183
  release only so stored rows can be deleted — delete them now, after the next
257
- release only direct database access remains; they read no routing, so they
258
- find rows in every configured tier even after `canon migrate` removes the
259
- `routing:`/`aging:` keys); the cutoff applies to every
260
- routed rung and every configured aging destination, including retained
261
- historical versions. For `trajectory`, the command also purges the
262
- operator-local Parquet learn store under `learn.root` in `canon.yaml`;
263
- an unavailable configured learn root is an explicit error, never a
264
- successful zero-row purge. The operation is idempotent. Apply mode
265
- preflights all attached destinations before the first delete, but storage
266
- backends are not one transaction: a failure after a prior delete returns
267
- an explicit `partial` result with matched/deleted counts and a nonzero
268
- status. Purge never rewrites Git history or deletes source transcript
269
- files. A tier that `canon.yaml` declares but that cannot attach (its bucket
270
- variable or DSN is unset) stops a commit, `RETENTION_TIERS_REQUIRED`, before
271
- anything is deleted; the preview of such a repository says so: it lists the
272
- removal set and the tier under `unavailable`, and its first `meta.next` step names
273
- the tier and what to set instead of a `--commit` command. Set the value and run
274
- the preview again to get the commit command.
184
+ release only direct database access remains). The cutoff applies to the ledger,
185
+ `.canon/hot.db` and the retained historical versions in the archive; a retired
186
+ kind reads no setting, so it finds its rows in both stores. For `trajectory`,
187
+ the command also purges the operator-local Parquet learn store under
188
+ `learn.root` in `canon.yaml`; an unavailable configured learn root is an
189
+ explicit error, never a successful zero-row purge, and a learn file that is no
190
+ Parquet file is `RETENTION_STORE_CORRUPT` (exit `2`, not retryable), which
191
+ stops `export --kind trajectory` too. The operation is idempotent. Apply mode
192
+ preflights both stores before the first delete, but the ledger and
193
+ `.canon/hot.db` are not one transaction: a failure after a prior delete returns
194
+ an explicit `partial` result with matched/deleted counts and a nonzero status.
195
+ `data.stores` lists one entry per store (`store` is `ledger` or `hot`,
196
+ `matched`, `deleted`). Purge never rewrites Git history or deletes source
197
+ transcript files.
275
198
 
276
199
  **Done when:** after `canon purge --kind <kind> --before <time> --commit
277
200
  --plan-digest <digest from the preview>`, a bare `canon purge` with the same
@@ -286,8 +209,7 @@ answers with what it would write and writes nothing.
286
209
 
287
210
  `canon export --kind <kind> [--before <RFC3339 date or date-time>] [--after <RFC3339 date or date-time>]
288
211
  [--output <file>] [--json] [--limit <n> | --all] [--cursor <c>]` emits a versioned manifest containing source scope,
289
- counts, digests, and redacted metadata. It does not authorize backend access;
290
- credentials remain an operator prerequisite. New output files are mode
212
+ counts, digests, and redacted metadata. New output files are mode
291
213
  `0600`. Raw event detail text is excluded unless `--include-sensitive` is
292
214
  passed and `.canon/policy.yaml` explicitly contains:
293
215
 
@@ -444,8 +366,8 @@ retry (the command exits `2` and writes no record).
444
366
 
445
367
  ## The repository write lock
446
368
 
447
- A committed destructive command (`canon purge`, `canon tier age`, `canon ledger
448
- compact`, `canon artifacts move`, `canon artifacts prune`, `canon migrate`) recomputes its plan, checks
369
+ A committed destructive command (`canon purge`, `canon ledger compact`,
370
+ `canon artifacts prune`, `canon migrate`) recomputes its plan, checks
449
371
  its digest and then makes the effects, and nothing may change the plan in
450
372
  between. It holds an OS file lock on `.canon/repo-write.lock` for the whole
451
373
  span, from before it recomputes the plan to after its last effect; a preview
@@ -467,7 +389,7 @@ call that needs the lock makes the file, in any repository.
467
389
  A fresh `canon init` writes these lines to `.gitignore` (each under a
468
390
  comment, only the missing ones):
469
391
 
470
- - `.canon/hot.db*` — the sqlite hot tier and its WAL/SHM sidecars.
392
+ - `.canon/hot.db*` — the sqlite hot database and its WAL/SHM sidecars.
471
393
  - `.canon/audit/` — the query/export/purge access log.
472
394
  - `.canon/ledger/kind=scenario/` — the scenario index; every reader
473
395
  rebuilds it.
@@ -480,8 +402,7 @@ comment, only the missing ones):
480
402
  every writer of what its plan reads hold.
481
403
  - `.canon/dashboard-snapshot/` — the snapshot `canon dashboard`
482
404
  regenerates on every run.
483
- - `.canon/learn/` and `.canon/r2/` — local learn scratch and the local
484
- object-store stand-in `canon report build` writes.
405
+ - `.canon/learn/` — local learn scratch.
485
406
 
486
407
  A rerun on a repo that already has `canon.yaml` only refreshes
487
408
  `AGENTS.md`; `canon migrate` adds the lines an existing `.gitignore`
@@ -464,9 +464,7 @@ closed again (`CLOSED`) and a change that is not deferred cannot be reopened
464
464
  <change>` on a closed change are refused (reason `CLOSED`).
465
465
 
466
466
  A closed change drops out of the requirements: the subject no longer answers
467
- for it and the scenarios only closed changes made are not asked for. A repo
468
- whose `canon.yaml` has no `change_state` line under `routing:` refuses the
469
- three leaves with `CONFIG_INVALID`; `canon migrate` adds the line.
467
+ for it and the scenarios only closed changes made are not asked for.
470
468
 
471
469
  - `canon status --json`: `data.subjects[].setAsideChanges` (each `change`,
472
470
  `state`, `reason`, `refs`, `approver`, `at`) and `setAsideScenarios` (each
@@ -773,11 +771,6 @@ uses, so status and the gate cannot disagree about a gap:
773
771
 
774
772
  Status fails closed rather than suggest progress the gate would refuse:
775
773
 
776
- - When `scenario`, `subject`, `review` or `finding` routes away from the
777
- `local` rung (the only rung status and the gate read), its records
778
- would read as empty. The only `next:` step is
779
- `canon init --check`, with the reason naming the
780
- `routing.<kind>: local` setting to restore.
781
774
  - When `spec_coverage` is present but unusable, `canon gate check`
782
775
  refuses. The first `next:` step is `canon gate check`, with the reason
783
776
  naming the section to fix, and no subject is suggested to move to its
@@ -155,7 +155,7 @@ usage: canon inventory sync [--spec-root <DIR>] [--dry-run] [--input]
155
155
  canon inventory sync --json
156
156
  ```
157
157
  ```text
158
- # Read stored records across every storage tier
158
+ # Read stored records
159
159
  usage: canon query --kind <change|task|scenario|run|handoff|review|divergence|trajectory|strategy_item|evidence|subject|finding|change_state> [--since <TIMESTAMP>] [--plugin <PLUGIN_ID> | --history] [--change <CHANGE_ID>] [--status <STATUS>] [--domain <NAME>] [--include-sensitive] [--limit <N> | --all] [--cursor <CURSOR>] [--fields <FIELDS>]
160
160
  ```
161
161
  ```bash
@@ -300,14 +300,12 @@ canon evidence add --input '[{"scenario":"auth.login.01","class":"test-run","ref
300
300
  A record binds exactly what its own write names (`--report`,
301
301
  `--artifact`): nothing is carried forward from an earlier record, so name
302
302
  every file the record should prove again. canon stores the bytes by digest
303
- in the artifact store (by default `.canon/artifacts/sha256/`, committed
304
- with the ledger; an object store when `canon.yaml`'s `artifact_store:` block
305
- names one, in which case nothing is kept locally) and `canon gate check`
303
+ in `.canon/artifacts/sha256/` (committed with the ledger; with
304
+ `storage.attachments: lfs` through git LFS, and the write is refused with
305
+ `ARTIFACTS_STORE_REQUIRED` when git-lfs is missing) and `canon gate check`
306
306
  re-checks them, so the working-tree report may be gitignored. Run
307
- `canon artifacts verify` to ask the store yourself; it refuses, never
308
- passes, when an object store cannot be reached. Moving an existing store
309
- (`canon artifacts move --tier`) and deleting the blobs no record binds
310
- (`canon artifacts prune`) are the repo owner's call: do not run them.
307
+ `canon artifacts verify` to check the store yourself. Deleting the blobs no
308
+ record binds (`canon artifacts prune`) is the repo owner's call: do not run it.
311
309
  For a scenario about what users see, let the test report carry its
312
310
  screenshots: Playwright's JUnit reporter attaches, per test case, what a
313
311
  test attaches (`testInfo.attach(name, {path})`, or `screenshot: 'on'`), and