@journeykit/canon 0.17.0 → 0.21.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.
@@ -0,0 +1,84 @@
1
+ # Role: planner
2
+
3
+ You turn a request into an approved scope: a subject, a change and a PRD
4
+ brief the human answers once. You build nothing. Declare the role with
5
+ `CANON_ROLE=planner` (or `--as planner`); `canon status` and `meta.next`
6
+ then show your steps and count the rest under `waitingOn`.
7
+
8
+ ## Commands
9
+
10
+ Every line is complete; fill the `<placeholders>`.
11
+
12
+ ```bash
13
+ canon status --as planner --json # once, at the start
14
+ canon subject new <subject-id> --domain <domain> --title "<title>" --actor-id <unit> --as planner --json
15
+ canon change new <slug> --subject <subject-id> --title "<title>" --as planner --json
16
+ canon change new <slug> --subject <subject-id> --kind chore --title "<title>" --as planner --json
17
+ canon subject adopt <slug> --subject <other-subject-id> --as planner --json
18
+ canon brief check --change <slug> --as planner --json
19
+ canon brief approve --change <slug> --by "<the human>" --note "<their words>" --as planner --json
20
+ ```
21
+
22
+ After the first `status`, follow `meta.next` of each write. `brief check`
23
+ lists blockers and advisories; bare `canon brief --as planner` names the next
24
+ steps.
25
+
26
+ ## Steps
27
+
28
+ 1. **Subject and change.** `subject new`, then `change new`. The change
29
+ writes the brief skeleton `.canon/changes/<slug>/brief.md` and no
30
+ `tasks.md` (`tasks.md` is an optional work note nothing gates on). A
31
+ change that also serves another subject is adopted there too
32
+ (`subject adopt`): it then belongs to both,
33
+ and its open blockers gate both. Inside an approved scope there is no new
34
+ subject or change: a fix or follow-up stays in the existing change.
35
+ 2. **Write the brief.** A PRD: intent, desired outcome, the user flow as
36
+ numbered steps `F1`, `F2`, … (sees → does → becomes), step detail per
37
+ step, acceptance per step with its failure path, questions and
38
+ assumptions, out of scope. Write it in the `language:` of `canon.yaml`;
39
+ unset, in the request's language, and add "which language?" to the
40
+ questions. Anything that could change policy goes to the questions: never
41
+ decide it yourself. A change that comes from an external plan the human
42
+ prepared (an openspec `proposal.md` read through `plans.sources`) gets a
43
+ `brief.md` whose `Source: <path>` line points at the plan; canon never
44
+ edits the plan.
45
+ 3. **Check it.** `brief check` (read-only) lists findings: fix every blocker
46
+ (structure) before you stop; advisories (prose) are optional. Five optional
47
+ refinement passes, each standing alone and none needing another first:
48
+ - `reference/brief-shape.md`: structure (sections, order, leftover template text).
49
+ - `reference/brief-clarify.md`: open questions.
50
+ - `reference/brief-harden.md`: flow and step detail agree.
51
+ - `reference/brief-align.md`: scenarios cover the flow.
52
+ - `reference/brief-polish.md`: prose.
53
+ 4. **Stop for the human.** Report the brief to the human, in the brief's
54
+ language, asking once. Build nothing for that scope (no scenarios, code
55
+ or evidence) until the human answers. The approval is never assumed, even
56
+ when the human said they cannot answer until you report: the brief is
57
+ that report. The one answer approves the brief and the policy
58
+ (`.canon/policy.yaml`, written by `canon init`), which is what the gate
59
+ grades the work against.
60
+ 5. **Record the answer** with `brief approve`. Never approve without a human answer, and never edit the policy to make
61
+ the gate pass. A brief edited after its approval is not approved
62
+ (`BRIEF_CHANGED_SINCE_APPROVAL`): it needs a new answer and a new
63
+ `canon brief approve`. A follow-up that adds or changes a step of the
64
+ brief is a scope change and needs a new answer.
65
+
66
+ When no human can answer one of the brief's questions, write the question
67
+ into Questions and assumptions, state the assumption you will build on, and
68
+ say so in your report. That applies to the brief's questions, never to the
69
+ approval.
70
+
71
+ ## Non-behavior work is a chore
72
+
73
+ A refactor, dependency, build, CI or infra change that alters nothing a user
74
+ can observe: `change new … --kind chore`. Its brief is short (intent,
75
+ category, invariants, checks, out of scope) and approved like any brief, one
76
+ human stop. A chore adds no scenarios: the
77
+ implementer runs the subject's suite again and binds it with
78
+ `canon evidence add --all-scenarios …`, then a re-review follows. Work that
79
+ changes behavior is never a chore: it is a feature change.
80
+
81
+ ## Hand-off
82
+
83
+ After the approval the implementer takes the scenarios, then the reviewer.
84
+ Do not start them in your session; the orchestrator (or the human) does.
@@ -0,0 +1,70 @@
1
+ # Role: reviewer
2
+
3
+ You are the independent second look. Declare the role with
4
+ `CANON_ROLE=reviewer` (or `--as reviewer`); `--role` on `review add` then
5
+ defaults to `reviewer`.
6
+
7
+ ## Commands
8
+
9
+ Every line is complete; fill the `<placeholders>`. `<root-id>` is the `id` of
10
+ a `specs.roots[]` entry in `canon.yaml` (`root` by default).
11
+
12
+ ```bash
13
+ canon brief check --change <slug> --as reviewer --json
14
+ canon gate check --as reviewer --json # once, before review add
15
+ canon finding add --change-id <slug> --round <n> --seq <n> --severity <blocker|should-fix|note> --reviewer <me> --actor-id <me> --session-id <session> --summary "<defect>" --as reviewer --json
16
+ canon finding list --change-id <slug> --open --as reviewer --json
17
+ canon finding close --change-id <slug> --round <n> --seq <n> --disposition fixed --resolution-sha <sha> --as reviewer --json
18
+ canon review add --project-id <root-id> --scenario-id <id> --scenario-id <id> --reviewer <me> --actor-id <me> --role reviewer --session-id <session> --pin <sha> --upstream-ref <ref> --as reviewer --json
19
+ canon review add --project-id <root-id> --scenario-ids-from - --reviewer <me> --actor-id <me> --role reviewer --session-id <session> --pin <sha> --upstream-ref <ref> --as reviewer --json # ids on stdin, one per line
20
+ ```
21
+
22
+ `review add` needs `--upstream-ref <ref>` or `--original-spec-ref <path>`;
23
+ add `--artifact <path>` (repeatable) for user-visible behavior. A short
24
+ `<sha>` is fine. With `write.promote: manual`, follow `finding add` and
25
+ `finding close` with `canon gate promote --as reviewer --json`.
26
+
27
+ Run `gate check` once, before `review add`: its `unreviewed-promotion`
28
+ violations are the subjects and scenarios that need your review. Do not loop
29
+ it. After `review add`, read its `meta.next` instead of calling `gate check`
30
+ or `status` again.
31
+
32
+ ## Separate session
33
+
34
+ You run as a separate process with your own session id, never the session
35
+ that wrote the code and evidence under another `--actor-id` or
36
+ `--session-id` label. Pass your real session id as `--session-id` on
37
+ everything you record. A harness with no subagent tool starts you (a new
38
+ `codex exec` run in this repo, say). Review happens on every change.
39
+
40
+ ## Read the PRD
41
+
42
+ 1. `brief check`: the brief must have no blockers.
43
+ 2. Read the brief itself, `.canon/changes/<slug>/brief.md`: intent, the flow
44
+ `F1`, `F2`, …, acceptance and failure path per step, out of scope. You do
45
+ not refine the brief; a brief defect is a finding, not an edit.
46
+ 3. Check the scenarios against it: every flow step has a scenario that
47
+ proves it, every step has a failure scenario, each scenario's steps match
48
+ the step's acceptance, and nothing builds what the brief puts out of
49
+ scope.
50
+
51
+ ## Run the checks yourself
52
+
53
+ Run the build, the tests and the app the evidence claims to cover, on the
54
+ commit you pin. Compare the results with the evidence records. Never sign
55
+ what you could not run: a reviewer that cannot run the tests says so and
56
+ does not sign off; record that instead (`--outcome indeterminate`, or
57
+ `unavailable` when you could not run).
58
+
59
+ ## Record
60
+
61
+ - Every defect is a finding; `finding list` shows round, seq, severity and
62
+ disposition, so the next seq and the open blockers are one command away.
63
+ Close a finding once it is fixed.
64
+ - Sign off in one batch with `review add`, all or nothing. It writes
65
+ directly; nothing to promote. canon stores and re-checks attached bytes
66
+ and never compares images.
67
+ - Fixes you ask for return as a re-review of the same change. When a new
68
+ evidence record makes your review stale, look again before you re-pin.
69
+
70
+ Reference: `reference/canon-review.md`.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@journeykit/canon",
3
- "version": "0.17.0",
3
+ "version": "0.21.0",
4
4
  "description": "canon — harness knowledge substrate. JS launcher: platform detection + native binary resolution.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -30,9 +30,9 @@
30
30
  },
31
31
  "dependencies": {},
32
32
  "optionalDependencies": {
33
- "@journeykit/canon-core-darwin-arm64": "0.17.0",
34
- "@journeykit/canon-core-linux-x64": "0.17.0",
35
- "@journeykit/canon-core-win32-x64": "0.17.0"
33
+ "@journeykit/canon-core-darwin-arm64": "0.21.0",
34
+ "@journeykit/canon-core-linux-x64": "0.21.0",
35
+ "@journeykit/canon-core-win32-x64": "0.21.0"
36
36
  },
37
37
  "devDependencies": {
38
38
  "@types/node": "^20.0.0",