@cursor/bdk 0.2.18 → 0.2.21

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 (294) hide show
  1. package/AGENTS.md +16 -6
  2. package/dist/channels/github/defaults.d.ts +1 -1
  3. package/dist/channels/github/defaults.d.ts.map +1 -1
  4. package/dist/channels/github/defaults.js +1 -1
  5. package/dist/channels/github/progress.d.ts +1 -1
  6. package/dist/channels/github/progress.d.ts.map +1 -1
  7. package/dist/channels/slack/slack-channel.d.ts +3 -2
  8. package/dist/channels/slack/slack-channel.d.ts.map +1 -1
  9. package/dist/channels/slack/slack-channel.js +9 -2
  10. package/dist/docs/404.html +2 -2
  11. package/dist/docs/assets/{app.CJ-XZTK5.js → app.C0diulDR.js} +4 -4
  12. package/dist/docs/assets/chunks/@localSearchIndexroot._fglLrPa.js +1 -0
  13. package/dist/docs/assets/chunks/{VPLocalSearchBox.CpbYgURZ.js → VPLocalSearchBox.mlUwkfRQ.js} +1 -1
  14. package/dist/docs/assets/chunks/{arc.B081PemO.js → arc.DM5RRfvb.js} +1 -1
  15. package/dist/docs/assets/chunks/{architectureDiagram-Q4EWVU46.DPaT_hi-.js → architectureDiagram-Q4EWVU46.CNHCBbQl.js} +1 -1
  16. package/dist/docs/assets/chunks/{baseUniq.Buu61NLg.js → baseUniq.25Udb_uV.js} +1 -1
  17. package/dist/docs/assets/chunks/{blockDiagram-DXYQGD6D.C6t63owh.js → blockDiagram-DXYQGD6D.Bg-f3-qN.js} +1 -1
  18. package/dist/docs/assets/chunks/{c4Diagram-AHTNJAMY.BtKabdXR.js → c4Diagram-AHTNJAMY.BywSQvK9.js} +1 -1
  19. package/dist/docs/assets/chunks/channel.C4s-x2x3.js +1 -0
  20. package/dist/docs/assets/chunks/{chunk-4BX2VUAB.DQpNaR8N.js → chunk-4BX2VUAB.C3IdWWlO.js} +1 -1
  21. package/dist/docs/assets/chunks/{chunk-4TB4RGXK.DrhL-6Rv.js → chunk-4TB4RGXK.D_t-pAXu.js} +1 -1
  22. package/dist/docs/assets/chunks/{chunk-55IACEB6.DRLIBfNR.js → chunk-55IACEB6.DvlNSQE5.js} +1 -1
  23. package/dist/docs/assets/chunks/{chunk-EDXVE4YY.kuUuFkIg.js → chunk-EDXVE4YY.6LpTrDTf.js} +1 -1
  24. package/dist/docs/assets/chunks/{chunk-FMBD7UC4.BlrVxprw.js → chunk-FMBD7UC4.BZxXsutI.js} +1 -1
  25. package/dist/docs/assets/chunks/{chunk-OYMX7WX6.CZCfYeQA.js → chunk-OYMX7WX6.CrtynS_e.js} +1 -1
  26. package/dist/docs/assets/chunks/{chunk-QZHKN3VN.C7rwVEMV.js → chunk-QZHKN3VN.CUOQY0pM.js} +1 -1
  27. package/dist/docs/assets/chunks/{chunk-YZCP3GAM.CGseJtT_.js → chunk-YZCP3GAM.Dv3biZVN.js} +1 -1
  28. package/dist/docs/assets/chunks/classDiagram-6PBFFD2Q.h-fLya-M.js +1 -0
  29. package/dist/docs/assets/chunks/classDiagram-v2-HSJHXN6E.h-fLya-M.js +1 -0
  30. package/dist/docs/assets/chunks/clone.BM9yCOiZ.js +1 -0
  31. package/dist/docs/assets/chunks/{cose-bilkent-S5V4N54A.BWlczAK4.js → cose-bilkent-S5V4N54A.DDzCqntx.js} +1 -1
  32. package/dist/docs/assets/chunks/{dagre-KV5264BT.Cw0tT0bB.js → dagre-KV5264BT.DoiV-U_C.js} +1 -1
  33. package/dist/docs/assets/chunks/{diagram-5BDNPKRD.Cm96ah9V.js → diagram-5BDNPKRD.LHX1aUDr.js} +1 -1
  34. package/dist/docs/assets/chunks/{diagram-G4DWMVQ6.Cl0AoWYM.js → diagram-G4DWMVQ6.lTnkbDQp.js} +1 -1
  35. package/dist/docs/assets/chunks/{diagram-MMDJMWI5.Bp7mlzKs.js → diagram-MMDJMWI5.CclJPnEx.js} +1 -1
  36. package/dist/docs/assets/chunks/{diagram-TYMM5635.ClVeqpcW.js → diagram-TYMM5635.CLmB0KKs.js} +1 -1
  37. package/dist/docs/assets/chunks/{erDiagram-SMLLAGMA.Bi8dojF9.js → erDiagram-SMLLAGMA.qKkkB7iQ.js} +1 -1
  38. package/dist/docs/assets/chunks/{flowDiagram-DWJPFMVM.Bb4urpfG.js → flowDiagram-DWJPFMVM.HIkXNLJ3.js} +1 -1
  39. package/dist/docs/assets/chunks/{ganttDiagram-T4ZO3ILL.whR4wFze.js → ganttDiagram-T4ZO3ILL.YN9lDgHe.js} +1 -1
  40. package/dist/docs/assets/chunks/{gitGraphDiagram-UUTBAWPF.6oVMi6-3.js → gitGraphDiagram-UUTBAWPF.CL6gf7f9.js} +1 -1
  41. package/dist/docs/assets/chunks/{graph.D8AJDOFK.js → graph.DMkP70rB.js} +1 -1
  42. package/dist/docs/assets/chunks/{infoDiagram-42DDH7IO.nTpsf5Vk.js → infoDiagram-42DDH7IO.CT98u6Zd.js} +1 -1
  43. package/dist/docs/assets/chunks/{ishikawaDiagram-UXIWVN3A.DhYDOwyB.js → ishikawaDiagram-UXIWVN3A.CF88w8YD.js} +1 -1
  44. package/dist/docs/assets/chunks/{journeyDiagram-VCZTEJTY.Bg7Rudw3.js → journeyDiagram-VCZTEJTY.BoWKk6Rz.js} +1 -1
  45. package/dist/docs/assets/chunks/{kanban-definition-6JOO6SKY.D80D_ZAR.js → kanban-definition-6JOO6SKY.CrmPv2sG.js} +1 -1
  46. package/dist/docs/assets/chunks/{layout.e9hmuC-K.js → layout.CEiPTQln.js} +1 -1
  47. package/dist/docs/assets/chunks/{linear.D6hEyqVB.js → linear.gkXuWu8G.js} +1 -1
  48. package/dist/docs/assets/chunks/{min.BPAdvB9D.js → min.C4EHK60v.js} +1 -1
  49. package/dist/docs/assets/chunks/{mindmap-definition-QFDTVHPH.tm2Sov2Q.js → mindmap-definition-QFDTVHPH.C-JqTP4s.js} +1 -1
  50. package/dist/docs/assets/chunks/{pieDiagram-DEJITSTG.BKHZ497m.js → pieDiagram-DEJITSTG.t2HgQOCt.js} +1 -1
  51. package/dist/docs/assets/chunks/{quadrantDiagram-34T5L4WZ.CPj7gSp6.js → quadrantDiagram-34T5L4WZ.D1k-BEKc.js} +1 -1
  52. package/dist/docs/assets/chunks/{requirementDiagram-MS252O5E._U68yVUd.js → requirementDiagram-MS252O5E.CUu9VVrt.js} +1 -1
  53. package/dist/docs/assets/chunks/{sankeyDiagram-XADWPNL6._6jrIQPb.js → sankeyDiagram-XADWPNL6.HroiBrt1.js} +1 -1
  54. package/dist/docs/assets/chunks/{sequenceDiagram-FGHM5R23.D9UlmB6F.js → sequenceDiagram-FGHM5R23.CeJapdwH.js} +1 -1
  55. package/dist/docs/assets/chunks/{stateDiagram-FHFEXIEX.BQSaiJCe.js → stateDiagram-FHFEXIEX.CLj6JnXZ.js} +1 -1
  56. package/dist/docs/assets/chunks/stateDiagram-v2-QKLJ7IA2.CLFLHNN0.js +1 -0
  57. package/dist/docs/assets/chunks/{theme.25ZC61Iy.js → theme.B9ZHHvCq.js} +2 -2
  58. package/dist/docs/assets/chunks/{timeline-definition-GMOUNBTQ.d-17NZ3L.js → timeline-definition-GMOUNBTQ.BzKGPAdN.js} +1 -1
  59. package/dist/docs/assets/chunks/{vennDiagram-DHZGUBPP.DE9AGEjG.js → vennDiagram-DHZGUBPP.DtBNkpF9.js} +1 -1
  60. package/dist/docs/assets/chunks/wardley-RL74JXVD.D_iarxve.js +162 -0
  61. package/dist/docs/assets/chunks/{wardleyDiagram-NUSXRM2D.D9SDNipV.js → wardleyDiagram-NUSXRM2D.rOXEXIA9.js} +1 -1
  62. package/dist/docs/assets/chunks/{xychartDiagram-5P7HB3ND.DM1sIMf8.js → xychartDiagram-5P7HB3ND.BrM71_SA.js} +1 -1
  63. package/dist/docs/assets/{deployment.md.ajc3VM0m.js → deployment.md.CtSJ6sF9.js} +3 -3
  64. package/dist/docs/assets/{deployment.md.ajc3VM0m.lean.js → deployment.md.CtSJ6sF9.lean.js} +1 -1
  65. package/dist/docs/assets/{guides_agent-to-agent.md.Cps5NiCV.js → guides_agent-to-agent.md.CwL5cwuE.js} +6 -5
  66. package/dist/docs/assets/{guides_agent-to-agent.md.Cps5NiCV.lean.js → guides_agent-to-agent.md.CwL5cwuE.lean.js} +1 -1
  67. package/dist/docs/assets/guides_export-grokbot.md.qo5bxi4h.js +55 -0
  68. package/dist/docs/assets/guides_export-grokbot.md.qo5bxi4h.lean.js +1 -0
  69. package/dist/docs/assets/{guides_hooks.md.B_bKG1oA.js → guides_hooks.md.Bfj0pK91.js} +1 -1
  70. package/dist/docs/assets/{guides_hooks.md.B_bKG1oA.lean.js → guides_hooks.md.Bfj0pK91.lean.js} +1 -1
  71. package/dist/docs/assets/{guides_opentelemetry.md.jcPNrQbH.js → guides_opentelemetry.md.ByW1Fs7b.js} +5 -5
  72. package/dist/docs/assets/{guides_opentelemetry.md.jcPNrQbH.lean.js → guides_opentelemetry.md.ByW1Fs7b.lean.js} +1 -1
  73. package/dist/docs/assets/{index.md.CHAFTf6m.js → index.md.CAnsLl8D.js} +2 -2
  74. package/dist/docs/assets/{index.md.CHAFTf6m.lean.js → index.md.CAnsLl8D.lean.js} +1 -1
  75. package/dist/docs/assets/{reference_cli.md.Bt3sAfat.js → reference_cli.md.Bkrsce22.js} +7 -4
  76. package/dist/docs/assets/{reference_cli.md.Bt3sAfat.lean.js → reference_cli.md.Bkrsce22.lean.js} +1 -1
  77. package/dist/docs/assets/{reference_connections.md.CxbLpaaP.js → reference_connections.md.BJE2Zllp.js} +4 -4
  78. package/dist/docs/assets/{reference_connections.md.CxbLpaaP.lean.js → reference_connections.md.BJE2Zllp.lean.js} +1 -1
  79. package/dist/docs/assets/{reference_hooks.md.DbJC8mcZ.js → reference_hooks.md.B1jq3oGl.js} +3 -3
  80. package/dist/docs/assets/{reference_hooks.md.DbJC8mcZ.lean.js → reference_hooks.md.B1jq3oGl.lean.js} +1 -1
  81. package/dist/docs/assets/reference_memory.md.BwyJXYZe.js +4 -0
  82. package/dist/docs/assets/reference_memory.md.BwyJXYZe.lean.js +1 -0
  83. package/dist/docs/assets/{reference_project-layout.md.SNzIvnmC.js → reference_project-layout.md.mFcS8yDD.js} +3 -3
  84. package/dist/docs/assets/{reference_project-layout.md.SNzIvnmC.lean.js → reference_project-layout.md.mFcS8yDD.lean.js} +1 -1
  85. package/dist/docs/assets/{reference_sessions.md.C_uzIWuy.js → reference_sessions.md.C8FXuGwk.js} +1 -1
  86. package/dist/docs/assets/{reference_skills.md.Ckddg6KX.js → reference_skills.md.C2GWh7g8.js} +3 -3
  87. package/dist/docs/assets/{reference_subagents.md.gmPt5J-M.js → reference_subagents.md.ChNGh6HK.js} +1 -1
  88. package/dist/docs/assets/{reference_subagents.md.gmPt5J-M.lean.js → reference_subagents.md.ChNGh6HK.lean.js} +1 -1
  89. package/dist/docs/assets/{troubleshooting.md.PCafNCb5.js → troubleshooting.md.DFnoTDlQ.js} +1 -1
  90. package/dist/docs/building-with-agents.html +35 -35
  91. package/dist/docs/deployment.html +38 -38
  92. package/dist/docs/deployment.md +27 -3
  93. package/dist/docs/evals.html +35 -35
  94. package/dist/docs/guides/agent-to-agent.html +41 -40
  95. package/dist/docs/guides/agent-to-agent.md +34 -21
  96. package/dist/docs/guides/bitbucket.html +35 -35
  97. package/dist/docs/guides/cloud-agents.html +35 -35
  98. package/dist/docs/guides/convert-automation.html +35 -35
  99. package/dist/docs/guides/export-grokbot.html +114 -0
  100. package/dist/docs/guides/export-grokbot.md +239 -0
  101. package/dist/docs/guides/github.html +35 -35
  102. package/dist/docs/guides/gitlab.html +35 -35
  103. package/dist/docs/guides/grokbot-agents.html +35 -35
  104. package/dist/docs/guides/hooks.html +37 -37
  105. package/dist/docs/guides/hooks.md +3 -1
  106. package/dist/docs/guides/improve.html +35 -35
  107. package/dist/docs/guides/jev.html +35 -35
  108. package/dist/docs/guides/mcp-oauth.html +35 -35
  109. package/dist/docs/guides/migrate.html +36 -36
  110. package/dist/docs/guides/opentelemetry.html +39 -39
  111. package/dist/docs/guides/opentelemetry.md +37 -5
  112. package/dist/docs/guides/slack.html +35 -35
  113. package/dist/docs/guides/webhooks.html +35 -35
  114. package/dist/docs/hashmap.json +1 -1
  115. package/dist/docs/hillclimbing.html +35 -35
  116. package/dist/docs/index.html +37 -37
  117. package/dist/docs/index.md +3 -0
  118. package/dist/docs/llms-full.txt +536 -44
  119. package/dist/docs/llms.txt +2 -0
  120. package/dist/docs/quickstart.html +35 -35
  121. package/dist/docs/reference/agent-config.html +35 -35
  122. package/dist/docs/reference/artifacts.html +35 -35
  123. package/dist/docs/reference/channels.html +35 -35
  124. package/dist/docs/reference/cli.html +41 -38
  125. package/dist/docs/reference/cli.md +39 -1
  126. package/dist/docs/reference/connections.html +38 -38
  127. package/dist/docs/reference/connections.md +16 -6
  128. package/dist/docs/reference/evals.html +36 -36
  129. package/dist/docs/reference/extensions.html +35 -35
  130. package/dist/docs/reference/hooks.html +38 -38
  131. package/dist/docs/reference/hooks.md +6 -2
  132. package/dist/docs/reference/http-api.html +35 -35
  133. package/dist/docs/reference/instructions.html +35 -35
  134. package/dist/docs/reference/memory.html +63 -0
  135. package/dist/docs/reference/memory.md +114 -0
  136. package/dist/docs/reference/playground.html +35 -35
  137. package/dist/docs/reference/project-layout.html +37 -37
  138. package/dist/docs/reference/project-layout.md +4 -1
  139. package/dist/docs/reference/prompt.html +35 -35
  140. package/dist/docs/reference/schedules.html +35 -35
  141. package/dist/docs/reference/sessions.html +36 -36
  142. package/dist/docs/reference/sessions.md +1 -3
  143. package/dist/docs/reference/skills.html +38 -38
  144. package/dist/docs/reference/subagents.html +36 -36
  145. package/dist/docs/reference/subagents.md +2 -0
  146. package/dist/docs/reference/tools.html +35 -35
  147. package/dist/docs/templates/agentic-owners.html +35 -35
  148. package/dist/docs/templates/grokbot-agents.html +35 -35
  149. package/dist/docs/templates/security-reviewer.html +35 -35
  150. package/dist/docs/templates/thermo-quality-review.html +35 -35
  151. package/dist/docs/templates/thermo-review.html +35 -35
  152. package/dist/docs/templates/triage.html +35 -35
  153. package/dist/docs/troubleshooting.html +36 -36
  154. package/dist/docs/troubleshooting.md +1 -1
  155. package/dist/evals/assertions.d.ts +3 -3
  156. package/dist/evals/assertions.d.ts.map +1 -1
  157. package/dist/evals/assertions.js +2 -2
  158. package/dist/evals/judge.d.ts +5 -4
  159. package/dist/evals/judge.d.ts.map +1 -1
  160. package/dist/evals.d.ts +1 -1
  161. package/dist/evals.js +1 -1
  162. package/dist/extensions/cursor-cloud-agents/extension.d.ts +5 -2
  163. package/dist/extensions/cursor-cloud-agents/extension.d.ts.map +1 -1
  164. package/dist/extensions/cursor-cloud-agents/extension.js +21 -1
  165. package/dist/extensions/cursor-cloud-agents/lib/backend.d.ts +22 -1
  166. package/dist/extensions/cursor-cloud-agents/lib/backend.d.ts.map +1 -1
  167. package/dist/extensions/cursor-cloud-agents/lib/backend.js +1 -0
  168. package/dist/extensions/cursor-cloud-agents/lib/launch-agent.d.ts +10 -3
  169. package/dist/extensions/cursor-cloud-agents/lib/launch-agent.d.ts.map +1 -1
  170. package/dist/extensions/cursor-cloud-agents/lib/launch-agent.js +10 -1
  171. package/dist/filesystem.js +1 -1
  172. package/dist/internal/cli-ax.d.ts +7 -7
  173. package/dist/internal/cli-ax.d.ts.map +1 -1
  174. package/dist/internal/cli-ax.js +36 -15
  175. package/dist/internal/cloud-turn-usage.d.ts +34 -0
  176. package/dist/internal/cloud-turn-usage.d.ts.map +1 -0
  177. package/dist/internal/cloud-turn-usage.js +94 -0
  178. package/dist/internal/cursor/account-mcp.d.ts +1 -1
  179. package/dist/internal/cursor/account-mcp.d.ts.map +1 -1
  180. package/dist/internal/cursor/account-mcp.js +1 -1
  181. package/dist/internal/cursor/github-credentials.d.ts +1 -1
  182. package/dist/internal/cursor/github-credentials.d.ts.map +1 -1
  183. package/dist/internal/deploy-client.js +20 -1
  184. package/dist/internal/discovery/agent.d.ts +1 -1
  185. package/dist/internal/discovery/agent.d.ts.map +1 -1
  186. package/dist/internal/estimate-cost.d.ts +55 -0
  187. package/dist/internal/estimate-cost.d.ts.map +1 -0
  188. package/dist/internal/{turn-cost.js → estimate-cost.js} +15 -23
  189. package/dist/internal/eval-judge-model.d.ts +1 -1
  190. package/dist/internal/eval-judge-model.d.ts.map +1 -1
  191. package/dist/internal/eval-runner.d.ts +2 -2
  192. package/dist/internal/eval-runner.d.ts.map +1 -1
  193. package/dist/internal/eval-runner.js +1 -1
  194. package/dist/internal/evals-client.d.ts +1 -1
  195. package/dist/internal/evals-client.d.ts.map +1 -1
  196. package/dist/internal/evals-client.js +1 -1
  197. package/dist/internal/event-log.d.ts +2 -2
  198. package/dist/internal/event-log.d.ts.map +1 -1
  199. package/dist/internal/event-log.js +6 -3
  200. package/dist/internal/event-mapper.d.ts.map +1 -1
  201. package/dist/internal/event-mapper.js +5 -1
  202. package/dist/internal/filesystem/nearest.d.ts +1 -1
  203. package/dist/internal/filesystem/nearest.d.ts.map +1 -1
  204. package/dist/internal/filesystem/walk.d.ts +1 -1
  205. package/dist/internal/filesystem/walk.d.ts.map +1 -1
  206. package/dist/internal/filesystem/walk.js +1 -1
  207. package/dist/internal/host-otel.d.ts.map +1 -1
  208. package/dist/internal/http-channel.js +1 -1
  209. package/dist/internal/init-scaffold.d.ts.map +1 -1
  210. package/dist/internal/init-scaffold.js +3 -4
  211. package/dist/internal/memory-dir.d.ts +8 -0
  212. package/dist/internal/memory-dir.d.ts.map +1 -0
  213. package/dist/internal/memory-dir.js +7 -0
  214. package/dist/internal/otel/collector.d.ts +3 -3
  215. package/dist/internal/otel/collector.d.ts.map +1 -1
  216. package/dist/internal/otel/collector.js +68 -43
  217. package/dist/internal/otel/computer-use-attrs.d.ts +18 -0
  218. package/dist/internal/otel/computer-use-attrs.d.ts.map +1 -0
  219. package/dist/internal/otel/computer-use-attrs.js +30 -0
  220. package/dist/internal/otel/config.d.ts +1 -1
  221. package/dist/internal/otel/config.d.ts.map +1 -1
  222. package/dist/internal/otel/config.js +1 -1
  223. package/dist/internal/otel/runtime.d.ts +2 -6
  224. package/dist/internal/otel/runtime.d.ts.map +1 -1
  225. package/dist/internal/otel/runtime.js +54 -43
  226. package/dist/internal/otel/tool-error-class.d.ts +4 -0
  227. package/dist/internal/otel/tool-error-class.d.ts.map +1 -0
  228. package/dist/internal/otel/tool-error-class.js +36 -0
  229. package/dist/internal/sdk-runner.d.ts.map +1 -1
  230. package/dist/internal/sdk-runner.js +5 -13
  231. package/dist/internal/session-cost.d.ts +21 -22
  232. package/dist/internal/session-cost.d.ts.map +1 -1
  233. package/dist/internal/session-cost.js +38 -46
  234. package/dist/internal/session-engine.d.ts +22 -40
  235. package/dist/internal/session-engine.d.ts.map +1 -1
  236. package/dist/internal/session-engine.js +62 -109
  237. package/dist/internal/sessions-client.d.ts +13 -1
  238. package/dist/internal/sessions-client.d.ts.map +1 -1
  239. package/dist/internal/sessions-client.js +24 -0
  240. package/dist/internal/tool-result.d.ts +2 -2
  241. package/dist/internal/tool-result.d.ts.map +1 -1
  242. package/dist/internal/tool-result.js +16 -11
  243. package/dist/internal/trajectory.d.ts +5 -6
  244. package/dist/internal/trajectory.d.ts.map +1 -1
  245. package/dist/internal/trajectory.js +1 -13
  246. package/dist/internal/workspace-sync.js +1 -1
  247. package/dist/internal/workspace.js +1 -1
  248. package/dist/memory.d.ts +5 -4
  249. package/dist/memory.d.ts.map +1 -1
  250. package/dist/memory.js +2 -3
  251. package/dist/playground/assets/cursor-icons-16-gwXtdAvu.woff2 +0 -0
  252. package/dist/playground/assets/index-BfePgvWh.css +1 -0
  253. package/dist/playground/assets/index-DAlf9lxD.js +71 -0
  254. package/dist/playground/index.html +2 -2
  255. package/dist/types.d.ts +25 -29
  256. package/dist/types.d.ts.map +1 -1
  257. package/docs/README.md +3 -0
  258. package/docs/deployment.md +27 -3
  259. package/docs/guides/agent-to-agent.md +34 -21
  260. package/docs/guides/export-grokbot.md +244 -0
  261. package/docs/guides/hooks.md +3 -1
  262. package/docs/guides/opentelemetry.md +37 -5
  263. package/docs/reference/cli.md +39 -1
  264. package/docs/reference/connections.md +16 -6
  265. package/docs/reference/hooks.md +6 -2
  266. package/docs/reference/memory.md +119 -0
  267. package/docs/reference/project-layout.md +4 -1
  268. package/docs/reference/sessions.md +1 -3
  269. package/docs/reference/subagents.md +2 -0
  270. package/docs/troubleshooting.md +1 -1
  271. package/package.json +6 -5
  272. package/skills/evals/SKILL.md +1 -1
  273. package/skills/framework-map/SKILL.md +3 -1
  274. package/skills/otel/SKILL.md +4 -3
  275. package/templates/agentic-owners/bot/lib/owners/matching.ts +57 -2
  276. package/templates/pr-autofixer/bot/tools/drive_pr.ts +1 -2
  277. package/dist/docs/assets/chunks/@localSearchIndexroot.ylB4B_Ud.js +0 -1
  278. package/dist/docs/assets/chunks/channel.BgjgeSqp.js +0 -1
  279. package/dist/docs/assets/chunks/classDiagram-6PBFFD2Q.CIVv63wE.js +0 -1
  280. package/dist/docs/assets/chunks/classDiagram-v2-HSJHXN6E.CIVv63wE.js +0 -1
  281. package/dist/docs/assets/chunks/clone.HcW7h-70.js +0 -1
  282. package/dist/docs/assets/chunks/stateDiagram-v2-QKLJ7IA2.B5d7jT7E.js +0 -1
  283. package/dist/docs/assets/chunks/wardley-RL74JXVD.BcY0KddE.js +0 -162
  284. package/dist/internal/cloud-turn-cost.d.ts +0 -42
  285. package/dist/internal/cloud-turn-cost.d.ts.map +0 -1
  286. package/dist/internal/cloud-turn-cost.js +0 -120
  287. package/dist/internal/turn-cost.d.ts +0 -41
  288. package/dist/internal/turn-cost.d.ts.map +0 -1
  289. package/dist/playground/assets/cursor-icons-16-DBmD_cqy.woff2 +0 -0
  290. package/dist/playground/assets/index-BDPd0Sec.css +0 -1
  291. package/dist/playground/assets/index-BrXDwbrN.js +0 -71
  292. /package/dist/docs/assets/{reference_sessions.md.C_uzIWuy.lean.js → reference_sessions.md.C8FXuGwk.lean.js} +0 -0
  293. /package/dist/docs/assets/{reference_skills.md.Ckddg6KX.lean.js → reference_skills.md.C2GWh7g8.lean.js} +0 -0
  294. /package/dist/docs/assets/{troubleshooting.md.PCafNCb5.lean.js → troubleshooting.md.DFnoTDlQ.lean.js} +0 -0
