@crouton-kit/crouter 0.3.28 → 0.3.29

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 (322) hide show
  1. package/dist/build-root.js +4 -2
  2. package/dist/builtin-memory/crouter-development/marketplaces.md +7 -6
  3. package/dist/builtin-memory/crouter-development/personas/base-prompt.md +1 -1
  4. package/dist/builtin-memory/crouter-development/personas/orchestrator-prompt.md +1 -1
  5. package/dist/builtin-memory/crouter-development/personas.md +1 -1
  6. package/dist/builtin-memory/crouter-development/plugins.md +20 -18
  7. package/dist/builtin-memory/design.md +1 -1
  8. package/dist/builtin-memory/development.md +1 -1
  9. package/dist/builtin-memory/internal/INDEX.md +1 -1
  10. package/dist/builtin-memory/internal/examples/INDEX.md +1 -1
  11. package/dist/builtin-memory/internal/examples/imessage-assistant.md +2 -2
  12. package/dist/builtin-memory/internal/nodes-and-canvas.md +1 -1
  13. package/dist/builtin-memory/internal/storage-tiers.md +1 -1
  14. package/dist/builtin-memory/planning.md +1 -1
  15. package/dist/builtin-memory/spec.md +6 -4
  16. package/dist/builtin-personas/orchestration-kernel.md +4 -5
  17. package/dist/builtin-personas/runtime-base.md +5 -4
  18. package/dist/builtin-personas/spec/PERSONA.md +8 -4
  19. package/dist/builtin-personas/spec/orchestrator.md +5 -3
  20. package/dist/builtin-personas/spec/requirements/PERSONA.md +10 -0
  21. package/dist/builtin-views/canvas/core.mjs +586 -0
  22. package/dist/builtin-views/canvas/text.mjs +58 -0
  23. package/dist/builtin-views/canvas/tui.mjs +165 -0
  24. package/dist/builtin-views/canvas/web.jsx +120 -0
  25. package/dist/builtin-views/git-pr/core.mjs +673 -0
  26. package/dist/builtin-views/git-pr/text.mjs +84 -0
  27. package/dist/builtin-views/git-pr/tui.mjs +302 -0
  28. package/dist/builtin-views/git-pr/web.jsx +216 -0
  29. package/dist/builtin-views/inbox/_lib/render.mjs +1 -3
  30. package/dist/builtin-views/inbox/core.mjs +1273 -0
  31. package/dist/builtin-views/inbox/text.mjs +73 -0
  32. package/dist/builtin-views/inbox/tui.mjs +312 -0
  33. package/dist/builtin-views/inbox/web.jsx +188 -0
  34. package/dist/builtin-views/linkedin/core.mjs +906 -0
  35. package/dist/builtin-views/linkedin/text.mjs +69 -0
  36. package/dist/builtin-views/linkedin/tui.mjs +427 -0
  37. package/dist/builtin-views/linkedin/web.jsx +206 -0
  38. package/dist/builtin-views/workspace-sidebar/core.mjs +621 -0
  39. package/dist/builtin-views/workspace-sidebar/text.mjs +53 -0
  40. package/dist/builtin-views/workspace-sidebar/tui.mjs +142 -0
  41. package/dist/builtin-views/workspace-sidebar/web.jsx +109 -0
  42. package/dist/cli.js +3 -3
  43. package/dist/clients/attach/__tests__/action-parity.test.js +48 -0
  44. package/dist/clients/attach/__tests__/clipboard-image.test.js +76 -0
  45. package/dist/clients/attach/__tests__/editor-newline.test.js +57 -0
  46. package/dist/clients/attach/__tests__/git-info.test.js +31 -0
  47. package/dist/clients/attach/__tests__/onrequest-wired.test.js +20 -0
  48. package/dist/clients/attach/__tests__/slash-quit-copy.test.js +42 -0
  49. package/dist/clients/attach/__tests__/titled-editor.test.js +39 -0
  50. package/dist/clients/attach/attach-cmd.js +282 -46
  51. package/dist/clients/attach/auth-pickers.d.ts +9 -0
  52. package/dist/clients/attach/auth-pickers.js +194 -0
  53. package/dist/clients/attach/canvas-panels.d.ts +4 -2
  54. package/dist/clients/attach/canvas-panels.js +45 -17
  55. package/dist/clients/attach/chat-view.d.ts +27 -2
  56. package/dist/clients/attach/chat-view.js +98 -9
  57. package/dist/clients/attach/clipboard-image.d.ts +47 -8
  58. package/dist/clients/attach/clipboard-image.js +150 -26
  59. package/dist/clients/attach/clipboard-text.d.ts +3 -0
  60. package/dist/clients/attach/clipboard-text.js +39 -0
  61. package/dist/clients/attach/config-load.d.ts +54 -7
  62. package/dist/clients/attach/config-load.js +99 -3
  63. package/dist/clients/attach/context-message.d.ts +12 -0
  64. package/dist/clients/attach/context-message.js +72 -0
  65. package/dist/clients/attach/git-info.d.ts +20 -0
  66. package/dist/clients/attach/git-info.js +44 -0
  67. package/dist/clients/attach/graph-overlay.d.ts +13 -4
  68. package/dist/clients/attach/graph-overlay.js +59 -19
  69. package/dist/clients/attach/input-controller.d.ts +75 -13
  70. package/dist/clients/attach/input-controller.js +305 -67
  71. package/dist/clients/attach/pickers.d.ts +58 -0
  72. package/dist/clients/attach/pickers.js +171 -0
  73. package/dist/clients/attach/slash-commands.d.ts +22 -0
  74. package/dist/clients/attach/slash-commands.js +91 -25
  75. package/dist/clients/attach/titled-editor.d.ts +33 -0
  76. package/dist/clients/attach/titled-editor.js +84 -0
  77. package/dist/clients/attach/view-socket.d.ts +18 -1
  78. package/dist/clients/attach/view-socket.js +70 -1
  79. package/dist/clients/web/dev-server.d.ts +7 -0
  80. package/dist/clients/web/dev-server.js +59 -0
  81. package/dist/clients/web/events.d.ts +14 -0
  82. package/dist/clients/web/events.js +151 -0
  83. package/dist/clients/web/server.d.ts +18 -0
  84. package/dist/clients/web/server.js +450 -0
  85. package/dist/clients/web/web-cmd.d.ts +2 -0
  86. package/dist/clients/web/web-cmd.js +120 -0
  87. package/dist/commands/canvas.js +1 -2
  88. package/dist/commands/chord.js +1 -1
  89. package/dist/commands/dashboard.js +5 -1
  90. package/dist/commands/memory/__tests__/lint-schema.test.js +6 -6
  91. package/dist/commands/memory/lint.js +14 -2
  92. package/dist/commands/memory/read.js +2 -2
  93. package/dist/commands/memory/shared.d.ts +7 -1
  94. package/dist/commands/memory/shared.js +18 -3
  95. package/dist/commands/memory/write.js +8 -4
  96. package/dist/commands/memory.js +4 -4
  97. package/dist/commands/node.d.ts +1 -1
  98. package/dist/commands/node.js +64 -65
  99. package/dist/commands/pkg.js +1 -2
  100. package/dist/commands/revive.js +11 -3
  101. package/dist/commands/sys/sync.d.ts +1 -0
  102. package/dist/commands/sys/sync.js +187 -0
  103. package/dist/commands/sys.js +3 -2
  104. package/dist/commands/view-cycle.js +2 -2
  105. package/dist/commands/view-list.js +8 -8
  106. package/dist/commands/view-new.js +21 -17
  107. package/dist/commands/view-pick.js +1 -1
  108. package/dist/commands/view-run.js +35 -14
  109. package/dist/commands/view.js +8 -6
  110. package/dist/commands/workspace.d.ts +2 -0
  111. package/dist/commands/workspace.js +161 -0
  112. package/dist/core/__tests__/broker-double-spawn.test.d.ts +1 -0
  113. package/dist/core/__tests__/broker-double-spawn.test.js +143 -0
  114. package/dist/core/__tests__/broker-fork-seam.test.d.ts +1 -0
  115. package/dist/core/__tests__/broker-fork-seam.test.js +102 -0
  116. package/dist/core/__tests__/broker-sdk-wiring.test.js +2 -0
  117. package/dist/core/__tests__/child-death-wake.test.js +56 -111
  118. package/dist/core/__tests__/close.test.js +14 -20
  119. package/dist/core/__tests__/context-intro.test.js +19 -19
  120. package/dist/core/__tests__/daemon-boot.test.js +30 -23
  121. package/dist/core/__tests__/draw-style.test.js +1 -1
  122. package/dist/core/__tests__/error-stall-recycle.test.d.ts +1 -0
  123. package/dist/core/__tests__/error-stall-recycle.test.js +141 -0
  124. package/dist/core/__tests__/fixtures/fake-engine.d.ts +17 -1
  125. package/dist/core/__tests__/fixtures/fake-engine.js +22 -2
  126. package/dist/core/__tests__/fixtures/fake-pi-host.js +2 -2
  127. package/dist/core/__tests__/focuses.test.js +25 -13
  128. package/dist/core/__tests__/fork.test.js +22 -5
  129. package/dist/core/__tests__/full/broker-control-preempt.test.d.ts +1 -0
  130. package/dist/core/__tests__/full/broker-control-preempt.test.js +61 -0
  131. package/dist/core/__tests__/full/broker-model-changed-broadcast.test.d.ts +1 -0
  132. package/dist/core/__tests__/full/broker-model-changed-broadcast.test.js +57 -0
  133. package/dist/core/__tests__/full/broker-navigate-tree-rewelcome.test.d.ts +1 -0
  134. package/dist/core/__tests__/full/broker-navigate-tree-rewelcome.test.js +80 -0
  135. package/dist/core/__tests__/full/broker-pane-resolution.test.js +90 -0
  136. package/dist/core/__tests__/full/cascade-close.test.js +22 -8
  137. package/dist/core/__tests__/full/detach-focus.test.js +66 -169
  138. package/dist/core/__tests__/helpers/harness.d.ts +6 -9
  139. package/dist/core/__tests__/helpers/harness.js +19 -36
  140. package/dist/core/__tests__/human-node-not-supervised.test.d.ts +1 -0
  141. package/dist/core/__tests__/human-node-not-supervised.test.js +83 -0
  142. package/dist/core/__tests__/lifecycle.test.js +1 -19
  143. package/dist/core/__tests__/live-mutation-verbs.test.js +5 -5
  144. package/dist/core/__tests__/memory-resolver.test.js +1 -1
  145. package/dist/core/__tests__/on-read-dedup-resume.test.js +2 -2
  146. package/dist/core/__tests__/refresh-stall-recycle.test.d.ts +1 -0
  147. package/dist/core/__tests__/refresh-stall-recycle.test.js +88 -0
  148. package/dist/core/__tests__/relaunch-root.test.d.ts +1 -0
  149. package/dist/core/__tests__/relaunch-root.test.js +114 -0
  150. package/dist/core/__tests__/reset.test.js +19 -79
  151. package/dist/core/__tests__/steer-note.test.js +9 -7
  152. package/dist/core/__tests__/tmux-surface.test.js +13 -7
  153. package/dist/core/bootstrap.d.ts +0 -3
  154. package/dist/core/bootstrap.js +1 -143
  155. package/dist/core/canvas/browse/__tests__/model.test.js +86 -1
  156. package/dist/core/canvas/browse/__tests__/render.test.js +2 -1
  157. package/dist/core/canvas/browse/app.js +131 -8
  158. package/dist/core/canvas/browse/model.d.ts +23 -5
  159. package/dist/core/canvas/browse/model.js +68 -13
  160. package/dist/core/canvas/browse/render.d.ts +7 -1
  161. package/dist/core/canvas/browse/render.js +178 -47
  162. package/dist/core/canvas/canvas.js +1 -1
  163. package/dist/core/canvas/focuses.d.ts +4 -4
  164. package/dist/core/canvas/focuses.js +7 -7
  165. package/dist/core/canvas/nav-model.js +8 -7
  166. package/dist/core/canvas/render.d.ts +68 -9
  167. package/dist/core/canvas/render.js +195 -61
  168. package/dist/core/canvas/types.d.ts +16 -23
  169. package/dist/core/config.js +1 -4
  170. package/dist/core/memory-resolver.js +43 -5
  171. package/dist/core/runtime/bearings.d.ts +1 -1
  172. package/dist/core/runtime/bearings.js +8 -8
  173. package/dist/core/runtime/branded-host.d.ts +16 -0
  174. package/dist/core/runtime/branded-host.js +127 -0
  175. package/dist/core/runtime/broker-protocol.d.ts +212 -6
  176. package/dist/core/runtime/broker.d.ts +4 -1
  177. package/dist/core/runtime/broker.js +494 -58
  178. package/dist/core/runtime/close.d.ts +12 -2
  179. package/dist/core/runtime/close.js +37 -16
  180. package/dist/core/runtime/front-door.js +6 -14
  181. package/dist/core/runtime/host.d.ts +14 -34
  182. package/dist/core/runtime/host.js +14 -50
  183. package/dist/core/runtime/launch.d.ts +12 -9
  184. package/dist/core/runtime/launch.js +27 -15
  185. package/dist/core/runtime/lifecycle.d.ts +1 -1
  186. package/dist/core/runtime/lifecycle.js +15 -19
  187. package/dist/core/runtime/nodes.d.ts +0 -55
  188. package/dist/core/runtime/nodes.js +6 -74
  189. package/dist/core/runtime/placement.d.ts +91 -335
  190. package/dist/core/runtime/placement.js +262 -840
  191. package/dist/core/runtime/promote.d.ts +2 -0
  192. package/dist/core/runtime/promote.js +24 -6
  193. package/dist/core/runtime/recap.d.ts +8 -0
  194. package/dist/core/runtime/recap.js +107 -0
  195. package/dist/core/runtime/recycle.js +25 -61
  196. package/dist/core/runtime/reset.d.ts +43 -37
  197. package/dist/core/runtime/reset.js +131 -218
  198. package/dist/core/runtime/revive.d.ts +9 -29
  199. package/dist/core/runtime/revive.js +40 -139
  200. package/dist/core/runtime/spawn.d.ts +15 -16
  201. package/dist/core/runtime/spawn.js +165 -194
  202. package/dist/core/runtime/surface-bg.d.ts +11 -0
  203. package/dist/core/runtime/surface-bg.js +68 -0
  204. package/dist/core/runtime/tmux.d.ts +13 -50
  205. package/dist/core/runtime/tmux.js +33 -87
  206. package/dist/core/scope.d.ts +1 -2
  207. package/dist/core/scope.js +1 -5
  208. package/dist/core/skill-sync/__tests__/dry-run-wrote-count.test.d.ts +1 -0
  209. package/dist/core/skill-sync/__tests__/dry-run-wrote-count.test.js +57 -0
  210. package/dist/core/skill-sync/builtins.d.ts +42 -0
  211. package/dist/core/skill-sync/builtins.js +112 -0
  212. package/dist/core/skill-sync/claude-plugins.d.ts +23 -0
  213. package/dist/core/skill-sync/claude-plugins.js +71 -0
  214. package/dist/core/skill-sync/engine.d.ts +42 -0
  215. package/dist/core/skill-sync/engine.js +633 -0
  216. package/dist/core/skill-sync/export.d.ts +23 -0
  217. package/dist/core/skill-sync/export.js +86 -0
  218. package/dist/core/skill-sync/manifest.d.ts +64 -0
  219. package/dist/core/skill-sync/manifest.js +181 -0
  220. package/dist/core/skill-sync/profile.d.ts +76 -0
  221. package/dist/core/skill-sync/profile.js +173 -0
  222. package/dist/core/skill-sync/snapshot.d.ts +57 -0
  223. package/dist/core/skill-sync/snapshot.js +120 -0
  224. package/dist/core/substrate/index.d.ts +1 -1
  225. package/dist/core/substrate/index.js +1 -1
  226. package/dist/core/substrate/injected-store.js +3 -3
  227. package/dist/core/substrate/on-read.js +68 -6
  228. package/dist/core/substrate/render.d.ts +8 -11
  229. package/dist/core/substrate/render.js +29 -43
  230. package/dist/core/substrate/schema.d.ts +10 -3
  231. package/dist/core/substrate/schema.js +6 -3
  232. package/dist/core/tui/host.d.ts +12 -4
  233. package/dist/core/tui/host.js +280 -149
  234. package/dist/core/view/bridge.d.ts +10 -0
  235. package/dist/core/view/bridge.js +31 -0
  236. package/dist/core/view/chrome.d.ts +9 -0
  237. package/dist/core/view/chrome.js +22 -0
  238. package/dist/core/view/contract.d.ts +171 -0
  239. package/dist/core/view/contract.js +23 -0
  240. package/dist/core/view/loader.d.ts +31 -0
  241. package/dist/core/view/loader.js +188 -0
  242. package/dist/core/view/transport-local.d.ts +7 -0
  243. package/dist/core/view/transport-local.js +70 -0
  244. package/dist/core/view/transport.d.ts +4 -0
  245. package/dist/core/view/transport.js +15 -0
  246. package/dist/daemon/crtrd.d.ts +38 -27
  247. package/dist/daemon/crtrd.js +303 -376
  248. package/dist/daemon/manage.js +6 -1
  249. package/dist/index.js +1 -1
  250. package/dist/pi-extensions/__tests__/canvas-stophook-agentend.test.js +28 -20
  251. package/dist/pi-extensions/canvas-context-intro.js +4 -4
  252. package/dist/pi-extensions/canvas-doc-substrate.js +16 -16
  253. package/dist/pi-extensions/canvas-nav.js +5 -0
  254. package/dist/pi-extensions/canvas-recap.d.ts +37 -0
  255. package/dist/pi-extensions/canvas-recap.js +236 -0
  256. package/dist/pi-extensions/canvas-resume.js +2 -1
  257. package/dist/pi-extensions/canvas-stophook.d.ts +14 -12
  258. package/dist/pi-extensions/canvas-stophook.js +87 -101
  259. package/dist/pi-extensions/canvas-view.js +2 -1
  260. package/dist/pi-extensions/widget-order-bus.d.ts +6 -0
  261. package/dist/pi-extensions/widget-order-bus.js +34 -0
  262. package/dist/prompts/view.d.ts +2 -2
  263. package/dist/prompts/view.js +145 -73
  264. package/dist/types.d.ts +1 -6
  265. package/dist/types.js +1 -3
  266. package/dist/web/ViewChrome.d.ts +7 -0
  267. package/dist/web/ViewChrome.js +28 -0
  268. package/dist/web/ViewPane.d.ts +39 -0
  269. package/dist/web/ViewPane.js +48 -0
  270. package/dist/web/index.d.ts +6 -0
  271. package/dist/web/index.js +16 -0
  272. package/dist/web/runtime.d.ts +39 -0
  273. package/dist/web/runtime.js +133 -0
  274. package/dist/web/states.d.ts +24 -0
  275. package/dist/web/states.js +24 -0
  276. package/dist/web/transport-http.d.ts +5 -0
  277. package/dist/web/transport-http.js +28 -0
  278. package/dist/web-client/assets/index-BUvQb4hR.css +2 -0
  279. package/dist/web-client/assets/index-ClLQXYAE.js +10 -0
  280. package/dist/web-client/index.html +13 -0
  281. package/package.json +20 -6
  282. package/dist/builtin-views/canvas/client.mjs +0 -303
  283. package/dist/builtin-views/canvas/view.mjs +0 -576
  284. package/dist/builtin-views/git-pr/client.mjs +0 -440
  285. package/dist/builtin-views/git-pr/view.mjs +0 -675
  286. package/dist/builtin-views/inbox/sources/gmail.mjs +0 -965
  287. package/dist/builtin-views/inbox/sources/linkedin.mjs +0 -427
  288. package/dist/builtin-views/inbox/view.mjs +0 -889
  289. package/dist/builtin-views/linkedin/client.mjs +0 -610
  290. package/dist/builtin-views/linkedin/view.mjs +0 -1171
  291. package/dist/commands/pkg/bridge.d.ts +0 -1
  292. package/dist/commands/pkg/bridge.js +0 -137
  293. package/dist/commands/skill/author.d.ts +0 -3
  294. package/dist/commands/skill/author.js +0 -140
  295. package/dist/commands/skill/shared.d.ts +0 -3
  296. package/dist/commands/skill/shared.js +0 -19
  297. package/dist/commands/skill.d.ts +0 -2
  298. package/dist/commands/skill.js +0 -21
  299. package/dist/commands/tmux-spread.d.ts +0 -2
  300. package/dist/commands/tmux-spread.js +0 -144
  301. package/dist/core/__tests__/full/daemon-liveness-pane.full.test.js +0 -292
  302. package/dist/core/__tests__/full/placement-focus.test.js +0 -309
  303. package/dist/core/__tests__/full/placement-reconcile.test.js +0 -212
  304. package/dist/core/__tests__/full/placement-revive.test.js +0 -238
  305. package/dist/core/__tests__/full/placement-teardown.test.js +0 -297
  306. package/dist/core/__tests__/home-session.test.js +0 -186
  307. package/dist/core/__tests__/relaunch.test.js +0 -335
  308. package/dist/core/bridge-map.d.ts +0 -19
  309. package/dist/core/bridge-map.js +0 -73
  310. package/dist/core/tui/contract.d.ts +0 -83
  311. package/dist/core/tui/contract.js +0 -8
  312. package/dist/core/tui/loader.d.ts +0 -16
  313. package/dist/core/tui/loader.js +0 -94
  314. package/dist/prompts/skill.d.ts +0 -2
  315. package/dist/prompts/skill.js +0 -650
  316. /package/dist/{core/__tests__/full/daemon-liveness-pane.full.test.d.ts → clients/attach/__tests__/action-parity.test.d.ts} +0 -0
  317. /package/dist/{core/__tests__/full/placement-focus.test.d.ts → clients/attach/__tests__/clipboard-image.test.d.ts} +0 -0
  318. /package/dist/{core/__tests__/full/placement-reconcile.test.d.ts → clients/attach/__tests__/editor-newline.test.d.ts} +0 -0
  319. /package/dist/{core/__tests__/full/placement-revive.test.d.ts → clients/attach/__tests__/git-info.test.d.ts} +0 -0
  320. /package/dist/{core/__tests__/full/placement-teardown.test.d.ts → clients/attach/__tests__/onrequest-wired.test.d.ts} +0 -0
  321. /package/dist/{core/__tests__/home-session.test.d.ts → clients/attach/__tests__/slash-quit-copy.test.d.ts} +0 -0
  322. /package/dist/{core/__tests__/relaunch.test.d.ts → clients/attach/__tests__/titled-editor.test.d.ts} +0 -0
