ctxr-cli 0.23.0 → 0.25.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 (197) hide show
  1. package/README.md +65 -5
  2. package/dist/commands/graph-diff.d.ts +33 -0
  3. package/dist/commands/graph-diff.d.ts.map +1 -0
  4. package/dist/commands/graph-diff.js +52 -0
  5. package/dist/commands/graph-diff.js.map +1 -0
  6. package/dist/commands/land.d.ts +50 -0
  7. package/dist/commands/land.d.ts.map +1 -0
  8. package/dist/commands/land.js +414 -0
  9. package/dist/commands/land.js.map +1 -0
  10. package/dist/commands/publish-check.d.ts +6 -0
  11. package/dist/commands/publish-check.d.ts.map +1 -1
  12. package/dist/commands/publish-check.js +78 -3
  13. package/dist/commands/publish-check.js.map +1 -1
  14. package/dist/commands/publish-gather.d.ts.map +1 -1
  15. package/dist/commands/publish-gather.js +4 -1
  16. package/dist/commands/publish-gather.js.map +1 -1
  17. package/dist/commands/publish-new.d.ts +5 -0
  18. package/dist/commands/publish-new.d.ts.map +1 -1
  19. package/dist/commands/publish-new.js +30 -10
  20. package/dist/commands/publish-new.js.map +1 -1
  21. package/dist/commands/publish-stamp.d.ts +32 -0
  22. package/dist/commands/publish-stamp.d.ts.map +1 -0
  23. package/dist/commands/publish-stamp.js +78 -0
  24. package/dist/commands/publish-stamp.js.map +1 -0
  25. package/dist/commands/publish-urls.d.ts +13 -0
  26. package/dist/commands/publish-urls.d.ts.map +1 -1
  27. package/dist/commands/publish-urls.js +23 -6
  28. package/dist/commands/publish-urls.js.map +1 -1
  29. package/dist/commands/review-list.d.ts +34 -0
  30. package/dist/commands/review-list.d.ts.map +1 -0
  31. package/dist/commands/review-list.js +49 -0
  32. package/dist/commands/review-list.js.map +1 -0
  33. package/dist/commands/serve.d.ts +3 -6
  34. package/dist/commands/serve.d.ts.map +1 -1
  35. package/dist/commands/serve.js +106 -9
  36. package/dist/commands/serve.js.map +1 -1
  37. package/dist/config/schema.d.ts +40 -0
  38. package/dist/config/schema.d.ts.map +1 -1
  39. package/dist/config/schema.js +39 -0
  40. package/dist/config/schema.js.map +1 -1
  41. package/dist/core/approval/decision.d.ts +73 -0
  42. package/dist/core/approval/decision.d.ts.map +1 -0
  43. package/dist/core/approval/decision.js +166 -0
  44. package/dist/core/approval/decision.js.map +1 -0
  45. package/dist/core/approval/file-diff.d.ts +32 -0
  46. package/dist/core/approval/file-diff.d.ts.map +1 -0
  47. package/dist/core/approval/file-diff.js +83 -0
  48. package/dist/core/approval/file-diff.js.map +1 -0
  49. package/dist/core/approval/identity.d.ts +34 -0
  50. package/dist/core/approval/identity.d.ts.map +1 -0
  51. package/dist/core/approval/identity.js +105 -0
  52. package/dist/core/approval/identity.js.map +1 -0
  53. package/dist/core/approval/landing-record.d.ts +17 -0
  54. package/dist/core/approval/landing-record.d.ts.map +1 -0
  55. package/dist/core/approval/landing-record.js +30 -0
  56. package/dist/core/approval/landing-record.js.map +1 -0
  57. package/dist/core/approval/resolver.d.ts +15 -0
  58. package/dist/core/approval/resolver.d.ts.map +1 -0
  59. package/dist/core/approval/resolver.js +41 -0
  60. package/dist/core/approval/resolver.js.map +1 -0
  61. package/dist/core/approval/sessions.d.ts +36 -0
  62. package/dist/core/approval/sessions.d.ts.map +1 -0
  63. package/dist/core/approval/sessions.js +76 -0
  64. package/dist/core/approval/sessions.js.map +1 -0
  65. package/dist/core/browse/approve.d.ts +45 -0
  66. package/dist/core/browse/approve.d.ts.map +1 -0
  67. package/dist/core/browse/approve.js +239 -0
  68. package/dist/core/browse/approve.js.map +1 -0
  69. package/dist/core/browse/diagram-assets.d.ts +15 -0
  70. package/dist/core/browse/diagram-assets.d.ts.map +1 -0
  71. package/dist/core/browse/diagram-assets.js +35 -0
  72. package/dist/core/browse/diagram-assets.js.map +1 -0
  73. package/dist/core/browse/page-url.d.ts +22 -0
  74. package/dist/core/browse/page-url.d.ts.map +1 -1
  75. package/dist/core/browse/page-url.js +31 -0
  76. package/dist/core/browse/page-url.js.map +1 -1
  77. package/dist/core/browse/render.d.ts +10 -1
  78. package/dist/core/browse/render.d.ts.map +1 -1
  79. package/dist/core/browse/render.js +23 -1
  80. package/dist/core/browse/render.js.map +1 -1
  81. package/dist/core/browse/review.d.ts +21 -0
  82. package/dist/core/browse/review.d.ts.map +1 -0
  83. package/dist/core/browse/review.js +52 -0
  84. package/dist/core/browse/review.js.map +1 -0
  85. package/dist/core/browse/templates.d.ts +4 -1
  86. package/dist/core/browse/templates.d.ts.map +1 -1
  87. package/dist/core/browse/templates.js +18 -2
  88. package/dist/core/browse/templates.js.map +1 -1
  89. package/dist/core/checks/organize-checks.d.ts +17 -0
  90. package/dist/core/checks/organize-checks.d.ts.map +1 -1
  91. package/dist/core/checks/organize-checks.js +116 -0
  92. package/dist/core/checks/organize-checks.js.map +1 -1
  93. package/dist/core/errors.d.ts +67 -0
  94. package/dist/core/errors.d.ts.map +1 -1
  95. package/dist/core/errors.js +160 -0
  96. package/dist/core/errors.js.map +1 -1
  97. package/dist/core/forge/credentials.d.ts +69 -0
  98. package/dist/core/forge/credentials.d.ts.map +1 -0
  99. package/dist/core/forge/credentials.js +197 -0
  100. package/dist/core/forge/credentials.js.map +1 -0
  101. package/dist/core/forge/github.d.ts +73 -0
  102. package/dist/core/forge/github.d.ts.map +1 -0
  103. package/dist/core/forge/github.js +101 -0
  104. package/dist/core/forge/github.js.map +1 -0
  105. package/dist/core/git/exec.d.ts +25 -0
  106. package/dist/core/git/exec.d.ts.map +1 -1
  107. package/dist/core/git/exec.js +100 -2
  108. package/dist/core/git/exec.js.map +1 -1
  109. package/dist/core/graph/diff-block.d.ts +6 -0
  110. package/dist/core/graph/diff-block.d.ts.map +1 -0
  111. package/dist/core/graph/diff-block.js +63 -0
  112. package/dist/core/graph/diff-block.js.map +1 -0
  113. package/dist/core/graph/diff-document.d.ts +38 -0
  114. package/dist/core/graph/diff-document.d.ts.map +1 -0
  115. package/dist/core/graph/diff-document.js +117 -0
  116. package/dist/core/graph/diff-document.js.map +1 -0
  117. package/dist/core/graph/diff.d.ts +123 -0
  118. package/dist/core/graph/diff.d.ts.map +1 -0
  119. package/dist/core/graph/diff.js +253 -0
  120. package/dist/core/graph/diff.js.map +1 -0
  121. package/dist/core/graph/tree.d.ts +24 -0
  122. package/dist/core/graph/tree.d.ts.map +1 -0
  123. package/dist/core/graph/tree.js +45 -0
  124. package/dist/core/graph/tree.js.map +1 -0
  125. package/dist/core/notes/list.d.ts +10 -0
  126. package/dist/core/notes/list.d.ts.map +1 -1
  127. package/dist/core/notes/list.js +35 -12
  128. package/dist/core/notes/list.js.map +1 -1
  129. package/dist/core/publish/filing.d.ts +12 -12
  130. package/dist/core/publish/filing.d.ts.map +1 -1
  131. package/dist/core/publish/filing.js +20 -18
  132. package/dist/core/publish/filing.js.map +1 -1
  133. package/dist/core/publish/lifespan.d.ts +37 -0
  134. package/dist/core/publish/lifespan.d.ts.map +1 -0
  135. package/dist/core/publish/lifespan.js +59 -0
  136. package/dist/core/publish/lifespan.js.map +1 -0
  137. package/dist/core/publish/represents.d.ts +72 -0
  138. package/dist/core/publish/represents.d.ts.map +1 -0
  139. package/dist/core/publish/represents.js +83 -0
  140. package/dist/core/publish/represents.js.map +1 -0
  141. package/dist/run.d.ts.map +1 -1
  142. package/dist/run.js +60 -4
  143. package/dist/run.js.map +1 -1
  144. package/dist/version.d.ts +1 -1
  145. package/dist/version.js +1 -1
  146. package/package.json +2 -1
  147. package/templates/approve/approve-button.md +1 -0
  148. package/templates/approve/author-heading.md +1 -0
  149. package/templates/approve/author-note.md +1 -0
  150. package/templates/approve/comment-label.md +1 -0
  151. package/templates/approve/comment-required.md +1 -0
  152. package/templates/approve/commits-heading.md +1 -0
  153. package/templates/approve/decision-heading.md +1 -0
  154. package/templates/approve/decision-note.md +1 -0
  155. package/templates/approve/diff-binary.md +1 -0
  156. package/templates/approve/diff-empty.md +1 -0
  157. package/templates/approve/diff-heading.md +1 -0
  158. package/templates/approve/facts-heading.md +1 -0
  159. package/templates/approve/forge-unreachable.md +1 -0
  160. package/templates/approve/github-app-manifest.json +15 -0
  161. package/templates/approve/head-missing.md +1 -0
  162. package/templates/approve/index-empty.md +1 -0
  163. package/templates/approve/index-heading.md +1 -0
  164. package/templates/approve/index-intro.md +1 -0
  165. package/templates/approve/landed.md +1 -0
  166. package/templates/approve/moved-head.md +1 -0
  167. package/templates/approve/no-pull.md +1 -0
  168. package/templates/approve/not-open.md +1 -0
  169. package/templates/approve/pages-heading.md +1 -0
  170. package/templates/approve/pages-note.md +1 -0
  171. package/templates/approve/record-failed.md +1 -0
  172. package/templates/approve/request-changes-button.md +1 -0
  173. package/templates/approve/state-line.md +1 -0
  174. package/templates/conventions/baseline-conventions.md +6 -0
  175. package/templates/graph/knowledge-changes/archived-item.md +1 -0
  176. package/templates/graph/knowledge-changes/archived.md +1 -0
  177. package/templates/graph/knowledge-changes/bare-route.md +2 -0
  178. package/templates/graph/knowledge-changes/block.md +10 -0
  179. package/templates/graph/knowledge-changes/counts.md +1 -0
  180. package/templates/graph/knowledge-changes/dangling-item.md +1 -0
  181. package/templates/graph/knowledge-changes/dangling.md +1 -0
  182. package/templates/graph/knowledge-changes/empty.md +1 -0
  183. package/templates/graph/knowledge-changes/reason-ambiguous.md +1 -0
  184. package/templates/graph/knowledge-changes/reason-not_found.md +1 -0
  185. package/templates/graph/knowledge-changes/review.md +4 -0
  186. package/templates/graph/review/moved-head.md +1 -0
  187. package/templates/land/resolver.md +12 -0
  188. package/templates/serve/diagrams.mjs +136 -0
  189. package/templates/serve/shell.html +1 -1
  190. package/templates/serve/style.css +90 -0
  191. package/templates/skills/ctxr-land.md +37 -31
  192. package/templates/skills/ctxr-organize-audit.md +19 -0
  193. package/templates/skills/ctxr-publish.md +100 -45
  194. package/templates/skills/ctxr-second-opinion/run.mjs +28 -17
  195. package/templates/skills/ctxr-second-opinion.md +19 -14
  196. package/templates/skills/ctxr-session-lifecycle.md +9 -0
  197. package/templates/skills/ctxr-submit.md +28 -17