@@ -0,0 +1,244 @@
1
+ ---
2
+ title: "Export a Grok Bot"
3
+ description: "Turn a Grok Bot recipe into a BDK project, preview what maps, and finish secrets and connector sign-ins."
4
+ ---
5
+
6
+ # Export a Grok Bot to a BDK project
7
+
8
+ `bdk init --from-grokbot` turns a Grok Bot recipe into a project you can
9
+ review, run locally, and keep in source control. It carries over the bot's
10
+ profile, selected skills and routines, memory, and connectors where BDK has a
11
+ matching project surface.
12
+
13
+ ## Preview the export
14
+
15
+ Start with `--dry-run`. The command resolves the same defaults as a real
16
+ export and shows every planned file, warning, secret name, and follow-up
17
+ without creating the target directory or installing packages.
18
+
19
+ ```bash
20
+ bdk init ./launch-desk \
21
+ --from-grokbot ./launch-desk.recipe.json \
22
+ --dry-run
23
+ ```
24
+
25
+ Selected lines from the example recipe's non-interactive preview look like
26
+ this:
27
+
28
+ ```text
29
+ Dry run: "Launch Desk" → ./launch-desk (nothing written)
30
+
31
+ bot/agent.ts profile
32
+ bot/channels/slack.ts routines/launch-questions, routines/blocker-watch, routines/ship-it
33
+ bot/instructions.md profile, gettingStarted, routines/launch-questions, routines/blocker-watch, routines/ship-it, memory
34
+ bot/mcp-connections/linear.ts plugins/linear
35
+ bot/schedules/morning-launch-brief.md routines/morning-launch-brief
36
+ bot/skills/release-checklist/SKILL.md skills/release-checklist
37
+ SECRETS.md answers
38
+ ...
39
+
40
+ Defaulted without asking:
41
+ - name
42
+ - description
43
+ - model
44
+ ...
45
+
46
+ Not carried over:
47
+ - profile.avatar: BDK agents have no avatar; kept in grokbot-export.json for the Slack app icon.
48
+
49
+ Secrets to set (names only; see SECRETS.md):
50
+ - LAUNCH_DESK_SLACK_APP_TOKEN
51
+ - LAUNCH_DESK_SLACK_BOT_TOKEN
52
+ ```
53
+
54
+ Each file row names the recipe parts that produced it. The remaining sections
55
+ list defaults, answers the recipe ignored, excluded items, unmapped behavior,
56
+ routine placeholders, fresh connector sign-ins, warnings, and setup steps.
57
+
58
+ Add `--json` when a script needs the preview:
59
+
60
+ ```bash
61
+ bdk init ./launch-desk \
62
+ --from-grokbot ./launch-desk.recipe.json \
63
+ --dry-run \
64
+ --json
65
+ ```
66
+
67
+ The core JSON shape is:
68
+
69
+ ```json
70
+ {
71
+ "ok": true,
72
+ "dryRun": true,
73
+ "directory": "/work/launch-desk",
74
+ "preview": {
75
+ "files": [],
76
+ "defaulted": [],
77
+ "ignored": [],
78
+ "excluded": [],
79
+ "unmapped": [],
80
+ "fillIns": [],
81
+ "secrets": { "names": [], "reauth": [] },
82
+ "warnings": [],
83
+ "setupSteps": []
84
+ }
85
+ }
86
+ ```
87
+
88
+ See [`bdk init`](../reference/cli.md#init) for the complete preview fields and
89
+ flag behavior.
90
+
91
+ ## Choose an answers file or the terminal interview
92
+
93
+ Run the command in a terminal when you want to review each choice once. Press
94
+ Enter to accept a default.
95
+
96
+ ```bash
97
+ bdk init ./launch-desk \
98
+ --from-grokbot ./launch-desk.recipe.json
99
+ ```
100
+
101
+ Use `--answers` for a repeatable export or a non-interactive environment. This
102
+ minimal file validates against the published schema and accepts every recipe
103
+ default:
104
+
105
+ ```json
106
+ {
107
+ "$schema": "./node_modules/@cursor/bdk/schemas/grokbot-answers.schema.json",
108
+ "version": 1
109
+ }
110
+ ```
111
+
112
+ Save it as `grokbot-answers.json`, then run:
113
+
114
+ ```bash
115
+ bdk init ./launch-desk \
116
+ --from-grokbot ./launch-desk.recipe.json \
117
+ --answers ./grokbot-answers.json
118
+ ```
119
+
120
+ The `$schema` property is an optional editor hint. Add only the choices you
121
+ want to override; any answer present in the file is not asked again. A
122
+ positional directory such as `./launch-desk` overrides `location` in the
123
+ answers file.
124
+
125
+ When stdin or stdout is not a TTY, the command never prompts. `--json` also
126
+ uses this non-interactive path. Missing fields take their defaults and appear
127
+ under **Defaulted without asking** or `preview.defaulted`. If a required
128
+ conditional answer has no default, such as the time for a scheduled decision,
129
+ the command stops and names the field to add to the answers file.
130
+
131
+ ## Write and check the project
132
+
133
+ Remove `--dry-run` after the preview matches your intent. The command writes
134
+ the project, installs its npm dependencies, and prints the next commands.
135
+ Export into a fresh directory; a project previously created with
136
+ `bdk init --template` is rejected.
137
+
138
+ ```bash
139
+ bdk init ./launch-desk \
140
+ --from-grokbot ./launch-desk.recipe.json \
141
+ --answers ./grokbot-answers.json
142
+
143
+ cd ./launch-desk
144
+ bdk validate
145
+ bdk dev
146
+ ```
147
+
148
+ Open the playground from `bdk dev` and try the routines you plan to keep
149
+ before connecting live channels.
150
+
151
+ ## Review what maps where
152
+
153
+ | Grok Bot recipe part | BDK project result |
154
+ | --- | --- |
155
+ | Profile or persona | The name and description become `bot/agent.ts` and the opening of `bot/instructions.md`. |
156
+ | Skills | Each selected skill becomes `bot/skills/<slug>/SKILL.md`. An enabled, valid skill schedule also becomes `bot/schedules/<slug>.md` when the schedule channel is on. |
157
+ | Getting-started skill | `bot/instructions.md` tells the agent to use this skill for a new conversation. |
158
+ | Cron routines | A selected routine with a valid, enabled cron trigger becomes `bot/schedules/<slug>.md` when the schedule channel is on. |
159
+ | Slack routines | When the Slack channel is on, the routine text becomes a section in `bot/instructions.md`; mentions, channel watches, keywords, and reactions are wired in `bot/channels/slack.ts`. Missing trigger values remain as warnings or TODOs. |
160
+ | GitHub or webhook routines | When the corresponding channel is on, the preview adds a setup step to wire the trigger. A routine with no other wired trigger also becomes an on-request skill. |
161
+ | Other routines | A routine without a wired trigger becomes an on-request skill. The preview explains which trigger still needs work. |
162
+ | Memory | The default is `bot/skills/knowledge/SKILL.md`. Choose `memory: "kv"` for `bot/lib/memory-seed.json`, or `memory: "drop"` to leave it out. |
163
+ | Plugins and connectors | Each selected plugin becomes `bot/mcp-connections/<slug>.ts` using Cursor-account auth, OAuth, or a named bearer-token secret. |
164
+ | Routine placeholders | Values under `fillIns.<routine-slug>` replace placeholders such as `{slack_channel}`. Unfilled placeholders remain visible and produce warnings. |
165
+ | Export decisions | Resolved answers and recipe metadata are recorded in `grokbot-export.json`. |
166
+
167
+ The generated project also includes the standard package, TypeScript, eval,
168
+ memory-hook, and ignore files needed to run it.
169
+
170
+ ## Resolve what does not map
171
+
172
+ The preview separates choices you made from behavior the converter could not
173
+ carry over:
174
+
175
+ | Preview result | What it means | What to do |
176
+ | --- | --- | --- |
177
+ | **Left out** | An answer excluded a skill, routine, plugin, or memory. | Change the matching `include` or `exclude` answer, or change `memory` from `"drop"`, then rerun; otherwise leave the item behind. |
178
+ | `BDK agents have no avatar` | The profile avatar is not an agent setting. Its metadata remains in `grokbot-export.json`. | Set an icon separately if the destination needs one. |
179
+ | `Unknown recipe field; ignored.` | The recipe contains a field this BDK version does not map. | Inspect the field and add its behavior to the generated project when needed. |
180
+ | `Paused schedule ...` | A paused cron trigger does not produce a schedule file. | Leave it paused, or add a schedule under `bot/schedules/`. |
181
+ | `trigger dropped: the ... channel is off.` | The answers disabled the channel used by a trigger. | Enable the channel in the answers or add the trigger manually after export. |
182
+ | `trigger has no BDK channel.` | The trigger type has no direct BDK channel mapping. | Add a supported channel or custom wake; use the generated on-request skill when one is present. |
183
+ | `is not a five-field cron expression.` | The source cron cannot become a BDK schedule. | Correct the expression and add the schedule before enabling it. |
184
+ | `placeholders ... are unfilled` | A routine still contains values such as `{slack_channel}`. | Set `fillIns.<routine-slug>` in the answers or edit the generated text. |
185
+ | `BDK has no built-in KV seed` | `memory: "kv"` writes data but does not load it into hosted KV. | Add your own `ctx.host.kv` seeding code, or use `memory: "skill"`. |
186
+
187
+ Treat setup steps and warnings as the checklist for restoring the source
188
+ behavior. A generated project is ready for review, not automatically ready for
189
+ live traffic.
190
+
191
+ ## Set secrets and reconnect OAuth
192
+
193
+ The export carries secret names only, never values. `SECRETS.md` lists each
194
+ name, where it is read, and every connector that needs a fresh sign-in.
195
+
196
+ Set local values in the environment where you run `bdk dev`. For a hosted
197
+ deployment, let `bdk` prompt for each value:
198
+
199
+ ```bash
200
+ bdk secrets set launch-desk LINEAR_API_KEY
201
+ ```
202
+
203
+ OAuth tokens do not move with the recipe. Sign in to each OAuth connector
204
+ again:
205
+
206
+ ```bash
207
+ bdk mcp oauth notion
208
+ ```
209
+
210
+ Add `--store` when the sign-in is for a hosted deployment.
211
+
212
+ ## Check cron schedules in UTC
213
+
214
+ BDK evaluates cron schedules in UTC. A recipe routine that asks for a
215
+ timezone produces a warning like:
216
+
217
+ ```text
218
+ routines/morning-launch-brief: BDK runs `0 8 * * 1-5` in UTC, not America/Los_Angeles; adjust the cron in bot/schedules/morning-launch-brief.md if the time matters.
219
+ ```
220
+
221
+ The timezone answer documents the source intent; it does not rewrite the cron.
222
+ Check each generated file under `bot/schedules/` and translate local
223
+ wall-clock times to UTC. For locations that observe daylight saving time,
224
+ also decide how you will handle the offset change.
225
+
226
+ ## Use the handoff files
227
+
228
+ | File | Purpose |
229
+ | --- | --- |
230
+ | `AGENTS.md` | Gives a coding agent the project commands and points it to the export handoff. |
231
+ | `SECRETS.md` | Lists secret names and connector sign-ins, without values. |
232
+ | `SLACK.md` | When Slack is selected, holds the Slack app setup notes. |
233
+ | `.cursor/skills/finish-grokbot-export/SKILL.md` | Guides a coding agent through the remaining setup, warnings, validation, and local test. |
234
+ | `.cursor/environment.json` | Tells a Cursor cloud agent to install the project with `npm install`. |
235
+
236
+ Server-side secret transfer, automatic moves of existing Slack apps, and
237
+ self-deploy are not shipped, so this guide does not cover those flows.
238
+
239
+ ## Related
240
+
241
+ - [`bdk init`](../reference/cli.md#init): flags, JSON output, and failures
242
+ - [Project layout](../reference/project-layout.md): generated project files
243
+ - [Schedules and reminders](../reference/schedules.md): cron behavior
244
+ - [MCP connections](../reference/connections.md): connector auth choices
@@ -98,9 +98,11 @@ replay recorded events into hooks.
98
98
  | --- | --- |
99
99
  | Add context before the model | `instructions.md`, skills, or `workspaceFiles` |
100
100
  | Deliver to Slack or a PR | Channel [`events`](../reference/channels.md#events) or packs |
101
- | Gate final assistant text | `defineResult` |
102
101
  | Gate behavior | [Evals](../evals.md) |
103
102
 
103
+ To act on a turn's decision, have the model record it with an authored
104
+ [tool](../reference/tools.md), then act on it from a `turn.completed` hook.
105
+
104
106
  [Cursor Agent hooks](https://cursor.com/docs/agent/hooks) in
105
107
  `.cursor/hooks.json` are a different product. They can observe, block, or
106
108
  modify the local agent loop.
@@ -51,7 +51,9 @@ await serve(".", {
51
51
 
52
52
  Use environment variables when you start the agent with
53
53
  `bdk serve`. Use `serve({ otel })` when your TypeScript
54
- application starts the server itself.
54
+ application starts the server itself. When that application
55
+ already uses OpenTelemetry, BDK sends its traces, metrics, and
56
+ logs to the collector configured here.
55
57
 
56
58
  ## Follow one conversation
57
59
 
@@ -74,6 +76,35 @@ turn: agent_sdk.turn
74
76
  A conversation can produce several turn traces, so use the session ID
75
77
  as the join key instead of expecting one long-lived session span.
76
78
 
79
+ ### Subagents
80
+
81
+ A subagent's tool calls are `agent_sdk.tool` spans under its
82
+ `agent_sdk.subagent` span. Its `reasoning.completed` and
83
+ `message.completed` events sit on that span too, so the subagent span
84
+ shows where its time went. Time between two tool spans is the model
85
+ choosing the next step. A subagent that fails or is cancelled ends its
86
+ span with ERROR status when it stops.
87
+
88
+ ### Computer use
89
+
90
+ Each computer use action is an `agent_sdk.tool` span with
91
+ `cursor.tool.name` set to `computerUse`, under the computer use
92
+ subagent's span. A failed action has ERROR status. These attributes
93
+ describe the action without typed text, coordinates, or screenshots:
94
+
95
+ | Attribute | Value |
96
+ | --- | --- |
97
+ | `agent_sdk.computer.actions` | The action type, such as `click`, `type`, or `screenshot` |
98
+ | `agent_sdk.computer.executor_duration_ms` | Time the desktop took to run the action and capture the screen |
99
+ | `agent_sdk.computer.settle_ms` | Part of that time spent waiting for the screen to settle |
100
+
101
+ The two durations appear only on actions that succeed.
102
+
103
+ To export the full actions, turn on tool content as shown in
104
+ [Control what leaves the process](#control-what-leaves-the-process).
105
+ Tool content includes the text the agent typed, which can contain
106
+ passwords.
107
+
77
108
  ## Add domain telemetry
78
109
 
79
110
  Use `ctx.host.otel` when your dashboard should answer questions the
@@ -124,10 +155,11 @@ The first metrics to look for are `cursor.token.usage`,
124
155
 
125
156
  ## Control what leaves the process
126
157
 
127
- User prompts, tool arguments, tool results, and failure text stay off
128
- the wire by default. You still get trace structure, tool names and
129
- status, usage metrics, and generic failure status without exporting the
130
- underlying content.
158
+ Traces include structure, tool names, usage metrics, and span
159
+ status. A failed tool's status includes a short failure reason.
160
+ A tool or subagent that is still open when the turn ends gets
161
+ ERROR status with the reason `no result`. User prompts, tool
162
+ arguments, and full tool results stay off the wire until you opt in.
131
163
 
132
164
  Turn on logs first, then opt into prompt or tool content separately:
133
165
 
@@ -136,6 +136,7 @@ bdk serve [--dir <path>] [--port <n>] [--host <host>]
136
136
  [--allow-anonymous-cursor-account-mcp]
137
137
  [--allow-anonymous-grokbot]
138
138
  [--public-url <url>]
139
+ [--peers-url <url>]
139
140
  [--no-schedules] [--no-playground] [--no-docs]
140
141
  [--cursor-events --repo <owner/name>]...
141
142
  ```
@@ -145,7 +146,7 @@ bdk serve [--dir <path>] [--port <n>] [--host <host>]
145
146
  | `--port <n>` | Listen on this port. The default is `3000`; `0` selects an available port. When an omitted default is occupied, the CLI selects the next port. An occupied explicit port fails with a next-port hint. |
146
147
  | `--host <host>` | Bind this host. The default is loopback-only `127.0.0.1`. |
147
148
  | `--mode multi` | Mount projects at `/<slug>/v1/*` and `/<slug>/playground`, with an index at `/`. This is the default. |
148
- | `--mode single` | Mount one project at `/v1/*` and `/playground`. |
149
+ | `--mode single` | Mount one project at `/v1/*` and `/playground`. Declared peers are omitted with a warning unless `--peers-url` is set. |
149
150
  | `--dev` | Disable automatic schedule and reminder firing, admit unsigned loopback GitHub deliveries, and enable local playground access. |
150
151
  | `--state-root <path>` | Store local sessions, streams, workspaces, and channel state here. Keep durable state outside a repository whose rules shouldn't reach agent workspaces. |
151
152
  | `--bearer-token <secret>` | Require this token on routes without authored authentication. Mutually exclusive with `--allow-anonymous`. |
@@ -154,6 +155,7 @@ bdk serve [--dir <path>] [--port <n>] [--host <host>]
154
155
  | `--allow-anonymous-cursor-account-mcp` | Let anonymous callers use Cursor account MCP connections. Requires an authenticating proxy. |
155
156
  | `--allow-anonymous-grokbot` | Let anonymous callers drive hosted Grok Bot runtime agents. Requires an authenticating proxy. |
156
157
  | `--public-url <url>` | Set the externally reachable base URL that turns running off the serve host use for peer MCP and host bridges. It does not expose the server; configure the listener or proxy separately. Local-runtime peers use loopback. |
158
+ | `--peers-url <url>` | Resolve declared peers for a single-agent serve through a hosting-provided peer service. Cursor-managed hosting sets this option automatically; a multi-agent serve rejects it. |
157
159
  | `--no-schedules` | Disable schedule firing outside dev mode. |
158
160
  | `--no-playground` | Skip the playground. |
159
161
  | `--no-docs` | Skip the documentation site at `/docs`. |
@@ -447,6 +449,8 @@ requires an ID. The `status` and `cancel` subcommands require `--url`.
447
449
 
448
450
  ```text
449
451
  bdk init [directory] [--template <name>] [--var id=value]... [--json]
452
+ bdk init [directory] --from-grokbot <recipe.json>
453
+ [--answers <file>] [--dry-run] [--json]
450
454
  ```
451
455
 
452
456
  Without a directory, `init` prints the setup guide and changes no files. With
@@ -463,6 +467,40 @@ On a TTY, templates with questions run their interview before writing files.
463
467
  `init` also offers to refresh the bundled coding-agent skills and starts login
464
468
  when the host has no Cursor credential.
465
469
 
470
+ #### Export a Grok Bot recipe
471
+
472
+ `--from-grokbot` reads a Grok Bot recipe and maps its profile, selected skills
473
+ and routines, memory, channels, and connectors into a BDK project. The target
474
+ directory defaults to the resolved `location` answer; a positional directory
475
+ overrides it. A target previously created with `bdk init --template` is
476
+ rejected; export into a fresh directory instead.
477
+
478
+ | Option | Contract |
479
+ | --- | --- |
480
+ | `--from-grokbot <recipe.json>` | Read the recipe to export. |
481
+ | `--answers <file>` | Read export decisions from a JSON object. Fields present in the file are not asked again. The published schema is `schemas/grokbot-answers.schema.json`. |
482
+ | `--dry-run` | Print the planned files, defaults, exclusions, unmapped behavior, placeholders, secret names, warnings, and setup steps without writing files or installing dependencies. |
483
+ | `--json` | Never prompt and print machine-readable output. Combine it with `--dry-run` for a machine-readable preview. |
484
+
485
+ On a TTY, the command asks for missing decisions and offers recipe-derived
486
+ defaults. Off a TTY, it never prompts, takes defaults where possible, and
487
+ lists the fields it defaulted.
488
+
489
+ `--dry-run --json` prints `{ ok, dryRun, directory, preview }`. The preview
490
+ contains `version`, `name`, resolved `answers`, `defaulted`, `ignored`, `files`
491
+ as `{ path, from }`, `excluded`, `unmapped` as `{ from, reason }`, `fillIns`,
492
+ `secrets` as `{ names, reauth }`, `warnings`, and `setupSteps`. A write with
493
+ `--json` also reports `files`, `installed`, and `installError`. A dependency
494
+ install failure leaves `ok: true`, sets `installed: false`, reports
495
+ `installError`, and exits `0`. Other errors print `{ ok: false, error }` and
496
+ exit nonzero.
497
+
498
+ `--answers` and `--dry-run` require `--from-grokbot`. This export mode does
499
+ not accept `--template` or `--var`.
500
+
501
+ See [Export a Grok Bot](../guides/export-grokbot.md) for the preview-first
502
+ workflow, mapping table, and post-export checklist.
503
+
466
504
  ### Convert an Automation {#convert-automation}
467
505
 
468
506
  ```text
@@ -9,8 +9,8 @@ An MCP connection gives the agent tools from an MCP server. Define one
9
9
  file per server under `bot/mcp-connections/`; the filename becomes the
10
10
  server name. Default-export `defineConnection` from
11
11
  `@cursor/bdk/connections`. The transport is remote HTTP, local stdio,
12
- the signed-in Cursor account's connectors, or a peer agent on the same
13
- host.
12
+ the signed-in Cursor account's connectors, or a peer agent addressed by
13
+ slug.
14
14
 
15
15
  Put a server in `bot/host-connections/` when only host tools should
16
16
  call it. Host connections use the same `defineConnection` shape and
@@ -254,9 +254,14 @@ Use a `{ command }` connection for stdio servers.
254
254
 
255
255
  ## Peer MCP connection {#peer-mcp-connection}
256
256
 
257
- `{ agent: "<slug>" }` addresses another agent mounted on the same serve
258
- host. The model gets the peer's `ask` and `check` tools, plus
259
- `call_tool` when the peer has server tools, and can delegate work to it:
257
+ `{ agent: "<slug>" }` addresses another agent without configuring a URL,
258
+ headers, or secrets. On a local multi-agent serve, the target is another
259
+ mount slug. On Cursor-managed hosting, it is the lowercase deployment slug
260
+ of another agent on the same team.
261
+
262
+ On a local multi-agent serve, the model gets the peer's `ask` and `check`
263
+ tools, plus `call_tool` when the peer has server tools, and can delegate work
264
+ to it:
260
265
 
261
266
  ```ts
262
267
  export default defineConnection({
@@ -265,7 +270,12 @@ export default defineConnection({
265
270
  });
266
271
  ```
267
272
 
268
- Unknown slugs and self-references fail `serve` at startup. Walkthrough:
273
+ Declare the connection only on the caller. The specialist needs no matching
274
+ configuration.
275
+
276
+ In a local multi-agent serve, unknown slugs and self-references fail at
277
+ startup. A single-agent serve omits peers with a warning unless its hosting
278
+ platform sets `--peers-url`. Walkthrough:
269
279
  [Peer agents](../guides/agent-to-agent.md#delegate-a-question-to-a-specialist).
270
280
 
271
281
  ## Call MCP from host code
@@ -58,7 +58,8 @@ reports all three. An extension mounts its hooks as `<ns>__<name>`, and
58
58
 
59
59
  `bdk init` scaffolds `bot/hooks/memory.ts`, which exports
60
60
  `memoryHook()` from `@cursor/bdk/memory` and journals every turn for
61
- later sessions to read. Delete the file to opt out.
61
+ later sessions to read. Delete the file to opt out. See
62
+ [Memory](./memory.md).
62
63
 
63
64
  ## Events and payloads
64
65
 
@@ -164,9 +165,12 @@ All three consume the same stream, for different jobs:
164
165
  | Add context before the model runs | The channel's `send` message and `workspaceFiles`, `instructions.md`, skills, or `sandbox/workspace/` seed files |
165
166
  | Reply on Slack, comment on a PR, or post any other delivery | The channel's `events` map, or the Slack and GitHub packs |
166
167
  | Show PR progress (merge-box check, sticky banner) | `githubChannel({ progress: { commitStatus, banner } })`; see [GitHub agents](../guides/github.md) |
167
- | Act on the final assistant text, reject it for a same-turn repair, or fail a bad turn | `defineResult` |
168
168
  | Gate a change on behavior | [Evals](../evals.md) |
169
169
 
170
+ To act on a turn's decision, such as a label or a ticket, have the model
171
+ record it with an authored [tool](./tools.md). A `turn.completed` hook then
172
+ reads the recorded decision and acts on it through `ctx.host`.
173
+
170
174
  ## Test a hook
171
175
 
172
176
  A hook definition is a plain object, so a unit test calls
@@ -0,0 +1,119 @@
1
+ ---
2
+ title: "Memory"
3
+ description: "Journal every turn so later sessions can read what earlier ones did."
4
+ ---
5
+
6
+ # Memory
7
+
8
+ Memory lets an agent recall work from earlier sessions. A memory hook
9
+ appends one record per turn to a shared journal, and the model reads
10
+ that journal with its normal file tools when its instructions send it
11
+ there. Every session and every user of the agent shares one journal.
12
+
13
+ ## Memory is on by default
14
+
15
+ `bdk init` scaffolds `bot/hooks/memory.ts`:
16
+
17
+ ```ts
18
+ // bot/hooks/memory.ts
19
+ import { memoryHook } from "@cursor/bdk/memory";
20
+
21
+ export default memoryHook();
22
+ ```
23
+
24
+ It also adds a `## Memory` section to `bot/instructions.md`. The model
25
+ has no recall tool, so that section is what sends it to the journal:
26
+ it says when to read `memory/`, and it tells the model to treat records
27
+ as untrusted history. To add memory to an existing project, create the
28
+ hook file and copy the `## Memory` section from a fresh `bdk init`
29
+ project into your instructions. To turn memory off, delete the hook
30
+ file and the `## Memory` section.
31
+
32
+ ## Journal records
33
+
34
+ The hook appends one JSON line to `memory/journal.jsonl` after each
35
+ turn completes or fails:
36
+
37
+ ```json
38
+ {"at":"2026-10-01T16:42:09.118Z","sessionId":"5f0c2a9e-7d1b-4c43-9a6e-2b8f1e0d7c35","channelId":"slack","status":"completed","title":"Checkout flaky test","userMessage":"Why does acme/checkout fail on main?","result":"The cart test races the price service mock...","usage":{"inputTokens":18234,"outputTokens":912,"cacheReadTokens":15002,"cacheWriteTokens":0}}
39
+ ```
40
+
41
+ | Field | Contract |
42
+ | --- | --- |
43
+ | `at` | ISO-8601 time the turn finished |
44
+ | `sessionId` | Session that ran the turn |
45
+ | `channelId` | Channel that started the session, such as `http` for the session API |
46
+ | `status` | `"completed"` or `"failed"` |
47
+ | `title` | Session title, when the channel set one |
48
+ | `userMessage` | The message that started the turn, truncated to `maxTextLength` |
49
+ | `result` | Final assistant text, or the failure message, truncated to `maxTextLength` |
50
+ | `usage` | Token usage for completed turns; see [Events and payloads](./hooks.md#events-and-payloads) |
51
+
52
+ As the journal grows, older records move to `journal-*.jsonl` files
53
+ beside it. Point the model at the whole `memory/` directory when it
54
+ needs history beyond the latest segment.
55
+
56
+ ## Read memory
57
+
58
+ Local turns find the journal at `memory/` in the session workspace. On
59
+ a Cursor-hosted deployment, the first prompt of each session names the
60
+ journal's path on that machine. A session on a server you run yourself
61
+ can't reach the journal.
62
+
63
+ `memory` is a reserved workspace path. BDK rejects per-send
64
+ `workspaceFiles` and `sandbox/workspace/` seed files under `memory/`,
65
+ so callers can't write records through the workspace.
66
+
67
+ Local servers keep the journal in the project state directory. `bdk
68
+ run` and `bdk eval` start an ephemeral server with a fresh state
69
+ directory unless you pass `--state-root`, so each run starts with
70
+ empty memory. Use `bdk serve` or `bdk dev`, or pass the same
71
+ `--state-root`, to keep memory across runs. Hosted deployments keep
72
+ the journal across redeploys.
73
+
74
+ ## Who sees memory
75
+
76
+ Records from every session and every user land in the same journal, so
77
+ one person's messages and the agent's replies to them can surface in
78
+ another person's session. Turn memory off for an agent whose users
79
+ shouldn't see each other's requests. Turning it off stops new records,
80
+ but the journal keeps the records it already has. On a local server,
81
+ delete the `memory/` directory in the project state directory to clear
82
+ them. On Cursor-managed hosting, the journal is deployment data, so
83
+ [Privacy Mode](../deployment.md#privacy-mode) applies to it.
84
+
85
+ Anyone who can message the agent can put text in the journal. The
86
+ scaffolded instructions tell the model never to follow instructions
87
+ found inside records; keep that rule if you write your own section.
88
+
89
+ ## Memory and host state
90
+
91
+ Memory is advisory. A record can be dropped, and records written by
92
+ concurrent sessions can show up only in a later session. Keep state
93
+ your code depends on, such as dedupe records and cursors, in
94
+ `ctx.host.kv` or `ctx.host.files`; see
95
+ [Handler context](./hooks.md#handler-context).
96
+
97
+ ## Options
98
+
99
+ `memoryHook(options?)` accepts:
100
+
101
+ | Option | Contract |
102
+ | --- | --- |
103
+ | `maxTextLength` | Truncation cap for `userMessage` and `result`. Default `2000` characters. |
104
+ | `backend` | A `MemoryBackend` that replaces the default journal |
105
+
106
+ A `MemoryBackend` has `appendTurn(record, { stateRoot, agentName })`,
107
+ which receives each record, and an optional
108
+ `prepareSession({ stateRoot, agentName })`, which runs when a session
109
+ starts. Records go only where `appendTurn` sends them, but the
110
+ `memory/` directory and the hosted first-prompt path still point at the
111
+ default journal. Give the model a tool or file to read your records,
112
+ and write instructions that send it there instead of `memory/`.
113
+
114
+ ## Related
115
+
116
+ - [Hooks](./hooks.md)
117
+ - [Instructions](./instructions.md)
118
+ - [Sessions](./sessions.md)
119
+ - [Deployment](../deployment.md)
@@ -80,12 +80,15 @@ Each path maps to a capability and a reference page.
80
80
  | `channels/*.ts` | HTTP surfaces beyond the built-in session API; `slack.ts` and `github.ts` use the platform packs | [Channels](./channels.md) |
81
81
  | `hooks/*.ts` | Observe-only event subscribers, never fatal | [Hooks](./hooks.md) |
82
82
  | `artifacts.ts` | `defineArtifacts` kinds, the `tag_artifact` opt-in, and retention | [Artifacts](./artifacts.md) |
83
- | `result.ts` | `defineResult` host `commit` on the final assistant text (`throw` or `ctx.reject`) | None |
84
83
  | `schedules/*` | Cron-driven runs (UTC, 5-field; never auto-fire under `--dev`) | [Schedules](./schedules.md) |
85
84
  | `reminders/*.ts` | Named reminder handlers that stay armed across restarts | [Schedules](./schedules.md#reminders) |
86
85
  | `sandbox/workspace/**` | Seed files copied into each local session workspace | [Sessions](./sessions.md#local-session-workspace) |
87
86
  | `lib/` | Import-only shared code, never discovered | None |
88
87
 
88
+ Discovery rejects a `bot/result.ts` file. To act on a turn's decision, have
89
+ the model record it with an authored [tool](./tools.md), then act on it from a
90
+ `turn.completed` [hook](./hooks.md).
91
+
89
92
  Evals use project-root paths:
90
93
 
91
94
  | Project-root path | What it is | Reference |
@@ -94,9 +94,7 @@ within one session. The `at` field is an ISO-8601 timestamp.
94
94
  Pair `actions.requested` with `actions.completed` for each model-step
95
95
  batch. `action.result` is the live per-call envelope. Read
96
96
  `turn.completed.data.usage` for input, output, and
97
- cache token counts. With `bot/result.ts`, `turn.failed` is emitted when
98
- `commit` throws, the turn has no assistant text, or `ctx.reject(message)`
99
- doesn't lead to an accepted revision.
97
+ cache token counts.
100
98
 
101
99
  ## Stream or replay events
102
100
 
@@ -10,6 +10,8 @@ mid-turn. Each one lives under `bot/subagents/<id>/` with a required
10
10
  `agent.ts`. Add `instructions.md` or inline `instructions` in `agent.ts`
11
11
  for a custom prompt. The parent model delegates through the `task` tool,
12
12
  and the stream records `subagent.called` and `subagent.completed`.
13
+ `subagent.completed` has `isError: true` when the subagent failed or was
14
+ cancelled.
13
15
 
14
16
  ```text
15
17
  bot/subagents/researcher/
@@ -69,7 +69,7 @@ Match the visible symptom below.
69
69
  | `run --prod --session <sessionId>` reports the session belongs to another channel | `--session` continues only sessions that `run --prod` or `session --prod` started. Reach Slack, SCM, and custom-route sessions through their own channel. |
70
70
  | A custom route returns `202` with no body | Expected on managed hosting. The handler runs after the response, so deliver results from the channel. See [Route responses](./reference/channels.md#route-responses). |
71
71
  | External HTTP rejects the alias token | Update the caller with the current token. If the token is lost or exposed, run `bdk rotate-token <slug>` and replace it everywhere. |
72
- | `deploy` says deployments are not available under legacy privacy mode | The team uses Privacy Mode (Legacy), which does not let Cursor store code. Managed hosting is not available with this setting. |
72
+ | `deploy`, a hosted session, or an eval run says it is not available with Privacy Mode (Legacy) | Switch to Privacy Mode, or ask a team admin if your team enforces this setting. A refused session does not store the message. See [Privacy Mode](./deployment.md#privacy-mode). |
73
73
  | `deploy` says persistent deployments are limited to 1 per team | Another deployment of the team already sets `persistent: true`. Remove the setting from one agent, or delete that deployment. |
74
74
  | A schedule does not fire on the hosted deployment | Make sure the deployment is running and its release has the schedule. Deploy again with `@cursor/bdk` 0.2.14 or newer. |
75
75
  | A request to a custom route gets `429` | The deployment received more requests than its limit. Wait for the time in `Retry-After`, then send the request again. |