@erclx/canon 4.72.1 → 4.74.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 (42) hide show
  1. package/claude/.claude-plugin/plugin.json +1 -1
  2. package/claude/skills/plan-feature/SKILL.md +2 -2
  3. package/claude/skills/plan-groundwork/SKILL.md +6 -5
  4. package/claude/skills/plan-intake/SKILL.md +1 -1
  5. package/claude/skills/role-orchestrator/references/orchestrator-dispatch.md +1 -0
  6. package/claude/skills/role-orchestrator/references/orchestrator-parked.md +2 -1
  7. package/claude/skills/session-relay/REQUIREMENT.md +2 -0
  8. package/claude/skills/session-relay/SKILL.md +1 -0
  9. package/claude/skills/task-board/SKILL.md +37 -3
  10. package/docs/agents/commands.md +1 -0
  11. package/docs/agents/index.md +1 -1
  12. package/docs/agents/install-and-sync.md +10 -6
  13. package/docs/agents/records.md +29 -9
  14. package/docs/agents/tasks.md +2 -0
  15. package/docs/target-projects.md +5 -1
  16. package/governance/rules/core/091-channel.md +13 -0
  17. package/package.json +1 -1
  18. package/src/claude/skills-reach.ts +13 -3
  19. package/src/commands/context.ts +7 -4
  20. package/src/commands/design.ts +6 -1
  21. package/src/commands/records.ts +138 -0
  22. package/src/commands/transcripts.ts +20 -3
  23. package/src/context/architecture.ts +15 -8
  24. package/src/context/citations.ts +31 -6
  25. package/src/context/folders.ts +27 -8
  26. package/src/gate/measures.ts +17 -8
  27. package/src/init/plan.ts +8 -1
  28. package/src/init/steps.ts +17 -0
  29. package/src/intake/folder.ts +1 -1
  30. package/src/migrate/records.ts +11 -3
  31. package/src/records/backup.ts +110 -38
  32. package/src/records/ordinal.ts +243 -0
  33. package/src/records/validate.ts +28 -0
  34. package/src/surface-root.ts +101 -0
  35. package/src/sync/stamp.ts +20 -5
  36. package/src/tasks/answers.ts +10 -1
  37. package/src/transcripts/fetch.ts +31 -1
  38. package/standards/groundwork.md +1 -1
  39. package/standards/intake.md +1 -1
  40. package/standards/plan.md +1 -0
  41. package/tooling/base/configs/.husky/post-merge +27 -0
  42. package/tooling/claude/seeds/.claude/hooks/tasks-index.sh +5 -4
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "canon",
3
3
  "description": "Automated governance, versioning, and discovery tools for Claude Code.",