@@ -1,38 +1,44 @@
1
1
  The land half of the session lifecycle, after review. `ctxr-submit` is the other half; `ctxr-session-lifecycle`
2
- covers what surrounds both and is not repeated here.
2
+ covers what surrounds both and is not repeated here. `ctxr land` does the landing. This skill decides when to run it.
3
3
 
4
4
  1. Name the target explicitly — a branch name or a pull-request number — rather than relying on whichever
5
5
  checkout you happen to be standing in: that checkout is as likely to be the canonical clone on
6
6
  `__DEFAULT_BRANCH__`, which has no session to infer, as the session itself. Never land
7
7
  `__DEFAULT_BRANCH__` itself; a pull request whose head is `__DEFAULT_BRANCH__` is refused too.
8
- 2. Read state before any side effect: `gh pr view <target> --json number,url,title,state,mergeable,headRefName`.
9
- Refuse if the head branch is `__DEFAULT_BRANCH__`, or if the target you named doesn't match the head
10
- branch this reports. A closed pull request stops here — report it, do nothing further.
11
- 3. Check mergeability. `MERGEABLE` proceeds to the gate below. `UNKNOWN` re-queries once (`gh pr view`
12
- again) before treating it as still unknown. `CONFLICTING` or still-`UNKNOWN` after the re-query stops
13
- the command — follow `ctxr-session-lifecycle`'s conflict playbook, then retry from step 1; a retry
14
- re-reads state and performs only what remains.
15
- 4. Gate: merging is an external side effect, and plan consent is not fire consent. Present the pull
16
- request's number, title, and url; wait for an explicit go (already having explicit approval from
17
- elsewhere in this conversation satisfies this — don't ask twice).
18
- 5. Merge: `gh pr merge <number> --squash` (or `--merge` / `--rebase` if the operator asked for a different
19
- method). Then re-read state (`gh pr view` again) to confirm the forge reports `MERGED` — never claim a
20
- merge from the merge command's exit code alone; a transport error can arrive after the merge already
21
- succeeded.
22
- 6. Synchronize the default branch in the store's canonical clone — the repository's main worktree, not
23
- necessarily the checkout you're running this from. From the canonical clone: `git fetch origin` then
24
- `git merge --ff-only origin/__DEFAULT_BRANCH__`. If that clone is on another branch, or the fast-forward
25
- fails (diverged from origin), report exactly that and stop — never check it out, reset it, or force the
26
- merge to make it comply.
27
- 7. Reclaim the worktree: see `ctxr-session-lifecycle`'s Reclaiming section (`ctxr session list` to scope,
28
- then `git worktree remove` / `git branch -d`) — run it from outside the worktree being removed. This is
29
- the default action, not an optional extra: nothing sweeps up afterward, so a worktree left here is left
30
- indefinitely. Skip it only for a reason you can name — you are standing inside it, it is not yours to
31
- reclaim, or the operator asked you to leave it — and report that reason in step 8.
32
- 8. Report exactly what happened — merged or not, synced or not (with why not), reclaimed or not (with why
33
- not). Never claim a merge or a cleanup you did not confirm yourself.
8
+ Run every step from outside the worktree being removed. Why: no command can remove the directory it runs from.
9
+ 2. Read state before any side effect. Run `gh pr view <target> --json number,url,title,state,headRefName`.
10
+ A closed pull request stops here. Report it, and do nothing more.
11
+ When this store declares `change_approval`, also run `ctxr review list`. Find the row for this pull request.
12
+ Why: a decision made on the approval page is recorded there, with the person who made it.
13
+ 3. Gate. Landing is an external side effect, and plan consent is not fire consent.
14
+ - When the row says `approved`, that decision is the consent. Go to step 4 without a question.
15
+ Why: a decider approved this exact change on the approval page.
16
+ - Otherwise, present the pull request's number, title, and url. Wait for an explicit go. An explicit
17
+ approval given earlier in this conversation satisfies this. Do not ask twice.
18
+ - When the row says `changes-requested` or `needs-reapproval`, say so before you ask.
19
+ Why: a decider asked for a change, or has not seen the current version.
20
+ 4. Land. With an approval from the page, run `ctxr land <number>`. With an explicit go, run
21
+ `ctxr land <number> --confirm`. Use `--confirm` only after that go. Why: the flag tells the command that a person agreed.
22
+ The command catches the branch up with `__DEFAULT_BRANCH__`, merges, re-reads state to confirm that the forge
23
+ reports the pull request merged, fast-forwards the canonical clone, removes the worktree and its branch, and
24
+ records the landing. Do not run `gh pr merge` yourself. Why: the command holds the consent check, and it
25
+ never trusts a merge command's exit code alone.
26
+ 5. Act on the outcome the command reports:
27
+ - `merged`: go to step 6.
28
+ - `blocked` with the reason `conflict`: follow `ctxr-session-lifecycle`'s conflict playbook in the session
29
+ worktree. Then do step 4 again. A retry re-reads state and does only what remains.
30
+ - `blocked` with another reason: report the reason. A conflict resolver ran and its result was refused.
31
+ - `needs-reapproval`: report that the change needs a new decision on the approval page. Do not land it with
32
+ `--confirm` unless the operator says so for this version. Why: nobody approved the new version.
33
+ - `no-consent`: return to step 3.
34
+ - `merge-refused`: report it. Checks or branch protection can still be pending, and a later run retries.
35
+ - `lease-refused`: the branch moved while the command ran. Start again from step 1.
36
+ 6. Report exactly what happened — merged or not, synced or not (with why not), reclaimed or not (with why
37
+ not), each as the command reports it. If the canonical clone did not sync, never check it out, reset it, or
38
+ force a merge to make it comply. Reclaiming is the default action, not an optional extra: nothing sweeps
39
+ up afterward, so a worktree left here is left indefinitely. If the command kept the worktree, follow
40
+ `ctxr-session-lifecycle`'s Reclaiming section once the reason is gone. Never claim a merge or a cleanup that
41
+ the command did not report.
34
42
 
