@journeykit/canon 0.46.0 → 0.48.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.
- package/dist/skills/SKILL.src.md +15 -18
- package/dist/skills/reference/canon-gate.md +31 -28
- package/dist/skills/reference/canon-inventory.md +1 -1
- package/dist/skills/reference/canon-plan-import.md +1 -1
- package/dist/skills/reference/canon-policy.md +1 -1
- package/dist/skills/reference/canon-report-dashboard.md +2 -6
- package/dist/skills/reference/canon-review.md +3 -3
- package/dist/skills/reference/canon-storage.md +76 -155
- package/dist/skills/reference/canon-subject.md +1 -8
- package/dist/skills/reference/role-implementer.md +13 -8
- package/dist/skills/reference/role-orchestrator.md +9 -27
- package/dist/skills/reference/role-planner.md +1 -4
- package/dist/skills/reference/role-reviewer.md +1 -1
- package/man/canon-adapter-authorize.1 +2 -2
- package/man/canon-adapter-validate.1 +2 -2
- package/man/canon-adapter.1 +2 -2
- package/man/canon-artifacts-prune.1 +4 -4
- package/man/canon-artifacts-store.1 +6 -4
- package/man/canon-artifacts-verify.1 +7 -7
- package/man/canon-artifacts.1 +5 -8
- package/man/canon-brief-approve.1 +2 -2
- package/man/canon-brief-check.1 +2 -2
- package/man/canon-brief-show.1 +2 -2
- package/man/canon-brief.1 +2 -2
- package/man/canon-change-defer.1 +3 -4
- package/man/canon-change-drop.1 +2 -2
- package/man/canon-change-new.1 +2 -2
- package/man/canon-change-reopen.1 +2 -2
- package/man/canon-change.1 +2 -2
- package/man/canon-completion.1 +2 -2
- package/man/canon-context-pack-add.1 +2 -2
- package/man/canon-context-pack-show.1 +2 -2
- package/man/canon-context-pack-verify.1 +2 -2
- package/man/canon-context-pack.1 +2 -2
- package/man/canon-context.1 +2 -2
- package/man/canon-dashboard.1 +2 -2
- package/man/canon-demo-init.1 +2 -2
- package/man/canon-demo-review.1 +2 -2
- package/man/canon-demo.1 +2 -2
- package/man/canon-dispatch-begin.1 +2 -2
- package/man/canon-dispatch-diff.1 +2 -2
- package/man/canon-dispatch-end.1 +2 -2
- package/man/canon-dispatch.1 +2 -2
- package/man/canon-divergence-accept.1 +2 -2
- package/man/canon-divergence-add.1 +2 -2
- package/man/canon-divergence-defer.1 +2 -2
- package/man/canon-divergence-list.1 +2 -2
- package/man/canon-divergence-resolve.1 +2 -2
- package/man/canon-divergence.1 +2 -2
- package/man/canon-evidence-add.1 +3 -3
- package/man/canon-evidence-approval-payload.1 +2 -2
- package/man/canon-evidence-audit.1 +2 -2
- package/man/canon-evidence.1 +2 -2
- package/man/canon-export.1 +2 -2
- package/man/canon-feature-new.1 +2 -2
- package/man/canon-feature.1 +2 -2
- package/man/canon-finding-add.1 +2 -2
- package/man/canon-finding-close.1 +2 -2
- package/man/canon-finding-list.1 +2 -2
- package/man/canon-finding.1 +2 -2
- package/man/canon-format.1 +2 -2
- package/man/canon-gate-check.1 +2 -2
- package/man/canon-gate-install-hooks.1 +2 -2
- package/man/canon-gate-promote.1 +2 -2
- package/man/canon-gate.1 +2 -2
- package/man/canon-ingest-plans.1 +2 -2
- package/man/canon-ingest-records.1 +2 -2
- package/man/canon-ingest.1 +2 -2
- package/man/canon-init.1 +2 -2
- package/man/canon-inventory-sync.1 +2 -2
- package/man/canon-inventory.1 +2 -2
- package/man/canon-ledger-compact.1 +2 -2
- package/man/canon-ledger.1 +2 -2
- package/man/canon-migrate.1 +3 -3
- package/man/canon-plugin-sync.1 +2 -2
- package/man/canon-plugin.1 +2 -2
- package/man/canon-policy-approve.1 +2 -2
- package/man/canon-policy-show.1 +2 -2
- package/man/canon-policy.1 +2 -2
- package/man/canon-prompt-add.1 +2 -2
- package/man/canon-prompt-show.1 +2 -2
- package/man/canon-prompt.1 +2 -2
- package/man/canon-purge.1 +2 -2
- package/man/canon-query.1 +4 -4
- package/man/canon-regime-show.1 +2 -2
- package/man/canon-regime.1 +2 -2
- package/man/canon-report-build.1 +2 -2
- package/man/canon-report-check.1 +2 -2
- package/man/canon-report-snapshot.1 +2 -2
- package/man/canon-report.1 +2 -2
- package/man/canon-retrieve.1 +2 -2
- package/man/canon-review-brief.1 +2 -2
- package/man/canon-review-change.1 +2 -2
- package/man/canon-review-scenario.1 +2 -2
- package/man/canon-review.1 +2 -2
- package/man/canon-scenario-new.1 +2 -2
- package/man/canon-scenario.1 +2 -2
- package/man/canon-schema.1 +2 -2
- package/man/canon-search.1 +2 -2
- package/man/canon-selftest.1 +2 -2
- package/man/canon-skills-check.1 +2 -2
- package/man/canon-skills-doctor.1 +2 -2
- package/man/canon-skills-install.1 +2 -2
- package/man/canon-skills-show.1 +2 -2
- package/man/canon-skills.1 +2 -2
- package/man/canon-status.1 +2 -2
- package/man/canon-strategy-approval-payload.1 +2 -2
- package/man/canon-strategy-promote.1 +2 -2
- package/man/canon-strategy-rollback.1 +2 -2
- package/man/canon-strategy.1 +2 -2
- package/man/canon-subject-adopt.1 +2 -2
- package/man/canon-subject-move.1 +2 -2
- package/man/canon-subject-new.1 +2 -2
- package/man/canon-subject-show.1 +2 -2
- package/man/canon-subject-unadopt.1 +2 -2
- package/man/canon-subject.1 +2 -2
- package/man/canon-task-done.1 +2 -2
- package/man/canon-task.1 +2 -2
- package/man/canon-trace.1 +2 -2
- package/man/canon.1 +4 -7
- package/package.json +5 -5
- package/man/canon-artifacts-move.1 +0 -63
- package/man/canon-tier-age.1 +0 -50
- package/man/canon-tier.1 +0 -39
package/dist/skills/SKILL.src.md
CHANGED
|
@@ -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
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
`canon artifacts verify` (`--full` re-hashes every blob)
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
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
|
|
185
|
-
history (shrinking that history is the repo owner's call, not the command's)
|
|
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
|
|
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
|
|
362
|
-
`canon
|
|
363
|
-
|
|
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` |
|
|
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
|
-
|
|
213
|
-
`uncovered-cell` on the subject `spec_coverage`:
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
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
|
|
@@ -573,10 +568,20 @@ refused (`EVIDENCE_ARGUMENT_CONFLICT`). A report attachment that is missing,
|
|
|
573
568
|
outside the repo or oversized is refused (`EVIDENCE_BINDING_NOT_FOUND`,
|
|
574
569
|
`EVIDENCE_BINDING_DENIED`, `EVIDENCE_BINDING_INVALID`).
|
|
575
570
|
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
scenario
|
|
579
|
-
|
|
571
|
+
A claimed `faithful` verdict over a failed case or a fabrication marker in
|
|
572
|
+
`--summary` refuses the whole batch, and nothing is written. A brief is
|
|
573
|
+
judged per scenario, as a single add judges it: a scenario whose own brief
|
|
574
|
+
is not approved (`BRIEF_APPROVAL_REQUIRED`), changed after its approval
|
|
575
|
+
(`BRIEF_APPROVAL_STALE`) or in the 0.30 format (`BRIEF_MIGRATION_REQUIRED`,
|
|
576
|
+
which `--override-reason` does not waive) is skipped, and the others are
|
|
577
|
+
recorded. The batch exits 0, `data.briefSkipped[]` lists each skipped
|
|
578
|
+
scenario with its briefs (`change`, `subject`, `code`) and each one has a
|
|
579
|
+
`BRIEF_SCENARIO_SKIPPED` warning; `canon gate check` still counts it as
|
|
580
|
+
without evidence. When every scenario is skipped the batch is refused with
|
|
581
|
+
the code of the most urgent reason and writes nothing; run the same batch
|
|
582
|
+
again once the human has answered the brief. `canon status` shows how many
|
|
583
|
+
scenarios a brief holds (`heldScenarios`). Each record binds only what the
|
|
584
|
+
batch names (nothing is carried forward).
|
|
580
585
|
`--scenario`, `--task`,
|
|
581
586
|
`--report-case`, `canon evidence audit` and the approval flags name one subject
|
|
582
587
|
and are refused with `--all-scenarios`.
|
|
@@ -730,21 +735,19 @@ again. The directory is tracked in git (`canon init` never ignores it):
|
|
|
730
735
|
commit it with the ledger. A file larger than 25 MiB is refused (exit 2);
|
|
731
736
|
raise the limit with `--max-artifact-mib <N>`.
|
|
732
737
|
|
|
733
|
-
Where those bytes live is `canon.yaml`'s `
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
`
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
`
|
|
741
|
-
|
|
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;
|
|
738
|
+
Where those bytes live is `canon.yaml`'s `storage.attachments`: `git` (the
|
|
739
|
+
default) keeps the directory above git-tracked, `lfs` has git LFS store the
|
|
740
|
+
blobs. With `lfs`, `evidence add`, `review scenario --artifact` and `artifacts
|
|
741
|
+
store` write bytes only when git-lfs is installed and exit 2 with
|
|
742
|
+
`ARTIFACTS_STORE_REQUIRED` otherwise. `canon gate check` and `canon artifacts
|
|
743
|
+
verify [--full]` read the directory (`--full` re-hashes every blob). A blob file
|
|
744
|
+
that is an LFS pointer is bytes not received: `artifacts verify` reports it as
|
|
745
|
+
`lfs_pointer` and the gate counts the attachment as a violation; run `git lfs
|
|
746
|
+
pull`. `canon artifacts prune` (a preview;
|
|
744
747
|
`--commit --plan-digest` acts) deletes the blobs no record binds any more and
|
|
745
748
|
leaves what `gate check` and `artifacts verify` read, so their answers do not
|
|
746
749
|
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
|
|
750
|
+
`artifacts verify` counts without deleting); it is the repo owner's decision. See `canon-storage`.
|
|
748
751
|
|
|
749
752
|
`canon gate check` re-checks every file bound to a LATEST evidence record
|
|
750
753
|
(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
|
|
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` (
|
|
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,
|
|
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
|
-
|
|
48
|
-
|
|
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
|
|
253
|
-
|
|
254
|
-
|
|
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
|
|
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
|
-
|
|
6
|
-
- `hot` — live-queryable state (sqlite or postgres).
|
|
7
|
-
- `cold` — bulk archive (s3).
|
|
5
|
+
## Where each record lives
|
|
8
6
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
32
|
-
|
|
33
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
51
|
-
|
|
52
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
`
|
|
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
|
-
|
|
83
|
-
preview>`, a bare `canon tier age` previews no effect (`moved` is `0`).
|
|
48
|
+
## Reading records
|
|
84
49
|
|
|
85
|
-
|
|
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
|
-
#
|
|
92
|
-
|
|
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
|
|
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.
|
|
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 (`
|
|
110
|
+
## Where artifact bytes live (`attachments:`)
|
|
159
111
|
|
|
160
|
-
|
|
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
|
-
`
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
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
|
|
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
|
|
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
|
|
205
|
-
|
|
206
|
-
|
|
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`
|
|
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.
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
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
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
preflights
|
|
266
|
-
|
|
267
|
-
an explicit `partial` result with matched/deleted counts and a nonzero
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
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.
|
|
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
|
|
448
|
-
|
|
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
|
|
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/`
|
|
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.
|
|
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
|