@erclx/canon 5.32.0 → 5.34.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/claude/.claude-plugin/plugin.json +1 -1
- package/claude/skills/api-design/REQUIREMENT.md +1 -2
- package/claude/skills/api-design/SKILL.md +2 -3
- package/claude/skills/api-design/references/adopted.md +1 -1
- package/claude/skills/auto-ship/SKILL.md +1 -1
- package/claude/skills/auto-ship/references/worktree-name.md +1 -1
- package/claude/skills/backlog-triage/REQUIREMENT.md +2 -2
- package/claude/skills/backlog-triage/SKILL.md +1 -1
- package/claude/skills/canon-cli/REQUIREMENT.md +16 -13
- package/claude/skills/canon-cli/SKILL.md +75 -32
- package/claude/skills/canon-feedback/REQUIREMENT.md +1 -0
- package/claude/skills/canon-feedback/SKILL.md +11 -29
- package/claude/skills/canon-feedback/references/template.md +53 -0
- package/claude/skills/{canvas → canvas-board}/REQUIREMENT.md +2 -2
- package/claude/skills/{canvas → canvas-board}/SKILL.md +6 -3
- package/claude/skills/{canvas → canvas-board}/references/canvas.md +26 -3
- package/{standards → claude/skills/canvas-board/references}/design.md +11 -2
- package/claude/skills/code-craft/REQUIREMENT.md +1 -1
- package/claude/skills/code-craft/SKILL.md +0 -1
- package/claude/skills/context-fold/REQUIREMENT.md +25 -33
- package/claude/skills/context-fold/SKILL.md +25 -70
- package/claude/skills/context-fold/references/classify.md +3 -3
- package/claude/skills/context-fold/references/completion-report.md +4 -4
- package/claude/skills/context-fold/references/context-refresh.md +5 -5
- package/{standards → claude/skills/context-fold/references}/context.md +16 -5
- package/claude/skills/context-fold/references/unusable-baseline.md +3 -5
- package/claude/skills/create-rule/SKILL.md +3 -3
- package/{standards → claude/skills/create-rule/references}/rule.md +15 -6
- package/claude/skills/create-skill/SKILL.md +2 -2
- package/{standards → claude/skills/create-skill/references}/skill.md +18 -15
- package/claude/skills/design-taste/REQUIREMENT.md +3 -3
- package/claude/skills/design-taste/SKILL.md +1 -1
- package/claude/skills/docs-sync/REQUIREMENT.md +1 -1
- package/claude/skills/docs-sync/SKILL.md +3 -3
- package/{standards → claude/skills/docs-sync/references}/docs.md +11 -0
- package/{standards → claude/skills/docs-sync/references}/readme.md +9 -2
- package/claude/skills/draft-and-pick/SKILL.md +5 -5
- package/claude/skills/draft-doc/SKILL.md +6 -6
- package/claude/skills/draft-figure/REQUIREMENT.md +2 -2
- package/claude/skills/draft-figure/SKILL.md +2 -2
- package/claude/skills/draft-figure/references/hand-drawn.md +1 -1
- package/claude/skills/draft-figure/references/mermaid-path.md +1 -1
- package/claude/skills/draft-identity/REQUIREMENT.md +2 -2
- package/claude/skills/draft-identity/SKILL.md +2 -2
- package/claude/skills/draft-ready/SKILL.md +1 -1
- package/claude/skills/git-branch/SKILL.md +1 -1
- package/{standards → claude/skills/git-branch/references}/branch.md +1 -1
- package/claude/skills/git-commit/SKILL.md +2 -2
- package/claude/skills/git-followup/REQUIREMENT.md +1 -1
- package/claude/skills/git-followup/SKILL.md +1 -1
- package/claude/skills/git-issue/SKILL.md +1 -1
- package/claude/skills/git-issue/references/issue.md +4 -1
- package/claude/skills/git-pr/SKILL.md +13 -13
- package/claude/skills/git-pr/references/evidence.md +2 -2
- package/claude/skills/git-pr/references/final-command.md +38 -14
- package/claude/skills/git-pr/references/labels.md +5 -1
- package/{standards → claude/skills/git-pr/references}/pr.md +19 -9
- package/{standards → claude/skills/git-pr/references}/publish.md +4 -2
- package/claude/skills/git-pr/references/task-number.md +1 -1
- package/claude/skills/git-ship/SKILL.md +15 -14
- package/claude/skills/git-split/SKILL.md +3 -3
- package/claude/skills/git-stage/SKILL.md +1 -1
- package/claude/skills/plan-feature/REQUIREMENT.md +1 -1
- package/claude/skills/review-address/SKILL.md +1 -1
- package/claude/skills/review-address/references/post-review-findings.md +1 -1
- package/claude/skills/review-craft/references/ui.md +1 -1
- package/claude/skills/review-pr/REQUIREMENT.md +1 -1
- package/claude/skills/review-pr/SKILL.md +3 -3
- package/claude/skills/review-pr/references/body-variants.md +2 -2
- package/claude/skills/review-pr/references/key-changes.md +3 -3
- package/claude/skills/review-pr/references/post.md +4 -2
- package/claude/skills/review-ui/REQUIREMENT.md +1 -1
- package/claude/skills/review-ui/SKILL.md +8 -6
- package/claude/skills/review-ui/references/driving.md +8 -8
- package/claude/skills/review-ui/references/post.md +53 -17
- package/claude/skills/role-orchestrator/REQUIREMENT.md +3 -0
- package/claude/skills/role-orchestrator/SKILL.md +2 -2
- package/claude/skills/role-orchestrator/references/orchestrator-dispatch.md +2 -2
- package/claude/skills/role-orchestrator/references/orchestrator-handoff.md +8 -5
- package/claude/skills/role-orchestrator/references/orchestrator-launch.md +32 -1
- package/claude/skills/role-orchestrator/references/orchestrator-refill.md +2 -2
- package/claude/skills/role-orchestrator/references/orchestrator-resume.md +3 -0
- package/claude/skills/role-planner/REQUIREMENT.md +2 -1
- package/claude/skills/role-planner/SKILL.md +13 -2
- package/claude/skills/role-reviewer/SKILL.md +1 -1
- package/claude/skills/role-worker/REQUIREMENT.md +1 -0
- package/claude/skills/role-worker/SKILL.md +9 -1
- package/claude/skills/session-map/SKILL.md +1 -1
- package/claude/skills/session-resume/REQUIREMENT.md +2 -2
- package/claude/skills/session-worktree/SKILL.md +5 -5
- package/claude/skills/target-setup/SKILL.md +10 -4
- package/claude/skills/target-setup/references/detect.md +20 -3
- package/claude/skills/task-board/REQUIREMENT.md +7 -12
- package/claude/skills/task-board/SKILL.md +5 -17
- package/claude/skills/task-board/references/tasks.md +2 -2
- package/claude/skills/task-complete/REQUIREMENT.md +47 -0
- package/claude/skills/task-complete/SKILL.md +86 -0
- package/claude/skills/{task-board → task-complete}/references/archive.md +4 -4
- package/claude/skills/{context-fold → task-complete}/references/receipt-sweep.md +5 -5
- package/claude/skills/task-complete/references/unusable-baseline.md +19 -0
- package/claude/skills/teach-workspace/REQUIREMENT.md +6 -2
- package/claude/skills/teach-workspace/SKILL.md +8 -4
- package/claude/skills/teach-workspace/references/lesson-craft.md +1 -1
- package/claude/skills/{context-fold/references/promoted-pages.md → teach-workspace/references/promotion-fold.md} +3 -3
- package/claude/skills/teach-workspace/references/promotion.md +3 -3
- package/claude/skills/test-craft/REQUIREMENT.md +2 -3
- package/claude/skills/test-craft/SKILL.md +15 -3
- package/claude/skills/ui-checklist/SKILL.md +1 -1
- package/claude/skills/ux-audit/SKILL.md +1 -1
- package/claude/skills/ux-measure/SKILL.md +1 -1
- package/docs/agents/canvas.md +6 -2
- package/docs/agents/commands.md +4 -3
- package/docs/agents/context-audit-checks.md +4 -4
- package/docs/agents/gov-detect.md +47 -0
- package/docs/agents/index.md +7 -4
- package/docs/agents/indexes.md +1 -1
- package/docs/agents/install-and-sync.md +10 -11
- package/docs/agents/key-changes.md +5 -5
- package/docs/agents/label-coverage.md +11 -0
- package/docs/agents/migrate.md +1 -1
- package/docs/agents/pr-evidence-layout.md +70 -0
- package/docs/agents/pr-evidence.md +8 -9
- package/docs/agents/pr-frames.md +7 -2
- package/docs/agents/pr-lift.md +132 -0
- package/docs/agents/records-push.md +2 -2
- package/docs/agents/records-stale.md +12 -47
- package/docs/agents/records-validate.md +3 -7
- package/docs/agents/records.md +5 -27
- package/docs/agents/rule-citations.md +1 -1
- package/docs/agents/sandbox.md +4 -4
- package/docs/agents/scripting.md +2 -1
- package/docs/agents/skills-audit.md +1 -1
- package/docs/agents/tasks-plans.md +2 -2
- package/docs/agents/tasks.md +2 -2
- package/docs/target/migrations.md +10 -2
- package/docs/target/projects.md +4 -4
- package/docs/target/sync.md +1 -1
- package/docs/workflow/operating-model.md +2 -2
- package/docs/workflow/parallel-features.md +7 -7
- package/docs/workflow/skill-map-on-request.md +9 -9
- package/docs/workflow/skill-map.md +12 -11
- package/docs/workflow/visual-design-workflow.md +2 -2
- package/governance/detect.toml +201 -0
- package/governance/renames.toml +0 -11
- package/governance/rules/canon/context.md +13 -0
- package/governance/rules/claude/skill.md +17 -0
- package/governance/rules/code/000-code.md +1 -13
- package/governance/rules/code/010-testing.md +2 -30
- package/governance/rules/ui/400-ui.md +1 -1
- package/governance/rules/ui/480-canvas.md +13 -0
- package/governance/stacks/base.toml +2 -4
- package/package.json +4 -4
- package/scripts/core/install-check.sh +3 -3
- package/scripts/core/regen-hero.ts +0 -6
- package/scripts/lib/ui.sh +0 -168
- package/src/audits/catalog.ts +0 -1
- package/src/canvas/arrange.ts +66 -0
- package/src/canvas/capture.ts +20 -6
- package/src/canvas/content.ts +39 -0
- package/src/canvas/fit.ts +238 -0
- package/src/canvas/tokens.ts +28 -10
- package/src/capture/frame-values.ts +2 -32
- package/src/claude/cases/misc.ts +1 -1
- package/src/claude/cases/setup.ts +4 -0
- package/src/claude/cases/workflow.ts +6 -1
- package/src/claude/seeds.ts +1 -1
- package/src/claude/skills-audit.ts +2 -2
- package/src/cli/help.ts +3 -1
- package/src/cli/ui.ts +2 -3
- package/src/commands/canvas.ts +179 -1
- package/src/commands/claude.ts +1 -1
- package/src/commands/gov.ts +146 -16
- package/src/commands/labels.ts +326 -7
- package/src/commands/migrate.ts +6 -1
- package/src/commands/pr.ts +377 -2
- package/src/commands/records.ts +13 -399
- package/src/commands/sandbox.ts +3 -6
- package/src/commands/tasks.ts +3 -3
- package/src/context/audit.ts +5 -5
- package/src/context/folders.ts +1 -1
- package/src/design/budget.ts +1 -1
- package/src/design/components.ts +1 -1
- package/src/design/document.ts +1 -1
- package/src/design/regen.ts +1 -1
- package/src/design/render.ts +1 -1
- package/src/feedback/body.ts +26 -5
- package/src/gate/measures.ts +59 -45
- package/src/gate/sequencer.ts +56 -1
- package/src/gate/stages.ts +4 -11
- package/src/gov/detect.ts +301 -0
- package/src/gov/install.ts +2 -3
- package/src/gov/list.ts +23 -2
- package/src/gov/stacks.ts +10 -1
- package/src/hooks/post-merge.ts +1 -1
- package/src/labels/apply.ts +39 -0
- package/src/labels/format.ts +3 -3
- package/src/labels/phase.ts +3 -3
- package/src/labels/sections.ts +43 -0
- package/src/migrate/skill-names.ts +20 -1
- package/src/pr/evidence.ts +218 -45
- package/src/pr/frames.ts +23 -3
- package/src/pr/lift.ts +418 -0
- package/src/pr/paths.ts +4 -4
- package/src/pr/rest.ts +3 -0
- package/src/pr/review-scope.ts +76 -0
- package/src/records/backup.ts +16 -6
- package/src/records/stale-canonical.ts +31 -1
- package/src/records/validate.ts +2 -188
- package/src/sandbox/census.ts +1 -1
- package/src/sandbox/coverage.ts +2 -6
- package/src/sandbox/equivalence.ts +19 -51
- package/src/sandbox/expect.ts +4 -4
- package/src/sandbox/provision.ts +13 -36
- package/src/sandbox/scenario.ts +26 -48
- package/src/sandbox/tree.ts +2 -6
- package/src/standards/read.ts +14 -1
- package/src/sync/git.ts +1 -1
- package/src/tasks/archive.ts +5 -5
- package/src/tasks/branch.ts +3 -3
- package/src/tasks/label.ts +1 -1
- package/src/tasks/record.ts +2 -2
- package/src/tasks/validate.ts +1 -1
- package/standards/index.md +0 -13
- package/standards/standard.md +1 -7
- package/tooling/base/reference.md +1 -1
- package/tooling/base/seeds/.github/pull_request_template.md +2 -2
- package/tooling/claude/reference.md +1 -1
- package/tooling/claude/seeds/.claude/hooks/pr-create-log.sh +9 -1
- package/tooling/claude/seeds/.claude/hooks/review-post-scan.sh +171 -0
- package/tooling/claude/seeds/.claude/settings.json +9 -0
- package/governance/rules/standards/context.md +0 -14
- package/governance/rules/standards/design.md +0 -12
- package/governance/rules/standards/readme.md +0 -12
- package/governance/rules/standards/rule.md +0 -13
- package/governance/rules/standards/skill.md +0 -21
- package/governance/rules/standards/standard.md +0 -13
- package/scripts/config.sh +0 -11
- package/scripts/lib/gov.sh +0 -14
- package/scripts/lib/sandbox-fixtures.sh +0 -191
- package/scripts/lib/sandbox-git.sh +0 -125
- package/scripts/lib/sandbox-path.sh +0 -50
- package/scripts/sandbox-hook.sh +0 -99
- package/src/gov/standard-rules.ts +0 -179
- package/src/records/migrate.ts +0 -78
- package/src/records/stale.ts +0 -243
- package/src/sandbox/hooks.ts +0 -128
- /package/{standards → claude/skills/draft-figure/references}/figures.md +0 -0
- /package/{standards → claude/skills/git-branch/references}/slug.md +0 -0
- /package/{standards → claude/skills/git-commit/references}/commit.md +0 -0
- /package/{standards → claude/skills/git-commit/references}/versioning.md +0 -0
|
@@ -1,67 +1,59 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: context-fold
|
|
3
|
-
description: What the
|
|
3
|
+
description: What the context-entry fold is for, the gaps it closes, and why it audits its own writes before it reports
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Context fold requirement
|
|
7
7
|
|
|
8
8
|
## Gap
|
|
9
9
|
|
|
10
|
-
Without this skill, the
|
|
10
|
+
Without this skill, the context entries describe the repository the session opened with. A decision a plan settled mid-cycle lives only in the conversation and dies with it, and an entry naming a module the diff rewrote keeps stating what the module used to do.
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
The receipt half of that sweep was missing entirely. A review receipt was deleted per shipped branch while another kind of receipt was skipped, because the exclusion protecting the checklist and audit prefixes caught a third by accident. Nothing but an operator asking collected it, and a collection that waits on someone remembering to ask is one a folder outgrows, so the skipped population grew per shipped branch and never shrank until it was most of the folder.
|
|
15
|
-
|
|
16
|
-
The trigger side carries a gap of its own. "Sync the docs" names either corpus to the person saying it, so a description leaving its corpus to the opening clause alone competes with its public-facing sibling on nothing the routing field states, and the planning surface the request was about goes untouched.
|
|
12
|
+
The trigger side carries a gap of its own. "Sync the docs" names either corpus to the person saying it, so a description leaving its corpus to the opening clause alone competes with its public-facing sibling on nothing the routing field states, and the context folder the request was about goes untouched.
|
|
17
13
|
|
|
18
14
|
The opposite gap opened from the same write. A fold allowed to touch the requirements record on every ship rewrote it one reasonable edit at a time, and nothing read it for whether it still stated the project's identity. Each ship looked correct and the sum drifted.
|
|
19
15
|
|
|
20
|
-
|
|
16
|
+
A fold that did everything at ship time hid its own job. It marked board outcomes, swept receipts, wrote the design record, and landed promoted pages, so a session invoking it to refresh the context entries ran ten steps and could not tell which one it had asked for.
|
|
17
|
+
|
|
18
|
+
This skill writes canonical docs at the end of a long build. An appended figure, a branch-narrated re-measurement, or an entry pushed past its length lands unchecked the same way a session's own edits do, so what the fold produces carries the exact defect the standards it cites already ban.
|
|
21
19
|
|
|
22
20
|
## Must
|
|
23
21
|
|
|
24
|
-
- Name the context entries
|
|
25
|
-
- Take
|
|
26
|
-
-
|
|
27
|
-
- Leave an outcome unchecked when the diff is ambiguous. An unmarked shipped outcome costs one manual edit and a wrongly marked one hides work that never happened.
|
|
28
|
-
- Write tracked docs at the current worktree root and the task board at the main root, since only the first commits with the branch
|
|
29
|
-
- Count every other citation before archiving a plan, comparing resolved targets rather than raw strings or bare filenames
|
|
30
|
-
- Retarget a closed task at the archived plan, so the reasoning behind finished work stays reachable
|
|
22
|
+
- Name the context entries in a trigger phrase rather than in the opening clause alone, so a bare request to sync the docs separates this skill from `docs-sync` on something both descriptions state
|
|
23
|
+
- Take decisions from the session and the refresh scope from the diff
|
|
24
|
+
- Write tracked docs at the current worktree root, since only that copy commits with the branch
|
|
31
25
|
- Write a decision to the domain context entry it constrains, whatever other domains its reasoning touches, so a decision has one home that loads on demand
|
|
32
26
|
- Report a requirements or direction change in one line naming `document-health`, rather than writing it, so the identity record changes only when the operator reviews it
|
|
33
|
-
-
|
|
34
|
-
- Land each block of a promotion handoff at the destination its heading names, then delete the file so a later run does not fold it twice
|
|
35
|
-
- Take a promotion destination as already decided, since the operator confirmed it where the page was produced
|
|
27
|
+
- Close on an audit of what the fold touched, running `canon context audit` and reporting the findings on files this run wrote or the diff carries
|
|
36
28
|
- Classify the fold's whole diff baseline through `canon context classify diff`, calling the verb rather than reimplementing its pattern or its prompt in the skill body, since an earlier commit on the branch carries a doc edit the fold is equally responsible for
|
|
37
29
|
- Apply a `REPLACE` or `HISTORY` finding against the quote it names, report a `MOVE` finding naming the surface it belongs on rather than cutting it, or keep a finding with a one-line reason, rather than leaving a finding unanswered
|
|
38
|
-
- Rewrite a restated or superseded statement in place rather than appending the replacement beside it
|
|
39
|
-
- Report a refusal or a missing `context classify` subcommand as one line and continue the fold either way, since a check that cannot run is not a reason to leave the fold's own output unshipped
|
|
30
|
+
- Rewrite a restated or superseded statement in place rather than appending the replacement beside it
|
|
31
|
+
- Report a refusal or a missing `context audit` or `context classify` subcommand as one line and continue the fold either way, since a check that cannot run is not a reason to leave the fold's own output unshipped
|
|
40
32
|
|
|
41
33
|
## Must not
|
|
42
34
|
|
|
43
|
-
-
|
|
44
|
-
-
|
|
45
|
-
- Widen what a writing step reads when the baseline is unusable. Widening a read is safe and widening a write stubs a surface for every file in the repository.
|
|
35
|
+
- Write the task board, the design record, `CLAUDE.md`, or a page from a promotion handoff. Each has its own owner, and a fold that writes them hides its job behind theirs.
|
|
36
|
+
- Widen what the refresh reads when the baseline is unusable. Widening a read is safe and widening a write stubs a surface for every file in the repository.
|
|
46
37
|
- Write the requirements record. It states identity, and a fold reads one session where a review reads the whole project.
|
|
47
|
-
-
|
|
48
|
-
-
|
|
49
|
-
-
|
|
38
|
+
- Create a context entry for a domain the catalog does not list
|
|
39
|
+
- Report an audit finding on an entry this run never touched, which belongs to whoever next edits it
|
|
40
|
+
- Add a path flag to the audit verb from this skill. It takes a project root, so the skill filters the record.
|
|
50
41
|
- Pick or configure a classifier backend. The project setting decides it, and this skill reports the resolved `modelLayer` as returned.
|
|
51
|
-
- Stop the fold on
|
|
42
|
+
- Stop the fold on an audit or classify finding, a refusal, or a missing subcommand. All of them report and continue.
|
|
52
43
|
- Apply a finding against a quote found more than once or not found at all. Report that it could not be located instead of guessing.
|
|
53
44
|
- Re-run the classifier after applying a finding, which loops it over its own edit
|
|
54
45
|
- Cut a `MOVE` finding. The verdict means correct content sitting on the wrong surface rather than a deletion candidate, so cutting one can discard content that belongs elsewhere rather than removing detail that never belonged at all.
|
|
55
|
-
- Scope
|
|
46
|
+
- Scope the classifier to the files Step 3 wrote this run. An earlier commit on the branch carries a doc edit the fold is equally responsible for, and the verb's own extraction already answers whether anything in range qualifies.
|
|
56
47
|
|
|
57
48
|
## Guards
|
|
58
49
|
|
|
59
50
|
- Neither a `canon/` nor a `.claude/` directory: stop and name the command that sets one up
|
|
60
|
-
- No session divergence and no
|
|
51
|
+
- No session divergence and no diff a context entry could describe: stop with a pass, since both conditions have to hold
|
|
61
52
|
|
|
62
53
|
## Out of scope
|
|
63
54
|
|
|
64
|
-
-
|
|
65
|
-
-
|
|
66
|
-
-
|
|
67
|
-
-
|
|
55
|
+
- Marking a shipped task's outcomes, sweeping review receipts, and archiving a task, which `task-complete` owns
|
|
56
|
+
- Landing a page a teach promotion handoff carries, which `teach-workspace` owns in its fold mode
|
|
57
|
+
- Creating or declining a task file, which `task-board` owns
|
|
58
|
+
- Public-facing docs, which `docs-sync` owns. Both descriptions name their corpus in the trigger so a request saying only "sync the docs" lands on one of the pair rather than on either.
|
|
59
|
+
- Regenerating the context catalog, which a commit hook runs
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: context-fold
|
|
3
|
-
description: Folds a session into the project's context entries,
|
|
3
|
+
description: Folds a session's decisions and its diff into the project's context entries, then audits what it touched. Use when asked to "fold the session into context", "update the context entries", "refresh the context folder", when design or requirements changed mid-cycle, after a pivot, or before shipping. Do NOT use for `README.md` or `docs/`, which is `docs-sync`, or to mark a shipped task's outcomes on the board, which is `task-complete`.
|
|
4
4
|
metadata:
|
|
5
5
|
family: ship
|
|
6
6
|
---
|
|
@@ -11,11 +11,11 @@ metadata:
|
|
|
11
11
|
|
|
12
12
|
- If neither a `canon/` nor a `.claude/` directory exists, stop: `❌ No canon/ or .claude/ directory found. Run canon claude init to set up the workflow.`
|
|
13
13
|
|
|
14
|
-
The skip for a session that changed nothing lives at the end of Step 2, because it needs the diff to decide.
|
|
14
|
+
The skip for a session that changed nothing lives at the end of Step 2, because it needs the diff to decide.
|
|
15
15
|
|
|
16
16
|
## Diff baseline
|
|
17
17
|
|
|
18
|
-
Steps 2 and
|
|
18
|
+
Steps 2, 3, and 4 share one diff. Resolve the base ref once and reuse it:
|
|
19
19
|
|
|
20
20
|
```bash
|
|
21
21
|
git merge-base HEAD origin/main 2>/dev/null || git merge-base HEAD main 2>/dev/null
|
|
@@ -25,18 +25,13 @@ Take the union of `git diff --name-only <base> HEAD`, `git diff --name-only HEAD
|
|
|
25
25
|
|
|
26
26
|
Prefer `origin/main` over local `main`. On `main` itself the local ref resolves to HEAD, so every committed change drops out of the set and the skill goes blind to the work it is meant to read.
|
|
27
27
|
|
|
28
|
-
The baseline is unusable when no merge base resolves against either ref, or when the base came from local `main` and equals HEAD. On an unusable baseline, read `${CLAUDE_SKILL_DIR}/references/unusable-baseline.md` before Step
|
|
28
|
+
The baseline is unusable when no merge base resolves against either ref, or when the base came from local `main` and equals HEAD. On an unusable baseline, read `${CLAUDE_SKILL_DIR}/references/unusable-baseline.md` before Step 3 for the set that step takes instead.
|
|
29
29
|
|
|
30
|
-
## Step 1: read
|
|
30
|
+
## Step 1: read the context catalog
|
|
31
31
|
|
|
32
|
-
Read
|
|
32
|
+
Read `canon/context/index.md` from the current worktree root (`pwd`), not the main worktree root, to see which domain entries exist. Entries are tracked files and edits must commit with the branch. A project the surface move has not reached holds the folder under `.claude/` rather than `canon/`, so read and write it at whichever root already carries it.
|
|
33
33
|
|
|
34
|
-
|
|
35
|
-
- `canon/DESIGN.md`
|
|
36
|
-
|
|
37
|
-
Read the task board from the main worktree root instead, resolving that root the way `session-worktree` does. It is gitignored scratch and never commits with the branch:
|
|
38
|
-
|
|
39
|
-
- `.canon/tasks/index.md` first, then the task files this session touched. That narrow read serves the marking step, which is the only step here that opens a task file.
|
|
34
|
+
Read `canon/REQUIREMENTS.md` beside it when it exists, for the direction a session decision is measured against. This skill never writes it.
|
|
40
35
|
|
|
41
36
|
## Step 2: identify what changed
|
|
42
37
|
|
|
@@ -46,81 +41,41 @@ Review the session for decisions that diverged from the original plan:
|
|
|
46
41
|
|
|
47
42
|
- Requirements added, removed, or changed scope
|
|
48
43
|
- Technical decisions made or revised
|
|
49
|
-
- Design or UX decisions that differ from
|
|
50
|
-
- Tasks blocked or newly identified
|
|
51
|
-
|
|
52
|
-
Then resolve the diff baseline and match it against the board. From `.canon/tasks/index.md` at the main worktree root, pick the task files whose title or description relates to the changed paths and read the ones Step 1 skipped.
|
|
53
|
-
|
|
54
|
-
Path matching only chooses which files to open. Behavior decides each outcome. For each unchecked outcome, decide whether the diff shipped the behavior that outcome names.
|
|
55
|
-
|
|
56
|
-
Completion is the one judgment here that is a fact about the repository rather than a fact about the conversation, so the diff decides it and the session does not. Requirements, decisions, and design stay session-sourced.
|
|
57
|
-
|
|
58
|
-
Keep the match conservative:
|
|
44
|
+
- Design or UX decisions that differ from what the context entries state
|
|
59
45
|
|
|
60
|
-
|
|
61
|
-
- Match on the behavior an outcome describes, not on filenames or commit subjects. The path match above only narrowed which task files to open.
|
|
62
|
-
- Leave an outcome `[ ]` when the diff is ambiguous. An unmarked shipped outcome costs one manual edit, while a wrongly marked one hides work that never happened.
|
|
46
|
+
Then resolve the diff baseline and keep the changed paths for Step 3.
|
|
63
47
|
|
|
64
|
-
|
|
48
|
+
Stop when the session shows no divergence **and** the diff carries no path a context entry could describe, being a change confined to the task board, scratch, or files outside the repository's source and docs. Report `✅ No context updates needed. Session matched the original plan.` Both conditions have to hold, since a session-only skip would drop the diff-driven refresh for a mechanical change nobody narrated.
|
|
65
49
|
|
|
66
|
-
|
|
50
|
+
## Step 3: refresh context entries
|
|
67
51
|
|
|
68
|
-
|
|
52
|
+
Skip this step silently when `canon/context/` does not exist or its catalog lists no entries.
|
|
69
53
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
For each doc with relevant changes, apply updates following these rules. Read a standard this skill names, here or in a later step, from `${CLAUDE_SKILL_DIR}/../../standards/` when the project does not have it.
|
|
73
|
-
|
|
74
|
-
**`.canon/tasks/`**
|
|
75
|
-
|
|
76
|
-
- Mark completed outcomes `[x]` in the task's own file through `canon tasks outcome <stem> --close <n> --json`, repeating `--close` for each. Positions count every outcome checkbox in file order from 1, which the read above already gives. Do not move or archive the file.
|
|
77
|
-
- Write a newly identified task as its own file, following `${CLAUDE_SKILL_DIR}/../task-board/references/tasks.md` for the filename and frontmatter.
|
|
78
|
-
- Do not touch task files this session did not change.
|
|
79
|
-
- Never hand-edit `.canon/tasks/index.md`. A hook regenerates it.
|
|
80
|
-
|
|
81
|
-
The verb resolves the board at the main worktree root in-process, which is the route `session-worktree` states for an edit inside an existing main-root file.
|
|
82
|
-
|
|
83
|
-
Read `ok` and `reason` out of that record rather than the exit. An operator's shell profile may wrap `canon` in a function that runs the binary and then a second command and takes the second status, which flattens every non-zero exit to zero. A refusal arriving as success leaves the outcome unmarked while the chain moves on, so the board reports shipped work as open and the next session re-plans it.
|
|
54
|
+
Otherwise read `${CLAUDE_SKILL_DIR}/references/context-refresh.md` for the diff it reads, the widening a removed capability takes, when a new entry is created, and the output lines.
|
|
84
55
|
|
|
85
|
-
|
|
56
|
+
Write a session decision into the entry for the domain it constrains, under that entry's `## Decisions`, whatever other domains its reasoning touches. Every write follows these rules:
|
|
86
57
|
|
|
87
58
|
- Never write `canon/REQUIREMENTS.md`. Report a requirements change in After completion.
|
|
88
|
-
- Update only the sections affected by session decisions.
|
|
89
|
-
-
|
|
90
|
-
- Rewrite a restated or superseded statement in place rather than appending the replacement beside it. State the fact that stands and keep the earlier reasoning only where it is the alternative that lost, per `${CLAUDE_SKILL_DIR}/../../standards/context.md`.
|
|
59
|
+
- Update only the sections affected by session decisions or the diff, and leave unrelated sections alone.
|
|
60
|
+
- Rewrite a restated or superseded statement in place rather than appending the replacement beside it. State the fact that stands and keep the earlier reasoning only where it is the alternative that lost, per `${CLAUDE_SKILL_DIR}/references/context.md`.
|
|
91
61
|
- Follow `${CLAUDE_SKILL_DIR}/../markdown-craft/references/markdown.md` and the `write-human` skill for all edits.
|
|
92
|
-
- Write a session decision into the `canon/context/` entry for the domain it constrains, under that entry's `## Decisions`, whatever other domains its reasoning touches.
|
|
93
62
|
|
|
94
63
|
Write each updated file immediately. Claude Code's tool permission dialog is the confirmation gate. Do not wait for user input.
|
|
95
64
|
|
|
96
|
-
## Step 4:
|
|
65
|
+
## Step 4: audit what the fold touched
|
|
97
66
|
|
|
98
|
-
|
|
67
|
+
Run the structural audit, then the content classifier, and answer both before the report.
|
|
99
68
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
## Step 5: refresh context entries
|
|
105
|
-
|
|
106
|
-
Read `canon/context/index.md` at `pwd` to see which domain entries exist. Skip this step silently if the directory does not exist or has no entries.
|
|
107
|
-
|
|
108
|
-
Otherwise read `${CLAUDE_SKILL_DIR}/references/context-refresh.md` for the diff it reads, the widening a removed capability takes, when a new entry is created, and the output lines.
|
|
109
|
-
|
|
110
|
-
## Step 6: fold promoted pages
|
|
111
|
-
|
|
112
|
-
Skip this step silently when no teach promotion handoff exists at `.canon/tmp/handoff/teach-promotion/<slug>.md` at the main worktree root, deriving `<slug>` per `${CLAUDE_SKILL_DIR}/../../standards/slug.md` with the `latest` fallback. Otherwise read `${CLAUDE_SKILL_DIR}/references/promoted-pages.md` for how each block lands, the handoff delete, and the output lines.
|
|
113
|
-
|
|
114
|
-
## Step 7: sweep consumed receipts
|
|
115
|
-
|
|
116
|
-
Read `${CLAUDE_SKILL_DIR}/references/receipt-sweep.md` for which review receipts this session sweeps, which it keeps, and the output lines. Skip this step silently when nothing qualifies.
|
|
69
|
+
```bash
|
|
70
|
+
canon context audit --json
|
|
71
|
+
```
|
|
117
72
|
|
|
118
|
-
|
|
73
|
+
The verb takes a project root rather than a file list, so it reports the whole folder. Report only the findings whose `rel` names a file Step 3 wrote this run or a file the diff carries, one line each as `⚠ Audit: <rel>, <finding>`, and leave the rest unreported, since a finding in an entry this run never touched belongs to whoever next edits it. Repair a finding in a file Step 3 wrote this run when the fix is inside what it already rewrote, such as a bare reference or a missing section it dropped. Report a missing subcommand or a refusal as `⚠ Audit: <message>` and continue.
|
|
119
74
|
|
|
120
|
-
Skip
|
|
75
|
+
Then classify. Skip the classifier only when the Diff baseline section could not resolve a base ref at all, reporting `⚠ No diff to scope against. Skipped the classify check.` The verb needs a resolvable ref to run against, which is the one condition it cannot answer for itself.
|
|
121
76
|
|
|
122
|
-
Otherwise read `${CLAUDE_SKILL_DIR}/references/classify.md` for the invocation, its scope, the record fields, applying a finding, the one-line keep reason, the unreachable and missing-subcommand lines, and the report shape. `${CLAUDE_SKILL_DIR}` names this skill's own directory, resolved once when the skill loaded
|
|
77
|
+
Otherwise read `${CLAUDE_SKILL_DIR}/references/classify.md` for the invocation, its scope, the record fields, applying a finding, the one-line keep reason, the unreachable and missing-subcommand lines, and the report shape. `${CLAUDE_SKILL_DIR}` names this skill's own directory, resolved once when the skill loaded. Read the reference by that resolved path rather than guessing a `.claude/skills/context-fold/references/classify.md` path from the toolkit's install-time layout, which is a different root than the one this skill's own files live under. The invocation is `canon context classify diff --base <base> --json`, and it runs whether or not that reference resolves. Findings never stop the fold.
|
|
123
78
|
|
|
124
79
|
## After completion
|
|
125
80
|
|
|
126
|
-
Read `${CLAUDE_SKILL_DIR}/references/completion-report.md` before printing anything, for the line each outcome prints, the lines Step
|
|
81
|
+
Read `${CLAUDE_SKILL_DIR}/references/completion-report.md` before printing anything, for the line each outcome prints, the lines Step 2 and Step 4 add, and when the closing line is suppressed.
|
|
@@ -5,7 +5,7 @@ description: The classify diff invocation, the record fields to read, applying a
|
|
|
5
5
|
|
|
6
6
|
# Classify the fold's diff baseline
|
|
7
7
|
|
|
8
|
-
Mechanics for Step
|
|
8
|
+
Mechanics for the classify half of Step 4 of `context-fold`. The body owns the skip condition and the shared baseline, and this file owns the invocation, what the record carries, and what applying a finding does.
|
|
9
9
|
|
|
10
10
|
## Invocation
|
|
11
11
|
|
|
@@ -30,14 +30,14 @@ Each finding carries `file`, a `verdict` of `KEEP`, `REPLACE`, `HISTORY`, or `MO
|
|
|
30
30
|
|
|
31
31
|
## Scope
|
|
32
32
|
|
|
33
|
-
Answer every non-`KEEP` finding the verb returns, not only the files Step 3
|
|
33
|
+
Answer every non-`KEEP` finding the verb returns, not only the files Step 3 wrote this run. A branch carrying earlier commits from a prior session has doc edits the fold is equally responsible for, and the verb's own extraction already scopes to canonical doc types and reports nothing when the range carries none, so there is no narrower check to add here.
|
|
34
34
|
|
|
35
35
|
## Applying a finding
|
|
36
36
|
|
|
37
37
|
Locate the finding by its `quote` in the file's current content. The quote is often a narrow fragment rather than the whole clause it sits in, since the regex layer's own match is a short pattern hit, so the edit below targets the sentence or bullet the quote sits in rather than the literal substring alone.
|
|
38
38
|
|
|
39
39
|
- **Found exactly once.** Apply the verdict:
|
|
40
|
-
- `REPLACE`: rewrite the sentence or bullet carrying the quote in place with the fact that now stands, per Step 3
|
|
40
|
+
- `REPLACE`: rewrite the sentence or bullet carrying the quote in place with the fact that now stands, per Step 3's rewrite-in-place rule. State what is current and drop what the quote restated, in the one edit.
|
|
41
41
|
- `HISTORY`: rewrite the sentence or bullet carrying the quote to drop the narration and keep any current fact the same clause states. The quote narrates how the fact arrived rather than stating the fact, which a canonical doc excludes regardless of what wrote it, and a literal cut of the fragment alone would leave the rest of the clause grammatically stranded.
|
|
42
42
|
- `MOVE`: do not cut. The verdict means correct content sitting on the wrong surface, such as a rule written into a context entry that belongs in a path-scoped rule, and only the model layer returns it. Cutting would delete content a fold with no model configured would never have flagged at all. Report the finding instead, naming the surface the `reason` names as where the content belongs, and leave the file unedited.
|
|
43
43
|
- **Found more than once, or not found at all.** Report that the finding could not be located rather than guessing which occurrence or rewriting nothing silently. A model verdict paraphrasing the quote it read is the ordinary way this happens.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: Completion report
|
|
3
|
-
description: The lines context-fold prints once every step has run, being one per file updated, the direction-change note, Step
|
|
3
|
+
description: The lines context-fold prints once every step has run, being one per file updated, the direction-change note, Step 4's audit and classify lines, and the closing line with when it is suppressed
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Completion report
|
|
@@ -13,10 +13,10 @@ Output one line per file updated:
|
|
|
13
13
|
|
|
14
14
|
When Step 2 noted a requirements change: `↪ Direction changed this session: run document-health on canon/REQUIREMENTS.md`
|
|
15
15
|
|
|
16
|
-
Step
|
|
16
|
+
Step 4 adds one `⚠ Audit:` line per audit finding it reported, in the shape the body gives. Its classify half adds its own lines when it applied or reported a finding, in the exact shape `${CLAUDE_SKILL_DIR}/references/classify.md` gives them under its own Report section. Do not shorten or paraphrase those lines here or in the reply, since the quote and the reason are what a reader checks the finding against.
|
|
17
17
|
|
|
18
|
-
If no files were updated and
|
|
18
|
+
If no files were updated and Step 4 reported nothing, output:
|
|
19
19
|
|
|
20
20
|
`✅ No changes needed.`
|
|
21
21
|
|
|
22
|
-
Suppress that line when Step 2 already reported no
|
|
22
|
+
Suppress that line when Step 2 already reported no context updates. It closes the run on its own, and emitting both leaves a quiet session reporting success twice for one outcome.
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: Refresh context entries
|
|
3
|
-
description: How context-fold Step
|
|
3
|
+
description: How context-fold Step 3 folds diff-scoped rewrites into canon/context entries, when it creates an entry, and the lines it reports
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Refresh context entries
|
|
7
7
|
|
|
8
|
-
Step
|
|
8
|
+
Step 3 of `context-fold`, reached in order once `canon/context/index.md` lists at least one entry.
|
|
9
9
|
|
|
10
10
|
The diff carries what the repository changed, and this step rewrites against it.
|
|
11
11
|
|
|
@@ -15,8 +15,8 @@ Reuse the diff from the baseline above, names and content both. For each domain
|
|
|
15
15
|
|
|
16
16
|
- Map the entry's section headings, whether they sit in one flat file or spread across a nested domain's sibling files, to the changed files. An entry is relevant when its prose references files, modules, or decisions touched by the diff.
|
|
17
17
|
- For each relevant entry, rewrite only the sections affected by the diff. Same pattern as `docs-sync`. Do not touch unrelated sections. Never rewrite a split domain's own `index.md` directly, since a regen overwrites it the same way it overwrites the top-level catalog. Rewrite the sibling file the affected section actually lives in instead.
|
|
18
|
-
- Rewrite a restated or superseded statement in place rather than appending beside it, the same rule
|
|
19
|
-
- Write a reference to another entry as the path that entry sits at, rather than as its bare filename. `${CLAUDE_SKILL_DIR}
|
|
18
|
+
- Rewrite a restated or superseded statement in place rather than appending beside it, the same rule the body states for a session decision.
|
|
19
|
+
- Write a reference to another entry as the path that entry sits at, rather than as its bare filename. `${CLAUDE_SKILL_DIR}/references/context.md` states the form, and a bare name strands the reference once a domain splits into subfolders.
|
|
20
20
|
|
|
21
21
|
## When the diff removes a capability
|
|
22
22
|
|
|
@@ -29,7 +29,7 @@ Grep the tree for the name that went, rather than for the paths the diff carries
|
|
|
29
29
|
|
|
30
30
|
Report each hit as an ordinary rewrite.
|
|
31
31
|
|
|
32
|
-
Create a new entry only for a domain `canon/context/index.md` already lists but carries no file for, following `${CLAUDE_SKILL_DIR}
|
|
32
|
+
Create a new entry only for a domain `canon/context/index.md` already lists but carries no file for, following `${CLAUDE_SKILL_DIR}/references/context.md` for its shape. Before treating a domain as carrying no file, confirm it holds no entry under either spelling, `canon/context/<domain>.md` or `canon/context/<domain>/index.md`, since a domain already split into a folder still passes a check that only looked for the flat file. A row in the catalog is the deliberate decision, taken by whoever added it. This step only fills in what that decision left open, and only until the next `canon indexes regen` pass, which rebuilds the catalog from each entry's own frontmatter plus every sibling's and drops a row whose file still does not exist. Create the file before that regen runs, or the row this bar exists to fill in is gone. A domain the catalog does not list at all is a different case: report it and stop, rather than creating an entry or a catalog row for it.
|
|
33
33
|
|
|
34
34
|
Write each updated entry immediately. Output one line per file, naming the path this run actually wrote rather than always the flat template:
|
|
35
35
|
|
|
@@ -1,17 +1,28 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: Context entry reference
|
|
3
3
|
description: Shape and content rules for canon/context/<domain>.md entries
|
|
4
|
-
paths:
|
|
5
|
-
- 'canon/context/**'
|
|
6
|
-
rule:
|
|
7
|
-
- 'Before non-trivial work in a domain, read its `canon/context/<domain>.md` entry. Use `canon/context/index.md` to find it.'
|
|
8
|
-
- 'Leave the entry conforming when work in its domain changes what it describes.'
|
|
9
4
|
---
|
|
10
5
|
|
|
11
6
|
# Context entry reference
|
|
12
7
|
|
|
13
8
|
Applies to per-domain narrative entries under `canon/context/`. Skip for `index.md`, which is regenerated by `canon indexes regen`.
|
|
14
9
|
|
|
10
|
+
## Contents
|
|
11
|
+
|
|
12
|
+
- [Scope](#scope)
|
|
13
|
+
- [Organizing principle](#organizing-principle)
|
|
14
|
+
- [What a working entry looks like](#what-a-working-entry-looks-like)
|
|
15
|
+
- [Frontmatter](#frontmatter)
|
|
16
|
+
- [Required sections](#required-sections)
|
|
17
|
+
- [Expected sections](#expected-sections)
|
|
18
|
+
- [Optional sections](#optional-sections)
|
|
19
|
+
- [Ordering](#ordering)
|
|
20
|
+
- [The development entry](#the-development-entry)
|
|
21
|
+
- [What goes in](#what-goes-in)
|
|
22
|
+
- [What does not go in](#what-does-not-go-in)
|
|
23
|
+
- [Length](#length)
|
|
24
|
+
- [Examples](#examples)
|
|
25
|
+
|
|
15
26
|
## Scope
|
|
16
27
|
|
|
17
28
|
Governs per-domain narrative entries under `canon/context/`: their structure, the decisions and gotchas they carry, and what they leave to the code.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: An unusable diff baseline
|
|
3
|
-
description: When context-fold's diff baseline is unusable,
|
|
3
|
+
description: When context-fold's diff baseline is unusable, why Step 3 keeps the scoped set rather than the whole tree
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# An unusable diff baseline
|
|
@@ -14,10 +14,8 @@ The baseline is unusable in two cases:
|
|
|
14
14
|
|
|
15
15
|
An unusable baseline costs only the committed half. `git diff <base> HEAD` is empty by definition once the base equals HEAD, while `git diff HEAD` and `git ls-files --others --exclude-standard` still report uncommitted and untracked work at correct scope.
|
|
16
16
|
|
|
17
|
-
**Step
|
|
17
|
+
**Step 3 keeps the scoped set.** Run it on the working tree and untracked files alone, and skip only when that set comes out empty, reporting the warning its own reference names.
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
Never substitute the whole tree for a missing baseline, and do not reuse Step 2's commit read in Step 5 for consistency. On a fresh `git init` project the last commit is the scaffold commit, so `git log -p -1` is the whole tree by another route. Step 2 tolerates that because it only reads, and it matches conservatively against outcomes already on the board. Step 5 writes, so the same set rewrites every context entry that tree touches.
|
|
19
|
+
Never substitute the whole tree for a missing baseline, and do not widen to `git log -p -1` for coverage. On a fresh `git init` project the last commit is the scaffold commit, so that read is the whole tree by another route, and Step 3 writes, so the same set rewrites every context entry that tree touches. `task-complete` takes the widened read for its marking step, which only reads and matches conservatively against outcomes already on the board.
|
|
22
20
|
|
|
23
21
|
Widening what a step reads is safe. Widening what a step writes is not.
|
|
@@ -45,7 +45,7 @@ A project-authored rule numbers in `900-999`, the band reserved for one. `000-89
|
|
|
45
45
|
|
|
46
46
|
## Step 4: write the rule
|
|
47
47
|
|
|
48
|
-
Read `${CLAUDE_SKILL_DIR}
|
|
48
|
+
Read `${CLAUDE_SKILL_DIR}/references/rule.md` for frontmatter, body shape, and voice before writing the body. Do not work the shape from memory.
|
|
49
49
|
|
|
50
50
|
Write `.claude/rules/project/<subdir>/<n>-<slug>.md` where `<slug>` is a 1-to-3-word kebab topic. Preview the resolved path, subdir, number, and frontmatter, then write immediately. The tool permission dialog is the confirmation gate.
|
|
51
51
|
|
|
@@ -66,8 +66,8 @@ paths:
|
|
|
66
66
|
- <imperative rule>
|
|
67
67
|
```
|
|
68
68
|
|
|
69
|
-
Title casing is sentence case, with proper nouns keeping their own casing (`# TypeScript standards`). `${CLAUDE_SKILL_DIR}
|
|
69
|
+
Title casing is sentence case, with proper nouns keeping their own casing (`# TypeScript standards`). `${CLAUDE_SKILL_DIR}/references/rule.md` owns the rest of the body shape.
|
|
70
70
|
|
|
71
71
|
## After writing
|
|
72
72
|
|
|
73
|
-
Emit the full path on its own line: `.claude/rules/project/<subdir>/<n>-<slug>.md`. Remind the user that Claude Code loads path-scoped rules when it reads a matching file, and always-on rules every session.
|
|
73
|
+
Emit the full path on its own line: `.claude/rules/project/<subdir>/<n>-<slug>.md`. Remind the user that Claude Code loads path-scoped rules when it reads or writes a matching file, and always-on rules every session.
|
|
@@ -1,19 +1,29 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: Governance rule reference
|
|
3
3
|
description: Rule frontmatter, body shape, and voice for .claude/rules files
|
|
4
|
-
paths:
|
|
5
|
-
- '.claude/rules/**/*.md'
|
|
6
|
-
rule:
|
|
7
|
-
- 'Read it before writing or editing a rule. Do not work the shape from memory.'
|
|
8
4
|
---
|
|
9
5
|
|
|
10
6
|
# Governance rule reference
|
|
11
7
|
|
|
8
|
+
## Contents
|
|
9
|
+
|
|
10
|
+
- [Overview](#overview)
|
|
11
|
+
- [Scope](#scope)
|
|
12
|
+
- [Whether a skill belongs behind the rule](#whether-a-skill-belongs-behind-the-rule)
|
|
13
|
+
- [Location](#location)
|
|
14
|
+
- [Reserved numbers](#reserved-numbers)
|
|
15
|
+
- [Two sources numbering into one folder](#two-sources-numbering-into-one-folder)
|
|
16
|
+
- [Frontmatter](#frontmatter)
|
|
17
|
+
- [Body](#body)
|
|
18
|
+
- [Examples](#examples)
|
|
19
|
+
|
|
12
20
|
## Overview
|
|
13
21
|
|
|
14
22
|
Rules give Claude Code coding constraints scoped to file paths. Claude Code discovers `.claude/rules/**/*.md` at session start.
|
|
15
23
|
|
|
16
|
-
A rule with no `paths:` field always applies, at the same priority as `CLAUDE.md`. A rule with `paths:` applies when Claude reads a file matching the glob. Author one rule per topic so the scope stays precise.
|
|
24
|
+
A rule with no `paths:` field always applies, at the same priority as `CLAUDE.md`. A rule with `paths:` applies when Claude reads or writes a file matching the glob. Author one rule per topic so the scope stays precise.
|
|
25
|
+
|
|
26
|
+
A rule with `paths:` loads on a read or a write of a matching file, inside a linked worktree as in the main one. A session creating the first matching file gets the rule only after that write lands, so a rule meant to shape new files also belongs in the skill or the always-on rule a session reads before it writes. Revisit when Claude Code loads a path-scoped rule before a write to a matching path. Re-measure with two headless `claude -p` runs in a linked worktree, one reading a matching file and one reading a file that does not match, each asking whether the rule's content is in context.
|
|
17
27
|
|
|
18
28
|
## Scope
|
|
19
29
|
|
|
@@ -41,7 +51,6 @@ Write both when both apply. A rule stating the directive and a skill stating how
|
|
|
41
51
|
- A rule the project authored itself lives at `.claude/rules/project/<subdirectory>/<n>-<slug>.md`, a sibling of `canon/` rather than nested inside it, keeping the same subdirectory names
|
|
42
52
|
- This repository's own toolkit-only rules, which never ship to a target, live at `.claude/rules/internal/<subdirectory>/<n>-<slug>.md`, a second sibling of `canon/`. See "Two sources numbering into one folder" below.
|
|
43
53
|
- Give every authored rule a numeric prefix. A bare-word filename reads as a folder name where a stack names its rules, so a rule without one is unreachable from a stack entry.
|
|
44
|
-
- A rule that only routes a path to a standard is generated, not authored. It lives at `governance/rules/standards/<standard>.md` under the standard's name, carries no number, and installs to `.claude/rules/canon/standards/`. Never hand-edit one. Change its globs and bullets in the standard's `paths` and `rule` frontmatter, and `canon gov regen` rewrites it. The generator refuses a standard named like a band folder, which keeps the bare-word name reachable.
|
|
45
54
|
|
|
46
55
|
## Reserved numbers
|
|
47
56
|
|
|
@@ -9,7 +9,7 @@ metadata:
|
|
|
9
9
|
|
|
10
10
|
Read these files in parallel:
|
|
11
11
|
|
|
12
|
-
- `${CLAUDE_SKILL_DIR}
|
|
12
|
+
- `${CLAUDE_SKILL_DIR}/references/skill.md`: skill structure, skill types, frontmatter fields, invocation rules
|
|
13
13
|
- `${CLAUDE_SKILL_DIR}/references/skill-requirement.md`: what `REQUIREMENT.md` must answer, its sections, and its template
|
|
14
14
|
- `${CLAUDE_SKILL_DIR}/references/skill-paths.md`: which root a path in the body resolves against, and how the body cites a standard
|
|
15
15
|
- `${CLAUDE_SKILL_DIR}/../markdown-craft/references/markdown.md`: punctuation and formatting for skill body text
|
|
@@ -18,7 +18,7 @@ Read these files in parallel:
|
|
|
18
18
|
|
|
19
19
|
## Guards
|
|
20
20
|
|
|
21
|
-
- If `${CLAUDE_SKILL_DIR}
|
|
21
|
+
- If `${CLAUDE_SKILL_DIR}/references/skill.md` is not present, stop: `❌ skill.md standard not found. Reinstall the canon plugin.`
|
|
22
22
|
|
|
23
23
|
## Steps
|
|
24
24
|
|
|
@@ -1,22 +1,25 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: Claude skill reference
|
|
3
3
|
description: Skill structure and authoring rules for Claude Code
|
|
4
|
-
paths:
|
|
5
|
-
- '.claude/skills/**/SKILL.md'
|
|
6
|
-
- 'claude/skills/**/SKILL.md'
|
|
7
|
-
- '.claude/skills/**/REQUIREMENT.md'
|
|
8
|
-
- 'claude/skills/**/REQUIREMENT.md'
|
|
9
|
-
rule:
|
|
10
|
-
- "Confirm `canon:create-skill`'s two creation-time questions are answered before a new `SKILL.md` lands, whether drafted by hand, by another skill, or by `canon:create-skill` itself. Carry the third question into the sibling `REQUIREMENT.md`'s `Must not` section as a review criterion rather than a gate."
|
|
11
|
-
- 'Report it rather than proceeding silently when `canon:create-skill` does not resolve. It ships with the plugin and this rule ships with the CLI, so a project that installed governance alone does not have it.'
|
|
12
|
-
- 'Re-read a skill body this session edited before invoking that skill again in the same session'
|
|
13
|
-
- 'Do not read a resolved file path in a held body as evidence the body is current'
|
|
14
|
-
- 'Follow the skill requirement standard for the shape a `REQUIREMENT.md` states. Read it with `canon standards skill-requirement`.'
|
|
15
|
-
- 'Follow the skill path standard for which root a path in a body resolves against and how a body cites a standard. Read it with `canon standards skill-paths`.'
|
|
16
4
|
---
|
|
17
5
|
|
|
18
6
|
# Claude skill reference
|
|
19
7
|
|
|
8
|
+
## Contents
|
|
9
|
+
|
|
10
|
+
- [Overview](#overview)
|
|
11
|
+
- [Scope](#scope)
|
|
12
|
+
- [Changing a skill](#changing-a-skill)
|
|
13
|
+
- [Whether a rule belongs beside the skill](#whether-a-rule-belongs-beside-the-skill)
|
|
14
|
+
- [Skill types](#skill-types)
|
|
15
|
+
- [Structure](#structure)
|
|
16
|
+
- [Frontmatter](#frontmatter)
|
|
17
|
+
- [Description](#description)
|
|
18
|
+
- [Body](#body)
|
|
19
|
+
- [Scripts](#scripts)
|
|
20
|
+
- [Invocation](#invocation)
|
|
21
|
+
- [Examples](#examples)
|
|
22
|
+
|
|
20
23
|
## Overview
|
|
21
24
|
|
|
22
25
|
Skills give Claude Code domain-specific constraints and rules inline, so it can act immediately without reading all docs.
|
|
@@ -34,7 +37,7 @@ Does not govern:
|
|
|
34
37
|
- Voice, rhythm, and sentence construction in a skill body: the `write-human` skill
|
|
35
38
|
- Punctuation, formatting, and word choice in a skill body: `markdown.md`
|
|
36
39
|
- The transform from a branch name to a slug a skill carries in a filename: `slug.md`
|
|
37
|
-
- Whether a new skill earns its place: the three-question test in the `create-skill` skill and the creation-time bullet in
|
|
40
|
+
- Whether a new skill earns its place: the three-question test in the `create-skill` skill and the creation-time bullet in the `skill` governance rule
|
|
38
41
|
|
|
39
42
|
## Changing a skill
|
|
40
43
|
|
|
@@ -47,7 +50,7 @@ Answer all four before editing, and carry the answers into wherever the change i
|
|
|
47
50
|
|
|
48
51
|
## Whether a rule belongs beside the skill
|
|
49
52
|
|
|
50
|
-
A skill fires when a session invokes it or its description matches the request. A path-scoped rule fires when a session reads a file matching its glob, with no decision from the session at all. The rule is the floor and the skill is the depth.
|
|
53
|
+
A skill fires when a session invokes it or its description matches the request. A path-scoped rule fires when a session reads or writes a file matching its glob, with no decision from the session at all. The rule is the floor and the skill is the depth.
|
|
51
54
|
|
|
52
55
|
Run the two-part test over what the body states before calling the skill finished. Does the invariant fire when a specific path is edited, and does violating it ship silently? An invariant passing both halves belongs in a rule as well, since a session that never invoked the skill still edits that path. An invariant failing either half stays here, which is most of a body.
|
|
53
56
|
|
|
@@ -133,7 +136,7 @@ allowed-tools: <tools required>
|
|
|
133
136
|
- Name every file under `references/` in the body at the point a session reads it, since an unnamed reference is never loaded.
|
|
134
137
|
- Open a file under `references/` running over 100 lines with a `## Contents` H2 of anchor links after its H1 and intro, so a session that reads only the top of the file still sees everything it holds.
|
|
135
138
|
- Keep the trigger, the skip condition, and the guard in the body. A run that never reaches the block has to decide that without opening the reference.
|
|
136
|
-
-
|
|
139
|
+
- Point one skill at a sibling skill's reference by the form `skill-paths.md` states, `${CLAUDE_SKILL_DIR}/../<skill>/references/<name>.md`, and name the owner rather than copying the file.
|
|
137
140
|
|
|
138
141
|
### Reading and running commands
|
|
139
142
|
|
|
@@ -15,7 +15,7 @@ The instruction against that already existed. `draft-and-pick` Step 1 says to na
|
|
|
15
15
|
|
|
16
16
|
The second half is the output itself. A model with no stated direction draws the population average of its training data, which produces interfaces that satisfy every craft rule and still read templated.
|
|
17
17
|
|
|
18
|
-
Prose is already governed in two halves and design is governed in neither. The character bans ship as data a command reads, and the shapes no closed word set can match needed a skill of their own, because each is a pattern rather than a token. `
|
|
18
|
+
Prose is already governed in two halves and design is governed in neither. The character bans ship as data a command reads, and the shapes no closed word set can match needed a skill of their own, because each is a pattern rather than a token. `claude/skills/canvas-board/references/design.md` governs the shape of a project's design document and is silent on whether its values are any good.
|
|
19
19
|
|
|
20
20
|
Importing an external catalog wholesale fails on what those catalogs turn out to carry. The largest is 1,206 lines in one file, pinned to one framework, one styling library and one animation package, and it scopes itself out of dashboards, data tables and multi-step product UI. A second bans default fonts by name and prescribes a component library.
|
|
21
21
|
|
|
@@ -56,7 +56,7 @@ A rule failing any of the four is recorded as considered and declined rather tha
|
|
|
56
56
|
- Express intensity as a numeric scale. A session picks a middle value and reports compliance, which satisfies the rule and decides nothing.
|
|
57
57
|
- Claim the reported failure is closed. Nothing measures whether a round follows these rules, so this skill states them and the measurement is owed separately.
|
|
58
58
|
- Duplicate a rule a surface already states for itself, such as slide layout or terminal color, where pointing at that surface is the whole of the correct answer
|
|
59
|
-
- Be reached only by an author typing its name. `
|
|
59
|
+
- Be reached only by an author typing its name. `claude/skills/create-skill/references/skill.md` makes this a review criterion rather than a check, since nothing answers it before the skill has run. The intended non-author caller is the declared read in `draft-and-pick`'s output. A round producing no read, with this skill never loaded, is the evidence that the description's triggers are too weak.
|
|
60
60
|
|
|
61
61
|
## Guards
|
|
62
62
|
|
|
@@ -71,6 +71,6 @@ A rule failing any of the four is recorded as considered and declined rather tha
|
|
|
71
71
|
- Validation timing, error placement and save blocking, which `420-forms` owns
|
|
72
72
|
- Rendered copy casing, button labels and error wording, which `400-ui` owns
|
|
73
73
|
- The candidate loop, the arm set, the render and the pick, which `draft-and-pick` owns and which this skill is loaded alongside rather than inside
|
|
74
|
-
- The shape of the project's design document, its sections and its token tables, which `
|
|
74
|
+
- The shape of the project's design document, its sections and its token tables, which `claude/skills/canvas-board/references/design.md` governs
|
|
75
75
|
- Prose on the surface being designed, which `write-human` and `markdown.md` govern between them
|
|
76
76
|
- Measuring whether finished output followed these rules, which needs a check this skill does not carry and which no command reaches while a render is an image rather than a parse
|
|
@@ -145,6 +145,6 @@ Run `${CLAUDE_SKILL_DIR}/references/preflight.md` against the output. It is the
|
|
|
145
145
|
- States, empty and loading coverage, destructive confirmation, truncation: the same rules
|
|
146
146
|
- Rendered copy casing, button labels, error message shape: the same rules
|
|
147
147
|
- The candidate loop, the arm set, the render, and the pick: `draft-and-pick`
|
|
148
|
-
- The shape of the project's design document and its token tables: `${CLAUDE_SKILL_DIR}
|
|
148
|
+
- The shape of the project's design document and its token tables: `${CLAUDE_SKILL_DIR}/../canvas-board/references/design.md`
|
|
149
149
|
- Reading source for roughness: `ux-audit`. Measuring what a running interface costs to paint: `ux-measure`
|
|
150
150
|
- Prose on the surface being designed: the `write-human` skill
|