@cursor/july 0.1.113 → 0.1.114

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 (229) hide show
  1. package/dist/docs/404.html +2 -2
  2. package/dist/docs/assets/{app.CAeK13eM.js → app.BqkJwOZ-.js} +4 -4
  3. package/dist/docs/assets/chunks/@localSearchIndexroot.BnSgidYE.js +1 -0
  4. package/dist/docs/assets/chunks/{VPLocalSearchBox.C9LbPHod.js → VPLocalSearchBox.BJAi2KiV.js} +1 -1
  5. package/dist/docs/assets/chunks/{arc.CmMq2zmS.js → arc.BZpXTgvV.js} +1 -1
  6. package/dist/docs/assets/chunks/{architectureDiagram-Q4EWVU46.CCXB8Uj5.js → architectureDiagram-Q4EWVU46.WYI-7F-Y.js} +1 -1
  7. package/dist/docs/assets/chunks/{baseUniq.CyQo6eLe.js → baseUniq.CZaUPpg0.js} +1 -1
  8. package/dist/docs/assets/chunks/{blockDiagram-DXYQGD6D.JYq6w91N.js → blockDiagram-DXYQGD6D.D6UES2pD.js} +1 -1
  9. package/dist/docs/assets/chunks/{c4Diagram-AHTNJAMY.BRV8GPJJ.js → c4Diagram-AHTNJAMY.cwebIe4i.js} +1 -1
  10. package/dist/docs/assets/chunks/channel.DdM5EfNW.js +1 -0
  11. package/dist/docs/assets/chunks/{chunk-4BX2VUAB.Bv4ooYQR.js → chunk-4BX2VUAB.fVyFnjxg.js} +1 -1
  12. package/dist/docs/assets/chunks/{chunk-4TB4RGXK.t4JtKPcj.js → chunk-4TB4RGXK.BanufG1c.js} +1 -1
  13. package/dist/docs/assets/chunks/{chunk-55IACEB6.34lCHj9Y.js → chunk-55IACEB6.VaSMz5-2.js} +1 -1
  14. package/dist/docs/assets/chunks/{chunk-EDXVE4YY.BSwrPNrt.js → chunk-EDXVE4YY.CN2diZOM.js} +1 -1
  15. package/dist/docs/assets/chunks/{chunk-FMBD7UC4.Beeun-R-.js → chunk-FMBD7UC4.g4ivypu3.js} +1 -1
  16. package/dist/docs/assets/chunks/{chunk-OYMX7WX6.BUUFUcJc.js → chunk-OYMX7WX6.GZXKn9JJ.js} +1 -1
  17. package/dist/docs/assets/chunks/{chunk-QZHKN3VN.B2XjHzN_.js → chunk-QZHKN3VN.itXxJZCd.js} +1 -1
  18. package/dist/docs/assets/chunks/{chunk-YZCP3GAM.CLYG8znk.js → chunk-YZCP3GAM.-rw2GfvX.js} +1 -1
  19. package/dist/docs/assets/chunks/classDiagram-6PBFFD2Q.CjfGHeg2.js +1 -0
  20. package/dist/docs/assets/chunks/classDiagram-v2-HSJHXN6E.CjfGHeg2.js +1 -0
  21. package/dist/docs/assets/chunks/clone.wSOICb_f.js +1 -0
  22. package/dist/docs/assets/chunks/{cose-bilkent-S5V4N54A.DVEa6fZp.js → cose-bilkent-S5V4N54A.CmaI5br0.js} +1 -1
  23. package/dist/docs/assets/chunks/{dagre-KV5264BT.C9PZQK-S.js → dagre-KV5264BT.4wY9S4Kt.js} +1 -1
  24. package/dist/docs/assets/chunks/{diagram-5BDNPKRD.DoN0uv3Y.js → diagram-5BDNPKRD.Pc3c0u9W.js} +1 -1
  25. package/dist/docs/assets/chunks/{diagram-G4DWMVQ6.Czv3duqx.js → diagram-G4DWMVQ6.CYrWz-nj.js} +1 -1
  26. package/dist/docs/assets/chunks/{diagram-MMDJMWI5.BinJ5kWb.js → diagram-MMDJMWI5.Bgj5hukb.js} +1 -1
  27. package/dist/docs/assets/chunks/{diagram-TYMM5635.DW326M4K.js → diagram-TYMM5635.DGMEXalS.js} +1 -1
  28. package/dist/docs/assets/chunks/{erDiagram-SMLLAGMA.U2pR_OA7.js → erDiagram-SMLLAGMA.GepTV9Im.js} +1 -1
  29. package/dist/docs/assets/chunks/{flowDiagram-DWJPFMVM.ByWJXeYK.js → flowDiagram-DWJPFMVM.DVKywg3j.js} +1 -1
  30. package/dist/docs/assets/chunks/{ganttDiagram-T4ZO3ILL.OquF0Rtg.js → ganttDiagram-T4ZO3ILL.C7qt9Mlo.js} +1 -1
  31. package/dist/docs/assets/chunks/{gitGraphDiagram-UUTBAWPF.Bpn01P7X.js → gitGraphDiagram-UUTBAWPF.U30_r82P.js} +1 -1
  32. package/dist/docs/assets/chunks/{graph.CNRB6ETL.js → graph.CyyMyAWv.js} +1 -1
  33. package/dist/docs/assets/chunks/{infoDiagram-42DDH7IO.CqhknMWi.js → infoDiagram-42DDH7IO.Dn9ACW3y.js} +1 -1
  34. package/dist/docs/assets/chunks/{ishikawaDiagram-UXIWVN3A.C6xpR2af.js → ishikawaDiagram-UXIWVN3A.DlIdIGOA.js} +1 -1
  35. package/dist/docs/assets/chunks/{journeyDiagram-VCZTEJTY.Cg5f7oB3.js → journeyDiagram-VCZTEJTY.DZj4vy4E.js} +1 -1
  36. package/dist/docs/assets/chunks/{kanban-definition-6JOO6SKY.Cx9YTwlU.js → kanban-definition-6JOO6SKY.Dl63eMUV.js} +1 -1
  37. package/dist/docs/assets/chunks/{layout.ljS-wFtK.js → layout.BLHZLWPH.js} +1 -1
  38. package/dist/docs/assets/chunks/{linear.jSxNrsFC.js → linear.aXKGKaNw.js} +1 -1
  39. package/dist/docs/assets/chunks/{min.Cum8AlQw.js → min.zWnFcpcc.js} +1 -1
  40. package/dist/docs/assets/chunks/{mindmap-definition-QFDTVHPH.BLiysLpe.js → mindmap-definition-QFDTVHPH.Qs4MQBea.js} +1 -1
  41. package/dist/docs/assets/chunks/{pieDiagram-DEJITSTG.BoIDyuKF.js → pieDiagram-DEJITSTG.BmPHgsk7.js} +1 -1
  42. package/dist/docs/assets/chunks/{quadrantDiagram-34T5L4WZ.DLkpDytR.js → quadrantDiagram-34T5L4WZ.D5MQ3gwA.js} +1 -1
  43. package/dist/docs/assets/chunks/{requirementDiagram-MS252O5E.DqTVqSu2.js → requirementDiagram-MS252O5E.CkdUFrO7.js} +1 -1
  44. package/dist/docs/assets/chunks/{sankeyDiagram-XADWPNL6.CG_6FF7j.js → sankeyDiagram-XADWPNL6.KZrljrAV.js} +1 -1
  45. package/dist/docs/assets/chunks/{sequenceDiagram-FGHM5R23.BIp9602K.js → sequenceDiagram-FGHM5R23.XMoEW-Lx.js} +1 -1
  46. package/dist/docs/assets/chunks/{stateDiagram-FHFEXIEX.COSXsD9I.js → stateDiagram-FHFEXIEX.BmTzePLj.js} +1 -1
  47. package/dist/docs/assets/chunks/stateDiagram-v2-QKLJ7IA2.Cu5X28zZ.js +1 -0
  48. package/dist/docs/assets/chunks/{theme.CXJ7PNwy.js → theme.BfQzpxsg.js} +2 -2
  49. package/dist/docs/assets/chunks/{timeline-definition-GMOUNBTQ.CXdVqkLq.js → timeline-definition-GMOUNBTQ.Dug0oamp.js} +1 -1
  50. package/dist/docs/assets/chunks/{vennDiagram-DHZGUBPP.CZxGuc4r.js → vennDiagram-DHZGUBPP.BOTHrEFu.js} +1 -1
  51. package/dist/docs/assets/chunks/{wardley-RL74JXVD.3oVgfqQk.js → wardley-RL74JXVD.DXy2i1LS.js} +1 -1
  52. package/dist/docs/assets/chunks/{wardleyDiagram-NUSXRM2D.6_irCgGJ.js → wardleyDiagram-NUSXRM2D.CoXKdfi6.js} +1 -1
  53. package/dist/docs/assets/chunks/{xychartDiagram-5P7HB3ND.TRPe92m3.js → xychartDiagram-5P7HB3ND.DXoSCjAW.js} +1 -1
  54. package/dist/docs/assets/{deployment.md.D2jQZuFx.js → deployment.md.D2YX7u_I.js} +1 -1
  55. package/dist/docs/assets/{guides_agent-to-agent.md.CD4T5FIl.js → guides_agent-to-agent.md.C6kPY8nu.js} +2 -2
  56. package/dist/docs/assets/{guides_cloud-agents.md.Cp1O3u-X.js → guides_cloud-agents.md.BPJqTZjT.js} +1 -1
  57. package/dist/docs/assets/{guides_grokbot-agents.md.CMhZNdEU.js → guides_grokbot-agents.md.CzV715v8.js} +1 -1
  58. package/dist/docs/assets/guides_hooks.md.BT9GLwEp.js +50 -0
  59. package/dist/docs/assets/guides_hooks.md.BT9GLwEp.lean.js +1 -0
  60. package/dist/docs/assets/{guides_jev.md.F5fAkkfN.js → guides_jev.md.DeSCqMaO.js} +6 -44
  61. package/dist/docs/assets/guides_jev.md.DeSCqMaO.lean.js +1 -0
  62. package/dist/docs/assets/reference_agent-config.md.BRxAlnRy.js +36 -0
  63. package/dist/docs/assets/{reference_agent-config.md.DGPyw7ms.lean.js → reference_agent-config.md.BRxAlnRy.lean.js} +1 -1
  64. package/dist/docs/assets/reference_artifacts.md.KRX0sAdt.js +18 -0
  65. package/dist/docs/assets/reference_artifacts.md.KRX0sAdt.lean.js +1 -0
  66. package/dist/docs/assets/reference_channels.md.DZr14vm7.js +23 -0
  67. package/dist/docs/assets/reference_channels.md.DZr14vm7.lean.js +1 -0
  68. package/dist/docs/assets/{reference_connections.md.Je9dMsdd.js → reference_connections.md.DJGUCxrr.js} +18 -30
  69. package/dist/docs/assets/{reference_connections.md.Je9dMsdd.lean.js → reference_connections.md.DJGUCxrr.lean.js} +1 -1
  70. package/dist/docs/assets/{reference_evals.md.DNJzM_yf.js → reference_evals.md.C6umwNC6.js} +6 -7
  71. package/dist/docs/assets/reference_evals.md.C6umwNC6.lean.js +1 -0
  72. package/dist/docs/assets/{reference_extensions.md.Cv5aLCz_.js → reference_extensions.md.DbNYu-DP.js} +3 -3
  73. package/dist/docs/assets/{reference_extensions.md.Cv5aLCz_.lean.js → reference_extensions.md.DbNYu-DP.lean.js} +1 -1
  74. package/dist/docs/assets/reference_hooks.md.BfOkhTU0.js +45 -0
  75. package/dist/docs/assets/{reference_hooks.md.B7uzNENk.lean.js → reference_hooks.md.BfOkhTU0.lean.js} +1 -1
  76. package/dist/docs/assets/reference_http-api.md.DdwtBeCj.js +11 -0
  77. package/dist/docs/assets/{reference_http-api.md.CduHavZ2.lean.js → reference_http-api.md.DdwtBeCj.lean.js} +1 -1
  78. package/dist/docs/assets/reference_instructions.md.B2mcIzT6.js +14 -0
  79. package/dist/docs/assets/reference_instructions.md.B2mcIzT6.lean.js +1 -0
  80. package/dist/docs/assets/reference_playground.md.CyrQD_n3.js +1 -0
  81. package/dist/docs/assets/reference_playground.md.CyrQD_n3.lean.js +1 -0
  82. package/dist/docs/assets/reference_project-layout.md.BEMzxAkq.js +19 -0
  83. package/dist/docs/assets/{reference_project-layout.md.BGhgpy9V.lean.js → reference_project-layout.md.BEMzxAkq.lean.js} +1 -1
  84. package/dist/docs/assets/reference_prompt.md.BFrqjHFL.js +9 -0
  85. package/dist/docs/assets/reference_prompt.md.BFrqjHFL.lean.js +1 -0
  86. package/dist/docs/assets/reference_schedules.md.BB9N3tRR.js +47 -0
  87. package/dist/docs/assets/reference_schedules.md.BB9N3tRR.lean.js +1 -0
  88. package/dist/docs/assets/reference_sessions.md.BBp-GIt-.js +1 -0
  89. package/dist/docs/assets/{reference_sessions.md.1_6Vyv7x.lean.js → reference_sessions.md.BBp-GIt-.lean.js} +1 -1
  90. package/dist/docs/assets/reference_skills.md.BVmi3UJ_.js +15 -0
  91. package/dist/docs/assets/{reference_skills.md.DjQkRefx.lean.js → reference_skills.md.BVmi3UJ_.lean.js} +1 -1
  92. package/dist/docs/assets/reference_subagents.md.DRoRy2Uj.js +10 -0
  93. package/dist/docs/assets/{reference_subagents.md.Dl16gcBj.lean.js → reference_subagents.md.DRoRy2Uj.lean.js} +1 -1
  94. package/dist/docs/assets/{reference_tools.md.B1dH1lpa.js → reference_tools.md.CgocLDX1.js} +9 -6
  95. package/dist/docs/assets/{reference_tools.md.B1dH1lpa.lean.js → reference_tools.md.CgocLDX1.lean.js} +1 -1
  96. package/dist/docs/assets/troubleshooting.md.HY95rCCz.js +1 -0
  97. package/dist/docs/building-with-agents.html +35 -35
  98. package/dist/docs/deployment.html +37 -37
  99. package/dist/docs/deployment.md +1 -1
  100. package/dist/docs/evals.html +35 -35
  101. package/dist/docs/guides/agent-to-agent.html +38 -38
  102. package/dist/docs/guides/agent-to-agent.md +11 -12
  103. package/dist/docs/guides/bitbucket.html +35 -35
  104. package/dist/docs/guides/cloud-agents.html +36 -36
  105. package/dist/docs/guides/cloud-agents.md +1 -1
  106. package/dist/docs/guides/convert-automation.html +35 -35
  107. package/dist/docs/guides/github.html +35 -35
  108. package/dist/docs/guides/gitlab.html +35 -35
  109. package/dist/docs/guides/grokbot-agents.html +37 -37
  110. package/dist/docs/guides/grokbot-agents.md +1 -1
  111. package/dist/docs/guides/hooks.html +109 -0
  112. package/dist/docs/guides/hooks.md +111 -0
  113. package/dist/docs/guides/improve.html +35 -35
  114. package/dist/docs/guides/jev.html +42 -80
  115. package/dist/docs/guides/jev.md +22 -79
  116. package/dist/docs/guides/mcp-oauth.html +36 -36
  117. package/dist/docs/guides/opentelemetry.html +35 -35
  118. package/dist/docs/guides/slack.html +35 -35
  119. package/dist/docs/guides/webhooks.html +35 -35
  120. package/dist/docs/hashmap.json +1 -1
  121. package/dist/docs/hillclimbing.html +35 -35
  122. package/dist/docs/index.html +35 -35
  123. package/dist/docs/llms-full.txt +993 -1303
  124. package/dist/docs/llms.txt +8 -7
  125. package/dist/docs/quickstart.html +35 -35
  126. package/dist/docs/reference/agent-config.html +42 -46
  127. package/dist/docs/reference/agent-config.md +48 -81
  128. package/dist/docs/reference/artifacts.html +39 -40
  129. package/dist/docs/reference/artifacts.md +71 -70
  130. package/dist/docs/reference/channels.html +41 -61
  131. package/dist/docs/reference/channels.md +134 -201
  132. package/dist/docs/reference/cli.html +35 -35
  133. package/dist/docs/reference/connections.html +54 -66
  134. package/dist/docs/reference/connections.md +92 -128
  135. package/dist/docs/reference/evals.html +42 -43
  136. package/dist/docs/reference/evals.md +42 -50
  137. package/dist/docs/reference/extensions.html +38 -38
  138. package/dist/docs/reference/extensions.md +9 -13
  139. package/dist/docs/reference/hooks.html +39 -67
  140. package/dist/docs/reference/hooks.md +72 -146
  141. package/dist/docs/reference/http-api.html +39 -39
  142. package/dist/docs/reference/http-api.md +137 -161
  143. package/dist/docs/reference/instructions.html +39 -39
  144. package/dist/docs/reference/instructions.md +21 -36
  145. package/dist/docs/reference/playground.html +36 -36
  146. package/dist/docs/reference/playground.md +26 -43
  147. package/dist/docs/reference/project-layout.html +38 -38
  148. package/dist/docs/reference/project-layout.md +12 -17
  149. package/dist/docs/reference/prompt.html +42 -42
  150. package/dist/docs/reference/prompt.md +18 -13
  151. package/dist/docs/reference/schedules.html +56 -91
  152. package/dist/docs/reference/schedules.md +52 -99
  153. package/dist/docs/reference/sessions.html +36 -36
  154. package/dist/docs/reference/sessions.md +36 -40
  155. package/dist/docs/reference/skills.html +38 -38
  156. package/dist/docs/reference/skills.md +15 -26
  157. package/dist/docs/reference/subagents.html +38 -38
  158. package/dist/docs/reference/subagents.md +20 -30
  159. package/dist/docs/reference/tools.html +44 -41
  160. package/dist/docs/reference/tools.md +45 -64
  161. package/dist/docs/templates/agentic-owners.html +35 -35
  162. package/dist/docs/templates/pr-autofixer.html +35 -35
  163. package/dist/docs/templates/security-reviewer.html +35 -35
  164. package/dist/docs/templates/thermo-quality-review.html +35 -35
  165. package/dist/docs/templates/thermo-review.html +35 -35
  166. package/dist/docs/templates/triage.html +35 -35
  167. package/dist/docs/troubleshooting.html +36 -36
  168. package/dist/docs/troubleshooting.md +1 -1
  169. package/dist/playground/assets/{index-DSMAewbx.css → index-C61EWMBK.css} +1 -1
  170. package/dist/playground/index.html +2 -2
  171. package/docs/deployment.md +1 -1
  172. package/docs/guides/agent-to-agent.md +11 -12
  173. package/docs/guides/cloud-agents.md +1 -1
  174. package/docs/guides/grokbot-agents.md +1 -1
  175. package/docs/guides/hooks.md +116 -0
  176. package/docs/guides/jev.md +23 -80
  177. package/docs/reference/agent-config.md +48 -81
  178. package/docs/reference/artifacts.md +72 -71
  179. package/docs/reference/channels.md +135 -202
  180. package/docs/reference/connections.md +93 -129
  181. package/docs/reference/evals.md +43 -51
  182. package/docs/reference/extensions.md +9 -13
  183. package/docs/reference/hooks.md +72 -146
  184. package/docs/reference/http-api.md +137 -161
  185. package/docs/reference/instructions.md +22 -37
  186. package/docs/reference/playground.md +26 -43
  187. package/docs/reference/project-layout.md +12 -17
  188. package/docs/reference/prompt.md +20 -15
  189. package/docs/reference/schedules.md +52 -99
  190. package/docs/reference/sessions.md +36 -40
  191. package/docs/reference/skills.md +15 -26
  192. package/docs/reference/subagents.md +20 -30
  193. package/docs/reference/tools.md +45 -64
  194. package/docs/troubleshooting.md +1 -1
  195. package/package.json +1 -1
  196. package/dist/docs/assets/chunks/@localSearchIndexroot.Ck9E52Ls.js +0 -1
  197. package/dist/docs/assets/chunks/channel.BHiYmnZ4.js +0 -1
  198. package/dist/docs/assets/chunks/classDiagram-6PBFFD2Q.Degh8l90.js +0 -1
  199. package/dist/docs/assets/chunks/classDiagram-v2-HSJHXN6E.Degh8l90.js +0 -1
  200. package/dist/docs/assets/chunks/clone.BIywbczV.js +0 -1
  201. package/dist/docs/assets/chunks/stateDiagram-v2-QKLJ7IA2.qrxrbFsX.js +0 -1
  202. package/dist/docs/assets/guides_jev.md.F5fAkkfN.lean.js +0 -1
  203. package/dist/docs/assets/reference_agent-config.md.DGPyw7ms.js +0 -40
  204. package/dist/docs/assets/reference_artifacts.md.Bu_4HmsD.js +0 -19
  205. package/dist/docs/assets/reference_artifacts.md.Bu_4HmsD.lean.js +0 -1
  206. package/dist/docs/assets/reference_channels.md.nFWbzAic.js +0 -43
  207. package/dist/docs/assets/reference_channels.md.nFWbzAic.lean.js +0 -1
  208. package/dist/docs/assets/reference_evals.md.DNJzM_yf.lean.js +0 -1
  209. package/dist/docs/assets/reference_hooks.md.B7uzNENk.js +0 -73
  210. package/dist/docs/assets/reference_http-api.md.CduHavZ2.js +0 -11
  211. package/dist/docs/assets/reference_instructions.md.CU1My5My.js +0 -14
  212. package/dist/docs/assets/reference_instructions.md.CU1My5My.lean.js +0 -1
  213. package/dist/docs/assets/reference_playground.md.Ch2d0Iqi.js +0 -1
  214. package/dist/docs/assets/reference_playground.md.Ch2d0Iqi.lean.js +0 -1
  215. package/dist/docs/assets/reference_project-layout.md.BGhgpy9V.js +0 -19
  216. package/dist/docs/assets/reference_prompt.md.Ccp0R53H.js +0 -1
  217. package/dist/docs/assets/reference_prompt.md.Ccp0R53H.lean.js +0 -1
  218. package/dist/docs/assets/reference_schedules.md.B2Nm6FaD.js +0 -82
  219. package/dist/docs/assets/reference_schedules.md.B2Nm6FaD.lean.js +0 -1
  220. package/dist/docs/assets/reference_sessions.md.1_6Vyv7x.js +0 -1
  221. package/dist/docs/assets/reference_skills.md.DjQkRefx.js +0 -15
  222. package/dist/docs/assets/reference_subagents.md.Dl16gcBj.js +0 -10
  223. package/dist/docs/assets/troubleshooting.md.mnfFG2Em.js +0 -1
  224. /package/dist/docs/assets/{deployment.md.D2jQZuFx.lean.js → deployment.md.D2YX7u_I.lean.js} +0 -0
  225. /package/dist/docs/assets/{guides_agent-to-agent.md.CD4T5FIl.lean.js → guides_agent-to-agent.md.C6kPY8nu.lean.js} +0 -0
  226. /package/dist/docs/assets/{guides_cloud-agents.md.Cp1O3u-X.lean.js → guides_cloud-agents.md.BPJqTZjT.lean.js} +0 -0
  227. /package/dist/docs/assets/{guides_grokbot-agents.md.CMhZNdEU.lean.js → guides_grokbot-agents.md.CzV715v8.lean.js} +0 -0
  228. /package/dist/docs/assets/{troubleshooting.md.mnfFG2Em.lean.js → troubleshooting.md.HY95rCCz.lean.js} +0 -0
  229. /package/dist/playground/assets/{index-De_lpFxE.js → index-CrMWlgUU.js} +0 -0
