@synap-core/cli 1.7.0 → 1.10.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 (371) hide show
  1. package/dist/commands/agent-chat.d.ts +47 -0
  2. package/dist/commands/agent-chat.js +250 -0
  3. package/dist/commands/agent-chat.js.map +1 -0
  4. package/dist/commands/agent-run.d.ts +47 -0
  5. package/dist/commands/agent-run.js +301 -0
  6. package/dist/commands/agent-run.js.map +1 -0
  7. package/dist/commands/agents.js +85 -46
  8. package/dist/commands/agents.js.map +1 -1
  9. package/dist/commands/artifact.d.ts +26 -0
  10. package/dist/commands/artifact.js +76 -0
  11. package/dist/commands/artifact.js.map +1 -0
  12. package/dist/commands/automation.d.ts +47 -0
  13. package/dist/commands/automation.js +601 -0
  14. package/dist/commands/automation.js.map +1 -0
  15. package/dist/commands/bridge-setup.d.ts +66 -0
  16. package/dist/commands/bridge-setup.js +1112 -0
  17. package/dist/commands/bridge-setup.js.map +1 -0
  18. package/dist/commands/cap-connections.d.ts +28 -0
  19. package/dist/commands/cap-connections.js +224 -0
  20. package/dist/commands/cap-connections.js.map +1 -0
  21. package/dist/commands/capability.d.ts +89 -0
  22. package/dist/commands/capability.js +1523 -0
  23. package/dist/commands/capability.js.map +1 -0
  24. package/dist/commands/cell.d.ts +55 -0
  25. package/dist/commands/cell.js +277 -0
  26. package/dist/commands/cell.js.map +1 -0
  27. package/dist/commands/centrality.d.ts +20 -0
  28. package/dist/commands/centrality.js +94 -0
  29. package/dist/commands/centrality.js.map +1 -0
  30. package/dist/commands/connect.d.ts +2 -0
  31. package/dist/commands/connect.js +25 -10
  32. package/dist/commands/connect.js.map +1 -1
  33. package/dist/commands/connections.js +0 -16
  34. package/dist/commands/connections.js.map +1 -1
  35. package/dist/commands/context.d.ts +22 -0
  36. package/dist/commands/context.js +149 -0
  37. package/dist/commands/context.js.map +1 -0
  38. package/dist/commands/data-extra.d.ts +14 -0
  39. package/dist/commands/data-extra.js +185 -0
  40. package/dist/commands/data-extra.js.map +1 -0
  41. package/dist/commands/data.d.ts +14 -10
  42. package/dist/commands/data.js +353 -192
  43. package/dist/commands/data.js.map +1 -1
  44. package/dist/commands/diagnose.d.ts +20 -0
  45. package/dist/commands/diagnose.js +143 -0
  46. package/dist/commands/diagnose.js.map +1 -0
  47. package/dist/commands/digest.d.ts +17 -0
  48. package/dist/commands/digest.js +121 -0
  49. package/dist/commands/digest.js.map +1 -0
  50. package/dist/commands/discover.d.ts +2 -0
  51. package/dist/commands/discover.js +25 -8
  52. package/dist/commands/discover.js.map +1 -1
  53. package/dist/commands/doc.d.ts +39 -0
  54. package/dist/commands/doc.js +130 -0
  55. package/dist/commands/doc.js.map +1 -0
  56. package/dist/commands/events.d.ts +26 -0
  57. package/dist/commands/events.js +69 -0
  58. package/dist/commands/events.js.map +1 -0
  59. package/dist/commands/explain.d.ts +21 -0
  60. package/dist/commands/explain.js +251 -0
  61. package/dist/commands/explain.js.map +1 -0
  62. package/dist/commands/facet.d.ts +29 -0
  63. package/dist/commands/facet.js +113 -0
  64. package/dist/commands/facet.js.map +1 -0
  65. package/dist/commands/graph.d.ts +18 -0
  66. package/dist/commands/graph.js +74 -0
  67. package/dist/commands/graph.js.map +1 -0
  68. package/dist/commands/home.d.ts +12 -0
  69. package/dist/commands/home.js +54 -0
  70. package/dist/commands/home.js.map +1 -0
  71. package/dist/commands/import.d.ts +38 -0
  72. package/dist/commands/import.js +440 -0
  73. package/dist/commands/import.js.map +1 -0
  74. package/dist/commands/init.d.ts +0 -2
  75. package/dist/commands/init.js +97 -118
  76. package/dist/commands/init.js.map +1 -1
  77. package/dist/commands/keys.d.ts +9 -0
  78. package/dist/commands/keys.js +78 -0
  79. package/dist/commands/keys.js.map +1 -0
  80. package/dist/commands/knowledge.d.ts +34 -18
  81. package/dist/commands/knowledge.js +355 -57
  82. package/dist/commands/knowledge.js.map +1 -1
  83. package/dist/commands/launch.d.ts +50 -0
  84. package/dist/commands/launch.js +790 -0
  85. package/dist/commands/launch.js.map +1 -0
  86. package/dist/commands/lens.d.ts +45 -0
  87. package/dist/commands/lens.js +386 -0
  88. package/dist/commands/lens.js.map +1 -0
  89. package/dist/commands/market.d.ts +209 -0
  90. package/dist/commands/market.js +1368 -0
  91. package/dist/commands/market.js.map +1 -0
  92. package/dist/commands/mcp.d.ts +42 -0
  93. package/dist/commands/mcp.js +184 -0
  94. package/dist/commands/mcp.js.map +1 -0
  95. package/dist/commands/observe.d.ts +9 -0
  96. package/dist/commands/observe.js +93 -0
  97. package/dist/commands/observe.js.map +1 -0
  98. package/dist/commands/open.d.ts +32 -0
  99. package/dist/commands/open.js +85 -0
  100. package/dist/commands/open.js.map +1 -0
  101. package/dist/commands/pod.d.ts +100 -0
  102. package/dist/commands/pod.js +359 -0
  103. package/dist/commands/pod.js.map +1 -0
  104. package/dist/commands/pods.d.ts +6 -0
  105. package/dist/commands/pods.js +160 -50
  106. package/dist/commands/pods.js.map +1 -1
  107. package/dist/commands/proposals-actions.d.ts +7 -0
  108. package/dist/commands/proposals-actions.js +77 -0
  109. package/dist/commands/proposals-actions.js.map +1 -0
  110. package/dist/commands/providers.d.ts +38 -0
  111. package/dist/commands/providers.js +170 -0
  112. package/dist/commands/providers.js.map +1 -0
  113. package/dist/commands/purge.d.ts +23 -0
  114. package/dist/commands/purge.js +148 -0
  115. package/dist/commands/purge.js.map +1 -0
  116. package/dist/commands/raycast.d.ts +15 -0
  117. package/dist/commands/raycast.js +153 -0
  118. package/dist/commands/raycast.js.map +1 -0
  119. package/dist/commands/sessions.d.ts +31 -0
  120. package/dist/commands/sessions.js +248 -0
  121. package/dist/commands/sessions.js.map +1 -0
  122. package/dist/commands/skill-manage.d.ts +21 -0
  123. package/dist/commands/skill-manage.js +195 -0
  124. package/dist/commands/skill-manage.js.map +1 -0
  125. package/dist/commands/skills-commands.d.ts +26 -0
  126. package/dist/commands/skills-commands.js +187 -0
  127. package/dist/commands/skills-commands.js.map +1 -0
  128. package/dist/commands/skills.d.ts +26 -0
  129. package/dist/commands/skills.js +196 -0
  130. package/dist/commands/skills.js.map +1 -0
  131. package/dist/commands/status.d.ts +3 -1
  132. package/dist/commands/status.js +231 -41
  133. package/dist/commands/status.js.map +1 -1
  134. package/dist/commands/statusline.d.ts +24 -0
  135. package/dist/commands/statusline.js +450 -0
  136. package/dist/commands/statusline.js.map +1 -0
  137. package/dist/commands/subscribe.d.ts +19 -0
  138. package/dist/commands/subscribe.js +91 -0
  139. package/dist/commands/subscribe.js.map +1 -0
  140. package/dist/commands/tools.d.ts +30 -0
  141. package/dist/commands/tools.js +315 -0
  142. package/dist/commands/tools.js.map +1 -0
  143. package/dist/commands/versions.d.ts +27 -0
  144. package/dist/commands/versions.js +277 -0
  145. package/dist/commands/versions.js.map +1 -0
  146. package/dist/commands/view.d.ts +57 -0
  147. package/dist/commands/view.js +195 -0
  148. package/dist/commands/view.js.map +1 -0
  149. package/dist/commands/whoami.d.ts +21 -0
  150. package/dist/commands/whoami.js +129 -0
  151. package/dist/commands/whoami.js.map +1 -0
  152. package/dist/index.d.ts +3 -4
  153. package/dist/index.js +1524 -202
  154. package/dist/index.js.map +1 -1
  155. package/dist/lib/agent-templates.d.ts +25 -0
  156. package/dist/lib/agent-templates.js +148 -0
  157. package/dist/lib/agent-templates.js.map +1 -0
  158. package/dist/lib/agents-config.d.ts +4 -1
  159. package/dist/lib/agents-config.js +19 -2
  160. package/dist/lib/agents-config.js.map +1 -1
  161. package/dist/lib/approval-poll.d.ts +42 -0
  162. package/dist/lib/approval-poll.js +52 -0
  163. package/dist/lib/approval-poll.js.map +1 -0
  164. package/dist/lib/auth.d.ts +29 -6
  165. package/dist/lib/auth.js +105 -94
  166. package/dist/lib/auth.js.map +1 -1
  167. package/dist/lib/bundle-version.d.ts +11 -0
  168. package/dist/lib/bundle-version.js +33 -0
  169. package/dist/lib/bundle-version.js.map +1 -0
  170. package/dist/lib/capture-lane.d.ts +67 -0
  171. package/dist/lib/capture-lane.js +136 -0
  172. package/dist/lib/capture-lane.js.map +1 -0
  173. package/dist/lib/cp-packages.d.ts +121 -0
  174. package/dist/lib/cp-packages.js +218 -0
  175. package/dist/lib/cp-packages.js.map +1 -0
  176. package/dist/lib/describe-lens.d.ts +46 -0
  177. package/dist/lib/describe-lens.js +33 -0
  178. package/dist/lib/describe-lens.js.map +1 -0
  179. package/dist/lib/hub-client.d.ts +84 -1
  180. package/dist/lib/hub-client.js +502 -22
  181. package/dist/lib/hub-client.js.map +1 -1
  182. package/dist/lib/installed.d.ts +51 -0
  183. package/dist/lib/installed.js +70 -0
  184. package/dist/lib/installed.js.map +1 -0
  185. package/dist/lib/next-steps.d.ts +61 -0
  186. package/dist/lib/next-steps.js +146 -0
  187. package/dist/lib/next-steps.js.map +1 -0
  188. package/dist/lib/pod.d.ts +104 -19
  189. package/dist/lib/pod.js +245 -57
  190. package/dist/lib/pod.js.map +1 -1
  191. package/dist/lib/project-ref.d.ts +95 -0
  192. package/dist/lib/project-ref.js +144 -0
  193. package/dist/lib/project-ref.js.map +1 -0
  194. package/dist/lib/project.d.ts +35 -0
  195. package/dist/lib/project.js +39 -0
  196. package/dist/lib/project.js.map +1 -0
  197. package/dist/lib/session-lens.d.ts +33 -0
  198. package/dist/lib/session-lens.js +76 -0
  199. package/dist/lib/session-lens.js.map +1 -0
  200. package/dist/lib/skill-import.d.ts +40 -0
  201. package/dist/lib/skill-import.js +203 -0
  202. package/dist/lib/skill-import.js.map +1 -0
  203. package/dist/lib/skills-installer.d.ts +16 -5
  204. package/dist/lib/skills-installer.js +132 -18
  205. package/dist/lib/skills-installer.js.map +1 -1
  206. package/dist/lib/suite.d.ts +28 -0
  207. package/dist/lib/suite.js +29 -0
  208. package/dist/lib/suite.js.map +1 -0
  209. package/dist/lib/superwhisper-import.d.ts +40 -0
  210. package/dist/lib/superwhisper-import.js +389 -0
  211. package/dist/lib/superwhisper-import.js.map +1 -0
  212. package/dist/lib/targets.d.ts +66 -2
  213. package/dist/lib/targets.js +914 -132
  214. package/dist/lib/targets.js.map +1 -1
  215. package/dist/lib/unwrapList.d.ts +1 -0
  216. package/dist/lib/unwrapList.js +20 -0
  217. package/dist/lib/unwrapList.js.map +1 -0
  218. package/dist/utils/logger.d.ts +2 -0
  219. package/dist/utils/logger.js +10 -2
  220. package/dist/utils/logger.js.map +1 -1
  221. package/package.json +10 -4
  222. package/skills/agent-os/SKILL.md +212 -0
  223. package/skills/manifest.json +5 -0
  224. package/skills/onboard/SKILL.md +186 -0
  225. package/skills/synap/SKILL.md +1524 -104
  226. package/skills/synap/_order.txt +37 -0
  227. package/skills/synap/_skill.yaml +24 -0
  228. package/skills/synap/authentication.md +10 -0
  229. package/skills/synap/automations.md +264 -0
  230. package/skills/synap/capabilities.md +107 -0
  231. package/skills/synap/capture.md +10 -0
  232. package/skills/synap/cli-operations.md +107 -0
  233. package/skills/synap/common-mistakes.md +12 -0
  234. package/skills/synap/creative-loop.md +43 -0
  235. package/skills/synap/crm.md +117 -0
  236. package/skills/synap/diagnostics.md +35 -0
  237. package/skills/synap/digesting-a-channel.md +38 -0
  238. package/skills/synap/document-embeds.md +123 -0
  239. package/skills/synap/escalation-ladder.md +71 -0
  240. package/skills/synap/focus-sessions.md +47 -0
  241. package/skills/synap/governance-rules.md +64 -0
  242. package/skills/synap/governance.md +6 -6
  243. package/skills/synap/graph-gardening.md +21 -0
  244. package/skills/synap/inline-patterns.md +38 -0
  245. package/skills/synap/lenses.md +38 -0
  246. package/skills/synap/linking-principle.md +39 -0
  247. package/skills/synap/linking.md +1 -0
  248. package/skills/synap/mental-model.md +45 -0
  249. package/skills/synap/more.md +7 -0
  250. package/skills/synap/multi-entity-capture.md +10 -0
  251. package/skills/synap/next-action.md +37 -0
  252. package/skills/synap/north-star.md +17 -0
  253. package/skills/synap/operating-mode-rules.md +45 -0
  254. package/skills/synap/operating-mode.md +9 -0
  255. package/skills/synap/quick-reference.md +67 -0
  256. package/skills/synap/reading.md +43 -0
  257. package/skills/synap/recap.md +21 -0
  258. package/skills/synap/reflexes.md +46 -0
  259. package/skills/synap/response-style.md +21 -0
  260. package/skills/synap/scope.md +13 -0
  261. package/skills/synap/showing.md +17 -0
  262. package/skills/synap/user-model.md +25 -0
  263. package/skills/synap/viewframe-cells.md +290 -0
  264. package/skills/synap/work-flow.md +113 -0
  265. package/skills/synap/worked-examples.md +53 -0
  266. package/skills/synap/workspace-design.md +45 -0
  267. package/skills/synap/workspace-edges.md +49 -0
  268. package/skills/synap/writes.md +156 -0
  269. package/skills/synap-schema/SKILL.md +97 -6
  270. package/skills/synap-schema/_order.txt +13 -0
  271. package/skills/synap-schema/_skill.yaml +22 -0
  272. package/skills/synap-schema/before-you-touch.md +14 -0
  273. package/skills/synap-schema/common-mistakes.md +9 -0
  274. package/skills/synap-schema/creating-profiles.md +17 -0
  275. package/skills/synap-schema/discover-profiles.md +24 -0
  276. package/skills/synap-schema/entity-scope.md +8 -0
  277. package/skills/synap-schema/extend-vs-create.md +31 -0
  278. package/skills/synap-schema/more.md +6 -0
  279. package/skills/synap-schema/overlay-properties.md +22 -0
  280. package/skills/synap-schema/profiles.md +3 -0
  281. package/skills/synap-schema/property-defs.md +29 -0
  282. package/skills/synap-schema/read-before-write.md +50 -0
  283. package/skills/synap-schema/relations.md +18 -0
  284. package/skills/synap-schema/worked-example.md +30 -0
  285. package/skills/synap-ui/SKILL.md +38 -11
  286. package/skills/synap-ui/_order.txt +13 -0
  287. package/skills/synap-ui/_skill.yaml +23 -0
  288. package/skills/synap-ui/ai-companion.md +27 -0
  289. package/skills/synap-ui/arranging-bento.md +8 -0
  290. package/skills/synap-ui/before-you-build.md +20 -0
  291. package/skills/synap-ui/bento-layouts.md +35 -0
  292. package/skills/synap-ui/common-mistakes.md +10 -0
  293. package/skills/synap-ui/creating-views.md +26 -0
  294. package/skills/synap-ui/four-builds.md +24 -0
  295. package/skills/synap-ui/more.md +7 -0
  296. package/skills/synap-ui/proposing-vs-extending.md +11 -0
  297. package/skills/synap-ui/view-list.md +24 -0
  298. package/skills/synap-ui/views.md +3 -0
  299. package/skills/synap-ui/worked-example.md +18 -0
  300. package/skills/synap-ui/workspaces.md +47 -0
  301. package/templates/automations/bookmark-enrichment.automation.json +44 -0
  302. package/templates/automations/mail-feed.automation.json +86 -0
  303. package/templates/automations/url-bookmark-capture.automation.json +70 -0
  304. package/templates/skills/README.md +21 -0
  305. package/templates/skills/authoring-automations/SKILL.md +95 -0
  306. package/templates/skills/authoring-automations/reference/node-matrix.md +49 -0
  307. package/templates/skills/authoring-capabilities/SKILL.md +93 -0
  308. package/templates/skills/authoring-capabilities/reference/template-anatomy.md +70 -0
  309. package/templates/skills/authoring-playbooks/SKILL.md +102 -0
  310. package/templates/skills/authoring-playbooks/reference/stages-contract.md +35 -0
  311. package/templates/skills/authoring-playbooks/reference/worked-example.md +64 -0
  312. package/templates/skills/bookmark-enrichment/SKILL.md +40 -0
  313. package/templates/skills/coordinating-agents/SKILL.md +32 -0
  314. package/templates/skills/coordinating-branches/SKILL.md +27 -0
  315. package/templates/skills/mapping-the-server/SKILL.md +54 -0
  316. package/templates/skills/reading-client-progress/SKILL.md +65 -0
  317. package/templates/skills/routing-to-channels/SKILL.md +54 -0
  318. package/templates/skills/stellar-scf-grants-advisor/ASSOCIATE-CHEATSHEET.md +133 -0
  319. package/templates/skills/stellar-scf-grants-advisor/ASSOCIATE-ONBOARDING-GUIDE.md +761 -0
  320. package/templates/skills/stellar-scf-grants-advisor/CLIENT-FAQ.md +181 -0
  321. package/templates/skills/stellar-scf-grants-advisor/PARTNER-HANDOVER.md +130 -0
  322. package/templates/skills/stellar-scf-grants-advisor/SKILL.md +102 -0
  323. package/templates/skills/stellar-scf-grants-advisor/examples/README.md +43 -0
  324. package/templates/skills/stellar-scf-grants-advisor/examples/chat-summary-templates.md +158 -0
  325. package/templates/skills/stellar-scf-grants-advisor/examples/corpus-comparable-rows.md +136 -0
  326. package/templates/skills/stellar-scf-grants-advisor/examples/q10-team-rewrites.md +109 -0
  327. package/templates/skills/stellar-scf-grants-advisor/examples/q2-description-rewrites.md +88 -0
  328. package/templates/skills/stellar-scf-grants-advisor/examples/q6-integration-rewrites.md +107 -0
  329. package/templates/skills/stellar-scf-grants-advisor/examples/tranche-structures.md +176 -0
  330. package/templates/skills/stellar-scf-grants-advisor/reference/01-methodology.md +96 -0
  331. package/templates/skills/stellar-scf-grants-advisor/reference/02-scoring-framework.md +199 -0
  332. package/templates/skills/stellar-scf-grants-advisor/reference/03-rejection-patterns.md +241 -0
  333. package/templates/skills/stellar-scf-grants-advisor/reference/04-winner-patterns.md +120 -0
  334. package/templates/skills/stellar-scf-grants-advisor/reference/05-comeback-patterns.md +92 -0
  335. package/templates/skills/stellar-scf-grants-advisor/reference/06-budget-benchmarks.md +125 -0
  336. package/templates/skills/stellar-scf-grants-advisor/reference/07-integration-list.md +147 -0
  337. package/templates/skills/stellar-scf-grants-advisor/reference/08-abstract-fields.md +258 -0
  338. package/templates/skills/stellar-scf-grants-advisor/reference/09-build-fields.md +259 -0
  339. package/templates/skills/stellar-scf-grants-advisor/reference/10-corpus-winners.md +135 -0
  340. package/templates/skills/stellar-scf-grants-advisor/reference/11-corpus-rejects.md +267 -0
  341. package/templates/skills/stellar-scf-grants-advisor/reference/12-client-communication.md +131 -0
  342. package/templates/skills/stellar-scf-grants-advisor/reference/13-excel-output-spec.md +199 -0
  343. package/templates/skills/stellar-scf-grants-advisor/reference/14-worked-examples.md +160 -0
  344. package/templates/skills/stellar-scf-grants-advisor/templates/abstract-review-builder.py +253 -0
  345. package/templates/skills/stellar-scf-grants-advisor/templates/build-review-builder.py +213 -0
  346. package/dist/commands/finish.d.ts +0 -25
  347. package/dist/commands/finish.js +0 -274
  348. package/dist/commands/finish.js.map +0 -1
  349. package/dist/commands/openclaw.d.ts +0 -40
  350. package/dist/commands/openclaw.js +0 -1148
  351. package/dist/commands/openclaw.js.map +0 -1
  352. package/dist/commands/security-audit.d.ts +0 -12
  353. package/dist/commands/security-audit.js +0 -100
  354. package/dist/commands/security-audit.js.map +0 -1
  355. package/dist/lib/hardening.d.ts +0 -18
  356. package/dist/lib/hardening.js +0 -214
  357. package/dist/lib/hardening.js.map +0 -1
  358. package/dist/lib/templates.d.ts +0 -11
  359. package/dist/lib/templates.js +0 -13
  360. package/dist/lib/templates.js.map +0 -1
  361. package/dist/templates/agent-os.json +0 -3090
  362. package/node_modules/@synap/hub-rest-client/dist/index.cjs +0 -881
  363. package/node_modules/@synap/hub-rest-client/dist/index.d.cts +0 -907
  364. package/node_modules/@synap/hub-rest-client/dist/index.d.ts +0 -907
  365. package/node_modules/@synap/hub-rest-client/dist/index.js +0 -851
  366. package/node_modules/@synap/hub-rest-client/package.json +0 -45
  367. package/node_modules/@synap/hub-rest-client/src/client.ts +0 -1143
  368. package/node_modules/@synap/hub-rest-client/src/errors.ts +0 -30
  369. package/node_modules/@synap/hub-rest-client/src/index.ts +0 -111
  370. package/node_modules/@synap/hub-rest-client/src/setup.ts +0 -77
  371. package/node_modules/@synap/hub-rest-client/src/types.ts +0 -639