@@ -1,650 +0,0 @@
1
- export function skillCreatePrompt(topic) {
2
- const topicLine = topic
3
- ? `Topic: **${topic}**`
4
- : `No topic provided — ask the user what to capture before proceeding.`;
5
- return `# Author a skill — step 1: pick template type
6
-
7
- You are about to write a skill (markdown read by future LLM agent sessions,
8
- not humans). Pick the template, then load its workflow.
9
-
10
- ${topicLine}
11
-
12
- ## Templates
13
-
14
- Pick by what the agent does after reading the skill:
15
-
16
- - \`playbook\` — **decide**. Judgment, heuristics, when-to-use / when-not-to-use.
17
- Examples: skill-authoring, debugging methodology. Most skills are this.
18
- - \`primer\` — **navigate**. Codebase/architectural facts. *"How does this
19
- subsystem work, why, what are the gotchas."* Triggers parallel-explore.
20
- - \`reference\` — **look up**. Stable facts: protocol fields, API surface,
21
- glossaries, lookup tables. Source of truth is external (spec, docs).
22
- - \`runbook\` — **execute**. Numbered procedure with decision points and
23
- rollback. Examples: deploy, incident response, review workflow.
24
- - \`freeform\` — **none of the above**. Catchall for decision records, prefs,
25
- miscellany.
26
-
27
- Litmus: *"when X, do Y"* → playbook. *"these are the fields of Y"* →
28
- reference. *"step 1, step 2, step 3"* → runbook. *"how X is built inside
29
- this repo"* → primer.
30
-
31
- A skill that *does* a thing is a \`runbook\` (ordered steps). A skill that
32
- ships a helper script bundles it as a sibling file (see Format) — the type
33
- is still chosen by what the agent does after reading, not by the script.
34
-
35
- ## Format (every type)
36
-
37
- - A skill is a **directory**; \`SKILL.md\` is its entry file. Siblings are
38
- assets; nested dirs are their own skills.
39
- - Required frontmatter: \`name\`, \`type\`, \`description\`. \`name\` must equal the
40
- dir path under \`skills/\` — slashes nest (\`web/frontend/design\`).
41
- - \`description\`: one sentence, front-load "Use when…" — it is the **only**
42
- text an agent reads before choosing the skill, so every "when to reach for
43
- this" / selection cue lives *here*, never in the body. By the time anyone
44
- reads the body they have already picked the skill; a body line about
45
- when-to-use is wasted. The body is purely the workflow or knowledge they
46
- came for.
47
- - Budget ~150 lines per \`SKILL.md\`; spill deeper material into sibling files.
48
- - \`crtr skill author scaffold <n> --type <t> --scope <s> --description "<d>"\` writes correct frontmatter for you; \`crtr sys doctor\` validates.
49
-
50
- ## Voice (every type) — prescriptive or descriptive, never speculative
51
-
52
- A skill states **what to do** or **what is true**. It never lists open
53
- questions, debates, "things to consider", or unresolved tradeoffs. If a line
54
- isn't prescriptive or descriptive, it isn't important — cut it. If you can't
55
- state the answer, you're not ready to write that line: omit it or go ask.
56
- Hedging is the tell — \`may\`, \`might\`, \`consider whether\`, \`it depends\`,
57
- \`there's debate\`, \`one option is\`. Resolve it to a rule or delete it.
58
-
59
- ## Next
60
-
61
- 1. Pick a type. If unclear, use \`AskUserQuestion\` with your best guess first.
62
- 2. Run (output is JSON; read the \`guide\` field):
63
-
64
- \`\`\`
65
- crtr skill author guide --type <type>${topic ? ` --topic "${topic}"` : ''}
66
- \`\`\`
67
-
68
- That output contains the research methodology, SKILL.md skeleton, and
69
- scaffold command. Follow it directly — don't paraphrase.
70
-
71
- ## Push back when
72
-
73
- - Subsystem is small/self-evident → suggest CLAUDE.md note instead of primer.
74
- - "Topic" is really a one-off task → don't capture; just do the work.
75
- - Content is one-off lookup that lives elsewhere → link to it, don't mirror.
76
- `;
77
- }
78
- export function skillTemplatePrompt(type, topic) {
79
- const t = type.toLowerCase();
80
- if (t === 'primer')
81
- return primerTemplatePrompt(topic);
82
- if (t === 'playbook')
83
- return playbookTemplatePrompt(topic);
84
- if (t === 'reference')
85
- return referenceTemplatePrompt(topic);
86
- if (t === 'runbook')
87
- return runbookTemplatePrompt(topic);
88
- if (t === 'freeform')
89
- return freeformTemplatePrompt(topic);
90
- return `unknown template type: ${type}\nvalid: playbook | primer | reference | runbook | freeform\nrun \`crtr skill author guide\` to pick.\n`;
91
- }
92
- function topicLine(topic) {
93
- return topic
94
- ? `Topic: **${topic}**`
95
- : `No topic — confirm with the user before continuing.`;
96
- }
97
- function primerTemplatePrompt(topic) {
98
- return `# Primer — codebase knowledge skill
99
-
100
- **Audience: future LLM agent sessions.** Captures *why* a subsystem exists +
101
- non-obvious facts that code alone doesn't reveal. Lets a future session skip
102
- re-exploration.
103
-
104
- ${topicLine(topic)}
105
-
106
- ## 1. Inventory (parallel)
107
-
108
- - \`ls\` repo top level
109
- - check stack manifests
110
- - \`git log --oneline -15\` in this area
111
- - \`crtr memory find "<topic>"\` / \`crtr memory list\` — does a primer already exist?
112
-
113
- If subsystem is small/self-evident, **stop**. Suggest a CLAUDE.md note. Primers
114
- are for large, complicated, or unintuitive systems only.
115
-
116
- ## 2. Scope + name
117
-
118
- - **Scope**: \`project\` by default. \`user\` only if cross-repo.
119
- - **Name**: kebab-case. Confirm no collision: \`crtr memory read <name>\` (returns \`.path\`, \`.scope\`).
120
-
121
- ## 3. Parallel exploration
122
-
123
- Dispatch **4–8 \`Explore\` subagents in parallel**, partitioned by *slice* (not
124
- directory):
125
-
126
- - Entry points (routes, CLI, events, public exports)
127
- - Data model (schemas, types, invariants)
128
- - Control flow (typical request/job end-to-end)
129
- - External integrations (APIs, queues, env vars)
130
- - Tests (what's tested = what's load-bearing)
131
- - History (recent git log surfaces pain points)
132
- - Cross-cutting (auth, errors, logging, flags as they apply)
133
-
134
- Each subagent returns: concrete \`file:line\` refs, *non-obvious* facts (skip
135
- filename-obvious), naming conventions, gotchas. Reject vague summaries.
136
-
137
- ## 4. Verify with user
138
-
139
- Code = *what*. User = *why*. Use \`AskUserQuestion\` (≤4 questions,
140
- multi-choice, best-guess first):
141
-
142
- - Business purpose / who depends on it
143
- - Surprising-looking architectural decisions
144
- - Ownership / deprecation status / expected scale
145
- - Canonical flow when multiple exist
146
-
147
- Skip if greppable or won't change the primer. **Never write unconfirmed
148
- assumptions.**
149
-
150
- ## 5. Scaffold
151
-
152
- Output is JSON; read the \`path\` field:
153
-
154
- \`\`\`
155
- crtr skill author scaffold <name> --type primer --scope project --description "<what+when, ≤250 chars, front-loaded triggers>"
156
- \`\`\`
157
-
158
- ## 6. Write the body
159
-
160
- \`\`\`markdown
161
- # <topic>
162
-
163
- ## Purpose
164
- Why this exists. Problem solved. Who depends on it.
165
- (1–3 tight paragraphs — what code can't tell you.)
166
-
167
- ## Architecture
168
- Components, responsibilities, data/control flow, boundaries.
169
-
170
- ## File map
171
- | Path | Role |
172
- |------|------|
173
- | \`src/foo/bar.ts\` | … |
174
-
175
- ## Key concepts
176
- Domain terms, invariants, non-obvious constraints.
177
-
178
- ## Entry points
179
- \`file:line\` where work enters.
180
-
181
- ## Gotchas
182
- Non-obvious coupling. Looks-broken-but-isn't. Past footguns.
183
- \`\`\`
184
-
185
- Add a \`## Related\` section only for genuinely related skills — cross-plugin
186
- or distant refs included; skip it when there is nothing worth pointing at.
187
-
188
- **Density rules:**
189
- - \`file:line\` over prose
190
- - Tables where structure fits
191
- - Skip 30-second-skim-obvious
192
- - No "this section covers…" meta
193
- - Descriptive only — state what *is*. No "open questions", "we should probably", "unclear whether". Can't state it? Go find out or cut the line.
194
- - No citations/source attributions — \`(Author 2025)\`, arXiv IDs, Sources tables are bloat
195
- - Budget ~150 lines; deeper reference → sibling files
196
-
197
- ## 7. Verify
198
-
199
- Output is JSON; \`.content\` has the body, \`.path\` has the location:
200
-
201
- \`\`\`
202
- crtr memory read <name>
203
- crtr memory find "<keyword>" # confirm description triggers discovery
204
- \`\`\`
205
-
206
- Sharpen description if discovery misses. Cut body if bloated.
207
-
208
- ## Updates
209
-
210
- If updating existing primer: diff draft vs current, call out changes + why
211
- before writing.
212
- `;
213
- }
214
- function playbookTemplatePrompt(topic) {
215
- return `# Playbook — methodology skill
216
-
217
- **Audience: future LLM agent sessions.** Teaches *judgment*, not facts —
218
- decision frameworks, heuristics, when-to-use / when-not-to-use. Examples:
219
- skill-authoring, debugging methodology, multi-agent orchestration.
220
-
221
- ${topicLine(topic)}
222
-
223
- ## Litmus test
224
-
225
- > Does this teach judgment, or describe an API?
226
-
227
- If you'd write *"when X, do Y because Z"* → playbook. If you'd write tables
228
- of fields/flags/events → reference material (put in sibling \`reference.md\`,
229
- not SKILL.md). If neither fits → use \`crtr skill author guide --type freeform${topic ? ` --topic "${topic}"` : ''}\` instead.
230
-
231
- **Playbook markers:** teaches a framework · has "when (not) to use" · prose
232
- over tables · reader makes better decisions after 30 seconds.
233
-
234
- ## 1. Interview
235
-
236
- A playbook = user's accumulated judgment. Not greppable. Use
237
- \`AskUserQuestion\` (≤4, multi-choice, best-guess first):
238
-
239
- - The decision this skill teaches
240
- - 2–4 most common failure modes without it
241
- - Triggers (words/situations that should load it)
242
- - Non-obvious rules that surprise newcomers
243
-
244
- Push back on vagueness. *"Be thoughtful"* ≠ heuristic. *"Prefer one bundled
245
- PR over many small ones for refactors here, because review churn dominates"*
246
- = heuristic.
247
-
248
- ## 2. Scope + name
249
-
250
- - **Scope**: \`user\` for cross-project methodology. \`project\` for repo-specific.
251
- - **Name**: kebab-case, verb-or-noun-phrase. Not "guide-to-X".
252
- - Check \`crtr memory read <name>\` (returns \`.path\`, \`.scope\`).
253
-
254
- ## 3. Scaffold
255
-
256
- Output is JSON; read the \`path\` field:
257
-
258
- \`\`\`
259
- crtr skill author scaffold <name> --type playbook --scope <user|project> --description "<what it teaches + when to load, ≤250 chars, front-loaded triggers>"
260
- \`\`\`
261
-
262
- ## 4. Density rules
263
-
264
- LLM reasoning degrades past ~3k tokens. **Budget ~150 lines for SKILL.md.**
265
-
266
- - Decision-first. *"When you need X"* before *"how X works"*.
267
- - One well-placed "don't" > three paragraphs of explanation.
268
- - Prescriptive only — every line is a rule or the reason behind one. No "open debates", "considerations", "it depends" without the deciding factor. An unresolved tradeoff isn't judgment; resolve it to *"when A, X; when B, Y"* or cut it.
269
- - Reasoning chains > example outputs. Show *how to think*, not *what to produce*.
270
- - No citations or source attributions. State the heuristic directly — \`(Author 2025)\`, arXiv IDs, "research shows", and Sources tables are bloat that competes for the agent's context. (Only a \`reference\` skill cites: it links one source-of-truth so facts can be verified.)
271
- - Section >20 lines without teaching judgment → move to \`reference.md\`.
272
-
273
- **Test:** can someone reading 30 seconds make a better decision? If they need
274
- to read the whole thing for value, you've buried the judgment.
275
-
276
- ## 5. Body skeleton
277
-
278
- \`\`\`markdown
279
- # <skill name>
280
-
281
- <1-paragraph: what + when to load>
282
-
283
- ## When to use
284
- - <trigger>
285
-
286
- ## When NOT to use
287
- - <anti-trigger>
288
-
289
- ## The core decision
290
- <central judgment — usually a heuristic or framework>
291
-
292
- ## <heuristic 1>
293
- <2–6 lines, brief (anti-)example>
294
-
295
- ## <heuristic 2>
296
-
297
-
298
- ## Failure modes
299
- - **<name>**: what it looks like; how to avoid
300
- \`\`\`
301
-
302
- Add a \`## Related\` section only for genuinely related skills — cross-plugin
303
- or distant refs included; skip it when there is nothing worth pointing at.
304
-
305
- ## 6. Progressive disclosure
306
-
307
- If deep reference is needed:
308
-
309
- \`\`\`
310
- <skill-dir>/
311
- SKILL.md # judgment layer — <150 lines
312
- reference.md # lookup layer
313
- examples.md # optional worked examples
314
- \`\`\`
315
-
316
- SKILL.md *links* to siblings (\`see [reference.md](reference.md)\`). Agent
317
- loads supporting files only when needed.
318
-
319
- ## 7. Verify
320
-
321
- Output is JSON; \`.content\` has the body, \`.path\` has the location:
322
-
323
- \`\`\`
324
- crtr memory read <name>
325
- crtr memory find "<keyword>"
326
- \`\`\`
327
-
328
- ## Constraints
329
-
330
- - Topic fails litmus? → \`crtr skill author guide --type freeform\`, \`crtr skill author guide --type reference\`, or \`crtr skill author guide --type runbook\`.
331
- - No unconfirmed heuristics — if not from user experience or clear principle,
332
- leave it out.
333
- `;
334
- }
335
- function freeformTemplatePrompt(topic) {
336
- return `# Freeform — escape hatch skill
337
-
338
- **Audience: future LLM agent sessions.** Use when content doesn't fit
339
- \`primer\` (codebase knowledge) or \`playbook\` (methodology) — glossaries,
340
- decisions, runbooks, lists, preferences.
341
-
342
- ${topicLine(topic)}
343
-
344
- ## 1. Pick a shape
345
-
346
- What kind of thing is this?
347
-
348
- - Terms + definitions → glossary-shaped
349
- - "We decided X, here's why" → decision-shaped
350
- - Procedure with steps + rollback → runbook-shaped
351
- - User preferences → preference-shaped
352
- - None of the above → freeform
353
-
354
- No strict template; the shape just tells you what to ask for.
355
-
356
- ## 2. Interview
357
-
358
- \`AskUserQuestion\` (≤4, multi-choice, best-guess first). Get only what you
359
- need to write the skill. **No unconfirmed assumptions** — if not from user
360
- or grep, omit it. **Prescriptive or descriptive only** — the skill states
361
- what to do or what is true. No "open questions", debates, or unresolved
362
- tradeoffs; if you can't state the answer, cut the line.
363
-
364
- ## 3. Scope + name + scaffold
365
-
366
- Output is JSON; read the \`path\` field:
367
-
368
- \`\`\`
369
- crtr skill author scaffold <name> --type freeform --scope <user|project> --description "<what+when, ≤250 chars, front-loaded triggers>"
370
- \`\`\`
371
-
372
- ## 4. Body — pick the closest skeleton
373
-
374
- **Glossary:**
375
- \`\`\`markdown
376
- # <domain> glossary
377
- | Term | Definition | Notes |
378
- |------|------------|-------|
379
- \`\`\`
380
-
381
- **Decision:**
382
- \`\`\`markdown
383
- # <decision> — <date>
384
- ## Context — the constraint that forced a choice (facts, not musing)
385
- ## Decision — what we do now, stated as a rule
386
- ## Consequences — what this commits us to (descriptive, not "we'll see")
387
- ## Alternatives rejected — each with the one reason it lost (not a pros/cons dump)
388
- \`\`\`
389
-
390
- **Runbook:**
391
- \`\`\`markdown
392
- # <procedure>
393
- ## When to run
394
- ## Steps
395
- ## Verification
396
- ## Rollback
397
- \`\`\`
398
-
399
- **Preference:**
400
- \`\`\`markdown
401
- # <preference>
402
- ## Rule
403
- ## Why
404
- ## How to apply
405
- \`\`\`
406
-
407
- Or invent your own. Stay tight — no padding.
408
-
409
- ## 5. Verify
410
-
411
- Output is JSON; \`.content\` has the body, \`.path\` has the location:
412
-
413
- \`\`\`
414
- crtr memory read <name>
415
- crtr memory find "<keyword>"
416
- \`\`\`
417
-
418
- ## Switch templates if needed
419
-
420
- Content actually fits a typed template?
421
-
422
- \`\`\`
423
- crtr skill author guide --type playbook${topic ? ` --topic "${topic}"` : ''} # decide
424
- crtr skill author guide --type primer${topic ? ` --topic "${topic}"` : ''} # navigate codebase
425
- crtr skill author guide --type reference${topic ? ` --topic "${topic}"` : ''} # look up stable facts
426
- crtr skill author guide --type runbook${topic ? ` --topic "${topic}"` : ''} # execute a procedure
427
- \`\`\`
428
- `;
429
- }
430
- function referenceTemplatePrompt(topic) {
431
- return `# Reference — lookup-fact skill
432
-
433
- **Audience: future LLM agent sessions.** Captures *stable lookup facts* an
434
- agent will grep or scan: protocol fields, API surfaces, glossaries, enum
435
- tables, status-code maps. Source of truth lives *outside* the skill (RFC,
436
- spec, vendor docs); the skill is a fast in-repo cache.
437
-
438
- ${topicLine(topic)}
439
-
440
- ## Litmus test
441
-
442
- > Would you *grep* this rather than *read* it?
443
-
444
- If you'd skim end-to-end → it's not reference. If you'd jump straight to
445
- the row you need → reference. If you'd make a decision after reading →
446
- \`crtr skill author guide --type playbook\`. If you'd execute steps → \`crtr skill author guide --type runbook\`.
447
-
448
- **Reference markers:** mostly tables · stable across releases · authoritative
449
- source elsewhere · agent loads to *answer*, not to *think*.
450
-
451
- ## 1. Confirm reference, not playbook
452
-
453
- Use \`AskUserQuestion\` (≤4, multi-choice, best-guess first):
454
-
455
- - The lookup the agent will perform (e.g., "what does HTTP 423 mean")
456
- - Stability: does this change every release? If yes, push back — link the
457
- upstream source instead of mirroring it.
458
- - Authoritative source URL (cite in the body)
459
-
460
- Skip if the topic is clearly facts (RFCs, public API). **Never invent
461
- field/flag/code values** — pull verbatim from source.
462
-
463
- ## 2. Scope + name
464
-
465
- - **Scope**: \`user\` for cross-project facts. \`project\` for repo-specific.
466
- - **Name**: noun-phrase. \`http-status-codes\` not \`learn-http-status\`.
467
- - Check \`crtr memory read <name>\` (returns \`.path\`, \`.scope\`).
468
-
469
- ## 3. Scaffold
470
-
471
- Output is JSON; read the \`path\` field:
472
-
473
- \`\`\`
474
- crtr skill author scaffold <name> --type reference --scope <user|project> --description "<what to look up + when to load, ≤250 chars>"
475
- \`\`\`
476
-
477
- ## 4. Density rules
478
-
479
- Reference skills are *load and scan*, not *load and read*. Optimize for jump-to-row.
480
-
481
- - Tables for anything multi-row. Columns: most-queried field first.
482
- - One topic per file. Split if it doesn't fit one screen.
483
- - Source URL at the top — agent verifies before trusting cached facts.
484
- - No prose paragraphs longer than 2 lines.
485
- - Skip *why* — playbooks teach why. Reference teaches what.
486
- - Every row is a settled fact. No "TBD", "varies", "may differ" rows — if a value isn't known, omit the row, don't hedge it.
487
-
488
- ## 5. Body skeleton
489
-
490
- \`\`\`markdown
491
- # <topic> reference
492
-
493
- **Source of truth:** <URL or spec name>
494
- **Last verified:** <date — when an agent should re-check>
495
-
496
- ## <table 1 title>
497
- | <field> | <value> | <notes> |
498
- |---------|---------|---------|
499
- | … | … | … |
500
-
501
- ## <table 2 title>
502
-
503
-
504
- ## Edge cases / gotchas
505
- - Brief bullets. *What* is misleading, not *why*.
506
- \`\`\`
507
-
508
- **No \`## Related\` for within-plugin siblings** — auto-appended by the CLI.
509
-
510
- ## 6. Progressive disclosure
511
-
512
- If reference is large, split:
513
-
514
- \`\`\`
515
- <skill-dir>/
516
- SKILL.md # top-level index + most-queried table
517
- full-table.md # the full set
518
- examples.md # rarely-needed worked examples
519
- \`\`\`
520
-
521
- SKILL.md links to siblings (\`see [full-table.md](full-table.md)\`).
522
-
523
- ## 7. Verify
524
-
525
- Output is JSON; \`.content\` has the body, \`.path\` has the location:
526
-
527
- \`\`\`
528
- crtr memory read <name>
529
- crtr memory find "<keyword>"
530
- \`\`\`
531
-
532
- Search must surface the skill on a typical lookup query. Sharpen the
533
- description if it doesn't.
534
-
535
- ## Constraints
536
-
537
- - No invented values. If you can't cite the source, leave the row out.
538
- - Topic teaches *judgment*, not facts? → \`crtr skill author guide --type playbook\`.
539
- - Topic is a *procedure*? → \`crtr skill author guide --type runbook\`.
540
- - Source updates faster than you'll update the skill? → don't capture; link.
541
- `;
542
- }
543
- function runbookTemplatePrompt(topic) {
544
- return `# Runbook — procedure skill
545
-
546
- **Audience: future LLM agent sessions.** Captures a *procedure* the agent
547
- executes: numbered steps, decision points, verification, rollback. Examples:
548
- deploy, incident response, review workflow, release cut.
549
-
550
- ${topicLine(topic)}
551
-
552
- ## Litmus test
553
-
554
- > After loading this, does the agent *do steps in order*?
555
-
556
- If yes → runbook. If the agent makes a decision and stops → \`playbook\`. If
557
- the agent looks up a value → \`reference\`. If neither fits → \`freeform\`.
558
-
559
- **Runbook markers:** numbered steps · ordering matters · has rollback or
560
- verification · maps an outcome to a known sequence.
561
-
562
- ## 1. Capture the procedure
563
-
564
- Use \`AskUserQuestion\` (≤4, multi-choice, best-guess first):
565
-
566
- - The trigger (when does the agent run this?)
567
- - Steps in order — explicit, atomic. *"Update X"* is not atomic; *"run
568
- \\\`pnpm db:migrate\\\` and confirm exit 0"* is.
569
- - Decision points within the sequence (when does the agent branch?)
570
- - Rollback / verification (how to confirm success; how to undo on failure)
571
-
572
- Push back on vagueness. *"Deploy to prod"* is a label; *"run \\\`pnpm build\\\`,
573
- push to \\\`main\\\`, wait for green CI, click promote"* is a runbook step.
574
-
575
- ## 2. Scope + name
576
-
577
- - **Scope**: \`project\` for repo-specific procedures. \`user\` for cross-project.
578
- - **Name**: verb-phrase. \`deploy-to-prod\` not \`production-deployment-guide\`.
579
- - Check \`crtr memory read <name>\` (returns \`.path\`, \`.scope\`).
580
-
581
- ## 3. Scaffold
582
-
583
- Output is JSON; read the \`path\` field:
584
-
585
- \`\`\`
586
- crtr skill author scaffold <name> --type runbook --scope <user|project> --description "<when to run + outcome, ≤250 chars, front-loaded trigger>"
587
- \`\`\`
588
-
589
- ## 4. Density rules
590
-
591
- - Steps are commands, not advice. Each step is something the agent can verify.
592
- - Decision points get explicit branches, not "use judgment."
593
- - Prescriptive only. No "you may want to", "consider whether", "depending on" without the branch spelled out. If a step's outcome is uncertain, that's a decision point — write the branches, don't hedge the step.
594
- - Verification belongs in-line, after the step that produces the change.
595
- - Rollback is mandatory if the procedure changes prod state.
596
-
597
- ## 5. Body skeleton
598
-
599
- \`\`\`markdown
600
- # <procedure>
601
-
602
- ## When to run
603
- - <trigger>
604
-
605
- ## Pre-flight
606
- - [ ] <thing that must be true before starting>
607
-
608
- ## Steps
609
-
610
- 1. **<atomic action>** — \\\`<command>\\\`
611
- Verify: <observation that confirms success>
612
- If <error condition>: <what to do>
613
-
614
- 2. **<atomic action>** — …
615
-
616
- ## Decision points
617
-
618
- - After step N, if X then go to step M; else continue.
619
-
620
- ## Verification (post-flight)
621
- - [ ] <how to confirm the procedure succeeded end-to-end>
622
-
623
- ## Rollback
624
- 1. <reverse-order undo steps with their own verification>
625
- \`\`\`
626
-
627
- **No \`## Related\` for within-plugin siblings** — auto-appended by the CLI.
628
-
629
- ## 6. Verify
630
-
631
- Output is JSON; \`.content\` has the body, \`.path\` has the location:
632
-
633
- \`\`\`
634
- crtr memory read <name>
635
- crtr memory find "<keyword>"
636
- \`\`\`
637
-
638
- Walk through the runbook mentally. Each step verifiable? Each decision
639
- explicit? Rollback covers the state changes? If any answer is no, fix
640
- before shipping.
641
-
642
- ## Constraints
643
-
644
- - Steps without verification are wishes. Add the verify line or cut the step.
645
- - "Use your judgment at step 4" → either turn step 4 into a playbook
646
- reference, or write the decision criteria explicitly.
647
- - A procedure that's actually one command isn't a runbook — make it a
648
- CLAUDE.md note.
649
- `;
650
- }