4
- "version": "4.72.1",
4
+ "version": "4.74.0",
5
5
  "author": {
6
6
  "name": "Eric Le",
7
7
  "url": "https://github.com/erclx"
@@ -52,8 +52,8 @@ What this skill adds on top of the standard:
52
52
 
53
53
  A plan sequencing its work into batches declares where one pull request ends, here rather than at ship time. A dependency chain cannot be split once it is built, so the choice exists only while the batches are still a plan.
54
54
 
55
- - One batch is one pull request. Carry one entry per batch naming what it targets, so a plan opening five says five before the first line is written.
56
- - A dependent batch stacks rather than merging into its neighbor. The batches are built in order and depend on each other in that order, which is what a stack expresses, so the dependency argues for stacking and never for collapsing two batches into one review.
55
+ - One batch is one pull request, and one pull request is one plan file, named for its own concern rather than a numeric suffix. `canon tasks plan-branch` derives one branch from one plan filename, so a `**Batch N**` sub-heading inside one file's `**Files to touch:**` shares that one branch across every batch, and the batch that merges first strands every batch behind it with nothing left to open a pull request against. Write a plan opening five batches as five files before the first line of any of them.
56
+ - State a dependent batch's dependency on the ones before it in its own `**Constraints:**`, naming the earlier batch's slug and stacking rather than merging into it. The batches are built in order and depend on each other in that order, which is what a stack expresses, so the dependency argues for stacking and never for collapsing two batches into one file or one review.
57
57
  - Mark each batch dependent or independent by comparing the file sets rather than the descriptions. A batch sharing no file with another is independent and earns its own branch even where both arrived in one request. One run measured at 68 files carried three such batches into a single review because nothing drew the boundary.
58
58
  - Sequence a sweep last. A batch deliberately rewriting files earlier batches touched is coherent as the final one and forces every batch behind it into one review anywhere else.
59
59
  - Keep each batch's commits contiguous once the work starts. A later fix to an earlier batch belongs on that batch's own commits, since a batch interrupted by another cannot be lifted onto its own branch afterward.
@@ -46,11 +46,12 @@ List `.canon/groundwork/` from the project root and match the topic against the
46
46
 
47
47
  Never match against `.claude/` itself. That directory holds every other workflow surface, so a topic matched there lands on a folder that was never a track.
48
48
 
49
- With no match, derive a kebab-case slug named for the subject rather than the activity. Prefer `ts-migration` over `migration-research`. Also list `.canon/intake/` and take `<nn>` as the highest ordinal present across both listings, incremented, per `${CLAUDE_SKILL_DIR}/../../standards/groundwork.md`. Then route on `.canon/groundwork/<nn>-<slug>/`:
49
+ With no match, derive a kebab-case slug named for the subject rather than the activity. Prefer `ts-migration` over `migration-research`. That is open mode outright: no folder can carry a slug nothing matched yet, so there is nothing to route on. `<nn>` for it is claimed in Open mode Step 1 rather than here, since the qualifying test below has to run before the folder exists.
50
50
 
51
- - Folder absent: open
52
- - Folder present without `06-decision.md`: resume
53
- - Present folder the user judges ready: close
51
+ A matched folder instead routes on its own `<nn>-<slug>/`:
52
+
53
+ - Present without `06-decision.md`: resume
54
+ - Present and the user judges it ready: close
54
55
 
55
56
  Detect the mode from the folder. Do not ask which one to run.
56
57
 
@@ -73,7 +74,7 @@ The standard sets the open question format and requires it inside a topic file a
73
74
 
74
75
  ## Open mode
75
76
 
76
- 1. Create `.canon/groundwork/<nn>-<slug>/`, with `<nn>` and `<slug>` as derived in Step 1.
77
+ 1. Claim the ordinal and create the folder in one act with `canon records ordinal groundwork <slug> --claim`, per `${CLAUDE_SKILL_DIR}/../../standards/groundwork.md`. Where the installed binary carries no such subcommand, fall back to listing both `.canon/groundwork/` and `.canon/intake/` and creating `.canon/groundwork/<nn>-<slug>/` at the highest ordinal present across the two, incremented.
77
78
  2. Write `README.md` first. Writing it first forces the question of what the track is for.
78
79
  3. Write `01-current-state.md` by measuring now. Never carry a figure from a previous session or from recall without re-measuring it. Measure only what an open question in the folder needs. A number with no question attached is how groundwork turns into the work.
79
80
  4. Write `00-scope.md` when the track is large enough to run away. Skip it on a small track.
@@ -42,7 +42,7 @@ List `.canon/intake/` from the project root and match the topic against the slug
42
42
 
43
43
  Never match against `.claude/` itself. That directory holds every other workflow surface, so a topic matched there lands on a folder that was never an intake.
44
44
 
45
- With no match, derive a kebab-case slug named for the subject rather than the activity. Prefer `toolkit-overview` over `august-triage`. Also list `.canon/groundwork/` and take `<nn>` as the highest ordinal present across both listings, incremented, per `${CLAUDE_SKILL_DIR}/../../standards/intake.md`. An absent folder opens, and a present one resumes by appending items and revising verdicts the tree has moved under.
45
+ With no match, derive a kebab-case slug named for the subject rather than the activity. Prefer `toolkit-overview` over `august-triage`. Claim the ordinal and create the folder in one act with `canon records ordinal intake <slug> --claim`, per `${CLAUDE_SKILL_DIR}/../../standards/intake.md`. Where the installed binary carries no such subcommand, fall back to listing both `.canon/intake/` and `.canon/groundwork/` and taking the highest ordinal present across the two, incremented. An absent folder opens, and a present one resumes by appending items and revising verdicts the tree has moved under.
46
46
 
47
47
  ## Step 2: orient
48
48
 
@@ -28,6 +28,7 @@ Run `canon tasks plan-answers <plan> --json` and read `launchable` off the recor
28
28
  - `launchable: false`: the row is not dispatchable. Report every entry in `open`, each carrying the question label and the reason its suggestion gave for needing a person, and hand the row to the human-launch line below. Never fill the slot on the operator's behalf, which is the one move the plan standard forbids outright.
29
29
  - `reason: archived`: the row's plan sits in `.canon/plans/archive/` and describes work that already shipped. Repoint the row at a live plan rather than dispatching, since `auto-ship` Step 1 refuses the same file and the worker would meet that refusal after the launch spent.
30
30
  - The command refuses for any other reason, or the record carries no `launchable` key: treat the row as unverified rather than clear, name what could not be read, and fall back to the human. A gate that reads nothing and proceeds is the gate not running.
31
+ - The same read also refuses a plan still staging its batches in one file with `**Batch N**` sub-headings. That reports as an entry in `open` labeled `Batch staging`, so a staged plan reads as `launchable: false` the same way an unanswered operator call does, and the row waits on a split rather than on the operator.
31
32
 
32
33
  Branch on `launchable` rather than on the exit code, which a shell function wrapping `canon` can flatten to zero and so read a held row as a clear one.
33
34
 
@@ -24,7 +24,7 @@ Take the board rows in board order and finish one before opening the next. Clear
24
24
  The blocker cell states what the row waits on, and each kind is tested differently. `canon tasks validate` already re-takes the first two and reports the rest as untested, so run it first and re-take by hand only what it names.
25
25
 
26
26
  - Collision with a track in flight: the validator tests the file the cell cites against the Touches column of every `## Run now` row. A track that merged since the row was parked is no longer in flight, whatever the sets still share. A cell naming the file in prose rather than in backticks cites nothing, so write the collision the way the board format spells it and the check picks the row up on the next run.
27
- - A dependency on another task: the validator opens the task a link in the cell names. One whose outcomes are all `[x]`, or one already archived, holds nothing. A cell naming the task in prose resolves to no file, so open it by hand and rewrite the cell as a link.
27
+ - A dependency on another task: the validator opens the task a link in the cell names. One whose outcomes are all `[x]`, one already archived, or one already declined, holds nothing. A cell naming the task in prose resolves to no file, so open it by hand and rewrite the cell as a link.
28
28
  - A condition about the tree, such as a count of some shape or the presence of a construct: measure it again, per Two ways a re-test goes wrong below.
29
29
  - Waiting on a plan: nothing external holds the row, so the pass writes the plan rather than testing anything. See The plan half below.
30
30
  - Waiting on an operator action, such as a run that happens from a shell: record it as untestable this pass and name what the operator has to do. A session cannot clear it, and re-measuring it every pass is waste.
@@ -72,6 +72,7 @@ A scoping defect can wear a blocker. A task whose file set collides with every o
72
72
  ```plaintext
73
73
  Re-tested: <row>, <blocker> → <what the measurement showed>
74
74
  Cleared: <row>, now <group>, plan at <path>
75
+ Declined: <row>, waited on <task> which was declined, now <group>
75
76
  Still parked: <row>, <blocker> re-confirmed against <what was measured>
76
77
  Untestable: <row>, waits on <operator action>
77
78
  Split: <task> into <tasks>, file set collided with everything by construction
@@ -18,6 +18,7 @@ Neither attempt named who the relay is from. A message an operator relays by han
18
18
  ## Must
19
19
 
20
20
  - Fire from inside `role-worker` or `role-planner`'s own `## The channel` section, at the point that section finds no message-sending tool
21
+ - Refuse a caller holding neither role, checked ahead of the tool-availability guard
21
22
  - Read the sender's own name off `canon sessions list --self --json` before composing anything, and degrade to naming itself from the environment when the installed CLI answers `--self` with an unknown option rather than a refusal carrying a reason
22
23
  - Resolve the addressee by running the calling role's own ladder rather than a second one
23
24
  - Carry the message body the calling role's bullet already names, verbatim
@@ -32,6 +33,7 @@ Neither attempt named who the relay is from. A message an operator relays by han
32
33
 
33
34
  ## Guards
34
35
 
36
+ - The calling session holds neither role: refuse, and state the addressing and timing it owes instead, since the plugin skill it would otherwise defer to reaches a target the moment it merges while a governance rule reaches one only through a separate install. Checked first, since the tool guard read alone let the incident behind this row stop at "you have a tool" without ever learning steps 2 and 3 were unreachable regardless.
35
37
  - A message-sending tool is available: refuse, name it, and send through it instead
36
38
 
37
39
  ## Out of scope
@@ -11,6 +11,7 @@ Read the calling body's `## The channel` section for the message owed and the la
11
11
 
12
12
  ## Guards
13
13
 
14
+ - Refuse to fire when the calling session holds neither `role-worker` nor `role-planner`. Say so, and state what it owes instead: resolve the addressee at send time through `canon sessions list --json`, never by name prefix, and send a block out as a message before it becomes an interactive prompt, leaving the message content to whatever dispatched it. Checked first, since a caller that never held either role never had a ladder here to run, and the tool guard below reads as the whole reason only once this one has cleared.
14
15
  - Refuse to fire when a message-sending tool is available. Say so, name the tool, and send through it. This skill exists for the gap, never as an alternative to the ordinary channel.
15
16
 
16
17
  ## Steps
@@ -14,7 +14,7 @@ Read `${CLAUDE_SKILL_DIR}/../../standards/tasks.md` before writing any file. It
14
14
  - Resolve the board at the main worktree root, not `pwd`. Run `git worktree list --porcelain | grep -m 1 '^worktree ' | cut -d' ' -f2-`, falling back to `pwd` outside a git repo. Every read and write below resolves against that root. The board is gitignored scratch shared across worktrees, so a linked worktree writing to its own `pwd` creates a second board nothing else reads.
15
15
  - From a linked worktree the file-editing tools refuse that root, so a new task file goes out through `Bash` as a plain single command carrying a heredoc. Archiving already runs through `canon tasks archive`, which resolves the root in-process. Marking an outcome shipped is `docs-fold` and runs through `canon tasks outcome`. Resolve that root the way `session-worktree` does.
16
16
  - If `.canon/tasks/` does not exist at that root, stop: `❌ No .canon/tasks/ board. Run canon claude init to set it up.`
17
- - Route on the request rather than on a flag. Creating names work that does not exist yet, archiving names a task file already on the board. If the request fits neither, stop: `❌ Ambiguous. Say whether to create a task or archive one.`
17
+ - Route on the request rather than on a flag. Creating names work that does not exist yet, archiving names a task file already shipped, and declining names one decided against. If the request fits none of the three, stop: `❌ Ambiguous. Say whether to create a task, archive one, or decline one.`
18
18
  - Never hand-edit `.canon/tasks/index.md`. A hook regenerates it from sibling frontmatter after a write. Do not run the regen command directly, except after a shell write from a linked worktree: the hook matches `Write|Edit|MultiEdit` and nothing fires on `Bash`, so that one case regenerates explicitly with `canon indexes regen --no-stage --root <main-root> <main-root>/.canon/tasks/index.md`.
19
19
 
20
20
  ## Create
@@ -63,13 +63,13 @@ Scan for work that has been decided and would otherwise be forgotten. Three orig
63
63
 
64
64
  List `.canon/groundwork/` and run `gh issue list --state open` when a remote is configured, then grep the board for each track name and issue number. Report any with no task, one line each.
65
65
 
66
- Read the dumps through `canon intake list --json`, which reports items, open, unread, and malformed per folder and owns the parse of the answer contract `${CLAUDE_SKILL_DIR}/../../standards/intake.md` fixes. Then grep both `.canon/tasks/` and `.canon/tasks/archive/` for each folder slug. A dump with no live task is the ordinary shape of one already promoted and shipped, so a check reading the board by itself reports every finished folder as abandoned.
66
+ Read the dumps through `canon intake list --json`, which reports items, open, unread, and malformed per folder and owns the parse of the answer contract `${CLAUDE_SKILL_DIR}/../../standards/intake.md` fixes. Then grep `.canon/tasks/`, `.canon/tasks/archive/`, and `.canon/tasks/declined/` for each folder slug. A dump with no live task is the ordinary shape of one already promoted and either shipped or declined, so a check reading the board by itself reports every settled folder as abandoned.
67
67
 
68
68
  A dump is the stronger case for this scan rather than the weaker one. A track holds one question and stays visible, while a dump holds dozens of items whose verdicts were reached and then left with nothing carrying them forward.
69
69
 
70
70
  Those two reads give four states, and the first three earn a line each:
71
71
 
72
- - Every item answered, `malformed` at zero, and neither the board nor the archive cites the folder. Decided work nobody promoted, which is what this step exists to find.
72
+ - Every item answered, `malformed` at zero, and none of the board, the archive, or the declined folder cites it. Decided work nobody promoted, which is what this step exists to find.
73
73
  - Unread items. The folder is waiting on the operator rather than forgotten, so it takes its own wording and never lands in the block above.
74
74
  - `malformed` above zero. An item carrying no answer slot can be reached by no verb, so name the folder as a file to repair rather than as work in either state above.
75
75
  - The archive cites it. Promoted and shipped, so say nothing.
@@ -129,6 +129,40 @@ Leave `TASK-ARCHIVE.md` alone when it is present in the archive folder. It recor
129
129
 
130
130
  The command drops the task's row from `.canon/tasks/priority.md` and leaves prose alone. Remove any sentence that still names the archived task or counts the rows that changed, since a stale count reads as board state.
131
131
 
132
+ ## Decline
133
+
134
+ A task decided against carries no `post-merge` hook of its own, so every decline request arrives here directly rather than through work the hook already did.
135
+
136
+ Do not move the file, edit `priority.md` or `backlog.md`, or regenerate the index by hand. `canon tasks decline` owns all three as one unit.
137
+
138
+ ### Step 1: gather the reason
139
+
140
+ Ask for the reason when the request does not carry one, and stop rather than guessing: `❌ No reason. Say why the task is being declined.` The command takes it as `--reason <text>` and refuses without it, so gathering it here saves a round trip through that refusal.
141
+
142
+ ### Step 2: run the decline
143
+
144
+ Pass the task's filename stem:
145
+
146
+ ```bash
147
+ canon tasks decline <stem> --reason "<text>" [--by <name>] --json
148
+ ```
149
+
150
+ The command refuses rather than reports, and the refusal reaches this skill through the record rather than through the exit, the same wrapper hazard `canon tasks archive` carries. Branch on `ok`, then on `reason`.
151
+
152
+ On success the record carries `from`, `to`, `priorityRowRemoved`, `backlogRowRemoved`, and `indexRegenerated`, where `backlogRowRemoved` is decline's own field since a task can be declined straight off `backlog.md` and archive never checks that file. It also carries `plan` when the task was the last live citation of a live plan, holding the `from` and `to` of the plan moved alongside it, the same shape `canon tasks archive` uses for its own `plan` field.
153
+
154
+ ### Step 3: route on a refusal
155
+
156
+ - `no-match`: the stem does not name exactly one task. Either none matches, or exactly one starts with it and the full name is needed. Check the name against the listed stems.
157
+ - `ambiguous`: the stem is a prefix more than one task starts with, unlike archive's own `ambiguous`, which fires on a shared pull request. Decline takes no pull-request selector, so this is the only route to it. Pass the full stem.
158
+ - `bad-input`: the command line was wrong rather than the board. Read the message, fix the arguments, and run it again. Nothing on the board needs repair, which is what separates this from the two above.
159
+
160
+ Do not move a plan by hand from this skill. The command carries the plan with the task when no other live task cites it, and retargets the declined task's `Plan:` line at the new path. A second mover drifts into relocating the same file differently.
161
+
162
+ ### Step 4: clear prose naming the task
163
+
164
+ The command drops the task's row from `.canon/tasks/priority.md` or `.canon/tasks/backlog.md` and leaves prose alone. Remove any sentence that still names the declined task or counts the rows that changed, since a stale count reads as board state.
165
+
132
166
  ## Output
133
167
 
134
168
  Emit the full relative path from the project root for every file written or moved. A bare filename names a file the reader cannot open.
@@ -48,6 +48,7 @@ Full help: `canon <command> --help`. Behavior notes for the install and sync ver
48
48
  | `canon teach nav` | Rewrite the teach-root listing, a workspace's contents page, and each lesson's chrome from its four marker regions (`--json`) |
49
49
  | `canon records validate` | Report a session record or a standard against the standard governing it, per kind (`--json`) |
50
50
  | `canon records migrate` | Rewrite the records a validate finding names a recoverable transform for (`--write`, `--json`) |
51
+ | `canon records ordinal` | Report or claim the next ordinal `intake` and `groundwork` share, creating the folder atomically (`--claim`, `--json`) |
51
52
  | `canon records size` | Report what each record folder holds and how much of it is recent, heaviest first (`--json`) |
52
53
  | `canon records push` | Commit the nine backed record folders and push them to a private records remote (`--json`) |
53
54
  | `canon records pull` | Fetch the records remote and write it back, refusing rather than discarding unpushed records (`--json`) |
@@ -29,7 +29,7 @@ CLI catalog and invocation rules for agents, split by command domain. Start with
29
29
  - [Output shape](output-shape.md): Two framed shapes every command renders into, how JSON and --names modes keep stdout clean, and the exit discipline that lets piped output drain
30
30
  - [Overview](overview.md): What this folder covers, the invocation rules every command inherits, and where domain behavior is documented instead
31
31
  - [Head-sensitive pull request reads](pr-reads.md): Resolving a branch tip from the remote rather than from the pull request object, reading what a review pass covered off its own marker rather than off GitHub's submission stamps, why an empty run list is not a pass, the refusal reasons each verb names, and what the remote read costs
32
- - [Records](records.md): The two roots a record folder resolves at, validating the session records and the standards corpus, the per-kind checks, the refusal reasons, migrating a record a frontmatter change orphaned, reading each folder's size and growth, backing the folders to a private remote, and which root each kind defaults to
32
+ - [Records](records.md): The two roots a record folder resolves at, validating the session records and the standards corpus, the per-kind checks, the refusal reasons, migrating a record a frontmatter change orphaned, claiming the ordinal intake and groundwork share, reading each folder's size and growth, backing the folders to a private remote, and which root each kind defaults to
33
33
  - [Restated instructions](restated.md): Counting the instructions the always-loaded file and every path-scoped rule share with the seed, the shipped skill bodies, and each other, how a match is decided, the three classes, which surface a later edit starts from, and why the sweep reports rather than gates
34
34
  - [Review classification](review-classification.md): Deciding whether a changed set needs the review pass, the two tests it runs, why an empty set refuses rather than skipping, and the written fallback a target on an older binary falls back to
35
35
  - [Routing report](routing.md): Reading per CLAUDE.md section how many bullets name a path, what counts as naming one, when a rule counts as covering it, the two refusals, and why the verb reports rather than gates
@@ -158,8 +158,9 @@ Use `--json` for the machine-readable report and `--exit-code` to fail a CI job.
158
158
  and missing files are both excluded from that exit code: a project-authored
159
159
  rule never converges, and a sync that added a missing one silently changes
160
160
  what the project is governed by, which stays a separate command an operator
161
- chooses to run. Attribution reads `.claude/canon/config.json`, which every
162
- install and sync writes.
161
+ chooses to run. Attribution reads `canon/config/config.json` first and falls
162
+ back to `.claude/canon/config.json`, which every install and sync still writes
163
+ in this release.
163
164
 
164
165
  A target installed before stamping shipped has no such file, and neither does
165
166
  that fallback do anything to migrate it. A target stamped before the file
@@ -401,16 +402,19 @@ so this section reports and gates nothing.
401
402
 
402
403
  ## Bootstrap
403
404
 
404
- `canon init` installs up to four core domains and reports each one independently. A
405
+ `canon init` installs up to five core domains and reports each one independently. A
405
406
  domain that fails does not abort the run, so the command finishes the rest and
406
407
  exits 1 naming the failures. Passing any flag skips the confirmation prompt,
407
408
  which is what makes it scriptable.
408
409
 
409
410
  `--stack` defaults to `base`, and the default
410
411
  does not read as a passed flag, so a bare `canon init` installs governance and
411
- still prompts. `--skip` takes `wiki` and `governance`, and warns
412
- without aborting on any other value. There is no `--standards` and no
413
- `--snippets`, since no run writes either corpus into the target.
412
+ still prompts. `--skip` takes `wiki`, `governance`, and `records`, and warns
413
+ without aborting on any other value. Records has nothing to run non-interactively,
414
+ since the private backup repository does not exist yet at scaffold time, so its
415
+ step only prints the one-time setup reminder and `--skip records` silences it.
416
+ There is no `--standards` and no `--snippets`, since no run writes either corpus
417
+ into the target.
414
418
 
415
419
  ## Unguarded tooling primitives
416
420
 
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  title: Records
3
- description: The two roots a record folder resolves at, validating the session records and the standards corpus, the per-kind checks, the refusal reasons, migrating a record a frontmatter change orphaned, reading each folder's size and growth, backing the folders to a private remote, and which root each kind defaults to
3
+ description: The two roots a record folder resolves at, validating the session records and the standards corpus, the per-kind checks, the refusal reasons, migrating a record a frontmatter change orphaned, claiming the ordinal intake and groundwork share, reading each folder's size and growth, backing the folders to a private remote, and which root each kind defaults to
4
4
  ---
5
5
 
6
6
  # Records
@@ -39,14 +39,14 @@ Nothing fires it automatically. The five record folders are gitignored, so the s
39
39
 
40
40
  ### What each kind checks
41
41
 
42
- | Kind | What it reports |
43
- | ------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
44
- | `plans` | A filename that is not `feature-<slug>.md`, a missing `# Feature:` heading, a missing required section, a files-to-touch entry naming no file or saying nothing about one, and a question carrying no suggestion or no answer slot |
45
- | `groundwork` | A track with no `README.md` or no `01-current-state.md`, a file missing `title` or `description`, a `README.md` with no `date` as `YYYY-MM-DD`, an unnumbered file, and a track holding a decision without its handoff or the reverse |
46
- | `intake` | A dump with no `00-overview.md`, the same frontmatter and numbering checks, an item missing any of `Problem`, `Fix`, `Worth it`, or `You`, and an item carrying `Open` with no `Suggested` |
47
- | `memory` | A filename whose prefix names none of the four types, an entry missing `title`, `description`, or `category`, a `category` disagreeing with that prefix, a title repeating the filename, and a rule-bearing body missing a part |
48
- | `standards` | A standard missing `title` or `description`, an absent `## Scope` section, a scope section carrying no `Does not govern:` list, a statement anchoring nothing, and a filename naming no part of the path the statement governs |
49
- | `teach` | A workspace folder carrying no two-digit ordinal, an absent `MISSION.md`, `RESOURCES.md`, or `GLOSSARY.md`, a file missing `title` or `description`, a mission with no `date` as `YYYY-MM-DD` or no `## Success looks like` section, an unnumbered learning record, and a reference page opening with an ordinal |
42
+ | Kind | What it reports |
43
+ | ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
44
+ | `plans` | A filename that is not `feature-<slug>.md`, a missing `# Feature:` heading, a missing required section, a files-to-touch entry naming no file or saying nothing about one, a question carrying no suggestion or no answer slot, and a batch still staged with a `**Batch N**` sub-heading inside the one file rather than split into its own plan |
45
+ | `groundwork` | A track with no `README.md` or no `01-current-state.md`, a file missing `title` or `description`, a `README.md` with no `date` as `YYYY-MM-DD`, an unnumbered file, and a track holding a decision without its handoff or the reverse |
46
+ | `intake` | A dump with no `00-overview.md`, the same frontmatter and numbering checks, an item missing any of `Problem`, `Fix`, `Worth it`, or `You`, and an item carrying `Open` with no `Suggested` |
47
+ | `memory` | A filename whose prefix names none of the four types, an entry missing `title`, `description`, or `category`, a `category` disagreeing with that prefix, a title repeating the filename, and a rule-bearing body missing a part |
48
+ | `standards` | A standard missing `title` or `description`, an absent `## Scope` section, a scope section carrying no `Does not govern:` list, a statement anchoring nothing, and a filename naming no part of the path the statement governs |
49
+ | `teach` | A workspace folder carrying no two-digit ordinal, an absent `MISSION.md`, `RESOURCES.md`, or `GLOSSARY.md`, a file missing `title` or `description`, a mission with no `date` as `YYYY-MM-DD` or no `## Success looks like` section, an unnumbered learning record, and a reference page opening with an ordinal |
50
50
 
51
51
  The half-closed track is the groundwork check a reader cannot run by eye. A folder holding `06` without `07` reads as closed to anyone scanning filenames while the file a returning session actually opens is absent.
52
52
 
@@ -104,6 +104,26 @@ A transform runs only where the missing value is recoverable from the file itsel
104
104
 
105
105
  Exit codes: `0` nothing carried a known transform, or `--write` repaired everything it found. `1` refused for a reason `validate` shares, every candidate it found failed to repair, or `--write` repaired only some of them. `2` a record carries a known transform and `--write` was not passed.
106
106
 
107
+ ## Ordinal
108
+
109
+ `canon records ordinal <kind> <slug>` reports the next ordinal `intake` and `groundwork` share, or claims it with `--claim`. The two kinds share one sequence, per `standards/intake.md` and `standards/groundwork.md`, so this reads both `.canon/intake/` and `.canon/groundwork/` regardless of which kind was asked for.
110
+
111
+ ```bash
112
+ canon records ordinal intake my-topic
113
+ canon records ordinal groundwork my-topic --claim
114
+ canon records ordinal groundwork my-topic --claim --json
115
+ ```
116
+
117
+ | Option | Behavior |
118
+ | --------------- | ------------------------------------------------------ |
119
+ | `--json` | Add a machine-readable record on stdout |
120
+ | `--claim` | Create the folder atomically instead of only reporting |
121
+ | `--root <path>` | Project root, defaulting to the main worktree |
122
+
123
+ Without `--claim` this only reports, so two sessions reading at once can still report the same number, which is what let two sessions open two different record folders under one ordinal on the same day. `--claim` closes that: it reserves the number at a path both an `intake` claim and a `groundwork` claim resolve to identically, whichever kind is asking, and only creates the kind's own `<nn>-<slug>/` folder once that reservation is won. A losing reservation is retried against a freshly read ordinal rather than reported as a collision, bounded to five attempts before refusing as `ordinal-contended`.
124
+
125
+ Exit codes: `0` reported the next ordinal, or `--claim` created the folder. `1` refused, `unknown-kind` when the argument names neither `intake` nor `groundwork`. `2` `--claim` lost every retry to a collision.
126
+
107
127
  ## Size
108
128
 
109
129
  `canon records size` reports what each record folder holds and how much of it is recent. It reads the ten backed folders named under Push and pull, plus the scratch folder, and it gates nothing.
@@ -141,6 +141,8 @@ A relative path resolves against the project root first and against `.canon/task
141
141
 
142
142
  `canon tasks plan-citations` reads a task's `Plan:` line against those same two bases in the opposite order, and tests that the target lands under the live plans folder, which this verb does not. Both answer the same file for every spelling a board writes. Liveness is a separate refusal here: a plan resolving inside `.canon/plans/archive/` returns `archived` rather than a launchable reading, since it answers every question and describes work that already shipped.
143
143
 
144
+ A plan still staging its batches with a `**Batch N**` sub-heading inside one file's `**Files to touch:**` reads `launchable: false` the same way, alongside the operator-call case. It reports as an entry in `open` labeled `Batch staging`, stating that the plan must split into one file per batch before it can dispatch, since the row waits on a split rather than on the operator.
145
+
144
146
  | Option | Effect |
145
147
  | --------------- | ------------------------------------------- |
146
148
  | `--json` | Emit a machine-readable record on stdout |
@@ -143,6 +143,10 @@ The first line takes the `.canon/` ignore entry, and the verb refuses until the
143
143
 
144
144
  Order matters between the first line and the two under it. The sync prunes the twelve old `.claude/` ignore entries down to the one `.canon/` line, which leaves every record still at the old root visible to git and therefore to the verb. The sweep passes over them on purpose, reporting a count of what it left alone rather than reading the memory pen and the groundwork trails as source.
145
145
 
146
+ ### Back records up off this machine, once
147
+
148
+ Moving records under `.canon/` relocates them, and relocating them is not the same as backing them up. Run `canon records push` once a private repository exists for them, and it prints the one-time setup command when it finds none, since the task board, the memory pen, and the groundwork trails otherwise live on one disk with nothing pushing them off it. `canon init` prints the same reminder as a notice-only step rather than trying to run this non-interactively, since the private repository does not exist yet at scaffold time.
149
+
146
150
  Read the `ok` field out of the `--json` record rather than the exit code. A shell profile that wraps `canon` in a function takes its status from whatever the function runs last, so an absent subcommand and a clean run can both exit 0, and a reader watching the exit alone concludes the move happened.
147
151
 
148
152
  A tracked file that names an old record path on purpose, such as prose dating a decision, keeps it by carrying `canon-keep-record-root` on that line or the nearest non-blank line above. The report pass prints every file it would rewrite, which is where to catch one before `--write` runs.
@@ -204,7 +208,7 @@ The report opens by naming the binary running it. The installed version reads ag
204
208
 
205
209
  A `stale` file still matches what the toolkit installed, so the update is mechanical. A `customized` file carries local edits, so taking the upstream version is a decision and `canon:seed-sync` is the tool for it. A `stranded` file sits where an older toolkit installed it and the toolkit has since moved, which is a relocation the report names but no command runs.
206
210
 
207
- That attribution comes from `.claude/canon/config.json`, a stamp every install and sync writes. A target stamped before that path shipped is read from the retired `.claude/canon.json` instead, reported rather than migrated. Governance records a hash per installed file, plus the stack `canon gov install` was given, and tooling records the stack chain it resolved instead of any file hash, since its install runs no per-file walk to attribute.
211
+ That attribution comes from `canon/config/config.json` when a project carries it, falling back to `.claude/canon/config.json`, a stamp every install and sync still writes in this release. A target stamped before that path shipped is read from the retired `.claude/canon.json` instead, reported rather than migrated. Governance records a hash per installed file, plus the stack `canon gov install` was given, and tooling records the stack chain it resolved instead of any file hash, since its install runs no per-file walk to attribute.
208
212
 
209
213
  Each domain holds its own toolkit commit, so syncing governance today does not move the revision tooling measures against, and each domain reports the upstream commits touching its own source path. Running any sync stamps that domain, and the report names the ones still unstamped.
210
214
 
@@ -0,0 +1,13 @@
1
+ ---
2
+ description: The addressing and timing a session holding neither role-worker nor role-planner owes when it must message whoever dispatched it
3
+ ---
4
+
5
+ # Channel standards
6
+
7
+ ## A session holding neither role
8
+
9
+ - Resolve the addressee at send time through `canon sessions list --json`, keyed on the id or branch the dispatcher named at launch, never by name prefix. A name is derived from what a session turns out to be doing and goes stale before a build finishes.
10
+ - Send a block out as a message before it becomes an interactive prompt. A session already waiting on input never reaches the tool round that drains an inbound message, so an answer relayed afterwards arrives under the open question and changes nothing.
11
+ - Leave the message content, and which transition earns one, to whatever dispatched this session. Both are task-specific and already stated where they apply.
12
+ - A session holding `canon:role-worker` or `canon:role-planner` follows that body's own addressee ladder instead, stated in its own `## The channel` section. This rule states what neither role leaves stated elsewhere, not a replacement for either ladder.
13
+ - Report it rather than proceeding silently when neither skill resolves to check against. Both ship with the plugin and this rule ships with the CLI, so a project that installed governance alone does not have them.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@erclx/canon",
3
3
  "type": "module",
4
- "version": "4.72.1",
4
+ "version": "4.74.0",
5
5
  "description": "Infrastructure and quality tooling for developer workflows",
6
6
  "license": "MIT",
7
7
  "bin": {
@@ -1,6 +1,7 @@
1
1
  import { existsSync, readFileSync } from 'node:fs'
2
2
  import { join } from 'node:path'
3
3
  import { resolveSkillsCorpus } from '@/claude/skills-list'
4
+ import { SURFACE_ROOTS } from '@/surface-root'
4
5
 
5
6
  /**
6
7
  * The authoring roots this repository owns and no install channel delivers.
@@ -15,9 +16,14 @@ import { resolveSkillsCorpus } from '@/claude/skills-list'
15
16
  * report a correct citation on every run and bury the defect this measures.
16
17
  * `docs/agents/` is the exception, being the CLI contract pages that exist
17
18
  * here alone.
19
+ *
20
+ * `.claude/context/` carries both surface-root spellings, since this list
21
+ * decides whether a shipped body names this repository's own tree and a body
22
+ * naming either root is doing that regardless of which root a given checkout
23
+ * carries.
18
24
  */
19
25
  const AUTHORING_ROOTS = [
20
- '.claude/context/',
26
+ ...SURFACE_ROOTS.map((root) => `${root}/context/`),
21
27
  'claude/',
22
28
  'docs/agents/',
23
29
  'governance/',
@@ -92,9 +98,13 @@ export function isQualified(line: string): boolean {
92
98
  * by corpus instead.
93
99
  */
94
100
  export function authoringRootsFor(corpus: string): readonly string[] {
95
- if (!corpus.startsWith('.claude/')) return AUTHORING_ROOTS
101
+ if (!SURFACE_ROOTS.some((root) => corpus.startsWith(`${root}/`))) {
102
+ return AUTHORING_ROOTS
103
+ }
96
104
 
97
- return AUTHORING_ROOTS.filter((root) => !root.startsWith('.claude/'))
105
+ return AUTHORING_ROOTS.filter(
106
+ (root) => !SURFACE_ROOTS.some((surface) => root.startsWith(`${surface}/`)),
107
+ )
98
108
  }
99
109
 
100
110
  /**
@@ -17,11 +17,11 @@ import {
17
17
  type SectionFinding,
18
18
  } from '@/context/audit'
19
19
  import {
20
+ architectureRel,
20
21
  type ArchitectureReport,
21
22
  coveredCount,
22
23
  isOverLength,
23
24
  measureArchitecture,
24
- RECORD_REL,
25
25
  testableCount,
26
26
  } from '@/context/architecture'
27
27
  import { auditCitations, type CitationReport } from '@/context/citations'
@@ -251,7 +251,7 @@ async function runAudit(
251
251
  reportProvenance(entries, folders)
252
252
  reportNarration(entries, folders, narration)
253
253
  reportDrift(drift)
254
- reportRecord(record)
254
+ reportRecord(record, root)
255
255
  outro()
256
256
  }
257
257
 
@@ -761,12 +761,15 @@ const CLAIM_LABEL: Record<string, string> = {
761
761
  * anchors it sits beside already do. Nothing is stored: every run reclassifies,
762
762
  * so an entry rewritten tomorrow is read as it stands then.
763
763
  */
764
- function reportRecord(report: ArchitectureReport | undefined): void {
764
+ function reportRecord(
765
+ report: ArchitectureReport | undefined,
766
+ root: string,
767
+ ): void {
765
768
  logStep('Architecture record')
766
769
 
767
770
  if (report === undefined) {
768
771
  logInfo(
769
- `Out of scope. The project carries no ${RECORD_REL}, so there was no record to measure.`,
772
+ `Out of scope. The project carries no ${architectureRel(root)}, so there was no record to measure.`,
770
773
  )
771
774
  return
772
775
  }
@@ -11,6 +11,7 @@ import { renderDesignDoc } from '@/design/render'
11
11
  import { DESIGN_BASE_CSS, DESIGN_DOCUMENT, regenDesign } from '@/design/regen'
12
12
  import { checkoutMismatchWarning, PROJECT_ROOT } from '@/project-root'
13
13
  import { creationRel } from '@/record-root'
14
+ import { surfaceDir } from '@/surface-root'
14
15
  import { recordStamp, runDomainSync } from '@/sync/engine'
15
16
  import { resolveTarget } from '@/target'
16
17
  import { intro, logAdd, logError, logInfo, logWarn, outro, palette } from '@/ui'
@@ -88,7 +89,11 @@ export function register(program: Command): void {
88
89
  design
89
90
  .command('render')
90
91
  .description('Render DESIGN.md tokens to HTML and CSS preview')
91
- .option('-s, --source <path>', 'Source DESIGN.md path', '.claude/DESIGN.md')
92
+ .option(
93
+ '-s, --source <path>',
94
+ 'Source DESIGN.md path',
95
+ relative(process.cwd(), surfaceDir(process.cwd(), 'DESIGN.md')),
96
+ )
92
97
  .option(
93
98
  '-o, --out <path>',
94
99
  'Output directory',