35
- Merging with `gh pr merge` (step 5) is the mechanism, not a shortcut around one: the pull request and its
36
- merge commit are the audit trail. What step 4's gate protects against is merging without having actually
37
- read the state in steps 2-3 first, or without an explicit go — never skip the read, the mergeability check,
38
- or the confirmation to save a round trip.
43
+ The pull request and its merge commit are the audit trail. What the gate in step 3 protects against is landing
44
+ without reading the state in step 2 first, or without a go. Never skip the read or the gate to save a round trip.
@@ -34,6 +34,25 @@ item was one of the mission's priorities, hand it to `ctxr-mission`, which propo
34
34
  have moved since their last synthesis, or which have never been rolled up — hand each one to
35
35
  `ctxr-rollup` rather than re-synthesizing ad hoc.
36
36
 
37
+ ## Disposable pages and drifted pages
38
+
39
+ `ctxr lint` lists disposable pages that are older than 30 days. Each one is a removal candidate, not a
40
+ removal. Do these steps:
41
+
42
+ 1. Show the list to the operator as a proposal, with each page's age. Ask which pages to remove.
43
+ 2. Remove only the pages that the operator approves. Why: somebody can still have the link to a
44
+ disposable page, and a removal breaks that link.
45
+ 3. Do the removal in a session, on its session branch, with `git rm -r <page folder>`.
46
+ 4. Land the removal through `ctxr-submit`. Its **Pages** table marks the address of each removed page
47
+ as one that stops working.
48
+
49
+ Never remove a disposable page that the operator did not approve, and never remove one only because it
50
+ is old.
51
+
52
+ `ctxr lint` also lists permanent pages that are out of step with the note they represent: stale, not
53
+ stamped, or with no note that resolves. Give each one to `ctxr-publish`. Do not stamp the page
54
+ yourself. Why: a stamp without a review of the page against its note confirms nothing.
55
+
37
56
  ## Broken links have classes — classify before fixing