@@ -0,0 +1,70 @@
1
+ {
2
+ "name": "URL → Bookmark (inbound messages)",
3
+ "triggerType": "event",
4
+ "status": "active",
5
+ "triggerConfig": {
6
+ "eventPattern": "external_message.received.*",
7
+ "filters": { "provider": "discord" }
8
+ },
9
+ "flowDefinition": {
10
+ "nodes": [
11
+ {
12
+ "id": "trigger",
13
+ "type": "trigger",
14
+ "position": { "x": 0, "y": 0 },
15
+ "data": {
16
+ "triggerType": "event",
17
+ "label": "Inbound message",
18
+ "config": {
19
+ "eventPattern": "external_message.received.*",
20
+ "filters": { "provider": "discord" }
21
+ }
22
+ }
23
+ },
24
+ {
25
+ "id": "extract",
26
+ "type": "transform",
27
+ "position": { "x": 0, "y": 120 },
28
+ "data": {
29
+ "label": "Extract URLs",
30
+ "expression": "{{trigger.payload.data.content}} | url_extract"
31
+ }
32
+ },
33
+ {
34
+ "id": "url-loop",
35
+ "type": "loop",
36
+ "position": { "x": 0, "y": 240 },
37
+ "data": {
38
+ "label": "For each URL",
39
+ "iteratorExpression": "steps.extract.output.result",
40
+ "itemVariable": "url"
41
+ }
42
+ },
43
+ {
44
+ "id": "create-bookmark",
45
+ "type": "output",
46
+ "position": { "x": 0, "y": 360 },
47
+ "data": {
48
+ "label": "Create bookmark",
49
+ "outputType": "entity_create",
50
+ "config": {
51
+ "profileSlug": "bookmark",
52
+ "title": "{{loop.item}}",
53
+ "dedupeBy": "url",
54
+ "properties": {
55
+ "url": "{{loop.item}}",
56
+ "sourceMessageId": "{{trigger.payload.data.messageId}}",
57
+ "sourceChannelId": "{{trigger.payload.data.threadId}}"
58
+ }
59
+ }
60
+ }
61
+ }
62
+ ],
63
+ "edges": [
64
+ { "id": "e1", "source": "trigger", "target": "extract" },
65
+ { "id": "e2", "source": "extract", "target": "url-loop" },
66
+ { "id": "e3", "source": "url-loop", "target": "create-bookmark" }
67
+ ]
68
+ },
69
+ "metadata": { "source": "bridge-template" }
70
+ }
@@ -0,0 +1,21 @@
1
+ # CLI-bundled skills (`synap skill add bundled`)
2
+
3
+ This directory must NOT hold hand-authored copies of the backend **SSOT** skills.
4
+ The pod's baseline skills already reach every pod two other ways:
5
+
6
+ - **Auto-seeded** on pod boot by `ensureSystemSkills()` (backend `skills/` → `system/*` rows).
7
+ - Shipped as **Agent-Skills packages** by `scripts/sync-skills.sh` (→ `synap-cli/skills/`).
8
+
9
+ Duplicating them here is what drifted (e.g. an old CRM `digesting-a-channel`), so the
10
+ 15 SSOT-covered skills were retired from this bundle.
11
+
12
+ What remains here, and why:
13
+ - **CLI/agent-runtime skills** (`coordinating-*`, `authoring-*`) — genuine runtime
14
+ concerns with no SSOT counterpart. Hand-authored; this is their home.
15
+ - **Agency/domain skills** (`stellar-scf-grants-advisor` + its reference corpus,
16
+ `mapping-the-server`, `routing-to-channels`, `bookmark-enrichment`,
17
+ `reading-client-progress`) — these belong in the **CP capability templates** and
18
+ are applied via `/capabilities/apply` (see `bridge-setup` AGENCY plan). They stay
19
+ bundled here TEMPORARILY until CP gains reference-corpus support (`documents[]`/
20
+ `referenceDir`) so the stellar corpus survives the move. Do not add new SSOT-style
21
+ skills here.
@@ -0,0 +1,95 @@
1
+ ---
2
+ name: authoring-automations
3
+ description: Authors a Synap Automation — the WHEN→THEN flow engine (triggers, nodes, data flow). Use whenever the user wants something to happen automatically: "every morning do X", "when a Y is created then Z", "poll this source and create entities", "fan out a list into records", "post to a channel when…", or asks to build/edit an automation flow. Also use when designing the trigger half of a playbook (the WHEN that fires a process).
4
+ ---
5
+
6
+ # Authoring Automations
7
+
8
+ A **Synap Automation** is a WHEN→THEN flow: a **trigger** fires, then a graph of **nodes** runs. It is how recurring work happens without a human in the loop. This skill encodes the VERIFIED capability matrix — the triggers, the nodes, the data-flow grammar, the canonical recipes, and the one firewall gotcha that will bite you.
9
+
10
+ Read `reference/node-matrix.md` for the exhaustive per-node field reference. Keep flows small: trigger → a couple of steps. Don't over-engineer the first version.
11
+
12
+ ## The template format
13
+
14
+ Automation templates live at `synap-backend/templates/automations/*.automation.json`:
15
+
16
+ ```jsonc
17
+ {
18
+ "name": "URL → Bookmark (inbound messages)",
19
+ "triggerType": "event",
20
+ "status": "active",
21
+ "triggerConfig": { "eventPattern": "external_message.received.*", "filters": { "provider": "discord" } },
22
+ "flowDefinition": {
23
+ "nodes": [ /* each: { id, type, position, data } */ ],
24
+ "edges": [ /* each: { id, source, target } */ ]
25
+ },
26
+ "metadata": { "source": "bridge-template" }
27
+ }
28
+ ```
29
+
30
+ The canonical `url-bookmark-capture` shape is: **message trigger → transform (`url_extract`) → loop → entity_create (with `dedupeBy`)**. That is the reference for any "extract items from input, create one entity each" flow.
31
+
32
+ ## Triggers (4)
33
+
34
+ | Trigger | Config | Fires when |
35
+ |---|---|---|
36
+ | `cron` | `{ expression: "0 9 * * *" }` | The pod-wide scheduler matches (it polls every minute, so minute granularity). |
37
+ | `event` | `{ eventPattern: "entities.*" \| "focus_session.stage_changed.*" \| …, filters }` | A matching domain event is emitted. |
38
+ | `webhook` | `{ webhookSubscriptionId }` | An inbound webhook hits the subscription. |
39
+ | `manual` | — | A user/agent runs it on demand. |
40
+
41
+ ## Nodes (14)
42
+
43
+ `trigger`, `command`, `condition`, `delay`, `output`, `loop`, `transform`, `fetch`, `query`, `switch`, `skill`, `capability`, `sub_automation`, `playbook_run`. Full fields in `reference/node-matrix.md`. The load-bearing ones:
44
+
45
+ - **command** — free-form AI step via the Intelligence Service. Powerful but UNTYPED — strongly prefer a `skill` for structured extraction. A `command` feeding a `loop` is a best-effort fallback only (ship `status: "draft"` + a reliability caveat; see below).
46
+ - **output** — the side-effect node. Subtypes: `entity_create` (`{ profileSlug, title, dedupeBy, properties }`; governed + empty/dup-guarded; **`dedupeBy` is a SINGLE key**), `entity_update`, `webhook` (POST to an arbitrary URL with vault headers), `notification`, `channel_message`.
47
+ - **loop** — iterate an array (cap 100). Its iterator is resolved **RAW** (not stringified) so it works on real arrays.
48
+ - **transform** — `uppercase` \| `lowercase` \| `json` \| `trim` \| `url_extract`.
49
+ - **fetch** — HTTP (30s timeout, vault headers, auto-JSON-parses the body).
50
+ - **skill** — run an IS skill (gated). The right tool for **structured extraction** (returns typed data).
51
+ - **capability** — run a capability verb → resolves to a skill (gated).
52
+ - **sub_automation** — call another automation (depth limit 5).
53
+ - **playbook_run** — start a playbook from a flow.
54
+
55
+ ## Data flow grammar
56
+
57
+ - `{{trigger.payload.x}}` — fields off the trigger event.
58
+ - `{{steps.<nodeId>.output.x}}` — output of a prior node by id.
59
+ - `{{loop.item}}` / `{{loop.index}}` — inside a loop body.
60
+
61
+ **Lossy stringify gotcha:** `resolveTemplate` STRINGIFIES values — fine for strings, **lossy for objects/arrays**. Two paths resolve RAW instead: the **loop iterator** (`iteratorExpression`) and **transform** input. So: build arrays/objects with those raw-path nodes; use `{{…}}` interpolation only where a string is wanted.
62
+
63
+ **Canonical fan-out:** a `skill` returns `{ items: [...] }` → `loop` over `steps.<skill>.output.items` → `entity_create` per `{{loop.item}}`. This is the backbone of every "source → many entities" automation.
64
+
65
+ ## The canonical "external source → calendar" recipe
66
+
67
+ ```
68
+ cron (0 7 * * *)
69
+ → fetch (GET the source URL)
70
+ → skill (structured extraction → returns { events: [...] })
71
+ → loop (iterator: steps.extract.output.events)
72
+ → entity_create (profileSlug: "event", dedupeBy: "externalId", properties from {{loop.item}})
73
+ ```
74
+
75
+ **Strongly prefer a skill for structured extraction.** A purpose-built `skill` (like `bookmark-enrichment`) returns typed, reliable structured data you can fan out — that is the path to reach for. A free-form `command` is NOT schema-typed; its IS task output shape is not guaranteed, so a `loop` over it is BEST-EFFORT and may resolve to `[]`. A `command → loop` is an explicit FALLBACK — use it only when no skill or JSON source exists, and when you do, ship the automation `status: "draft"` with a reliability caveat noting the output shape isn't guaranteed. Do not present command-based extraction as reliable.
76
+
77
+ ## THE FIREWALL GOTCHA (critical)
78
+
79
+ **`channel_message` does NOT relay to Discord.** It only inserts an internal `messages` row. To reach Discord from an automation you must use a **`webhook` node → Discord webhook URL**.
80
+
81
+ **BUT** that webhook path **bypasses the team-vs-client-comms firewall.** So:
82
+
83
+ - Posting to an internal **team** channel via webhook: acceptable.
84
+ - Posting to anything **client-linked** (a `client-comms` channel, mirrored to the client): **NEVER via an automation webhook.** It must go through the bridge's `proactive_post` / `route_to_channel` path, which enforces the firewall. An automation that webhooks into a client channel leaks bot activity to the client.
85
+
86
+ When in doubt, route client-facing posts through the bridge, never an automation.
87
+
88
+ ## Authoring checklist
89
+
90
+ 1. Pick the **trigger** (cron / event / webhook / manual) and its config.
91
+ 2. Sketch the smallest node chain that does the job.
92
+ 3. For structured extraction → strongly prefer a `skill`. A `command → loop` is a best-effort fallback only — ship it `status: "draft"` with a reliability caveat (output shape not guaranteed; the loop may resolve `[]`).
93
+ 4. Fan out with `skill → loop → entity_create` + a `dedupeBy` key (idempotency).
94
+ 5. Reaching Discord? `webhook` node — and if the target is client-linked, route through the bridge instead.
95
+ 6. Write it as `{ name, triggerType, status, triggerConfig, flowDefinition: { nodes, edges }, metadata }`.
@@ -0,0 +1,49 @@
1
+ # Automation node matrix (exhaustive)
2
+
3
+ Every node is `{ id, type, position: {x,y}, data }`. Edges are `{ id, source, target }`. `data` shape varies by `type`.
4
+
5
+ ## Triggers (4)
6
+
7
+ | triggerType | triggerConfig | Notes |
8
+ |---|---|---|
9
+ | `cron` | `{ expression: "0 9 * * *" }` | Pod-wide scheduler polls every minute → minute granularity, no sub-minute. |
10
+ | `event` | `{ eventPattern, filters }` | Patterns: `entities.*`, `focus_session.stage_changed.*`, `external_message.received.*`, etc. `filters` narrows by payload fields (e.g. `{ provider: "discord" }`). |
11
+ | `webhook` | `{ webhookSubscriptionId }` | Fires on inbound webhook delivery. |
12
+ | `manual` | — | On-demand run by user/agent. |
13
+
14
+ ## Nodes (14)
15
+
16
+ | type | Purpose | Key fields / config |
17
+ |---|---|---|
18
+ | `trigger` | Entry node mirroring the trigger | `{ triggerType, config }` |
19
+ | `command` | Free-form AI step via IS | prompt; UNTYPED output — strongly prefer a `skill` for extraction. `command → loop` is a best-effort fallback only (ship `status: "draft"` + reliability caveat; output shape not guaranteed, loop may resolve `[]`) |
20
+ | `condition` | Branch on a safe comparison | safe comparators (eq, neq, gt, lt, contains…); no arbitrary eval |
21
+ | `delay` | Pause the flow | `5m` \| `1h` \| `1d` \| `1w` |
22
+ | `output` | Side effects (see subtypes below) | `outputType` + `config` |
23
+ | `loop` | Iterate an array | `iteratorExpression` (RAW path); cap **100**. `itemVariable` is currently IGNORED by the executor (it only binds `context.loop.item`) — reference items as `{{loop.item.*}}`, not the named var |
24
+ | `transform` | String transform | `expression: "<raw path> \| op"`; ops: `uppercase`, `lowercase`, `json`, `trim`, `url_extract` |
25
+ | `fetch` | HTTP request | URL, method, vault headers; 30s timeout; auto-JSON-parses body |
26
+ | `query` | Read entities from the pod | profile + filter |
27
+ | `switch` | Multi-way branch | cases on a value |
28
+ | `skill` | Run an IS skill (gated) | skill name + args; returns STRUCTURED data — use for extraction |
29
+ | `capability` | Run a capability verb → skill (gated) | verb resolves to a skill |
30
+ | `sub_automation` | Call another automation | depth limit **5** |
31
+ | `playbook_run` | Start a playbook | playbook ref + params/subject |
32
+
33
+ ## `output` subtypes
34
+
35
+ | outputType | config | Notes |
36
+ |---|---|---|
37
+ | `entity_create` | `{ profileSlug, title, dedupeBy, properties }` | Governed (proposal-gated). Empty/duplicate guarded. **`dedupeBy` is a SINGLE key**, not a list. |
38
+ | `entity_update` | target + properties | Governed. |
39
+ | `webhook` | `{ url, method, headers, body }` | POST to ANY URL; headers can pull from the vault. The ONLY way to reach Discord from an automation. |
40
+ | `notification` | message/target | In-app notification. |
41
+ | `channel_message` | channel + content | Inserts an internal `messages` row ONLY. Does NOT relay to Discord/Telegram. |
42
+
43
+ ## Data-flow paths
44
+
45
+ - `{{trigger.payload.x}}` — trigger event fields.
46
+ - `{{steps.<nodeId>.output.x}}` — a prior node's output.
47
+ - `{{loop.item}}`, `{{loop.index}}` — inside a loop body.
48
+
49
+ **Resolution rule:** `{{…}}` interpolation goes through `resolveTemplate`, which STRINGIFIES (lossy for objects/arrays). The **loop `iteratorExpression`** and **transform `expression`** input resolve the path RAW — that is why looping over `steps.extract.output.events` works on the real array. Build/iterate structured data with those raw-path fields; reserve `{{…}}` for string slots.
@@ -0,0 +1,93 @@
1
+ ---
2
+ name: authoring-capabilities
3
+ description: Authors a Synap Capability template — the delivery vehicle that bundles tools + skills + playbooks + automations into one applyable .capability.json. Use whenever the user wants to connect a service (OAuth or API key), package a reusable know-how/process pack, ship a new connector, or assemble several skills and a process into one installable bundle. This is the top of the authoring stack: pick the pack shape, then author the playbook (process) and automations (when) inside it.
4
+ ---
5
+
6
+ # Authoring Capabilities
7
+
8
+ A **Capability** is the delivery vehicle in Synap: a named container that bundles **tools** (connections), **skills** (know-how/code), **playbooks** (processes), and optionally **automations** (when), applied as one unit. This skill teaches the template file, the skill kinds, the connector shapes, and how to seed it. It is the top of the three-skill authoring stack — compose it with `authoring-playbooks` and `authoring-automations`.
9
+
10
+ Read `reference/template-anatomy.md` for the full field reference and reference templates.
11
+
12
+ ## The file
13
+
14
+ `synap-control-plane-api/src/seeds/capability-templates/<key>.capability.json`:
15
+
16
+ ```jsonc
17
+ {
18
+ "key": "my-connector",
19
+ "name": "My Connector",
20
+ "description": "What this bundle gives an agent and when to use it.",
21
+ "params": [ /* { name, label, type, required?, default?, description } */ ],
22
+ "vault": [ /* secrets to encrypt */ ],
23
+ "tools": [ /* connectors */ ],
24
+ "skills": [ /* know-how + code */ ],
25
+ "playbooks": [ /* processes — REQUIRE a workspaceId at apply time */ ],
26
+ "automations": [ /* optional WHEN→THEN flows */ ]
27
+ }
28
+ ```
29
+
30
+ ## Materialization order (idempotent)
31
+
32
+ `createCapabilityFromDefinition()` applies parts in dependency order:
33
+
34
+ 1. **vault** — encrypt each secret → it becomes referenceable as `vault://<id>` by its `ref`.
35
+ 2. **tools** — created governed. A tool's `credentialRef` resolves: a `ref` name → `vault://<id>`, or `nango://<provider>` for OAuth. A tool's **verb catalog is DERIVED** from the skills that `requires` it.
36
+ 3. **skills** — created (instruction skills injected as prompt; code skills born `approved: false`).
37
+ 4. **playbooks** — created LAST among content; they **REQUIRE a `workspaceId`** (a playbook is workspace-scoped).
38
+ 5. **container** — the capability itself, with `member_of` links wiring all parts together.
39
+
40
+ Re-applying is idempotent — existing parts are matched, not duplicated.
41
+
42
+ ## Skill kinds — pick the right one
43
+
44
+ | `kind` | What it is | When to use |
45
+ |---|---|---|
46
+ | `instruction` | Markdown injected into the agent's prompt (the `code`/body field holds the text) | Pure know-how: methodology, rules, how to draft/classify. No execution, no connector calls. |
47
+ | `code` | JS run in the IS isolate (sandboxed). Born `approved: false`. | Executable logic: fetch + transform + propose entities. Needs review before it runs. |
48
+ | `provider` | Declarative `providerSpec` (HTTP), run **in-process Tier-1** — NOT via the IS. | A trusted, declarative HTTP verb (e.g. a provider call) that doesn't need the AI isolate. Lowest latency. |
49
+
50
+ **`provider`-kind skills work only via the SEED-FILE path.** The inline Hub `POST /api/hub/capabilities/apply { definition }` route validates skills with a `SkillDefSchema` that accepts only `instruction` | `code` — so a `provider` skill passed inline is rejected. To ship a `provider` skill, seed it from a `<key>.capability.json` template (the seed path), not via an inline `definition`.
51
+
52
+ ## Connector shapes — Nango (OAuth) vs vault-generic (API key)
53
+
54
+ | | Nango / OAuth | Vault-generic / API key |
55
+ |---|---|---|
56
+ | tool `kind` | `provider` | `api` |
57
+ | `credentialRef` | `nango://<provider>` | a `ref` → `vault://<id>` |
58
+ | `vault[]` | empty (Nango holds the token) | one entry (the API key) |
59
+ | tool `config` | provider-defined | `{ baseUrl, auth: { in, name, prefix } }` |
60
+ | Reference template | `nango-google.capability.json` | `generic-apikey.capability.json` |
61
+
62
+ **Reference templates (the molds to clone):**
63
+ - `nango-google` — Nango/OAuth connector.
64
+ - `cal-com` — vault/API-key connector.
65
+ - `agency-skills` — instruction-only pack + 2 playbooks. **The mold for a know-how + process pack.**
66
+ - `generic-apikey` — the blueprint to clone for any new vault-backed connector.
67
+
68
+ **Builtin `web_fetch` / `web_search` are always available** — no template needed just to read a URL.
69
+
70
+ ## Seeding the capability
71
+
72
+ Two ways:
73
+
74
+ - **Via the bridge:** add the key to `AGENCY_CAPABILITY_PLAN` in `synap-cli/src/commands/bridge-setup.ts`. Set `workspaceScoped: true` if it bundles playbooks (so the bridge applies it WITH a workspace).
75
+ - **Directly:** `POST /api/hub/capabilities/apply` with `{ templateKey | definition, params, workspaceId }`.
76
+
77
+ ## How the three authoring skills compose
78
+
79
+ A subagent given a plain goal ("build a process for X") works top-down:
80
+
81
+ 1. **authoring-capabilities** (this skill) → pick the pack shape and the connectors it needs (Nango? API key? instruction-only?).
82
+ 2. **authoring-playbooks** → design the process: ordered stages, subject, grants.
83
+ 3. **authoring-automations** → design the WHEN: the trigger(s) that fire the playbook and any fan-out flows.
84
+ 4. **Emit** the `.capability.json` (with `skills[]` + `playbooks[]`) plus any `*.automation.json`, then seed via the plan or `apply`.
85
+
86
+ ## Authoring checklist
87
+
88
+ 1. Choose the shape: connector (Nango/API key) or pure know-how/process pack.
89
+ 2. Declare `params` and `vault` (empty for Nango / instruction-only).
90
+ 3. Add `tools` with the right `credentialRef`; let verbs derive from skills' `requires`.
91
+ 4. Add `skills` — pick `instruction` / `code` / `provider` per skill.
92
+ 5. Add `playbooks` (remember: needs a workspaceId) and optional `automations`.
93
+ 6. Seed via `AGENCY_CAPABILITY_PLAN` (`workspaceScoped` matching whether it has playbooks) or `POST /api/hub/capabilities/apply`.
@@ -0,0 +1,70 @@
1
+ # Capability template anatomy
2
+
3
+ File: `synap-control-plane-api/src/seeds/capability-templates/<key>.capability.json`. Top-level keys: `key`, `name`, `description`, `params`, `vault`, `tools`, `skills`, `playbooks`, `automations?`.
4
+
5
+ ## params
6
+
7
+ ```jsonc
8
+ { "name": "apiKey", "label": "API key", "type": "text", "required": true,
9
+ "default": "…", "description": "…" }
10
+ ```
11
+ Param values are interpolated into the rest of the template as `{{paramName}}` (and `{{name}}` = the capability name). `type`: `text` | `number` | `entity` | `choice` | `boolean`.
12
+
13
+ ## vault
14
+
15
+ ```jsonc
16
+ { "ref": "apiKeySecret", "name": "{{name}} API key", "value": "{{apiKey}}",
17
+ "type": "api_key", "description": "…" }
18
+ ```
19
+ Each entry is encrypted at apply time and becomes referenceable as `vault://<id>` via its `ref`. **Nango / instruction-only capabilities have an empty `vault[]`.**
20
+
21
+ ## tools
22
+
23
+ ```jsonc
24
+ // vault-backed (API key)
25
+ { "name": "generic_api", "kind": "api", "credentialRef": "apiKeySecret",
26
+ "executor": "is-agent",
27
+ "config": { "baseUrl": "{{baseUrl}}",
28
+ "auth": { "in": "header", "name": "Authorization", "prefix": "Bearer " } } }
29
+
30
+ // Nango (OAuth)
31
+ { "name": "gmail", "kind": "provider", "credentialRef": "nango://google-mail", ... }
32
+ ```
33
+ - `credentialRef`: a vault `ref` (→ `vault://<id>`) OR `nango://<provider>`.
34
+ - Tools are created **governed**.
35
+ - A tool's **verb catalog is DERIVED** from the skills whose `requires` names that tool — you don't list verbs on the tool.
36
+
37
+ ## skills
38
+
39
+ ```jsonc
40
+ { "name": "draft-outreach", "kind": "instruction", "scope": "pod",
41
+ "description": "…", "requires": ["unipile_linkedin"],
42
+ "code": "# Markdown body injected into the agent's prompt …" }
43
+
44
+ { "name": "{{name}} fetch-and-propose", "kind": "code", "scope": "pod",
45
+ "requires": ["generic_api"], "executionMode": "async", "timeoutSeconds": 60,
46
+ "parameters": { "path": "string?" },
47
+ "code": "// JS statement body run in the IS isolate …" }
48
+ ```
49
+ - `kind`: `instruction` (prompt text in `code`) | `code` (JS, born `approved:false`) | `provider` (declarative `providerSpec` HTTP, in-process Tier-1).
50
+ - `requires`: the tool names the skill feeds into — this is what derives the tool's verb catalog and wires `member_of` links.
51
+ - code skills: `propose.entity({ profileSlug, title, properties })` requires `title` (not `name`) and routes through `checkPermissionOrPropose`. `callProvider(toolName, method, path, body?)` is POSITIONAL; the dispatcher resolves the tool's credential server-side.
52
+
53
+ ## playbooks
54
+
55
+ The `playbooks[]` array holds full playbook definitions (see the `authoring-playbooks` skill). They are materialized LAST and **REQUIRE a `workspaceId`** at apply time — that is why a capability bundling playbooks is seeded `workspaceScoped: true`.
56
+
57
+ ## automations (optional)
58
+
59
+ The `automations[]` array can carry WHEN→THEN flows in the same `{ name, triggerType, status, triggerConfig, flowDefinition, metadata }` shape used by `synap-backend/templates/automations/*.automation.json` (see `authoring-automations`).
60
+
61
+ ## Reference templates (in the same directory)
62
+
63
+ | Template | Shape | Clone it for |
64
+ |---|---|---|
65
+ | `nango-google.capability.json` | Nango/OAuth, empty vault | Any OAuth connector |
66
+ | `cal-com.capability.json` | vault/API-key | A keyed HTTP service |
67
+ | `generic-apikey.capability.json` | vault + one api tool + one code skill | The blueprint for a new vault connector |
68
+ | `agency-skills.capability.json` | instruction-only skills + 2 playbooks | A know-how + process pack |
69
+
70
+ Builtin `web_fetch` / `web_search` need no template — they are always available to agents.
@@ -0,0 +1,102 @@
1
+ ---
2
+ name: authoring-playbooks
3
+ description: Authors a Synap Playbook — the session-template process object that turns a goal into ordered stages over a subject entity. Use whenever the user asks to create a playbook, build a process, design a workflow with stages, set up a "process for X", add or reorder stages, or define what an agent session should do step by step (e.g. "build me a client-onboarding process", "make a 3-stage research playbook", "add a review stage").
4
+ ---
5
+
6
+ # Authoring Playbooks
7
+
8
+ A **Playbook** is the process object in Synap: a reusable template for an AI working session. It declares a goal, the parameters that specialize it, the capabilities it is allowed to use, where it runs, what it should produce, and — first-class now — the **ordered stages** a subject moves through. When a playbook runs it instantiates a `focus_session` over a single **subject** entity, advancing one stage at a time.
9
+
10
+ This skill teaches the data model, the live authoring path, the field reference, and the run lifecycle. Read `reference/stages-contract.md` before writing stages, and `reference/worked-example.md` for a full example.
11
+
12
+ ## The mental model (memorize this)
13
+
14
+ ```
15
+ automation (WHEN, the trigger)
16
+ └─> playbook_run (a process template, instantiated)
17
+ └─> over a SUBJECT entity (subjectProfile resolves which one)
18
+ └─> in a focus_session (the runtime instance)
19
+ └─> currentStage = the one active stage key
20
+ ```
21
+
22
+ - A playbook is a **template**. A `focus_session` is a **running instance** of it.
23
+ - A subject is in **exactly ONE stage at a time** — `focus_sessions.currentStage` holds the active stage key.
24
+ - An **automation** decides WHEN a playbook runs (its `flowAutomationId` wires the trigger). The playbook decides WHAT happens once running.
25
+ - The session works **over a subject**: one `company`, one `deal`, one `person`, etc. — resolved through `subjectProfile`.
26
+
27
+ ## The LIVE authoring path (where playbooks actually ship)
28
+
29
+ A playbook is **not** authored as a standalone file. It ships **inside a CapabilityDefinition's `playbooks[]` array**:
30
+
31
+ 1. Define it in the capability template: `synap-control-plane-api/src/seeds/capability-templates/<key>.capability.json`, under `"playbooks": [ ... ]`.
32
+ 2. It is materialized by `createCapabilityFromDefinition()` when the capability is applied via `POST /api/hub/capabilities/apply`. Playbooks REQUIRE a `workspaceId` at apply time.
33
+ 3. The Discord bridge seeds it by adding the capability key to `AGENCY_CAPABILITY_PLAN` in `synap-cli/src/commands/bridge-setup.ts` with `workspaceScoped: true` (the flag that tells the bridge this capability bundles playbooks, so it must be applied with a workspace).
34
+
35
+ **GOTCHA — do not copy the vestigial file.** `synap-control-plane-api/templates/packs/deep-research.playbook.json` looks like a standalone playbook template but it is VESTIGIAL: its playbook-specific fields are dropped during materialization. Never copy it or treat it as the schema. The authoritative shape is the `playbooks[]` entry inside a `.capability.json`. For a real example **with ordered stages**, see `stellar-grant-client.capability.json` and `reference/worked-example.md` (note: `agency-skills.capability.json` bundles playbooks but their `stages` are `[]`, so it does not demo the stages contract).
36
+
37
+ ## Playbook field reference
38
+
39
+ | Field | Type / shape | Meaning |
40
+ |---|---|---|
41
+ | `name` | string | Display name. |
42
+ | `description` | string | What this process does and when it runs. |
43
+ | `goalTemplate` | string with `@{arg:…}` grammar | The session's objective. Interpolate params with `@{arg:paramName}`. |
44
+ | `params` | `{ name, label?, type, required?, description? }[]` | Inputs that specialize a run. `type`: `text` \| `number` \| `entity` \| `choice` \| `boolean`. |
45
+ | `inputStrategy` | `{ kind, description? }` | What the session iterates over. `kind`: `none` \| `static` \| `rotating` \| `query`. |
46
+ | `channelSpec` | `{ type, aiReactionMode? }` | Where it runs. `type`: `GROUP` \| `AGENT_COLLAB` \| `THREAD`. |
47
+ | `expectedOutputs` | `{ kind, label }[]` | The deliverables a run should produce (drives the output checklist). `kind` is **loosely typed** — stick to the shared vocab `note` \| `document` \| `report` for consistency, though any string is accepted. |
48
+ | `schedule` | `{ cron, enabled }` \| `null` | Optional recurring schedule. |
49
+ | `executor` | enum | `is-agent` \| `external-agent` \| `hybrid` — who runs the session. |
50
+ | `subjectProfile` | `{ profileSlug, filter? }` | The profile of the subject entity the session operates over. |
51
+ | `flowAutomationId` | id | The automation whose trigger fires this playbook (the WHEN). **Set post-create by a separate mutation — NOT settable via the template.** |
52
+ | `stages` | `PlaybookStage[]` (ordered) | The ordered process steps. See `reference/stages-contract.md`. |
53
+ | `grants` | `CapabilityRef[]` (stage-level only) | Advisory capability hints surfaced to the agent. See below. |
54
+
55
+ ### grants — advisory capability hints (NOT enforcement)
56
+
57
+ A `grant` is a `CapabilityRef`: `{ kind, id }` where `kind` is `tool` \| `skill` \| `command` and `id` names the capability. Two things to know before you rely on them:
58
+
59
+ - **Top-level playbook `grants` are DROPPED.** They are not part of `PlaybookDefSchema` / playbook create, so a `grants` array at the playbook level is silently ignored during materialization. Declare grants on **stages** instead.
60
+ - **Stage `grants` are stored as opaque JSON and are currently ADVISORY.** They are surfaced to the agent at runtime via `RunContext` (the is-agent executor lists a stage's grants in the kickoff prompt) but are **NOT resolved into enforcement `capability` / `link` rows** — nothing blocks the agent from using an ungranted capability, and nothing auto-wires a granted one. Hard enforcement is a documented FOLLOW-UP, not current behavior.
61
+
62
+ Because of this, "granting" a skill at a stage really means **telling the agent to use that skill at that stage**. An `instruction` skill (e.g. `stellar-scf-grants-advisor`) is already available to the agent through the pod skill catalog + `load_skill` REGARDLESS of any grant — listing it in a stage's `grants` just points the agent at it as the stage's working methodology. Builtin `web_fetch` / `web_search` are always available and need no grant.
63
+
64
+ ## The STAGES contract (the new first-class field)
65
+
66
+ Stages are **ordered** and drive the session's progression. Read `reference/stages-contract.md` for the full schema and event semantics. In brief:
67
+
68
+ ```jsonc
69
+ "stages": [
70
+ {
71
+ "key": "scope", // stable id, referenced by currentStage
72
+ "name": "Scope",
73
+ "description": "Understand the client and their problem.",
74
+ "goal": "Produce a one-paragraph problem statement.", // optional
75
+ "grants": [{ "kind": "skill", "id": "client-brief" }], // optional, advisory hint (not enforced)
76
+ "expectedOutputs": [{ "kind": "note", "label": "Problem statement" }],
77
+ "suggestedTasks": ["Read the intake form", "List open questions"]
78
+ }
79
+ ]
80
+ ```
81
+
82
+ - The running session tracks `focus_sessions.currentStage` (the active stage key).
83
+ - Changing `currentStage` emits a **`focus_session.stage_changed`** event — automations can trigger on it (e.g. notify when a subject reaches "build").
84
+ - **Empty `stages`** = legacy progress-only behavior (a single 0→100% bar, no stage events).
85
+
86
+ ## Run lifecycle
87
+
88
+ 1. **Start** — `playbooks.run` (tRPC) or `synap_start_session`. Instantiates a `focus_session` over the resolved subject, `currentStage` = first stage key.
89
+ 2. **Advance** — `synap_update_session`: set `currentStage` to move stages (emits `stage_changed`), update `progress`, `addOutput` / `completeOutput` as deliverables land.
90
+ 3. **Complete** — `synap_complete_session` when the goal is met.
91
+
92
+ ## Authoring checklist
93
+
94
+ 1. State the **goal** as a `goalTemplate` with `@{arg:…}` for anything parameterized.
95
+ 2. Define **params** (minimum needed to specialize a run).
96
+ 3. Pick the **subjectProfile** — what single entity is each run about?
97
+ 4. Write **ordered stages** — each with a clear `goal` and `expectedOutputs`. One subject, one active stage.
98
+ 5. Declare stage **grants** to point the agent at the skills/tools each stage should use (advisory hints, not an access gate; put them on stages, not the playbook level).
99
+ 6. Set **channelSpec**, **executor**, and (optionally) **schedule**.
100
+ 7. Place it in the capability template's `playbooks[]` and add the key to `AGENCY_CAPABILITY_PLAN` (`workspaceScoped: true`).
101
+
102
+ See `reference/worked-example.md` for a complete 3-stage client-process playbook over a `company` subject.
@@ -0,0 +1,35 @@
1
+ # PlaybookStage — the stages contract
2
+
3
+ Stages are the first-class, ordered process steps of a playbook. They replaced the old "progress percentage only" model. A subject moving through a playbook is in **exactly one stage at a time**.
4
+
5
+ ## Schema
6
+
7
+ ```ts
8
+ type PlaybookStage = {
9
+ key: string; // stable identifier; what currentStage holds. Required.
10
+ name: string; // human label. Required.
11
+ description?: string; // what this stage is about
12
+ goal?: string; // the concrete objective of this stage
13
+ grants?: CapabilityRef[]; // advisory capability hints ({ kind: tool|skill|command, id }) — see note below
14
+ expectedOutputs?: ExpectedOutput[];// deliverables expected before advancing ({ kind, label }; kind loosely typed)
15
+ suggestedTasks?: string[]; // soft checklist the agent can turn into tasks
16
+ };
17
+ ```
18
+
19
+ - `key` is **stable** — `focus_sessions.currentStage` stores it, and `stage_changed` events carry it. Don't rename keys on a live playbook; add/deprecate instead.
20
+ - Stages are **ordered** by their position in the `stages[]` array.
21
+ - `grants` here are **advisory**: stored as opaque JSON and surfaced to the agent in the stage's kickoff prompt via `RunContext`, but NOT resolved into enforcement `capability` / `link` rows (hard enforcement is a documented follow-up). "Granting" a skill at a stage = telling the agent to use it there; the skill is already reachable via the pod skill catalog + `load_skill` regardless. Declare grants on stages, not at the playbook level — top-level playbook `grants` are dropped during materialization.
22
+
23
+ ## Runtime semantics
24
+
25
+ - A `focus_session` starts with `currentStage` = the first stage's `key`.
26
+ - Calling `synap_update_session` with a new `currentStage` advances (or moves back) the subject.
27
+ - **Every change to `currentStage` emits a `focus_session.stage_changed` event.** Automations can subscribe with an event trigger on `focus_session.stage_changed.*` (optionally filtered by the new stage key) — this is how "when a deal reaches negotiation, notify the team" is wired.
28
+ - **Empty `stages` array = legacy behavior**: the session tracks only a 0→100% `progress` value and emits no stage events.
29
+
30
+ ## Design rules
31
+
32
+ - Keep stages **few and meaningful** (3–6 is typical). Each stage should represent a real change in what the agent is doing or waiting on.
33
+ - Give every stage a `goal` and at least one `expectedOutput` so "done with this stage" is observable.
34
+ - Use `suggestedTasks` for the soft checklist; use `expectedOutputs` for the hard deliverables that gate advancement. For `expectedOutputs[].kind`, keep to the shared (loosely typed) vocab `note` | `document` | `report`.
35
+ - Stage `grants` point the agent at the right capability per stage — name the LinkedIn tool in the "outreach" stage, not the "scope" stage. Remember they are advisory hints, not an access gate.
@@ -0,0 +1,64 @@
1
+ # Worked example — a 3-stage client-process playbook
2
+
3
+ Goal: a reusable process that takes a prospective `company`, scopes their problem, abstracts it into a buildable spec, and ships a first build. The subject is one `company` per run. Three ordered stages: **Scope → Abstract → Build**.
4
+
5
+ This is a `playbooks[]` entry inside a `.capability.json` (NOT a standalone file).
6
+
7
+ ```jsonc
8
+ {
9
+ "name": "Client Build Process",
10
+ "description": "Take a prospective company from raw problem to a shipped first build, one stage at a time.",
11
+ "goalTemplate": "Run @{arg:companyName} through scope → abstract → build. Produce a problem statement, a buildable spec, and a working first deliverable. Every write stays proposal-gated.",
12
+ "params": [
13
+ { "name": "companyName", "label": "Company", "type": "entity", "required": true,
14
+ "description": "The company this run is about (the subject)." }
15
+ ],
16
+ "subjectProfile": { "profileSlug": "company" },
17
+ "inputStrategy": { "kind": "none" },
18
+ "channelSpec": { "type": "AGENT_COLLAB", "aiReactionMode": "only_mentioned" },
19
+ "executor": "is-agent",
20
+ "schedule": null,
21
+ "expectedOutputs": [
22
+ { "kind": "note", "label": "Problem statement" },
23
+ { "kind": "document", "label": "Buildable spec" },
24
+ { "kind": "document", "label": "First build deliverable" }
25
+ ],
26
+ "stages": [
27
+ {
28
+ "key": "scope",
29
+ "name": "Scope",
30
+ "description": "Understand the company and the problem worth solving.",
31
+ "goal": "Produce a one-paragraph problem statement grounded in the company context.",
32
+ "grants": [{ "kind": "skill", "id": "client-brief" }],
33
+ "expectedOutputs": [{ "kind": "note", "label": "Problem statement" }],
34
+ "suggestedTasks": ["Assemble the client brief", "List the open questions", "Confirm the problem with the operator"]
35
+ },
36
+ {
37
+ "key": "abstract",
38
+ "name": "Abstract",
39
+ "description": "Turn the problem into a buildable specification.",
40
+ "goal": "Write a spec: scope, constraints, success criteria, and the smallest first deliverable.",
41
+ "expectedOutputs": [{ "kind": "document", "label": "Buildable spec" }],
42
+ "suggestedTasks": ["Draft the spec", "Define success criteria", "Get spec sign-off"]
43
+ },
44
+ {
45
+ "key": "build",
46
+ "name": "Build",
47
+ "description": "Ship the first deliverable against the spec.",
48
+ "goal": "Produce a working first build and link it to the company.",
49
+ "grants": [{ "kind": "tool", "id": "gdrive" }],
50
+ "expectedOutputs": [{ "kind": "document", "label": "First build deliverable" }],
51
+ "suggestedTasks": ["Build the first deliverable", "Link it to the company", "Hand off for review"]
52
+ }
53
+ ]
54
+ }
55
+ ```
56
+
57
+ ## How a run flows
58
+
59
+ 1. Operator (or an automation via `flowAutomationId`) starts the playbook with `companyName` = a specific company. The `focus_session` opens with `currentStage = "scope"`.
60
+ 2. The agent works the **scope** stage, producing the problem-statement note. When done, `synap_update_session({ currentStage: "abstract" })` advances it — emitting `focus_session.stage_changed` (new stage `abstract`).
61
+ 3. An automation could trigger on `focus_session.stage_changed.*` filtered to `build` to post "X has reached the build stage" in the team channel.
62
+ 4. When the build deliverable lands and is linked, `synap_complete_session` closes the session.
63
+
64
+ Note on `grants`: declare them on **stages**, not at the playbook level — top-level playbook `grants` are dropped during materialization. Stage `grants` are **advisory** (surfaced to the agent in the stage kickoff prompt, not resolved into enforcement rows — see the SKILL.md grants section). Keep the surface tight — only point at `gdrive` in the build stage where it is actually used, so the agent knows that is the stage's tool.