@@ -1,17 +1,15 @@
1
1
  # Hooks
2
2
 
3
- A hook subscribes to the session event stream and runs a side effect
4
- after each event is recorded: an audit line, a metric, a copy of the
5
- transcript in your own store, or derived state for later turns. Hooks
6
- run in the serving process for every session of the agent, on local and
7
- cloud runtime turns alike.
8
-
9
- Hooks observe. They can't change the turn, the prompt, or the reply, and
10
- a handler that throws is logged and skipped. Treat the event as
11
- read-only; later subscribers see the same object. That makes hooks safe
12
- to add to a production agent, and the wrong tool for anything that must
13
- happen before the model runs or must fail a turn; see
14
- [When not to use a hook](#when-not-to-use-a-hook).
3
+ A hook subscribes to selected session events and can run a side effect
4
+ after each matching event is recorded: an audit line, a metric, a
5
+ transcript copy, or derived state. Hooks run for every session of the
6
+ agent, on local and cloud turns alike. They cannot change the turn, the
7
+ prompt, or the reply; a handler that throws is logged and skipped.
8
+
9
+ Treat the event as read-only. Later subscribers see the same object.
10
+ That makes hooks safe to add to a production agent, and the wrong
11
+ surface for anything that must run before the model or must fail a
12
+ turn; see [Hook boundaries](#hook-boundaries).
15
13
 
16
14
  `defineHook` is unrelated to
17
15
  [Cursor Agent hooks](https://cursor.com/docs/agent/hooks), the
@@ -60,95 +58,54 @@ later sessions to read. Delete the file to opt out.
60
58
  ## Events and payloads
61
59
 
62
60
  Keys are event types from the
63
- [event vocabulary](/docs/reference/sessions.md#which-events-can-i-stream), or `"*"`
61
+ [event vocabulary](/docs/reference/sessions.md#stream-events), or `"*"`
64
62
  for every event. A typed key narrows `event.data`; a `"*"` handler
65
63
  receives the union, so switch on `event.type`. Every event carries the
66
64
  stream envelope `{ type, index, sessionId, turnId?, at, data }`, with
67
- `turnId` set on turn-scoped events.
68
-
69
- The payloads hooks read most often:
65
+ `turnId` set on turn-scoped events. Skip `*.appended` deltas when you
66
+ want the final text; `message.completed` already has it.
70
67
 
71
68
  | Event | `event.data` |
72
69
  | ------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
73
70
  | `message.received` | `{ text }` |
74
71
  | `turn.completed` | `{ result?, usage?, cost? }`. `usage` has `inputTokens`, `outputTokens`, `cacheReadTokens`, `cacheWriteTokens`, and optional `reasoningTokens`. `cost` has `totalUsd` and the `model` it was priced against |
75
- | `turn.failed` | `{ message }` |
76
- | `actions.requested` | `{ calls: [{ callId, toolName, args? }] }`. A call with `parentCallId` belongs to a subagent |
77
- | `action.result` | `{ callId, toolName, output?, isError, stubbed? }`. `stubbed` means a dry-run session answered a write without running it |
72
+ | `turn.failed` | `{ message, status? }`. `status` is `"error"` or `"cancelled"` when present |
73
+ | `actions.requested` | `{ calls: [{ callId, toolName, args?, parentCallId? }], parentCallId? }`. `parentCallId` marks subagent work |
74
+ | `action.result` | `{ callId, toolName, output?, isError, stubbed?, parentCallId? }`. `stubbed` means a dry-run session answered a write without running it |
78
75
 
79
76
  The types are `SessionEvent`, `SessionEventType`, and `HookContext`,
80
77
  exported from `@cursor/july`.
81
78
 
82
79
  ## Handler context
83
80
 
84
- | Member | What it is |
85
- | --------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
86
- | `ctx.session` | Read-only session info: `id`, `channelId`, `mode` (`chat` or `task`), `purpose` (`live` or `eval`), `auth`, plus `title` and `sdkAgentId` when set |
87
- | `ctx.agent` | `{ name }` of the agent the event belongs to |
88
- | `ctx.channel` | `{ id, continuationToken }`. The token is `null` when the session can't take follow-ups |
89
- | `ctx.host.kv` | Durable JSON, shared by every session of the agent; the storage backend decides whether it survives a hosted replace. Prefix keys with `ctx.session.id` for per-session state |
90
- | `ctx.host.files` | Durable files, bound to this session. Pass `{ scope: "deployment" }` for agent-wide files |
91
- | `ctx.host.otel` | Counters, histograms, and tags, attributed to this session |
92
- | `ctx.host.mcp`, `ctx.host.github`, `ctx.host.slack` | The same shared clients tools get |
93
- | `ctx.host.reminders` | Per-session [reminders](/docs/reference/schedules.md), the same API tools get |
94
- | `ctx.artifacts` | Session-bound [artifacts](/docs/reference/artifacts.md) facade: `tag` fills in `sessionId` and `turnId` |
95
- | `ctx.stateRoot` | Absolute path of the local state root. It resets when a hosted deployment is replaced; keep derived state in `kv` or `files` |
96
-
97
- ## When hooks run
98
-
99
- A hook runs after the event is durably recorded. It never delays the
100
- model turn and never sees an event that wasn't recorded.
101
-
102
- Within one session, events dispatch in order, one at a time: the
103
- channel's `events` handlers first, then each hook in discovery order.
104
- Sessions don't wait on each other.
105
-
106
- Two consequences:
107
-
108
- - A slow handler holds up the next event's handlers for that session,
109
- not the model. Keep handlers short and queue anything slow.
110
- - Hooks fire for eval sessions too. Check
111
- `ctx.session.purpose === "eval"` before metering or paging.
112
-
113
- Each event reaches a hook at most once. A restart doesn't replay the log
114
- into hooks, so a mirror needs no dedupe, and the event log rather than
115
- the hook's copy is the source of truth.
116
-
117
- ## Hooks, channel events, or evals?
118
-
119
- All of them consume the same stream, for different jobs:
120
-
121
- | | Hooks | Channel `events` | Evals |
122
- | ------------------ | ----------------------------------------------- | ----------------------------------------------------------------- | --------------------------------- |
123
- | Scope | every session of the agent | sessions the channel owns | one test turn |
124
- | Job | observe: audit, metrics, mirrors, derived state | deliver: replies back to the channel's surface | assert: gates over the trajectory |
125
- | Context | `ctx.host`, `ctx.artifacts`, session info | `channel.state`, `setContinuationToken`, `ctx.host`, session info | the `t` assertion helpers |
126
- | Can affect the run | no | yes, it owns the surface | n/a |
127
- | Authored at | `agent/hooks/*.ts` | channel config | `evals/**/*.eval.ts` |
128
-
129
- ## When not to use a hook
130
-
131
- | You want to | Use instead |
132
- | ------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- |
133
- | Add context before the model runs | The channel's `send` message and `workspaceFiles`, `instructions.md`, skills, or `sandbox/workspace/` seed files |
134
- | Reply on Slack, comment on a PR, or post any other delivery | The channel's `events` map, or the Slack and GitHub packs |
135
- | Show PR progress (merge-box check, sticky banner) | `githubChannel({ progress: { commitStatus, banner } })`; see the [PR autofixer](/docs/templates/pr-autofixer.md) |
136
- | Block, approve, or rewrite a tool call | [`needsApproval`](/docs/reference/tools.md#gate-a-tool-on-human-approval) on the tool |
137
- | Act on the final assistant text, reject it for a same-turn repair, or fail a bad turn | `defineResult` |
138
- | Gate a change on behavior | [Evals](/docs/evals.md) |
139
-
140
- ## Patterns
141
-
142
- Usage metering is the [authoring example](#author-a-hook). Three more:
143
-
144
- ### Alert on failure
145
-
146
- `turn.failed` carries the message, and `ctx.session.id` points at the
147
- trace. Skip interrupted turns; those are preemptions, not failures. Read
148
- secrets inside the handler: hosted deployments bind them after the
149
- process starts, so a module-scope read stays empty. Give the call a
150
- timeout, since a stalled request holds up later handlers on that
151
- session.
81
+ | Member | What it is |
82
+ | --------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- |
83
+ | `ctx.session` | Read-only session info: `id`, `channelId`, `mode` (`chat` or `task`), `purpose` (`live` or `eval`), `auth`, plus `title` and `sdkAgentId` when set |
84
+ | `ctx.agent` | `{ name }` of the agent the event belongs to |
85
+ | `ctx.channel` | `{ id, continuationToken }`. The token is `null` when the session can't take follow-ups |
86
+ | `ctx.host.kv` | Durable JSON, shared by every session of the agent. Prefix keys with `ctx.session.id` for per-session state |
87
+ | `ctx.host.files` | Durable files, bound to this session. Pass `{ scope: "deployment" }` for agent-wide files |
88
+ | `ctx.host.otel` | Counters, histograms, and tags, attributed to this session |
89
+ | `ctx.host.mcp`, `ctx.host.github`, `ctx.host.slack` | The same shared clients tools get |
90
+ | `ctx.host.reminders` | Per-session [reminders](/docs/reference/schedules.md#reminders), the same API tools get |
91
+ | `ctx.artifacts` | Session-bound [artifacts](/docs/reference/artifacts.md) facade: `tag` fills in `sessionId` and `turnId` |
92
+ | `ctx.stateRoot` | Absolute path of the local state root. It resets when a hosted deployment is replaced; keep derived state in `kv` or `files` |
93
+
94
+ ## Hook dispatch
95
+
96
+ A hook runs after the event is recorded. It never delays the model and
97
+ never sees an event that wasn't recorded.
98
+
99
+ | Rule | What happens |
100
+ | --- | --- |
101
+ | Same session | Events dispatch one at a time |
102
+ | Eval sessions | The same stream fires; skip metering or paging when `ctx.session.purpose === "eval"` |
103
+ | Host restart | Recorded events are not replayed into hooks, so a mirror needs no dedupe |
104
+ | Slow handler | Holds the next event's handlers on that session, not the model. Keep handlers short and queue anything slow |
105
+
106
+ Read hosted secrets inside the handler, not at module scope. Give
107
+ outbound calls a timeout; a stalled request holds later handlers on that
108
+ session. Skip cancelled turns when paging; they record interrupted work.
152
109
 
153
110
  ```ts
154
111
  // agent/hooks/page-on-failure.ts
@@ -161,7 +118,7 @@ export default defineHook({
161
118
  if (
162
119
  pagerUrl === undefined ||
163
120
  ctx.session.purpose === "eval" ||
164
- event.data.message === "turn interrupted"
121
+ event.data.status === "cancelled"
165
122
  ) {
166
123
  return;
167
124
  }
@@ -181,78 +138,47 @@ export default defineHook({
181
138
  });
182
139
  ```
183
140
 
184
- ### Mirror the transcript
141
+ ## Hooks vs channels vs evals
185
142
 
186
- Subscribe to `"*"` and write one file per event, skipping the
187
- `*.appended` deltas: they arrive per token, and `message.completed`
188
- carries the final text. Session scope keeps transcripts apart without a
189
- session id in the path. The mirror holds reasoning text and raw tool
190
- arguments and outputs, so pick the store accordingly, and write to your
191
- own store instead when you need cross-session queries.
143
+ All three consume the same stream, for different jobs:
192
144
 
193
- ```ts
194
- // agent/hooks/mirror.ts
195
- import { defineHook } from "@cursor/july/hooks";
196
-
197
- export default defineHook({
198
- events: {
199
- async "*"(event, ctx) {
200
- if (event.type.endsWith(".appended")) {
201
- return;
202
- }
203
- const name = String(event.index).padStart(6, "0");
204
- await ctx.host.files.write(
205
- `transcript/${name}.json`,
206
- JSON.stringify(event)
207
- );
208
- },
209
- },
210
- });
211
- ```
212
-
213
- ### Keep derived state across a replace
214
-
215
- Write it to `ctx.host.kv` under a session-prefixed key; a tool reads it
216
- back with `ctx.host.kv.get`.
145
+ | | Hooks | Channel `events` | Evals |
146
+ | ------------------ | ----------------------------------------------- | ----------------------------------------------------------------- | --------------------------------- |
147
+ | Scope | every session of the agent | sessions the channel owns | one test turn |
148
+ | Job | observe: audit, metrics, mirrors, derived state | deliver: replies back to the channel's surface | assert: gates over the trajectory |
149
+ | Context | `ctx.host`, `ctx.artifacts`, session info | `channel.state`, `setContinuationToken`, `ctx.host`, session info | the `t` assertion helpers |
150
+ | Can affect the run | no | yes, it owns the surface | n/a |
151
+ | Authored at | `agent/hooks/*.ts` | channel config | `evals/**/*.eval.ts` |
217
152
 
218
- ```ts
219
- // agent/hooks/last-result.ts
220
- import { defineHook } from "@cursor/july/hooks";
153
+ ## Hook boundaries
221
154
 
222
- export default defineHook({
223
- events: {
224
- async "turn.completed"(event, ctx) {
225
- await ctx.host.kv.put(`last-result/${ctx.session.id}`, {
226
- at: event.at,
227
- result: event.data.result ?? null,
228
- });
229
- },
230
- },
231
- });
232
- ```
155
+ | You want to | Use instead |
156
+ | ------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- |
157
+ | Add context before the model runs | The channel's `send` message and `workspaceFiles`, `instructions.md`, skills, or `sandbox/workspace/` seed files |
158
+ | Reply on Slack, comment on a PR, or post any other delivery | The channel's `events` map, or the Slack and GitHub packs |
159
+ | Show PR progress (merge-box check, sticky banner) | `githubChannel({ progress: { commitStatus, banner } })`; see the [PR autofixer](/docs/templates/pr-autofixer.md) |
160
+ | Block, approve, or rewrite a tool call | [`needsApproval`](/docs/reference/tools.md#gate-a-tool-on-human-approval) on the tool |
161
+ | Act on the final assistant text, reject it for a same-turn repair, or fail a bad turn | `defineResult` |
162
+ | Gate a change on behavior | [Evals](/docs/evals.md) |
233
163
 
234
- ## Test and debug a hook
164
+ ## Test a hook
235
165
 
236
166
  A hook definition is a plain object, so a unit test calls
237
167
  `hook.events["turn.completed"]` directly with an event and a stub
238
168
  `HookContext`. Discovery skips `*.test.ts`, so the test can live next to
239
169
  the hook.
240
170
 
241
- At runtime:
242
-
243
- - `agent-sdk validate --dir .` reports discovery errors and the
244
- empty-handlers warning.
245
- - `agent-sdk info --dir . --json` lists the loaded hooks under
246
- `agents[].hooks`.
247
- - Send a turn with `agent-sdk dev` or `agent-sdk run --dir . --message "…"`
248
- and watch the serve log for
249
- `hook "<name>" handler for <event> threw: …`. `run` prints that log on
250
- stderr. On hosting, read it with [`agent-sdk logs`](/docs/reference/cli.md#logs).
171
+ | Command | What it reports |
172
+ | --- | --- |
173
+ | `agent-sdk validate --dir .` | Discovery errors and the empty-handlers warning |
174
+ | `agent-sdk info --dir . --json` | Loaded hooks under `agents[].hooks` |
175
+ | `agent-sdk run --dir . --message "…"` | Serve log on stderr, including `hook "<name>" handler for <event> threw: …` |
251
176
 
252
- ## What's next
177
+ On hosting, read the same log with [`agent-sdk logs`](/docs/reference/cli.md#logs).
253
178
 
254
- Continue with these pages:
179
+ ## Related
255
180
 
181
+ - [Hooks guide](/docs/guides/hooks.md): meter usage and page on failure
256
182
  - [Sessions and streaming](/docs/reference/sessions.md): the event vocabulary hooks observe
257
183
  - [OpenTelemetry](/docs/guides/opentelemetry.md): OTLP traces and metrics
258
184
  from the same event stream