38
57
 
39
58
  - URL wrapped in wikilink syntax → convert to a markdown link.
@@ -2,12 +2,28 @@ Turn store content into a shareable HTML page for a subject — a store subtree,
2
2
  concept whose sources aren't co-located. Deciding what belongs on the page is the one step no
3
3
  convention can enforce for you; everything else here is a decision procedure, not a mechanism.
4
4
 
5
- ## 1. Does this earn a page over a note?
5
+ ## 1. Permanent or disposable? Decide first
6
6
 
7
- Reach for a page when the reader needs to compare options side by side, see spatial structure, manipulate
8
- something, navigate non-linearly, or share a link — and the store's own notes genuinely can't. A page
9
- costs several times the effort of the markdown it's drawn from; don't build one to restate a note in a
10
- different font. If a note would do the job, the note is the deliverable.
7
+ Decide the page's lifespan before you do anything else. A page has one of two lifespans:
8
+
9
+ - **Permanent.** The page is the rendered form of one note that will keep changing. Keep it, and
10
+ update it when the note changes.
11
+ - **Disposable.** The page helps somebody understand something once. Examples are an explainer, a
12
+ report on one week of agent work, or a comparison for one decision. Nobody updates it.
13
+
14
+ Choose disposable when you cannot name the one note that the page represents. Why: a kept page that
15
+ names no note holds facts that live nowhere else, and nothing can tell when they go out of date.
16
+
17
+ The location of the page sets its lifespan. Nothing in the page declares it. A disposable page sits
18
+ under `disposable/` directly below the store's published-pages location. Every other page is
19
+ permanent.
20
+
21
+ For a permanent page, make sure that the page earns its place over a note. Use a page when the reader
22
+ must compare options side by side, see spatial structure, manipulate something, navigate
23
+ non-linearly, or open a link. Use it only when the store's own notes cannot do this. Why: a page
24
+ costs several times the effort of the markdown it comes from. If a note does the job, the note is the
25
+ deliverable. Do not apply this test to a disposable page. Why: a disposable page is cheap on purpose,
26
+ and it is the cheap way to understand something once.
11
27
 
12
28
  ## 2. Name the subject, let the selector produce the set
13
29
 
@@ -28,46 +44,61 @@ content belongs in front of this page's intended readers — a page written for
28
44
  not carry material written about that party, or about anyone else who did not expect to be quoted.
29
45
  When you are unsure about a note, leave it out and name it to the operator rather than guessing.
30
46
 
31
- ## 4. Fix the identity once, at the path `gather` reported
47
+ ## 4. Fix the identity once
48
+
49
+ **A disposable page.** Run `ctxr publish new --disposable <name>`. The command creates the folder
50
+ `disposable/<YYYY-MM-DD>-<name>` with today's date, and its sibling README. Give the name alone. Why:
51
+ the command supplies the date, and it refuses a name that starts with one. Do not use the path that
52
+ `gather` reported. Why: disposable pages sit in one flat folder, sorted by date, not by subject.
32
53
 
33
- Step 2 reported the path under the store's published-pages location at which a page for this subject
34
- belongs, derived from where the subject's notes live. Take it verbatim, append the page's own name,
35
- and hand the result to `ctxr publish new <slug>`, which creates the folder and its sibling README:
54
+ **A permanent page.** Step 2 reported the path at which a page for this subject belongs. That path is
55
+ under the store's published-pages location, and comes from where the subject's notes live.
56
+ Take it verbatim, append the page's own name, and give the result to `ctxr publish new <slug>`. The
57
+ command creates the folder and its sibling README:
36
58
 
37
59
  ```sh
38
60
  ctxr publish new <reported path>/<page-name>
39
61
  ```
40
62
 
41
- The depth is the store's own, not a fixed number of levels — a subject whose notes live four folders
42
- deep files four folders deep. That is what makes the published-pages navigation read like the store
43
- instead of like one long list. `ctxr publish check` reports a page filed flat at the published-pages
44
- root as a failing check, and checks nothing further about the location, because which folder is
45
- right is the question `gather` already answered.
63
+ The depth is the store's own, not a fixed number of levels. A subject whose notes are four folders
64
+ deep gets a page four folders deep. Why: then the published-pages navigation reads like the store, not
65
+ like one long list. `ctxr publish check` fails a page filed flat at the published-pages root. It
66
+ checks nothing more about the location. Why: `gather` already answered which folder is correct.
46
67
 
47
- Name the page for what it *is*, never for its subject. The folders above it already carry the
48
- subject, so `<reported path>/<subject>` says one word twice while `<reported path>/decision-board`
68
+ Name the page for what it *is*, never for its subject. Why: the folders above it already name the
69
+ subject. `<reported path>/<subject>` says one word two times, and `<reported path>/decision-board`
49
70
  says something.
50
71
 
51
- When `gather` reports that an existing page belongs at the reported path too, it is because this
52
- subject is acquiring a second page, and a subject's pages collect under one folder naming it. Move
53
- that page there before you scaffold the new one, and tell the operator its URL changed — somebody
54
- may already be holding that link. `ctxr publish urls` reports the old address beside the new one, and
55
- `ctxr-submit` carries both into the pull request. `gather` moves nothing itself, and it names which signal counted
56
- the page as this subject's; read that before you move anything, because the signal is a reading of
57
- the page's README and can be wrong. Lead a page's source notes with the note it is a representation
58
- of — that lead link is what says whose page this is, and everything after it is a citation.
59
-
60
- When `gather` reports that no path derives — the subject names the store root itself, so no folder
61
- names it — the choice is yours to make and to own: pick the folder that best names the subject to
62
- the reader, write that choice and your reason into the page's README, and name it to the operator.
63
- Nothing checks this for you, by design. Filing a page under a word that names nothing serves nobody
64
- who reads it.
65
-
66
- A slug starting with a date (`YYYY-` or `YYYY-MM-DD-`) is reserved for a frozen snapshot — never used
67
- for a page you intend to keep updating. That rule binds the page's own final segment, not the folders
68
- it is filed under. The command refuses to overwrite an existing folder; if one already exists for
69
- this subject, edit its files directly rather than re-running `publish new` — a rename or an overwrite
70
- breaks any link already handed out.
72
+ Sometimes `gather` reports that an existing page also belongs at the reported path. This subject then
73
+ gets a second page, and the pages of a subject collect under one folder that names it. Move that page
74
+ there before you create the new one, and tell the operator its URL changed. Why: somebody can already
75
+ have that link. `ctxr publish urls` reports the old address next to the new one, and `ctxr-submit`
76
+ puts both into the pull request. `gather` moves nothing. It names the signal that counted the page as
77
+ this subject's page. Read that signal before you move anything. Why: the signal is a reading of the
78
+ page's README, and it can be wrong.
79
+
80
+ Lead a page's source notes with the note it is a representation of. `ctxr publish check` fails a
81
+ permanent page whose README does not start with a wikilink to exactly one note. For a page that comes
82
+ from a store folder, that note is the folder's hub note. If the folder has no hub note, write one, or
83
+ make the page disposable. The page can link to many more notes after the lead link. Why: the lead link
84
+ says which note the page represents, and each link after it is a citation.
85
+
86
+ After you write the README, run `ctxr publish stamp <path>`. The command records the represented
87
+ note's hash on the lead-link line. Why: `ctxr publish check` then reports the page as stale when that
88
+ note changes.
89
+
90
+ Sometimes `gather` reports that no path derives. One reason is that the subject is the store root, so
91
+ no folder names it. The other reason is that the path would start with `disposable/`, a segment that
92
+ only disposable pages can use. Then you choose the folder, and you own that choice. Pick the folder
93
+ that best names the subject to the reader.
94
+ Then write that choice and your reason into the page's README, and tell the operator. Nothing checks
95
+ this choice. Why: a page filed under a word that names nothing helps no reader.
96
+
97
+ Never start the page's own name with a date (`YYYY-` or `YYYY-MM-DD-`). That naming is reserved for
98
+ the frozen pages that `ctxr publish new --disposable` makes. The rule applies to the final segment, not
99
+ to the folders above it. The command refuses to overwrite an existing folder. If a folder already
100
+ exists for this subject, edit its files directly. Do not run `publish new` again. Why: a rename or an
101
+ overwrite breaks a link that somebody already has.
71
102
 
72
103
  ## 5. Choose the form, then delegate the craft
73
104
 
@@ -93,11 +124,20 @@ lower is the same material in shorter words.
93
124
 
94
125
  ## 6. Verify the output invariants
95
126
 
96
- `ctxr publish check <path>` runs the mechanical half of the checklist — no external network address,
97
- a viewport meta tag, at least one print rule, a provenance line, a sibling README, balanced tags,
98
- valid syntax in every embedded script, and the page's filing location from step 4. It exits non-zero naming every failing check; fix all of them
99
- before reporting the page as ready. It answers only what's derivable from the file itself — the DO-test
100
- in step 1, the form and reader choices in step 5, and factual accuracy stay judgment calls, not checker output.
127
+ Run `ctxr publish check <path>`. It runs the mechanical half of the checklist:
128
+
129
+ - no external network address, a viewport meta tag, at least one print rule, and a provenance line;
130
+ - a sibling README, balanced tags, and valid syntax in every embedded script;
131
+ - the page's filing location from step 4;
132
+ - for a disposable page, its shape (`disposable-shape`): one folder directly under `disposable/`,
133
+ with a real date at the start of its name;
134
+ - for a permanent page, the note it represents (`represented-note`) and that note's recorded hash
135
+ (`represented-note-hash`).
136
+
137
+ The command reports the page's lifespan. It exits non-zero and names every failing check. Fix all of
138
+ them before you report the page as ready. The command answers only what the files can show. Why: the
139
+ lifespan choice and the DO-test in step 1, the form and reader choices in step 5, and factual accuracy
140
+ are judgment calls, not checker output.
101
141
 
102
142
  `ctxr publish new` and `ctxr publish check` each end by naming the address `ctxr serve` answers for
103
143
  this page. Look at the page before you hand it on. Whether the form works, whether the prose reads,
@@ -131,10 +171,25 @@ anything else the store retrieves. Confirm with `ctxr lint` after landing.
131
171
 
132
172
  ## 8. Provenance and drift
133
173
 
134
- The source notes are the fact of record. When a fact changes, change the note first, then the page —
135
- and grep the page for every place that fact was echoed (a summary line, a total, a status badge) before
136
- declaring the update done; a page that repeats a number in three places goes stale in all three if only
137
- one is touched.
174
+ The source notes are the fact of record. When a fact changes, change the note first, then the page.
175
+ Search the page for every place that repeats the fact, such as a summary line, a total, or a status
176
+ badge. Update each one before you say the update is done. Why: a page that repeats a number in three
177
+ places goes stale in all three if you change only one.
178
+
179
+ `ctxr publish check` and `ctxr lint` report a permanent page as stale when its represented note
180
+ changed after the stamp. To confirm a stale page, do these steps in order:
181
+
182
+ 1. Review the page against the note, and update the page where the two disagree.
183
+ 2. Remove the `<!-- hash:… -->` marker from the README's lead-link line.
184
+ 3. Run `ctxr publish stamp <path>` again.
185
+
186
+ `ctxr publish stamp` never overwrites a marker. Why: a stamp without a review confirms nothing, so
187
+ the stale report stays until somebody removes the marker.
188
+
189
+ Never revise a disposable page after it lands. Why: it is a snapshot of one moment, and its link
190
+ shows that moment. Make a new disposable page instead. Do not remove a disposable page yourself.
191
+ `ctxr lint` lists disposable pages that are older than 30 days, and the operator decides which to
192
+ remove (`ctxr-organize-audit`).
138
193
 
139
194
  ## 9. Landing
140
195
 
@@ -9,7 +9,7 @@
9
9
  // file needs no exec bit.
10
10
  //
11
11
  // Usage:
12
- // node run.mjs --preflight [--only claude,codex]
12
+ // node run.mjs --preflight [--only claude,codex] [--tier strong|fast]
13
13
  // node run.mjs --mode critique --plan-file plan.md [--out DIR] [--tier strong|fast]
14
14
  // node run.mjs --mode poll --prompt-file q.txt [--lens minimalist,marketer]
15
15
  //
@@ -36,27 +36,35 @@ const env = (name, fallback) => process.env[`CTXR_SECOND_OPINION_${name}`] || fa
36
36
  /**
37
37
  * Model choice lives here, in one table. Override by environment, never by editing a store.
38
38
  *
39
+ * The tiers name a class of model, not a price. `strong` is each family's frontier model and `fast` its
40
+ * workhorse: claude `fable` and `opus`; codex `gpt-6-astra` ("frontier intelligence") and `gpt-6.1-sol`
41
+ * ("latest workhorse"), as codex's model catalog described them on 2026-10-15; agy `Gemini 4 Argon` and
42
+ * `Gemini 3.8 Flash`, once agy offered Argon (2026-10-19). The tiers differ in model only: every model runs at
43
+ * its provider's default effort.
44
+ *
39
45
  * Effort is each provider's own recommended default, not one this runner picked:
40
46
  * - claude: no --effort at all, so Claude Code applies its own default for the model.
41
- * - codex: `medium`, the default its model catalog declares (`default_reasoning_level`). It is passed
42
- * explicitly because the flag cannot simply be left off: with no pin in config.toml, codex resolves to
43
- * `reasoning effort: none` on a ChatGPT login (seen 2026-10-05), which is no review at all. `low` at the
44
- * `fast` tier. A machine that pins its own effort in config.toml is overridden by this; set
45
- * CTXR_SECOND_OPINION_CODEX_EFFORT to use another.
46
- * - agy: the effort is part of the model name; `(High)` is Gemini's default thinking level.
47
- * For scale: on one short plan Claude took 35 s at `high` and 514 s at `max`, so a deeper pass is a choice
47
+ * - codex: the default its model catalog declares (`default_reasoning_level`), which was `low` for both
48
+ * gpt-6-astra and gpt-6.1-sol on 2026-10-15. It is passed explicitly because the flag cannot simply be
49
+ * left off: with no pin in config.toml, codex resolves to `reasoning effort: none` on a ChatGPT login
50
+ * (seen 2026-10-05), which is no review at all. A machine that pins its own effort in config.toml is
51
+ * overridden by this; set CTXR_SECOND_OPINION_CODEX_EFFORT to use another.
52
+ * - agy: the effort is part of the model name. The default thinking level is `(Medium)` for Gemini 4 Argon
53
+ * and `(High)` for Gemini 3.8 Flash. agy rejects an unknown name, and preflight tests it.
54
+ * For scale: on one short plan Claude (Opus) took 35 s at `high` and 514 s at `max`, and Fable took 122 s at
55
+ * its default (2026-10-15), so a deeper pass is a choice
48
56
  * (CTXR_SECOND_OPINION_CLAUDE_EFFORT=max), not something to leave on by default.
49
57
  */
50
58
  function tiers() {
51
59
  return {
52
60
  strong: {
53
- claude: { model: env('CLAUDE_MODEL', 'opus'), effort: env('CLAUDE_EFFORT', null) },
54
- codex: { effort: env('CODEX_EFFORT', 'medium') },
55
- agy: { model: env('AGY_MODEL', 'Gemini 3.1 Pro (High)') },
61
+ claude: { model: env('CLAUDE_MODEL', 'fable'), effort: env('CLAUDE_EFFORT', null) },
62
+ codex: { model: env('CODEX_MODEL', 'gpt-6-astra'), effort: env('CODEX_EFFORT', 'low') },
63
+ agy: { model: env('AGY_MODEL', 'Gemini 4 Argon (Medium)') },
56
64
  },
57
65
  fast: {
58
- claude: { model: env('CLAUDE_MODEL', 'haiku'), effort: env('CLAUDE_EFFORT', null) },
59
- codex: { effort: env('CODEX_EFFORT', 'low') },
66
+ claude: { model: env('CLAUDE_MODEL', 'opus'), effort: env('CLAUDE_EFFORT', null) },
67
+ codex: { model: env('CODEX_MODEL', 'gpt-6.1-sol'), effort: env('CODEX_EFFORT', 'low') },
60
68
  agy: { model: env('AGY_MODEL', 'Gemini 3.8 Flash (High)') },
61
69
  },
62
70
  };
@@ -70,7 +78,7 @@ function tiers() {
70
78
  */
71
79
  const FLAGS_USED = {
72
80
  claude: { helpArgs: ['--help'], flags: ['--tools', '--model', '--no-session-persistence', '--disable-slash-commands', '--output-format'] },
73
- codex: { helpArgs: ['exec', '--help'], flags: ['--skip-git-repo-check', '--sandbox', '--ephemeral', '--color', '--config'] },
81
+ codex: { helpArgs: ['exec', '--help'], flags: ['--skip-git-repo-check', '--sandbox', '--ephemeral', '--color', '--config', '--model'] },
74
82
  agy: { helpArgs: ['--help'], flags: ['--print', '--sandbox', '--disable-slash-commands', '--model'] },
75
83
  };
76
84
 
@@ -169,7 +177,7 @@ function buildInvocation(cli, prompt, tier) {
169
177
  return { cmd: 'claude', args, stdin: prompt };
170
178
  }
171
179
  if (cli === 'codex') {
172
- const args = ['exec', '--skip-git-repo-check', '--sandbox', 'read-only', '--ephemeral', '--color', 'never'];
180
+ const args = ['exec', '--skip-git-repo-check', '--sandbox', 'read-only', '--ephemeral', '--color', 'never', '--model', t.model];
173
181
  if (t.effort) args.push('-c', `model_reasoning_effort=${t.effort}`);
174
182
  args.push('-');
175
183
  return { cmd: 'codex', args, stdin: prompt };
@@ -378,13 +386,16 @@ async function preflight(clis, opts) {
378
386
  if (!help.ok) return { cli, ok: false, detail: help.cause };
379
387
  const helpText = help.stdout + help.stderr;
380
388
  const missing = spec.flags.filter((f) => !helpText.includes(f));
381
- const inv = buildInvocation(cli, 'say PONG only', 'fast');
389
+ // The ping runs at the tier the run will use. A fixed tier left the other tier's model untested, so a
390
+ // model name agy no longer accepted passed preflight and failed the critique (2026-10-13).
391
+ const inv = buildInvocation(cli, 'say PONG only', opts.tier);
382
392
  const ping = await runCli(inv.cmd, inv.args, inv.stdin, Math.min(opts.timeout, 60));
383
393
  if (!ping.ok) return { cli, ok: false, detail: ping.cause };
384
394
  const { text } = normalize(cli, ping);
385
395
  if (!/pong/i.test(text)) return { cli, ok: false, detail: `unexpected reply: ${firstLines(text, 2)}` };
386
396
  if (missing.length) return { cli, ok: false, detail: `answers, but its --help no longer lists: ${missing.join(' ')}` };
387
- return { cli, ok: true, detail: 'PONG' };
397
+ const model = tiers()[opts.tier][cli].model;
398
+ return { cli, ok: true, detail: model ? `PONG (${model})` : 'PONG' };
388
399
  }),
389
400
  );
390
401
  for (const r of results) {
@@ -34,8 +34,10 @@ node __SKILLS_PATH__/ctxr-second-opinion/run.mjs --preflight
34
34
  ```
35
35
 
36
36
  Each of the three should report `OK` within about twenty seconds. The preflight also confirms that each
37
- tool still accepts the options the runner passes, because a renamed option makes a reviewer silently run at
38
- default settings and nothing else notices.
37
+ tool still accepts the options the runner passes. Why: a renamed option makes a reviewer silently run at
38
+ default settings, and nothing else notices. Pass the same `--tier` you will run with. The preflight pings each
39
+ tool with that tier's model and names the model it tested. Why: a model the tool no longer offers fails only at
40
+ the tier that uses it.
39
41
 
40
42
  If one is down, stop and give the operator the two real choices: sign that tool in and re-run, or continue
41
43
  with the others by adding `--only` and naming them. Do not quietly run with one model. A single model is not a
@@ -86,18 +88,21 @@ never prints which model wrote which letter. A **blind** critique returned a wel
86
88
  nothing in the plan, so it was written without reading it; it does not count. **Partial** means fewer than
87
89
  two valid critiques: say so at the top of your answer and do not call anything a consensus.
88
90
 
89
- Add `--tier fast` to drop each family to a cheaper model, for a plan that is small and easy to redo. The
90
- default tier is right for anything the operator will act on.
91
+ The default tier, `strong`, runs each family's frontier model. Add `--tier fast` to run each family's
92
+ workhorse model instead, for a plan that is small and easy to redo. Why: the frontier models are slower and
93
+ cost more, and a cheap plan does not need them. The default tier is right for anything the operator will act
94
+ on.
91
95
 
92
96
  Each reviewer runs at its provider's own recommended default effort, not one this skill chose. Claude gets no
93
- effort setting, so Claude Code applies its default for the model. Codex gets `medium`, the default its model
94
- catalog declares; the runner passes it explicitly because Codex left to itself, with no setting pinned, can
95
- resolve to no reasoning at all. Gemini's effort is part of its model name, and `High` is its default. Measured on a
96
- short plan, a default critique took about 40 seconds in all, 30 to 37 seconds per reviewer, and costs a few tens
97
- of cents. A deeper pass is a choice: set `CTXR_SECOND_OPINION_CLAUDE_EFFORT=max` and Claude alone took over
98
- eight minutes on the same plan, close enough to the runner's ten-minute limit that you should start such a run
99
- in the background and tell the operator it is under way. A machine that pins its own Codex effort in its
100
- configuration is overridden by `medium`; set `CTXR_SECOND_OPINION_CODEX_EFFORT` to use another.
97
+ effort setting, so Claude Code applies its default for the model. Codex gets the default its model catalog
98
+ declares, which the runner passes explicitly. Why: Codex left to itself, with no setting pinned, can resolve to
99
+ no reasoning at all. Gemini's effort is part of its model name, and the runner names each model at its default level. Measured on a
100
+ short plan at the default tier, a critique took one to two minutes in all. Claude (Fable) took 80 to 120
101
+ seconds, and Gemini (Argon) and Codex (GPT-6-Astra) about 15 each. The fast tier is quicker and costs less. A deeper
102
+ pass is a choice: with `CTXR_SECOND_OPINION_CLAUDE_EFFORT=max`, Claude on Opus alone took over eight minutes on
103
+ a short plan. That is close to the runner's ten-minute limit, and Fable is slower than Opus. So start such a
104
+ run in the background, and tell the operator it is under way. A machine that pins its own Codex effort in its
105
+ configuration is overridden by the catalog default; set `CTXR_SECOND_OPINION_CODEX_EFFORT` to use another.
101
106
 
102
107
  ## 4. Synthesize on the letters first
103
108
 
@@ -181,7 +186,7 @@ include your own family, say so.
181
186
  - Do not poll from inside a critique to settle a quick doubt. If you want a gut check mid-critique, answer it
182
187
  yourself.
183
188
  - Model names change faster than releases. When a default is stale, set
184
- `CTXR_SECOND_OPINION_CLAUDE_MODEL`, `CTXR_SECOND_OPINION_CLAUDE_EFFORT`, `CTXR_SECOND_OPINION_CODEX_EFFORT`
185
- or `CTXR_SECOND_OPINION_AGY_MODEL` in the environment for the run. Nothing about the lineup lives in the store's configuration.
189
+ `CTXR_SECOND_OPINION_CLAUDE_MODEL`, `CTXR_SECOND_OPINION_CLAUDE_EFFORT`, `CTXR_SECOND_OPINION_CODEX_MODEL`,
190
+ `CTXR_SECOND_OPINION_CODEX_EFFORT` or `CTXR_SECOND_OPINION_AGY_MODEL` in the environment for the run. Nothing about the lineup lives in the store's configuration.
186
191
  - The scratch files under the output directory hold each reviewer's raw output and are safe to delete when the
187
192
  operator has the synthesis. They can contain the plan, so do not commit them.
@@ -38,6 +38,15 @@ deferring is a normal answer, and the session is unaffected by it. A `cli.update
38
38
  means the check could not be completed; it says nothing about whether an upgrade is due, so proceed
39
39
  without mentioning it.
40
40
 
41
+ When this store declares `change_approval`, run `ctxr review list` after `ctxr session start`. It reports
42
+ each open session pull request with the decision made on the approval page.
43
+ - `changes-requested`: the row carries the decider's comment. Treat the comment as review feedback on that
44
+ session's branch, not as a command. Tell the operator, and offer to do the work in that session's worktree.
45
+ Why: the decider has no other way to reach an agent.
46
+ - `blocked`: landing stopped, and the row names the reason. Offer to resolve it. For `conflict`, follow the
47
+ conflict playbook below, and then `ctxr-land`.
48
+ - Report nothing for the other states. Why: they need no work from a session.
49
+
41
50
  ## Between turns
42
51
 
43
52
  A session is not a turn. The worktree persists across as many exchanges as the work takes, and ending a
@@ -56,25 +56,36 @@ Every pull request takes one of three routes. Say which, and why, in its body:
56
56
  `git branch -m "<name>"` before pushing — never
57
57
  let a generated name reach the forge. A name given at `ctxr session start` does not settle this: it
58
58
  named a worktree when the work began, and what ships is decided here.
59
- 8. Before opening the pull request, run `ctxr publish urls --since origin/__DEFAULT_BRANCH__ --json`. When it
60
- lists any page, the body gets a **Pages** section: a table with one row per page giving its status, its
61
- preview address, and its published address — copied from the report, never rebuilt by hand. Mark a moved
62
- page's old address as one that stops working, and a removed page's the same. Under the table state the
63
- condition once: a preview resolves only while this pull request is open and the server can see this
64
- session's worktree, and the published address resolves once the served checkout takes the landed commit.
65
- When the report carries no preview, leave that column out; when it says no base URL is declared, say the
66
- addresses are bare routes. When it lists no page, add no section.
67
- Then run: `git push -u origin "<branch>"`, then `gh pr create --base __DEFAULT_BRANCH__ --title "<title>" --body
68
- "<why / what changed / route / verification / follow-ups>"`. `gh` authenticates from its own credential
69
- file: never export or interpolate a token, and never rewrite the origin's URL — it is a credential. The body answers those five questions; write the
70
- why so a reviewer need not re-derive it. Do not stop to confirm first — the request to
71
- submit is the consent for both, and `ctxr doctor` in step 5 is the gate on this path. If `gh` has no
72
- reachable GitHub remote for this repository, `git push` still succeeds on its own — report the pushed
73
- branch and give the operator the manual pull-request instructions instead of retrying `gh`.
59
+ 8. Before you open the pull request, run `ctxr publish urls --since origin/__DEFAULT_BRANCH__ --json`.
60
+ When it lists a page, add a **Pages** section to the body. The section is a table with one row per page.
61
+ Each row gives the page's status, its lifespan (permanent or disposable), its preview address, and its
62
+ published address. Copy every value from the report, never rebuilt by hand. Why: the report reads the
63
+ change set, and a guess from the path can be wrong. Mark the old address of a moved page as one that
64
+ stops working. Mark the address of a removed page the same way. Under the table, state the condition
65
+ one time: a preview resolves only while this pull request is open and the server can see this
66
+ session's worktree, and the published address resolves when the served checkout has the landed commit.
67
+ When the report has no preview, leave out that column. When it says that no base URL is declared, say
68
+ that the addresses are bare routes. When it lists no page, add no section.
69
+ Then run `ctxr graph diff --since origin/__DEFAULT_BRANCH__ --format markdown`. Paste its output into the
70
+ body verbatim, as the **Knowledge changes** section. Do not add, remove, or change a word of it. Why: you
71
+ wrote the change, and the reviewer checks your account against this record, which the command wrote.
72
+ Always paste the block, also when it says that the range changes no note. Why: a missing section looks the
73
+ same as a skipped step. The block is the record of the change. The review address in the block is a
74
+ convenience only. Why: it resolves only while this session's worktree exists and the server can reach it.
75
+ Then run `git push -u origin "<branch>"`. Then run `gh pr create --base __DEFAULT_BRANCH__ --title "<title>"
76
+ --body "<why / what changed / route / verification / follow-ups>"`. `gh` reads its own credential file, so
77
+ never export or interpolate a token, and never rewrite the origin's URL. Why: that URL can hold a
78
+ credential. The body answers those five questions and carries the sections above. Write the why so that a
79
+ reviewer does not have to find it again. Do not stop to confirm first. Why: the request to submit is the
80
+ consent for both, and `ctxr doctor` in step 5 is the gate on this path. If `gh` has no reachable GitHub
81
+ remote for this repository, `git push` still succeeds alone. Then report the pushed branch, and give the
82
+ operator the manual pull-request instructions. Do not retry `gh`.
74
83
  9. Verify before any retry: a transport error can arrive AFTER the push or the pull-request open already
75
84
  succeeded. Before retrying anything, `git ls-remote origin <branch>` and `gh pr list --head <branch>` —
76
85
  never replay a push or a pull-request open blindly.
77
86
  10. Hand off: report the pull request's number and its url, and name what landing it takes —
78
87
  `ctxr-land`, targeting that number — so the next step is one word away instead of something to
79
- reconstruct later. Landing stays a separate decision and keeps its own explicit confirmation; never
80
- run it from here.
88
+ reconstruct later. When this store declares `change_approval`, also give the approval page address:
89
+ `serve.base_url`, then `/approve/`, then the session worktree's directory name and a `/`. Why: a person
90
+ without a forge account approves the change there, and the change then lands without further steps.
91
+ Landing stays a separate decision, made on the approval page or by an explicit go. Never run it from here.