@cursor/july 0.1.95 → 0.1.97

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 (424) hide show
  1. package/AGENTS.md +3 -4
  2. package/README.md +3 -2
  3. package/dist/bin/agent-serve.js +14 -3
  4. package/dist/channels/deployments/types.d.ts +1 -1
  5. package/dist/channels/deployments/types.d.ts.map +1 -1
  6. package/dist/channels/deployments/types.js +1 -0
  7. package/dist/channels/origin/api.d.ts +72 -15
  8. package/dist/channels/origin/api.d.ts.map +1 -1
  9. package/dist/channels/origin/api.js +185 -28
  10. package/dist/channels/origin/binding.d.ts +13 -2
  11. package/dist/channels/origin/binding.d.ts.map +1 -1
  12. package/dist/channels/origin/binding.js +41 -25
  13. package/dist/channels/origin/checks.d.ts +6 -6
  14. package/dist/channels/origin/checks.js +6 -6
  15. package/dist/channels/origin/cursor-account.d.ts +5 -3
  16. package/dist/channels/origin/cursor-account.d.ts.map +1 -1
  17. package/dist/channels/origin/cursor-account.js +5 -3
  18. package/dist/channels/origin/index.d.ts +1 -0
  19. package/dist/channels/origin/index.d.ts.map +1 -1
  20. package/dist/channels/origin/index.js +1 -0
  21. package/dist/channels/origin/origin-channel.d.ts.map +1 -1
  22. package/dist/channels/origin/origin-channel.js +3 -0
  23. package/dist/channels/origin/reactions.d.ts +56 -0
  24. package/dist/channels/origin/reactions.d.ts.map +1 -0
  25. package/dist/channels/origin/reactions.js +67 -0
  26. package/dist/channels/origin/types.d.ts +11 -0
  27. package/dist/channels/origin/types.d.ts.map +1 -1
  28. package/dist/channels/slack/api.d.ts +9 -0
  29. package/dist/channels/slack/api.d.ts.map +1 -1
  30. package/dist/channels/slack/api.js +36 -5
  31. package/dist/channels/slack/approvals.d.ts +16 -0
  32. package/dist/channels/slack/approvals.d.ts.map +1 -1
  33. package/dist/channels/slack/approvals.js +86 -0
  34. package/dist/channels/slack/cli-project.d.ts +19 -0
  35. package/dist/channels/slack/cli-project.d.ts.map +1 -0
  36. package/dist/channels/slack/cli-project.js +234 -0
  37. package/dist/channels/slack/defaults.d.ts.map +1 -1
  38. package/dist/channels/slack/defaults.js +110 -81
  39. package/dist/channels/slack/dispatch.d.ts +7 -1
  40. package/dist/channels/slack/dispatch.d.ts.map +1 -1
  41. package/dist/channels/slack/dispatch.js +47 -23
  42. package/dist/channels/slack/inbound.d.ts +8 -0
  43. package/dist/channels/slack/inbound.d.ts.map +1 -1
  44. package/dist/channels/slack/inbound.js +32 -0
  45. package/dist/channels/slack/init.d.ts +3 -2
  46. package/dist/channels/slack/init.d.ts.map +1 -1
  47. package/dist/channels/slack/init.js +5 -5
  48. package/dist/channels/slack/interactive.d.ts +2 -1
  49. package/dist/channels/slack/interactive.d.ts.map +1 -1
  50. package/dist/channels/slack/interactive.js +15 -4
  51. package/dist/channels/slack/live-delivery.d.ts +26 -29
  52. package/dist/channels/slack/live-delivery.d.ts.map +1 -1
  53. package/dist/channels/slack/live-delivery.js +172 -73
  54. package/dist/channels/slack/manifest.d.ts +1 -1
  55. package/dist/channels/slack/manifest.d.ts.map +1 -1
  56. package/dist/channels/slack/manifest.js +6 -2
  57. package/dist/channels/slack/nudge-carrier.d.ts +2 -0
  58. package/dist/channels/slack/nudge-carrier.d.ts.map +1 -1
  59. package/dist/channels/slack/nudge-carrier.js +48 -1
  60. package/dist/channels/slack/setup.d.ts +1 -1
  61. package/dist/channels/slack/setup.d.ts.map +1 -1
  62. package/dist/channels/slack/setup.js +10 -6
  63. package/dist/channels/slack/slack-channel.d.ts.map +1 -1
  64. package/dist/channels/slack/slack-channel.js +3 -2
  65. package/dist/channels/slack/tool-approval-events.d.ts.map +1 -1
  66. package/dist/channels/slack/tool-approval-events.js +91 -1
  67. package/dist/docs/404.html +2 -2
  68. package/dist/docs/ab.html +4 -4
  69. package/dist/docs/assets/{app.BBj0klBO.js → app.B3rWNYE1.js} +1 -1
  70. package/dist/docs/assets/chunks/@localSearchIndexroot.BU9nHdnQ.js +1 -0
  71. package/dist/docs/assets/chunks/{VPLocalSearchBox.CUEXpL78.js → VPLocalSearchBox.C1lhqJJR.js} +1 -1
  72. package/dist/docs/assets/chunks/{theme.DabmQnia.js → theme.B40_SXuv.js} +2 -2
  73. package/dist/docs/assets/{deployment.md.D9msOFOW.js → deployment.md.MFPKqsqI.js} +2 -2
  74. package/dist/docs/assets/{guides_mcp-oauth.md.DPYmBCbV.js → guides_mcp-oauth.md.CN-6YmTJ.js} +4 -4
  75. package/dist/docs/assets/{guides_mcp-oauth.md.DPYmBCbV.lean.js → guides_mcp-oauth.md.CN-6YmTJ.lean.js} +1 -1
  76. package/dist/docs/assets/guides_slack.md.VDXQV3ja.js +22 -0
  77. package/dist/docs/assets/guides_slack.md.VDXQV3ja.lean.js +1 -0
  78. package/dist/docs/assets/index.md.CVeRUOeZ.js +5 -0
  79. package/dist/docs/assets/{index.md.BoHaMdeZ.lean.js → index.md.CVeRUOeZ.lean.js} +1 -1
  80. package/dist/docs/assets/{reference_agent-config.md.Cp_x38Nl.js → reference_agent-config.md.BHeYMgme.js} +1 -1
  81. package/dist/docs/assets/{reference_cli.md.BsMOxDvh.js → reference_cli.md.RyZf5OTE.js} +10 -6
  82. package/dist/docs/assets/{reference_cli.md.BsMOxDvh.lean.js → reference_cli.md.RyZf5OTE.lean.js} +1 -1
  83. package/dist/docs/assets/{reference_connections.md.BH8Oc0D0.js → reference_connections.md.DxldvyIB.js} +4 -3
  84. package/dist/docs/assets/{reference_http-api.md.D89k1mdm.js → reference_http-api.md.5zOAbV86.js} +1 -1
  85. package/dist/docs/assets/reference_sessions.md.NxFP_CAC.js +1 -0
  86. package/dist/docs/assets/{reference_tools.md.BHeXn2id.js → reference_tools.md.B84gw9Ii.js} +1 -1
  87. package/dist/docs/assets/templates_agents-md.md.CXSMZljE.js +2 -0
  88. package/dist/docs/assets/templates_agents-md.md.CXSMZljE.lean.js +1 -0
  89. package/dist/docs/assets/templates_code-wiki.md.CDYZIBFN.js +2 -0
  90. package/dist/docs/assets/templates_code-wiki.md.CDYZIBFN.lean.js +1 -0
  91. package/dist/docs/assets/troubleshooting.md.DCiPBhYs.js +1 -0
  92. package/dist/docs/building-with-agents.html +4 -4
  93. package/dist/docs/concepts.html +4 -4
  94. package/dist/docs/deployment.html +7 -7
  95. package/dist/docs/deployment.md +5 -4
  96. package/dist/docs/evals.html +4 -4
  97. package/dist/docs/guides/agent-to-agent.html +4 -4
  98. package/dist/docs/guides/cloud-runtime.html +4 -4
  99. package/dist/docs/guides/convert-automation.html +4 -4
  100. package/dist/docs/guides/github.html +4 -4
  101. package/dist/docs/guides/human-in-the-loop.html +4 -4
  102. package/dist/docs/guides/mcp-oauth.html +8 -8
  103. package/dist/docs/guides/mcp-oauth.md +26 -8
  104. package/dist/docs/guides/opentelemetry.html +4 -4
  105. package/dist/docs/guides/slack.html +17 -33
  106. package/dist/docs/guides/slack.md +92 -201
  107. package/dist/docs/guides/webhooks.html +4 -4
  108. package/dist/docs/hashmap.json +1 -1
  109. package/dist/docs/hillclimbing.html +4 -4
  110. package/dist/docs/index.html +6 -6
  111. package/dist/docs/index.md +7 -3
  112. package/dist/docs/llms-full.txt +398 -653
  113. package/dist/docs/llms.txt +3 -2
  114. package/dist/docs/quickstart.html +4 -4
  115. package/dist/docs/reference/agent-config.html +6 -6
  116. package/dist/docs/reference/agent-config.md +2 -2
  117. package/dist/docs/reference/artifacts.html +4 -4
  118. package/dist/docs/reference/channels.html +4 -4
  119. package/dist/docs/reference/cli.html +14 -10
  120. package/dist/docs/reference/cli.md +39 -16
  121. package/dist/docs/reference/connections.html +9 -8
  122. package/dist/docs/reference/connections.md +6 -3
  123. package/dist/docs/reference/hooks.html +4 -4
  124. package/dist/docs/reference/http-api.html +6 -6
  125. package/dist/docs/reference/http-api.md +2 -1
  126. package/dist/docs/reference/instructions.html +4 -4
  127. package/dist/docs/reference/playground.html +4 -4
  128. package/dist/docs/reference/project-layout.html +4 -4
  129. package/dist/docs/reference/prompt.html +4 -4
  130. package/dist/docs/reference/schedules.html +4 -4
  131. package/dist/docs/reference/sessions.html +5 -5
  132. package/dist/docs/reference/sessions.md +4 -2
  133. package/dist/docs/reference/skills.html +4 -4
  134. package/dist/docs/reference/subagents.html +4 -4
  135. package/dist/docs/reference/tools.html +6 -6
  136. package/dist/docs/reference/tools.md +9 -2
  137. package/dist/docs/scaffolding-agents.html +4 -4
  138. package/dist/docs/storage.html +4 -4
  139. package/dist/docs/templates/agentic-owners.html +4 -4
  140. package/dist/docs/templates/agents-md.html +28 -0
  141. package/dist/docs/templates/agents-md.md +105 -0
  142. package/dist/docs/templates/code-wiki.html +28 -0
  143. package/dist/docs/templates/code-wiki.md +91 -0
  144. package/dist/docs/templates/demo.html +5 -5
  145. package/dist/docs/templates/pr-autofixer.html +4 -4
  146. package/dist/docs/templates/security-help.html +4 -4
  147. package/dist/docs/templates/security-reviewer.html +5 -5
  148. package/dist/docs/templates/triage.html +4 -4
  149. package/dist/docs/troubleshooting.html +5 -5
  150. package/dist/docs/troubleshooting.md +2 -2
  151. package/dist/evals/run-facts.d.ts.map +1 -1
  152. package/dist/evals/run-facts.js +27 -0
  153. package/dist/files-backends/cursor-hosted.d.ts +26 -4
  154. package/dist/files-backends/cursor-hosted.d.ts.map +1 -1
  155. package/dist/files-backends/cursor-hosted.js +32 -4
  156. package/dist/internal/advertise-tools.d.ts +2 -0
  157. package/dist/internal/advertise-tools.d.ts.map +1 -1
  158. package/dist/internal/advertise-tools.js +30 -10
  159. package/dist/internal/approval-gate.d.ts +12 -13
  160. package/dist/internal/approval-gate.d.ts.map +1 -1
  161. package/dist/internal/approval-gate.js +16 -21
  162. package/dist/internal/bounded.d.ts +7 -0
  163. package/dist/internal/bounded.d.ts.map +1 -0
  164. package/dist/internal/bounded.js +32 -0
  165. package/dist/internal/chat-client.js +10 -0
  166. package/dist/internal/cli-deploy.d.ts +5 -0
  167. package/dist/internal/cli-deploy.d.ts.map +1 -1
  168. package/dist/internal/cli-deploy.js +57 -18
  169. package/dist/internal/cli-mcp-oauth.js +8 -18
  170. package/dist/internal/cli-slack-manual.d.ts +24 -2
  171. package/dist/internal/cli-slack-manual.d.ts.map +1 -1
  172. package/dist/internal/cli-slack-manual.js +251 -20
  173. package/dist/internal/cli-slack.d.ts +9 -2
  174. package/dist/internal/cli-slack.d.ts.map +1 -1
  175. package/dist/internal/cli-slack.js +29 -82
  176. package/dist/internal/conversation-mirror.d.ts +11 -8
  177. package/dist/internal/conversation-mirror.d.ts.map +1 -1
  178. package/dist/internal/conversation-mirror.js +116 -55
  179. package/dist/internal/cursor/account-mcp.d.ts +1 -0
  180. package/dist/internal/cursor/account-mcp.d.ts.map +1 -1
  181. package/dist/internal/cursor/account-mcp.js +17 -0
  182. package/dist/internal/cursor/backend-client.d.ts.map +1 -1
  183. package/dist/internal/cursor/backend-client.js +22 -48
  184. package/dist/internal/cursor/session-token.d.ts +45 -0
  185. package/dist/internal/cursor/session-token.d.ts.map +1 -0
  186. package/dist/internal/cursor/session-token.js +99 -0
  187. package/dist/internal/cursor-agent-template.d.ts +1 -1
  188. package/dist/internal/cursor-agent-template.d.ts.map +1 -1
  189. package/dist/internal/cursor-agent-template.js +2 -0
  190. package/dist/internal/deploy-client.d.ts +17 -0
  191. package/dist/internal/deploy-client.d.ts.map +1 -1
  192. package/dist/internal/deploy-client.js +31 -10
  193. package/dist/internal/env-file.d.ts +19 -0
  194. package/dist/internal/env-file.d.ts.map +1 -0
  195. package/dist/internal/env-file.js +90 -0
  196. package/dist/internal/framework-file-storage.d.ts +61 -0
  197. package/dist/internal/framework-file-storage.d.ts.map +1 -0
  198. package/dist/internal/framework-file-storage.js +210 -0
  199. package/dist/internal/framework-storage-selection.d.ts +11 -5
  200. package/dist/internal/framework-storage-selection.d.ts.map +1 -1
  201. package/dist/internal/framework-storage-selection.js +38 -11
  202. package/dist/internal/hosted-delivery-protocol.d.ts +7 -0
  203. package/dist/internal/hosted-delivery-protocol.d.ts.map +1 -1
  204. package/dist/internal/hosted-delivery-protocol.js +7 -0
  205. package/dist/internal/hosted-delivery.d.ts +13 -0
  206. package/dist/internal/hosted-delivery.d.ts.map +1 -1
  207. package/dist/internal/hosted-delivery.js +64 -19
  208. package/dist/internal/hosted-execution-diag.d.ts +48 -0
  209. package/dist/internal/hosted-execution-diag.d.ts.map +1 -0
  210. package/dist/internal/hosted-execution-diag.js +150 -0
  211. package/dist/internal/http-channel.d.ts.map +1 -1
  212. package/dist/internal/http-channel.js +81 -1
  213. package/dist/internal/init-project.d.ts.map +1 -1
  214. package/dist/internal/init-project.js +4 -0
  215. package/dist/internal/install-cursor-skills.d.ts.map +1 -1
  216. package/dist/internal/install-cursor-skills.js +1 -3
  217. package/dist/internal/logs-client.d.ts +5 -0
  218. package/dist/internal/logs-client.d.ts.map +1 -1
  219. package/dist/internal/logs-client.js +5 -0
  220. package/dist/internal/managed-delivery.d.ts +80 -0
  221. package/dist/internal/managed-delivery.d.ts.map +1 -0
  222. package/dist/internal/managed-delivery.js +86 -0
  223. package/dist/internal/mcp-endpoint.js +2 -3
  224. package/dist/internal/mcp-host.d.ts +10 -0
  225. package/dist/internal/mcp-host.d.ts.map +1 -1
  226. package/dist/internal/mcp-host.js +57 -8
  227. package/dist/internal/mcp-oauth-on-demand.d.ts +68 -0
  228. package/dist/internal/mcp-oauth-on-demand.d.ts.map +1 -0
  229. package/dist/internal/mcp-oauth-on-demand.js +287 -0
  230. package/dist/internal/mcp-oauth-persist.d.ts +42 -0
  231. package/dist/internal/mcp-oauth-persist.d.ts.map +1 -0
  232. package/dist/internal/mcp-oauth-persist.js +92 -0
  233. package/dist/internal/mcp-oauth.d.ts +1 -0
  234. package/dist/internal/mcp-oauth.d.ts.map +1 -1
  235. package/dist/internal/mcp-oauth.js +10 -2
  236. package/dist/internal/otel/collector.d.ts.map +1 -1
  237. package/dist/internal/otel/collector.js +22 -9
  238. package/dist/internal/runtime-dispatch-runner.d.ts +5 -1
  239. package/dist/internal/runtime-dispatch-runner.d.ts.map +1 -1
  240. package/dist/internal/runtime-dispatch-runner.js +7 -0
  241. package/dist/internal/sdk-runner.d.ts +11 -0
  242. package/dist/internal/sdk-runner.d.ts.map +1 -1
  243. package/dist/internal/sdk-runner.js +39 -8
  244. package/dist/internal/server.d.ts +3 -0
  245. package/dist/internal/server.d.ts.map +1 -1
  246. package/dist/internal/server.js +49 -21
  247. package/dist/internal/session-engine.d.ts +101 -3
  248. package/dist/internal/session-engine.d.ts.map +1 -1
  249. package/dist/internal/session-engine.js +577 -46
  250. package/dist/internal/sessions-client.d.ts +9 -7
  251. package/dist/internal/sessions-client.d.ts.map +1 -1
  252. package/dist/internal/sessions-client.js +3 -1
  253. package/dist/internal/steering.d.ts +15 -0
  254. package/dist/internal/steering.d.ts.map +1 -0
  255. package/dist/internal/steering.js +18 -0
  256. package/dist/internal/storage-coordinator.d.ts +7 -0
  257. package/dist/internal/storage-coordinator.d.ts.map +1 -1
  258. package/dist/internal/storage-coordinator.js +28 -5
  259. package/dist/internal/storage-roles.d.ts +5 -0
  260. package/dist/internal/storage-roles.d.ts.map +1 -1
  261. package/dist/internal/stream-progress.d.ts.map +1 -1
  262. package/dist/internal/stream-progress.js +10 -0
  263. package/dist/internal/tool-policy.d.ts +9 -1
  264. package/dist/internal/tool-policy.d.ts.map +1 -1
  265. package/dist/internal/tool-policy.js +13 -0
  266. package/dist/internal/trajectory.d.ts.map +1 -1
  267. package/dist/internal/trajectory.js +10 -0
  268. package/dist/internal/turn-outbox.d.ts +24 -0
  269. package/dist/internal/turn-outbox.d.ts.map +1 -0
  270. package/dist/internal/turn-outbox.js +80 -0
  271. package/dist/playground/assets/{index-CZA1uEWA.js → index-DrkI6y5O.js} +51 -51
  272. package/dist/playground/assets/index-DzNGwm7q.css +1 -0
  273. package/dist/playground/index.html +2 -2
  274. package/dist/storage-backends/cursor-hosted.d.ts +9 -6
  275. package/dist/storage-backends/cursor-hosted.d.ts.map +1 -1
  276. package/dist/storage-backends/cursor-hosted.js +16 -3
  277. package/dist/storage.d.ts +8 -0
  278. package/dist/storage.d.ts.map +1 -1
  279. package/dist/types.d.ts +65 -8
  280. package/dist/types.d.ts.map +1 -1
  281. package/docs/README.md +7 -3
  282. package/docs/deployment.md +5 -4
  283. package/docs/guides/mcp-oauth.md +26 -8
  284. package/docs/guides/slack.md +93 -202
  285. package/docs/reference/agent-config.md +2 -2
  286. package/docs/reference/cli.md +39 -16
  287. package/docs/reference/connections.md +6 -3
  288. package/docs/reference/http-api.md +2 -1
  289. package/docs/reference/sessions.md +4 -2
  290. package/docs/reference/tools.md +9 -2
  291. package/docs/templates/agents-md.md +110 -0
  292. package/docs/templates/code-wiki.md +96 -0
  293. package/docs/troubleshooting.md +2 -2
  294. package/package.json +2 -2
  295. package/skills/ab/SKILL.md +13 -97
  296. package/skills/create-agent/SKILL.md +124 -223
  297. package/skills/debug/SKILL.md +34 -68
  298. package/skills/evals/SKILL.md +55 -180
  299. package/skills/framework-map/SKILL.md +83 -145
  300. package/skills/github/SKILL.md +53 -111
  301. package/skills/hillclimb/SKILL.md +40 -163
  302. package/skills/mcp-auth/SKILL.md +51 -107
  303. package/skills/otel/SKILL.md +22 -68
  304. package/skills/setup-slack/SKILL.md +91 -212
  305. package/src/bin/agent-serve.ts +13 -1
  306. package/src/channels/deployments/types.ts +1 -0
  307. package/src/channels/origin/api.ts +264 -33
  308. package/src/channels/origin/binding.ts +57 -28
  309. package/src/channels/origin/checks.ts +6 -6
  310. package/src/channels/origin/cursor-account.ts +5 -3
  311. package/src/channels/origin/index.ts +1 -0
  312. package/src/channels/origin/origin-channel.ts +4 -0
  313. package/src/channels/origin/reactions.ts +82 -0
  314. package/src/channels/origin/types.ts +11 -0
  315. package/src/channels/slack/api.ts +41 -5
  316. package/src/channels/slack/approvals.ts +105 -0
  317. package/src/channels/slack/cli-project.ts +267 -0
  318. package/src/channels/slack/defaults.ts +122 -93
  319. package/src/channels/slack/dispatch.ts +56 -22
  320. package/src/channels/slack/inbound.ts +43 -0
  321. package/src/channels/slack/init.ts +10 -5
  322. package/src/channels/slack/interactive.ts +35 -9
  323. package/src/channels/slack/live-delivery.ts +235 -114
  324. package/src/channels/slack/manifest.ts +6 -2
  325. package/src/channels/slack/nudge-carrier.ts +48 -1
  326. package/src/channels/slack/setup.ts +10 -6
  327. package/src/channels/slack/slack-channel.ts +3 -0
  328. package/src/channels/slack/tool-approval-events.ts +93 -0
  329. package/src/evals/run-facts.ts +32 -0
  330. package/src/files-backends/cursor-hosted.ts +40 -7
  331. package/src/internal/advertise-tools.ts +49 -12
  332. package/src/internal/approval-gate.ts +20 -29
  333. package/src/internal/bounded.ts +28 -0
  334. package/src/internal/chat-client.ts +19 -0
  335. package/src/internal/cli-deploy.ts +91 -9
  336. package/src/internal/cli-mcp-oauth.ts +7 -21
  337. package/src/internal/cli-slack-manual.ts +350 -18
  338. package/src/internal/cli-slack.ts +40 -84
  339. package/src/internal/conversation-mirror.ts +145 -69
  340. package/src/internal/cursor/account-mcp.ts +21 -0
  341. package/src/internal/cursor/backend-client.ts +34 -58
  342. package/src/internal/cursor/session-token.ts +115 -0
  343. package/src/internal/cursor-agent-template.ts +2 -0
  344. package/src/internal/deploy-client.ts +43 -0
  345. package/src/internal/env-file.ts +84 -0
  346. package/src/internal/framework-file-storage.ts +228 -0
  347. package/src/internal/framework-storage-selection.ts +51 -11
  348. package/src/internal/hosted-delivery-protocol.ts +7 -0
  349. package/src/internal/hosted-delivery.ts +107 -24
  350. package/src/internal/hosted-execution-diag.ts +207 -0
  351. package/src/internal/http-channel.ts +99 -0
  352. package/src/internal/init-project.ts +4 -0
  353. package/src/internal/install-cursor-skills.ts +1 -4
  354. package/src/internal/logs-client.ts +5 -0
  355. package/src/internal/managed-delivery.ts +125 -0
  356. package/src/internal/mcp-endpoint.ts +13 -4
  357. package/src/internal/mcp-host.ts +77 -11
  358. package/src/internal/mcp-oauth-on-demand.ts +352 -0
  359. package/src/internal/mcp-oauth-persist.ts +127 -0
  360. package/src/internal/mcp-oauth.ts +17 -1
  361. package/src/internal/otel/collector.ts +30 -0
  362. package/src/internal/runtime-dispatch-runner.ts +10 -0
  363. package/src/internal/sdk-runner.ts +56 -8
  364. package/src/internal/server.ts +61 -9
  365. package/src/internal/session-engine.ts +723 -60
  366. package/src/internal/sessions-client.ts +17 -8
  367. package/src/internal/steering.ts +17 -0
  368. package/src/internal/storage-coordinator.ts +38 -8
  369. package/src/internal/storage-roles.ts +7 -0
  370. package/src/internal/stream-progress.ts +19 -0
  371. package/src/internal/tool-policy.ts +18 -0
  372. package/src/internal/trajectory.ts +10 -0
  373. package/src/internal/turn-outbox.ts +85 -0
  374. package/src/storage-backends/cursor-hosted.ts +22 -8
  375. package/src/storage.ts +12 -0
  376. package/src/types.ts +70 -9
  377. package/templates/agents-md/README.md +39 -0
  378. package/templates/agents-md/agent/agent.ts +8 -0
  379. package/templates/agents-md/agent/channels/github.ts +10 -0
  380. package/templates/agents-md/agent/channels/queue.ts +28 -0
  381. package/templates/agents-md/agent/channels/slack.ts +9 -0
  382. package/templates/agents-md/agent/instructions.md +39 -0
  383. package/templates/agents-md/agent/lib/collect.ts +439 -0
  384. package/templates/agents-md/agent/lib/config.ts +8 -0
  385. package/templates/agents-md/agent/lib/paths.ts +51 -0
  386. package/templates/agents-md/agent/schedules/weekly.ts +17 -0
  387. package/templates/agents-md/agent/tools/apply_agents.ts +226 -0
  388. package/templates/agents-md/evals/agents.eval.ts +135 -0
  389. package/templates/agents-md/evals/evals.config.ts +5 -0
  390. package/templates/agents-md/init.json +38 -0
  391. package/templates/agents-md/package.json +18 -0
  392. package/templates/agents-md/tsconfig.json +12 -0
  393. package/templates/code-wiki/README.md +34 -0
  394. package/templates/code-wiki/agent/agent.ts +8 -0
  395. package/templates/code-wiki/agent/channels/github.ts +144 -0
  396. package/templates/code-wiki/agent/instructions.md +39 -0
  397. package/templates/code-wiki/agent/lib/repos.ts +5 -0
  398. package/templates/code-wiki/agent/lib/wiki.ts +22 -0
  399. package/templates/code-wiki/agent/tools/apply_wiki.ts +219 -0
  400. package/templates/code-wiki/evals/evals.config.ts +5 -0
  401. package/templates/code-wiki/evals/wiki.eval.ts +132 -0
  402. package/templates/code-wiki/init.json +25 -0
  403. package/templates/code-wiki/package.json +18 -0
  404. package/templates/code-wiki/tsconfig.json +12 -0
  405. package/dist/docs/assets/chunks/@localSearchIndexroot.oqPawjiD.js +0 -1
  406. package/dist/docs/assets/guides_slack.md.C32HsdKk.js +0 -38
  407. package/dist/docs/assets/guides_slack.md.C32HsdKk.lean.js +0 -1
  408. package/dist/docs/assets/index.md.BoHaMdeZ.js +0 -5
  409. package/dist/docs/assets/reference_sessions.md.D0mIh4KK.js +0 -1
  410. package/dist/docs/assets/troubleshooting.md.Ctv3T8C2.js +0 -1
  411. package/dist/docs/design/agsh.md +0 -406
  412. package/dist/internal/deployment-scm-event-stream.d.ts +0 -116
  413. package/dist/internal/deployment-scm-event-stream.d.ts.map +0 -1
  414. package/dist/internal/deployment-scm-event-stream.js +0 -474
  415. package/dist/playground/assets/index-CF7hUDnQ.css +0 -1
  416. package/docs/design/agsh.md +0 -406
  417. package/src/internal/deployment-scm-event-stream.ts +0 -593
  418. /package/dist/docs/assets/{deployment.md.D9msOFOW.lean.js → deployment.md.MFPKqsqI.lean.js} +0 -0
  419. /package/dist/docs/assets/{reference_agent-config.md.Cp_x38Nl.lean.js → reference_agent-config.md.BHeYMgme.lean.js} +0 -0
  420. /package/dist/docs/assets/{reference_connections.md.BH8Oc0D0.lean.js → reference_connections.md.DxldvyIB.lean.js} +0 -0
  421. /package/dist/docs/assets/{reference_http-api.md.D89k1mdm.lean.js → reference_http-api.md.5zOAbV86.lean.js} +0 -0
  422. /package/dist/docs/assets/{reference_sessions.md.D0mIh4KK.lean.js → reference_sessions.md.NxFP_CAC.lean.js} +0 -0
  423. /package/dist/docs/assets/{reference_tools.md.BHeXn2id.lean.js → reference_tools.md.B84gw9Ii.lean.js} +0 -0
  424. /package/dist/docs/assets/{troubleshooting.md.Ctv3T8C2.lean.js → troubleshooting.md.DCiPBhYs.lean.js} +0 -0
@@ -693,9 +693,10 @@ use `UPPER_SNAKE_CASE`. Commit names only; set their values after
693
693
  creating the deployment. Names beginning with `CURSOR_` are reserved.
694
694
 
695
695
  For `defineConnection({ url, oauth: true })`, declare
696
- `MCP_OAUTH_<CONNECTION>_*` in `secretNames`, authorize with
697
- `agent-sdk mcp oauth <connection> --store`, then redeploy. See
698
- [Host MCP OAuth](/docs/guides/mcp-oauth.md).
696
+ `MCP_OAUTH_<CONNECTION>_*` in `secretNames`. Finish Connect for the
697
+ current process. Run `agent-sdk mcp oauth <connection> --store` and
698
+ redeploy so the next pod sees the secrets.
699
+ See [Host MCP OAuth](/docs/guides/mcp-oauth.md).
699
700
 
700
701
  Run `agent-sdk validate` before deploying. It reports invalid domains and
701
702
  secret names as warnings, so fix them even when validation exits zero.
@@ -943,7 +944,7 @@ A self-hosted server can read these credentials.
943
944
  | Slack tokens | Slack channels | `<PREFIX>_SLACK_BOT_TOKEN` + `<PREFIX>_SLACK_APP_TOKEN` per agent |
944
945
  | GitHub webhook secret | delivery signature verification | `GITHUB_WEBHOOK_SECRET`, same value on server and signer |
945
946
  | GitHub API | outbound API calls | a GitHub App (`GITHUB_APP_ID` + `GITHUB_APP_PRIVATE_KEY` + installation id) or `GITHUB_TOKEN` / `gh auth login` |
946
- | MCP connection tokens | authored MCP connections | env vars your `mcp-connections/*.ts` read, or host OAuth secrets from `agent-sdk mcp oauth <name> --store` (`MCP_OAUTH_*`; see [Host MCP OAuth](/docs/guides/mcp-oauth.md)) |
947
+ | MCP connection tokens | authored MCP connections | env vars your `mcp-connections/*.ts` read, or host OAuth secrets from hosted Connect / `agent-sdk mcp oauth <name> --store` (`MCP_OAUTH_*`; see [Host MCP OAuth](/docs/guides/mcp-oauth.md)) |
947
948
 
948
949
  Use a dedicated Cursor key per host. `agent-sdk whoami` shows the active
949
950
  credential. `logout` removes the stored key from the host; revoke the key
@@ -1087,417 +1088,6 @@ Continue with these pages:
1087
1088
 
1088
1089
  ---
1089
1090
 
1090
- Source: /docs/design/agsh.md
1091
-
1092
- # agsh: a shell for deployed agents
1093
-
1094
- ## What this is
1095
-
1096
- `agsh` (agent shell) is a standalone CLI that connects to one agent-sdk
1097
- deployment and turns the agent's live tool surface into commands. Every tool
1098
- the deployment can execute (authored server tools and tools provided by the
1099
- agent's MCP connections) becomes a subcommand with a synopsis derived from its
1100
- input schema, a man-page style `--help`, and a place in an interactive shell.
1101
-
1102
- It is a separate binary and a separate package from `agent-sdk`. The
1103
- `agent-sdk` CLI stays what it is today: the developer workflow tool for
1104
- authoring, validating, deploying, and debugging agent projects. `agsh` is the
1105
- operator's tool for working *inside* one deployed agent. The split also keeps
1106
- heavy presentation dependencies (markdown rendering, syntax highlighting, the
1107
- shell interpreter) out of `@cursor/july`, which ships to every agent project.
1108
-
1109
- ## The experience
1110
-
1111
- ```
1112
- $ agsh help # list of commands, man-page style
1113
- $ agsh read --help # man-page style: NAME, SYNOPSIS, DESCRIPTION, OPTIONS
1114
- $ agsh read /repo/README.md
1115
- $ agsh datadog_list_monitors --query "service:api"
1116
- $ agsh # bare: interactive shell on a TTY, script from stdin otherwise
1117
- ❯ ls /repo | grep -i readme
1118
- ❯ read /repo/config.json | jq .version
1119
- ```
1120
-
1121
- Every invocation binds to the deployment's latest session by default, with
1122
- `--session` and `--continuation-token` overrides, and prints the session
1123
- identifier as a final stderr line.
1124
-
1125
- ## Configuration
1126
-
1127
- `agsh` is a client only; it never boots an agent. Every invocation needs a
1128
- target deployment, given by flags or by environment variables. Flags always
1129
- win over the environment.
1130
-
1131
- Global command line options, accepted on every command and on the bare shell
1132
- launch:
1133
-
1134
- | Option | Environment default | Meaning |
1135
- | --- | --- | --- |
1136
- | `--target <url \| name>` | `AGENT_SHELL_TARGET` | The deployment to talk to: a URL is a local deployment (`http://127.0.0.1:39400/executor`), a name a production one (`change-monitor-executor`). |
1137
- | `--team <team>` | `AGENT_SHELL_TEAM` | Team override for production resolution, when the login spans several. |
1138
- | `--bearer-token <token>` | `AGENT_SHELL_BEARER_TOKEN` | Explicit bearer auth for a deployment that is not behind the Cursor login. |
1139
- | `--session <id>` | | Bind to a specific session instead of the latest. |
1140
- | `--continuation-token <token>` | | Bind by continuation token instead of session id. |
1141
- | `--output <text\|json>` | | Result rendering: human-friendly views (default) or raw JSON. |
1142
- | `-h`, `--help` | | Per-command help. |
1143
-
1144
- One parameter carries the whole target selection, and the value's shape
1145
- encodes the mode: a URL (`http://` or `https://`) targets a local
1146
- deployment, anything else names a production one. Two options with a
1147
- precedence rule would invite exactly the confusion a target selector must
1148
- not have; with one parameter the only rule is that the flag beats the
1149
- environment. A URL is self-contained down to the agent because one local
1150
- agent-sdk serve process hosts every agent of the project (change-monitor's
1151
- dev stack mounts `/executor` and `/planner` from a single port); a
1152
- production deployment is a single agent, so its name is the complete
1153
- address (`--team` narrows resolution when the login spans several).
1154
- Authentication defaults to the stored Cursor login (the same engine-access
1155
- credential agent-sdk uses); `--bearer-token` is the escape hatch for direct
1156
- deployments. Session flags are per invocation and have no environment
1157
- default: a session is state, not configuration. Color output follows the
1158
- `NO_COLOR` convention and TTY detection; there is no agsh-specific color
1159
- setting. No configuration file: one environment variable pins a working
1160
- target for a terminal session
1161
- (`AGENT_SHELL_TARGET=change-monitor-executor`, or a URL for a local stack),
1162
- which is the whole persistent-configuration need.
1163
-
1164
- With no target from flags or environment, every command fails with a message
1165
- naming both ways to provide one.
1166
-
1167
- ## Architecture
1168
-
1169
- ### A new package
1170
-
1171
- A new workspace package (working name `packages/agsh`, bin `agsh`) that
1172
- depends on `@cursor/july` for target resolution, stored Cursor login, and the
1173
- HTTP client plumbing. It owns the presentation stack: `marked` for terminal
1174
- markdown (moved out of `@cursor/july`), with syntax highlighting (`shiki`)
1175
- arriving in the phase that renders code; the shell interpreter is
1176
- purpose-built (see Rationale).
1177
- No new abstraction seam between the two packages; `agsh` imports what it
1178
- needs until a second consumer justifies extracting a thin client.
1179
-
1180
- ### The tool catalog
1181
-
1182
- At startup `agsh` fetches one live catalog of everything invocable on the
1183
- deployment. This is the piece the current `/v1/info` cannot provide: `/v1/info`
1184
- projects the authored manifest, and connection tools only exist at runtime,
1185
- resolved per session under the connection's auth. A new endpoint provides the
1186
- live view (see Backend changes).
1187
-
1188
- Catalog entries carry exactly one identifier each: the tool name exactly as
1189
- the agent sees it. Authored server tools keep their authored name (`read`).
1190
- Connection tools appear under their model-facing advertised name (the
1191
- sanitized passthrough name from `advertise-tools.ts`, e.g.
1192
- `datadog_list_monitors`). The CLI never invents a different naming format:
1193
- a tool name copied from a session transcript is a valid `agsh` command, and
1194
- vice versa. Where a tool came from — the upstream connector name when the
1195
- tool declares one, the connection name otherwise — is a field on the
1196
- catalog entry, not part of the identifier.
1197
-
1198
- ### Two command tiers
1199
-
1200
- Each catalog entry becomes a command, through one of two shapes:
1201
-
1202
- **Curated commands for builtin tools.** The well-known tool names (`ls`,
1203
- `read`, `grep`, `glob`, `diff`, ...) get hand-designed, POSIX-flavored
1204
- command shapes, hardcoded in `agsh` next to their titles. These tools are
1205
- what an operator types all day; their shapes should feel like the unix
1206
- commands they mirror, not like generated bindings. A curated shape decides
1207
- which schema fields are positional operands and which are flags, and every
1208
- input has exactly one spelling: an operand is only an operand, never also a
1209
- flag.
1210
-
1211
- ```
1212
- $ agsh read /repo/package.json --limit 2
1213
- {
1214
- "name": "change-monitor",
1215
- → ses_a99d1b69c329eb75a2ec8603
1216
-
1217
- $ agsh grep -i -A 2 toolEffect /repo/src
1218
- src/tool-policy.ts:12:export type ToolEffect = "read" | "write";
1219
- ...
1220
- → ses_a99d1b69c329eb75a2ec8603
1221
-
1222
- $ agsh ls /repo --ignore-globs '*.test.ts' --ignore-globs 'node_modules/**'
1223
- ```
1224
-
1225
- `read` takes its path as an operand mapped to the schema's `path` field, with
1226
- `--offset` and `--limit` as integer flags. `grep` follows POSIX grep:
1227
- `grep [options] <pattern> [path]`, with the rg-style options (`-i`, `-A`,
1228
- `-B`, `-C`, `--output-mode`, `--head-limit`) mapping onto the schema fields
1229
- of the same names (kebab-cased). `ls` shows array input: an array field's flag repeats once
1230
- per element. A curated shape binds to the deployment's live schema at
1231
- startup; when a deployment's tool lacks the expected field, the command
1232
- degrades to the generic shape below rather than guessing.
1233
-
1234
- A curated shape may also reformat the tool's text result toward the unix
1235
- command's own output conventions: the VFS ls tool returns the model-facing
1236
- tree (` - name/` rows under a header), and `agsh ls` prints it as standard
1237
- ls does, one name per line with the trailing slash kept on directories. The
1238
- tool's result string itself stays what the model sees; when a result does
1239
- not match the expected shape it prints verbatim.
1240
-
1241
- **Generated commands for MCP tools.** Connection tools are dynamically
1242
- discovered, so no special treatment is possible; they get a uniform
1243
- schema-derived mapping:
1244
-
1245
- - Every schema property is accepted as one flag, spelled as the
1246
- kebab-cased property name (`org_slug` → `--org-slug`) — the unix
1247
- convention; kebab collisions gain a numeric suffix. Properties already
1248
- shaped like flags (grep's `-i`) stay literal. No positionals, no other
1249
- aliases.
1250
- - Object-typed properties flatten recursively into one flag per leaf,
1251
- dash-joined (`--telemetry-context` for `telemetry.context`), so every
1252
- option reads as a plain value; a free-form object with no declared
1253
- properties stays one JSON-valued flag. A leaf is required only when its
1254
- whole ancestor chain is.
1255
- - Values are coerced by schema type: booleans are valueless flags, numbers
1256
- and integers are parsed, arrays accept the flag repeated once per element,
1257
- enums are validated before the call.
1258
-
1259
- ```
1260
- $ agsh datadog_list_monitors --query "service:api" --limit 10
1261
- ```
1262
-
1263
- In both tiers `-h`/`--help` and the global target and session flags are
1264
- reserved and injected, a flag that names no schema property fails before any
1265
- request (listing the tool's actual properties), and the bound session prints
1266
- as a final stderr line.
1267
-
1268
- ### Result rendering
1269
-
1270
- Raw JSON on a terminal is not an experience for people, so `--output=text`
1271
- (the default) renders structured results through a small set of views,
1272
- selected automatically by the shape of the value each call actually returned;
1273
- tool metadata plays no part, since most tools advertise no output schema, and
1274
- many return structured data as JSON text. A string result that parses as a
1275
- JSON object or array counts as structured. An array of objects renders as a
1276
- table (columns are the union of keys, missing cells stay blank, the table
1277
- clamps to the terminal width); a single object renders as a property view
1278
- (aligned keys, scalar lists as bullets, nested structures indented); an
1279
- object that is nothing but an error wrapper renders as an `Error:` line;
1280
- plain text prints verbatim. `--output=json` renders the structured value as
1281
- raw JSON. The rendering never depends on the TTY: piped and interactive
1282
- output carry the same content, only color follows TTY detection.
1283
-
1284
- ### Help rendering
1285
-
1286
- `--help` on a tool renders a man-page layout: NAME (the tool name, with the
1287
- tool's `title` beside it when the catalog carries one; titles are curated
1288
- data, never derived from the description), SYNOPSIS (operands from the
1289
- curated shape; options never enumerate — they summarize as `[options...]`,
1290
- man-page style, so the line stays bounded), DESCRIPTION (the tool
1291
- description rendered as terminal markdown), OPERANDS (positional arguments,
1292
- curated commands only), and OPTIONS. Descriptions of operands and options
1293
- come from the schema's property descriptions. Effect and approval metadata
1294
- render as notes when declared. Everything except the curated shape derives
1295
- from `GET /v1/tools/:name`; nothing else is hand-written per tool.
1296
-
1297
- ```
1298
- $ agsh read --help
1299
- NAME
1300
- read - Read a file
1301
-
1302
- SYNOPSIS
1303
- read [options...] <path>
1304
-
1305
- DESCRIPTION
1306
- Reads a file from the local filesystem. This tool can also read image
1307
- files when called with the appropriate path. Formats supported:
1308
- jpeg/jpg, png, gif, webp.
1309
-
1310
- OPERANDS
1311
- <path>
1312
- The absolute path of the file to read.
1313
-
1314
- OPTIONS
1315
- --offset <integer>
1316
- The line number to start reading from. Positive values are 1-indexed
1317
- from the start of the file. Negative values count backwards from the
1318
- end. Only provide if the file is too large to read at once.
1319
-
1320
- --limit <integer>
1321
- The number of lines to read. Only provide if the file is too large
1322
- to read at once.
1323
-
1324
- NOTES
1325
- Effect: read (performs no writes).
1326
- ```
1327
-
1328
- `agsh help` lists the available command names grouped by source, authored
1329
- tools first, then one group per upstream connector (its name is the group
1330
- header — one aggregating connection can host tools from several connectors,
1331
- and the connector name is what an operator recognizes). Each row is the
1332
- name, with the title beside it when the tool declares one; everything else
1333
- lives behind the command's `--help`:
1334
-
1335
- The agent's description renders as a DESCRIPTION section when the deployment
1336
- declares one (`/v1/info` carries both name and description).
1337
-
1338
- ```
1339
- $ agsh help
1340
- NAME
1341
- change-monitor-executor
1342
-
1343
- DESCRIPTION
1344
- Executes monitoring plans against changed code.
1345
-
1346
- COMMANDS
1347
- diff Show workspace changes
1348
- glob Find files by pattern
1349
- grep Search file contents
1350
- ls List a directory
1351
- read Read a file
1352
- report_change_issue
1353
- report_change_succeeded
1354
-
1355
- DATADOG
1356
- datadog_list_monitors List monitors
1357
- ...
1358
-
1359
- Run any command with --help for its synopsis and options.
1360
- ```
1361
-
1362
- ### Shell mode
1363
-
1364
- Invoked bare, `agsh` starts a shell. On a TTY this is a REPL; on a pipe it
1365
- reads a script from stdin, so `echo 'ls /' | agsh` and here-docs work.
1366
-
1367
- The interpreter is purpose-built and minimal: tokenizing (quotes, escapes),
1368
- pipelines, and `;` / `&&` / `||`. The command namespace is exactly the
1369
- deployment's tool catalog plus a small curated set of local pipe filters
1370
- (`head`, `tail`, `wc`, stdin-filtering `grep`), so a tool name can never be
1371
- shadowed. There is no local filesystem, no variables, no control flow: agsh
1372
- has nothing local to operate on, and every command is a single traced
1373
- `POST /v1/tools/:name` call.
1374
-
1375
- The shell binds one session identity at launch (latest by default) and keeps
1376
- it for the whole run, so a sequence of tool calls observes one consistent
1377
- session context.
1378
-
1379
- ## Backend changes on the agent-sdk runtime
1380
-
1381
- Two read endpoints, mirroring the invocation path:
1382
-
1383
- **`GET /v1/tools`: the live tool listing.** Returns the session's tool
1384
- namespace exactly as a turn would assemble it: authored server tools plus the
1385
- advertised passthrough tools synthesized from connections, under their
1386
- model-facing names. Entries are light (name, source, and `title` when one is
1387
- known); everything else lives behind the detail endpoint. Titles have two
1388
- sources and no new authoring surface: connection tools inherit the upstream
1389
- server's MCP title, which the host already propagates length-capped off
1390
- listings; tools that do not come from MCP get theirs from a hardcoded
1391
- name-to-title table in the runtime's endpoint implementation, covering the
1392
- well-known tool names. A tool in neither place has no title. Accepts the same
1393
- optional session binding as invocation (`session` or `continuationToken`)
1394
- because advertised inventories can be tenant-scoped and resolved per session.
1395
- Implementation reuses the existing plumbing: the discovered manifest for
1396
- authored tools and the advertise-tools synthesis (`McpHost.listTools`, or the
1397
- `oneOff` path when per-session auth substitution applies) for connection
1398
- tools. This is not a duplicate of `/v1/info`: the info document stays the
1399
- static authored manifest; the listing is the runtime view that only the
1400
- running deployment can answer.
1401
-
1402
- **`GET /v1/tools/:name`: one tool's full description.** Description, input
1403
- schema, output schema when declared, effect when declared, approval
1404
- requirement, and source connection. Same path as invocation
1405
- (`POST /v1/tools/:name`), different method: GET describes what POST executes,
1406
- for the same identifier.
1407
-
1408
- Invocation needs no new naming scheme. Advertised connection tools are
1409
- synthesized as ordinary server tools in the session's namespace, so
1410
- `POST /v1/tools/:name` addresses them by their model-facing name like any
1411
- authored tool, with the same session binding, policy checks, and per-call
1412
- tracing. (The direct-call path did need the synthesis step added: it now
1413
- resolves the advertised listing for the call's session identity when the
1414
- authored lookup misses.)
1415
-
1416
- Phase 1 ships the minimal runtime surface agsh calls: the `effect`
1417
- projection in `/v1/info` (rendered in per-tool help), the scratch-workspace
1418
- fallback on direct calls, and `continuationToken` binding on
1419
- `POST /v1/tools/:toolName`. The detail endpoint in phase 2 also closes the
1420
- output-schema gap; `/v1/info` stays as it is.
1421
-
1422
- ## Local development loop
1423
-
1424
- `factory/change-monitor` is the test bed. Its `pnpm start` already serves the
1425
- planner and executor locally through the agent-sdk dev runtime
1426
- (`agent-sdk serve --dir . --dev`). The loop:
1427
-
1428
- 1. `cd factory/change-monitor && pnpm start` (local stack, both agents).
1429
- 2. `agsh --target http://127.0.0.1:<port>/<agent>` against it, via a dev shim
1430
- analogous to `agent-sdk-dev` so the CLI runs from the worktree.
1431
- 3. Iterate end to end: VFS verbs (`ls`, `read`, `grep`, `glob`, `diff`) for the
1432
- authored-tool path, and the planner's tenant connectors for the
1433
- connection-tool path once `GET /v1/tools` exists.
1434
-
1435
- ## Removing the inspector surface from agent-sdk
1436
-
1437
- The inspector CLI is still on development branches, so nothing migrates: the
1438
- CLI-side code is removed from `agent-sdk` and `agsh` is built in its place.
1439
-
1440
- - The verb commands (`ls`, `read`, `grep`, `glob`, `diff`) become the
1441
- curated tier: their hand-designed shapes, schema-binding logic (including
1442
- the candidate-field fallback), and session binding carry over. The
1443
- schema-to-argv flag mapping seeds the generated tier for MCP tools.
1444
- - The `tools` and `skills` commands disappear entirely. `agsh help` and
1445
- per-tool `--help` are the discovery surface.
1446
- - `marked` and `shiki` leave `@cursor/july`; agsh's help rendering takes
1447
- `marked`, and `shiki` returns when agsh ships syntax highlighting.
1448
- `agent-sdk` keeps its developer workflow commands unchanged.
1449
-
1450
- ## Plan
1451
-
1452
- 1. **Package and core invocation.** Create the package, port target
1453
- resolution, the schema-to-argv mapping, and help rendering from the
1454
- inspector code. Authored tools only, against the existing endpoints.
1455
- Verified end to end on the local change-monitor stack.
1456
- 2. **Live catalog.** Add `GET /v1/tools` and `GET /v1/tools/:name` to
1457
- the agent-sdk runtime, with the hardcoded title table for non-MCP tools, and verify
1458
- direct invocation resolves advertised connection tools by their
1459
- model-facing names. Connection tools appear as commands. Verified against
1460
- the planner's connectors.
1461
- 3. **Shell mode.** The purpose-built mini-shell: REPL on TTY, script on
1462
- stdin, tools as the command namespace, one session per shell run.
1463
- 4. **Cleanup.** Remove the inspector CLI surface and presentation
1464
- dependencies from `@cursor/july`.
1465
-
1466
- ## Rationale and rejected alternatives
1467
-
1468
- **Why not extend `agent-sdk`.** The audiences differ: `agent-sdk` is for the
1469
- person building and deploying an agent; this tool is for the person operating
1470
- inside one. Bundling also forces every agent project to carry markdown
1471
- rendering, syntax highlighting, and a bash interpreter it never uses.
1472
-
1473
- **Name.** `agsh` reads as "agent shell", is four characters, collides with
1474
- nothing common, and works as a shell prompt name. Considered: `august`
1475
- (pairs with `july` but says nothing about purpose), `toolsh` (awkward to
1476
- pronounce), `cursor-shell` (too broad; this is scoped to one agent).
1477
-
1478
- **Why a REST catalog instead of the MCP endpoint.** The deployment already
1479
- speaks MCP at `/v1/mcp/tools`, including a per-connection bridge, but the
1480
- bridge is bound to an active turn and speaks JSON-RPC. The CLI wants a plain
1481
- authenticated GET with session binding that returns the assembled tool
1482
- namespace under the names the model sees. Wrapping that in MCP framing buys
1483
- nothing for a first-party client.
1484
-
1485
- **Why a purpose-built interpreter instead of just-bash.** just-bash was the
1486
- original plan (a full bash emulation with a custom-command extension point),
1487
- and a prototype disproved it: custom commands replace its coreutils but can
1488
- never shadow its shell builtins, and `read`, `test`, `type`, and `help` are
1489
- builtins — so the flagship `read` tool is unreachable, and the precedence is
1490
- not ours to control (vercel-labs owns the package). No other embeddable JS
1491
- shell interpreter has a workable custom-command story (mvdan-sh's JS build
1492
- does not expose one; bash-parser is a parser only). agsh also needs almost
1493
- none of bash: no local filesystem, no variables, no control flow — just
1494
- tokenizing, pipelines, and a command namespace it fully owns. A TypeScript
1495
- REPL with tools as async functions (the shape of change-monitor's `script`
1496
- tool) was considered and kept as a possible later addition; it trades away
1497
- the unix muscle memory the curated commands exist for.
1498
-
1499
- ---
1500
-
1501
1091
  Source: /docs/evals.md
1502
1092
 
1503
1093
  # Evals
@@ -2795,8 +2385,9 @@ Source: /docs/guides/mcp-oauth.md
2795
2385
  Use host MCP OAuth when your agent talks to a remote MCP server that
2796
2386
  speaks OAuth, and you want credentials on the serve host (or the hosted
2797
2387
  engine) instead of a Cursor account connector. Local login writes tokens
2798
- next to your Cursor credentials. `--store` copies them onto the
2799
- deployment as secrets so prod can reconnect after a redeploy.
2388
+ next to your Cursor credentials. `--store` copies those tokens onto the
2389
+ deployment as secrets so prod can reconnect after a redeploy. Hosted
2390
+ Connect lets the current process retry.
2800
2391
 
2801
2392
  The companion skill is
2802
2393
  [`skills/mcp-auth/SKILL.md`](https://github.com/cursor/cursor/blob/main/packages/agent-serve/skills/mcp-auth/SKILL.md).
@@ -2807,8 +2398,8 @@ The companion skill is
2807
2398
  flow (`agent-sdk mcp oauth <connection>`)
2808
2399
  - Keep tokens in `mcp-auth.json` under the CLI config directory, bound
2809
2400
  to that connection's resource URL
2810
- - Upsert deployment secrets with `--store` so hosted engines seed the
2811
- same tokens from env
2401
+ - Upsert deployment secrets with `--store` so the next deploy seeds the
2402
+ same tokens from env. Hosted Connect lets the current process retry.
2812
2403
  - Use `advertiseTools: true` when local turns should call the server by
2813
2404
  name. Host tools can still call it through `ctx.host.mcp`.
2814
2405
 
@@ -2888,7 +2479,16 @@ connection URL (tokens are bound to the resource URL).
2888
2479
 
2889
2480
  ## How do I store credentials on a hosted deployment?
2890
2481
 
2891
- Authorize once, then push secrets to the deployment:
2482
+ Authorize once. Then get the tokens onto the deployment.
2483
+
2484
+ On a hosted engine, finishing Connect lets the current process retry.
2485
+ Self-hosted serve writes tokens locally only.
2486
+
2487
+ `--store` from a signed-in laptop is the reliable way to put
2488
+ `MCP_OAUTH_*` on the next deploy. If `agent-sdk secrets list` is
2489
+ empty, run `--store` and redeploy.
2490
+
2491
+ From a laptop, push secrets with the CLI:
2892
2492
 
2893
2493
  ```bash
2894
2494
  agent-sdk mcp oauth inventory --store
@@ -2906,13 +2506,21 @@ agent-sdk mcp oauth inventory --store
2906
2506
  | `MCP_OAUTH_<NAME>_CLIENT_ID` | dynamic client id when registration returned one |
2907
2507
 
2908
2508
  You must be signed in (`agent-sdk login`) with permission to set secrets
2909
- on that slug. Secrets apply on the **next** deploy; run
2910
- `agent-sdk deploy` (or wait for your usual deploy path) after `--store`.
2509
+ on that slug. Secrets apply on the **next** deploy. Run
2510
+ `agent-sdk deploy` after `--store`. A fresh pod sees `MCP_OAUTH_*`
2511
+ only after that deploy.
2911
2512
 
2912
2513
  On the engine, when `mcp-auth.json` is empty, serve seeds the OAuth
2913
2514
  provider from those env vars so host MCP calls work without a browser
2914
2515
  on the pod.
2915
2516
 
2517
+ These secrets are deployment-wide. Anyone who can list or set secrets
2518
+ on that slug, and the hosted engine's runtime env, can use them. That
2519
+ is the same blast radius as `--store`. They are not scoped to the
2520
+ caller who clicked Connect. `cursorAccount: true` tokens stay on the
2521
+ Cursor backend for the deployment service account and do not use
2522
+ `MCP_OAUTH_*`.
2523
+
2916
2524
  ## How do host tools call the server?
2917
2525
 
2918
2526
  ```ts
@@ -2932,7 +2540,7 @@ an allowlist or other deterministic gate.
2932
2540
  | --- | --- |
2933
2541
  | `must be defineConnection({ url, oauth: true })` | Add `oauth: true` on that connection, or pick the right connection name |
2934
2542
  | Callback never completes | Keep port `8787` free; finish the browser login on this machine |
2935
- | Hosted calls unauthorized after `--store` | Confirm secrets with `agent-sdk secrets list <slug>`, then redeploy |
2543
+ | Hosted calls unauthorized after Connect or `--store` | Confirm secrets with `agent-sdk secrets list <slug>`, then redeploy |
2936
2544
  | Tokens ignored after URL change | Expected: resource URL binding drops stale entries. Re-run `mcp oauth` |
2937
2545
 
2938
2546
  ## What's next
@@ -3162,16 +2770,14 @@ Source: /docs/guides/slack.md
3162
2770
 
3163
2771
  # Slack agents
3164
2772
 
3165
- The Slack channel puts your agent in Slack as its own Socket Mode bot.
3166
- `agent-sdk slack create` opens the dashboard wizard and writes tokens
3167
- to `.env.local`. To own the Slack app yourself, run
3168
- `agent-sdk slack init --manual` and paste the manifests at
3169
- [api.slack.com](https://api.slack.com/apps). Socket Mode has no
3170
- public Request URL. Replies stream in threads, with tool "thinking" steps,
3171
- suggested prompts, and opt-in approval buttons.
2773
+ The Slack channel is a Socket Mode bot. The app connects out, so you
2774
+ don't need a public Request URL. Mentions and DMs start a thread.
2775
+ Replies stream there, with thinking steps and suggested prompts.
3172
2776
 
3173
- The companion skill is
3174
- [`skills/setup-slack/SKILL.md`](https://github.com/cursor/cursor/blob/main/packages/agent-serve/skills/setup-slack/SKILL.md).
2777
+ Use `agent-sdk slack create` when Cursor should own the Slack app. Use
2778
+ `agent-sdk slack init --manual` when you own it. Commands and flags live
2779
+ in the [CLI reference](/docs/reference/cli.md#slack). Coding agents should
2780
+ follow [`skills/setup-slack/SKILL.md`](https://github.com/cursor/cursor/blob/main/packages/agent-serve/skills/setup-slack/SKILL.md).
3175
2781
 
3176
2782
  ## Define the channel
3177
2783
 
@@ -3181,35 +2787,23 @@ Author `agent/channels/slack.ts` with `slackChannel()` from
3181
2787
  ```ts
3182
2788
  import { slackChannel } from "@cursor/july/channels/slack";
3183
2789
 
3184
- // Single agent: reads SLACK_BOT_TOKEN + SLACK_APP_TOKEN
3185
2790
  export default slackChannel();
3186
-
3187
- // Multi-agent serve: one Slack app (and token pair) per agent
3188
- export default slackChannel({ envPrefix: "WEATHER_AGENT" });
3189
- // → WEATHER_AGENT_SLACK_BOT_TOKEN + WEATHER_AGENT_SLACK_APP_TOKEN
3190
2791
  ```
3191
2792
 
3192
- By default the channel connects over Socket Mode (the app connects
3193
- outward, so it works from behind any firewall) and responds only to
3194
- `app_mention` events and direct messages. It also refuses Slack Connect
3195
- users, guests, and senders from other workspaces. Threads bind to
3196
- sessions with `continuationToken = channelId:threadTs`, so a thread is
3197
- one durable conversation. Replies stream (`chat.startStream` /
3198
- `appendStream` / `stopStream`) with a plain-message fallback, a rotating
3199
- status shows while the agent works, and the pack sets thread titles and
3200
- suggested prompts. When a Slack API is unavailable (`method_not_found`,
3201
- `missing_scope`), the pack degrades to `postMessage` instead of failing.
2793
+ `slackChannel()` reads `SLACK_BOT_TOKEN` and `SLACK_APP_TOKEN`. Pass
2794
+ `envPrefix: "WEATHER_AGENT"` to read `WEATHER_AGENT_SLACK_BOT_TOKEN`
2795
+ and `WEATHER_AGENT_SLACK_APP_TOKEN` instead. Use a prefix when one
2796
+ host serves several Slack bots.
3202
2797
 
3203
- Missing tokens leave the channel idle (`channel idle missing
3204
- credentials`) rather than failing `serve`. That's useful when you mount
3205
- many agents and only some have Slack apps.
2798
+ A thread is one conversation. The bot answers mentions and DMs. It
2799
+ refuses Slack Connect users, guests, and people from other workspaces.
2800
+ Missing tokens leave this channel idle. The rest of `serve` still
2801
+ starts.
3206
2802
 
3207
2803
  ## Control who can message the agent
3208
2804
 
3209
- External senders are blocked by default. Slack Connect users, guests, and
3210
- people whose home workspace is not the install team never reach the
3211
- handler. Set `blockExternals: false` only when the agent should serve
3212
- people outside your org:
2805
+ External senders are blocked. Set `blockExternals: false` only when
2806
+ people outside your org should reach the agent:
3213
2807
 
3214
2808
  ```ts
3215
2809
  export default slackChannel({
@@ -3217,9 +2811,8 @@ export default slackChannel({
3217
2811
  });
3218
2812
  ```
3219
2813
 
3220
- Sessions are thread-scoped by default, so anyone in the thread can
3221
- continue. Restrict follow-ups to the person who started the session with
3222
- `respondTo: "author"`:
2814
+ Anyone in the thread can continue it. Restrict follow-ups to the person
2815
+ who started the session with `respondTo: "author"`:
3223
2816
 
3224
2817
  ```ts
3225
2818
  export default slackChannel({
@@ -3229,237 +2822,143 @@ export default slackChannel({
3229
2822
 
3230
2823
  ## Set it up
3231
2824
 
3232
- For a dedicated Socket Mode bot, run `agent-sdk slack create`. The CLI
3233
- opens the signed-in Cursor dashboard wizard. Slack consent, bot name,
3234
- and admin-approval wait happen there. Tokens are stored as deployment
3235
- secrets and written to `.env.local`. They are never shown. Do not paste
3236
- a manifest at [api.slack.com](https://api.slack.com/apps) unless you
3237
- are on the [manual setup](#manual-setup) path.
3238
-
3239
- Bots that already have tokens in `.env.local` keep working. Skip the
3240
- wizard unless you want a Cursor-managed app.
2825
+ `slack create` opens the Cursor dashboard wizard. Finish Slack consent
2826
+ and the bot name there. The CLI writes tokens to `.env.local` and never
2827
+ prints them. Skip the wizard if those tokens are already set, unless
2828
+ you want a Cursor-managed app.
3241
2829
 
3242
2830
  ### Provision with the CLI
3243
2831
 
3244
2832
  ```bash
3245
- agent-sdk slack create --dir . # dev app (default)
3246
- agent-sdk slack create --dir . --prod # prod app
2833
+ agent-sdk slack create --dir .
2834
+ agent-sdk slack create --dir . --prod
2835
+ ```
2836
+
2837
+ Sign in first (`agent-sdk login` or `CURSOR_API_KEY`). Finish **Add
2838
+ Slack to this agent** as the same Cursor account. Then run
2839
+ `agent-sdk slack doctor --prefix MY_AGENT` and serve:
2840
+
2841
+ ```bash
2842
+ agent-sdk serve --dir . --dev
3247
2843
  ```
3248
2844
 
3249
- `slack create` needs a signed-in host (`agent-sdk login` or
3250
- `CURSOR_API_KEY`). It scaffolds `agent/channels/slack.ts` when the file
3251
- is missing, opens the dashboard wizard, and waits. Finish **Add Slack
3252
- to this agent** in the browser as the same Cursor account. The CLI
3253
- writes `<PREFIX>_SLACK_BOT_TOKEN` and `<PREFIX>_SLACK_APP_TOKEN` into
3254
- `<dir>/.env.local`, then runs `doctor`. Serve and smoke it as described
3255
- [below](#wire-the-env-and-verify).
2845
+ Invite the bot and mention it, or DM it. Expect a Thinking status,
2846
+ then a threaded streaming reply.
3256
2847
 
3257
- If Slack needs a workspace admin to approve the app, keep the CLI
3258
- running. Managed install does not file the request. Open Slack's
3259
- **Request approval** page (the CLI prints the link; the same URL is
3260
- **Send a reminder** after you submit). After an admin approves, click
2848
+ If Slack needs a workspace admin, keep the CLI running. Open the
2849
+ **Request approval** link it prints. After an admin approves, click
3261
2850
  **Retry** in the wizard.
3262
2851
 
3263
- Useful companions: `--name` / `--icon` / `--channel-posts` prefill the
3264
- wizard. `--slack-team T0123ABCD` picks a workspace when several are
3265
- connected. A second `slack create` for the same agent and env overwrites
3266
- that Slack app. It keeps the Slack app id and replaces the manifest and
3267
- tokens. `agent-sdk slack destroy` deletes the provisioned app.
3268
- `agent-sdk slack icon <source>` updates the icon later.
2852
+ `slack destroy` deletes the Cursor-managed app. `slack icon` updates
2853
+ its icon. A second `slack create` for the same agent and environment
2854
+ replaces that app's manifest and tokens.
3269
2855
 
3270
2856
  ### Provision from the dashboard
3271
2857
 
3272
2858
  The same wizard is on [Deployed Agents](https://cursor.com/dashboard).
3273
- Open **Integrations** on an agent and click **Add Slack to this agent**,
3274
- or follow the URL `slack create` printed.
2859
+ Open **Integrations** and click **Add Slack to this agent**.
3275
2860
 
3276
- A first-run agent that has no hosted engine yet shows **Not deployed
3277
- yet**. Local `agent-sdk serve` works from `.env.local`. The next
3278
- **Deploy** injects the stored secrets; there is no Slack-only Redeploy.
2861
+ Local `agent-sdk serve` reads `.env.local`. The next deploy injects the
2862
+ stored secrets.
3279
2863
 
3280
- If Slack needs admin approval, the wizard waits. Click **Request
3281
- approval** to file the request in Slack (that same page later sends a
3282
- reminder). After an admin approves, click **Retry**.
2864
+ If Slack needs admin approval, click **Request approval**, then
2865
+ **Retry** after an admin approves.
3283
2866
 
3284
- The app row's menu covers later care: rename, set an icon, rotate
3285
- tokens, remove the app, or disconnect the workspace.
2867
+ The app row's menu covers rename, icon, token rotation, removal, and
2868
+ workspace disconnect.
3286
2869
 
3287
- ### Wire the env and verify
2870
+ ### Create your own Slack app
3288
2871
 
3289
- `agent-sdk slack create` already wrote the tokens to `.env.local`, so
3290
- after provisioning skip straight to `doctor`. `serve` / `dev` /
3291
- `slack doctor` load that file (real environment variables always win).
2872
+ `slack init --manual` is for an app you own. It writes the channel file
2873
+ and Slack manifests. When Slack CLI (`~/.slack/bin/slack`) is logged
2874
+ in, it installs the app. When it isn't, install the app yourself.
3292
2875
 
3293
2876
  ```bash
3294
- agent-sdk slack doctor --prefix MY_AGENT
2877
+ agent-sdk slack init --manual --dir . --name "My Agent"
3295
2878
  ```
3296
2879
 
3297
- Proceed when `app_token`, `connections_open`, `bot_token`, and
3298
- `auth_test` are all green. Then serve and smoke it:
2880
+ Install Slack CLI if you need it:
3299
2881
 
3300
2882
  ```bash
3301
- agent-sdk serve --dir . --dev
3302
- # expect: [agent-sdk/slack] Socket Mode connected
2883
+ curl -fsSL https://downloads.slack-edge.com/slack-cli/install.sh | bash
3303
2884
  ```
3304
2885
 
3305
- Invite the bot to a channel and @mention it (or DM it). Expect the
3306
- Thinking… status, then a threaded streaming reply, with correlated
3307
- server logs (`inbound kind=app_mention`, `session start`,
3308
- `reply delivered via stream|postMessage`).
3309
-
3310
- ### Manual setup
2886
+ Log in with `slack login --no-prompt`. In Slack, send
2887
+ `/slackauthticket <ticket>`, then
2888
+ `slack login --ticket <ticket> --challenge <code>`. Install the
2889
+ workspace app with `slack app install`. Create a separate production
2890
+ app the same way.
3311
2891
 
3312
- `slack init --manual` is for a Slack app you own at api.slack.com. You
3313
- paste the generated manifests and mint tokens yourself. Use this when
3314
- you want an unmanaged app, or when the dashboard wizard is not an
3315
- option.
2892
+ Or paste `.slack/manifest.dev.json` at
2893
+ [api.slack.com/apps](https://api.slack.com/apps) (**Create New App**
2894
+ **From a manifest**). Repeat with `.slack/manifest.prod.json`. Dev and
2895
+ prod are separate Slack apps.
3316
2896
 
3317
- ```bash
3318
- agent-sdk slack init --manual --dir . --name "My Agent"
3319
- ```
2897
+ Then put a bot token (`xoxb-...`) and an app-level token with
2898
+ `connections:write` (`xapp-...`) in `.env.local`. Use the names
2899
+ `slack init --manual` printed. Run `slack doctor` and serve as above.
3320
2900
 
3321
- That writes `agent/channels/slack.ts`, Slack manifests under the
3322
- project state directory, `env.example`, and `setup-status.json`.
3323
- `--no-prefix` uses shared `SLACK_*` variables on
3324
- a single-agent host. `--prefix CUSTOM` overrides the directory-derived
3325
- prefix. `--channel-posts` subscribes the manifests to channel-post
3326
- events.
3327
-
3328
- `slack manifest --env both` regenerates the JSON files without
3329
- touching the channel file.
3330
-
3331
- #### Create the apps
3332
-
3333
- This phase needs someone with permission to create Slack apps.
3334
-
3335
- 1. Open [api.slack.com/apps](https://api.slack.com/apps) → **Create New
3336
- App** → **From a manifest**.
3337
- 2. Paste `manifest.dev.json` and create the dev app.
3338
- 3. Repeat with `manifest.prod.json`. Dev and prod are separate Slack
3339
- apps with separate tokens.
3340
-
3341
- #### Install and mint tokens
3342
-
3343
- For each app: **Install to Workspace** and copy the Bot User OAuth Token
3344
- (`xoxb-…`). Then under **Basic Information → App-Level Tokens** create a
3345
- token with scope `connections:write` and copy it (`xapp-…`).
3346
-
3347
- Put the pair in `.env.local` using the names from `env.example`, then
3348
- run `slack doctor` and serve as [above](#wire-the-env-and-verify).
2901
+ Serve this app with Agent SDK. Do not run `slack deploy`.
3349
2902
 
3350
2903
  ## Choose when the agent engages
3351
2904
 
3352
- Mentions and DMs are on by default. Watching channels means dispatching
3353
- on new posts without a mention. That's an explicit opt-in:
2905
+ Mentions and DMs are on. Watching channel posts without a mention is
2906
+ opt-in:
3354
2907
 
3355
2908
  ```ts
3356
2909
  export default slackChannel({
3357
2910
  envPrefix: "TRIAGE",
3358
2911
  engagement: {
3359
- // mentions / directMessages default to true
3360
2912
  channelPosts: {
3361
- allow: ["#triage-alerts"], // use ["*"] for every joined channel
3362
- posts: "top-level", // default: thread replies never dispatch
3363
- debounceMs: 15_000, // optional: let rapid edits settle
3364
- includeBotPosts: false, // default: bot-authored posts never dispatch
2913
+ allow: ["#triage-alerts"],
2914
+ posts: "top-level",
2915
+ debounceMs: 15_000,
3365
2916
  },
3366
2917
  },
3367
- onChannelPost: async (ctx, message) => {
3368
- // same contract as onAppMention: return null to skip
2918
+ onChannelPost: async (_ctx, message) => {
3369
2919
  return message.markdown.length > 20 ? {} : null;
3370
2920
  },
3371
2921
  });
3372
2922
  ```
3373
2923
 
3374
- Channel watching needs the `message.channels` / `message.groups` events
3375
- on the Slack app. Pass `--channel-posts` on `slack create` or
3376
- `slack init --manual`. The bot must also be a member of each watched
3377
- channel.
3378
-
3379
- Set `allow: ["*"]` to watch every channel the bot has joined.
2924
+ Pass `--channel-posts` on `slack create` or `slack init --manual` so
2925
+ the Slack app receives those events. The bot must be in each watched
2926
+ channel. `allow: ["*"]` watches every joined channel.
3380
2927
 
3381
- Set `includeBotPosts: true` when the posts worth watching come from bots:
3382
- alert feeds, webhook integrations, or other agents posting notes. The
3383
- watching app's own posts stay dropped either way, matched by the `bot_id`
3384
- and bot user id from `auth.test`, so an agent can never dispatch on its
3385
- own replies. Use this for a bot-fed alerts channel.
2928
+ Set `includeBotPosts: true` for alert feeds and other bots. This app
2929
+ never wakes on its own posts.
3386
2930
 
3387
2931
  ## Prepare work on the host
3388
2932
 
3389
2933
  Mention and DM handlers may return a prepared `message`,
3390
- `workspaceFiles`, or `cloud` block. It's the same host-prep pattern as
2934
+ `workspaceFiles`, or `cloud` block. Use the same host-prep pattern as
3391
2935
  [custom channels](/docs/guides/webhooks.md#prepare-on-the-host-then-hand-off).
3392
- PR agents use it: extract a PR URL from the mention text and run the
3393
- same host path as the HTTP channel.
3394
2936
 
3395
- Slack file uploads are attached automatically. Images become vision input.
2937
+ Slack file uploads attach automatically. Images become vision input.
3396
2938
  Supported documents become workspace files for the turn.
3397
2939
 
3398
2940
  ## Add approval buttons
3399
2941
 
3400
- Tools with `needsApproval` park until a person decides. Route that
3401
- through Slack with one flag:
2942
+ Tools with `needsApproval` park until a person decides. Post those
2943
+ decisions in Slack with one flag:
3402
2944
 
3403
2945
  ```ts
3404
2946
  export default slackChannel({
3405
- toolApprovals: true, // posts Block Kit Approve/Deny cards + routes clicks
2947
+ toolApprovals: true,
3406
2948
  });
3407
2949
  ```
3408
2950
 
3409
- Approval cards need interactivity on the Slack app. Recreate with
3410
- `slack create` if clicks do nothing. Composing events by hand: spread
3411
- `buildToolApprovalEvents({ credentials })` into `events` and set
3412
- `interactivity: true` on the channel so Socket Mode routes the clicks.
3413
-
3414
- Cards show redacted, truncated arguments (Block Kit size limits);
3415
- execution still uses the full validated input, so review sensitive tools
3416
- in the playground when the arguments may exceed the card. Approvals
3417
- exist for `execution: "server"` tools on the local runtime only, and
3418
- parked calls do not survive a host restart. The full lifecycle is in
2951
+ The Slack app needs interactivity. Recreate it with `slack create` if
2952
+ clicks do nothing. Cards show redacted, truncated arguments. Execution
2953
+ still uses the full input, so review sensitive tools in the playground
2954
+ when the card may hide fields. The lifecycle is in
3419
2955
  [Human-in-the-loop](/docs/guides/human-in-the-loop.md).
3420
2956
 
3421
2957
  ## Run several agents on one host
3422
2958
 
3423
- One Slack app and token pair per agent. Never share a pair across
3424
- agents in the same process. `envPrefix` keeps them apart
3425
- (`WEATHER_AGENT_SLACK_*`, `TRIAGE_SLACK_*`, …), and agents without tokens mount
3426
- with their Slack channel idle while everything else serves normally.
3427
-
3428
- ## Keep the channel healthy
3429
-
3430
- Two habits matter most.
3431
-
3432
- - Don't `await` long work inside Slack dispatch handlers. The pack
3433
- dispatches through `waitUntil` and streams as the turn progresses.
3434
- - In `--dev` (loopback) or `--allow-anonymous` (trusted shared host), the
3435
- playground can list and stream Slack sessions and resolve their parked
3436
- approvals (the audit trail records the HTTP caller). Bearer-auth hosts
3437
- stay strict: Slack approvals must come from Slack interactivity or a
3438
- matching principal.
3439
-
3440
- ## CLI reference
3441
-
3442
- The `slack` subcommands cover setup end to end.
3443
-
3444
- ```bash
3445
- agent-sdk slack setup # printed setup guide
3446
- agent-sdk slack create --dir . # dashboard wizard (dev app)
3447
- agent-sdk slack create --dir . --prod # prod app
3448
- agent-sdk slack destroy --dir . # delete the provisioned app
3449
- agent-sdk slack icon ./icon.png --dir . # set the provisioned app's icon
3450
- agent-sdk slack init --manual --dir . # manifests to paste at api.slack.com
3451
- agent-sdk slack manifest --env both # regenerate those JSON files
3452
- agent-sdk slack doctor --prefix MY_AGENT # token / connectivity checks
3453
- ```
3454
-
3455
- ## What's next
3456
-
3457
- Continue with these pages:
3458
-
3459
- - [Human-in-the-loop](/docs/guides/human-in-the-loop.md): the approval lifecycle
3460
- behind `toolApprovals`
3461
- - [Webhooks and custom channels](/docs/guides/webhooks.md): the mechanism this
3462
- pack is built on
2959
+ Give each agent its own Slack app and token pair. Set `envPrefix` so
2960
+ the names don't collide (`WEATHER_AGENT_SLACK_*`, `TRIAGE_SLACK_*`).
2961
+ Agents without tokens stay idle. The others still serve.
3463
2962
 
3464
2963
  ---
3465
2964
 
@@ -4058,7 +3557,7 @@ npx @cursor/july docs
4058
3557
  | Building a new agent with Cursor | [Scaffold an agent with Cursor](/docs/scaffolding-agents.md) |
4059
3558
  | Turning a Cursor Automation into a project | [Convert a Cursor Automation](/docs/guides/convert-automation.md) |
4060
3559
  | Wiring an agent to Slack | [Slack guide](/docs/guides/slack.md) |
4061
- | Starting from a packaged template | [Demo](/docs/templates/demo.md), [Security reviewer](/docs/templates/security-reviewer.md), [Security help](/docs/templates/security-help.md), [Triage](/docs/templates/triage.md), or [Agentic Owners](/docs/templates/agentic-owners.md) |
3560
+ | Starting from a packaged template | [Demo](/docs/templates/demo.md), [Code wiki](/docs/templates/code-wiki.md), [Living AGENTS.md](/docs/templates/agents-md.md), [Security reviewer](/docs/templates/security-reviewer.md), [Security help](/docs/templates/security-help.md), [Triage](/docs/templates/triage.md), or [Agentic Owners](/docs/templates/agentic-owners.md) |
4062
3561
  | Wiring an agent to GitHub webhooks | [GitHub guide](/docs/guides/github.md) |
4063
3562
  | Driving PRs from a cloud VM | [PR autofixer template](/docs/templates/pr-autofixer.md) |
4064
3563
  | Driving an agent from Linear (or another tracker) | [Webhooks guide: Linear example](/docs/guides/webhooks.md#example-linear-as-the-control-plane) |
@@ -4084,6 +3583,10 @@ npx @cursor/july docs
4084
3583
 
4085
3584
  - [Record a walkthrough from a collected PR](/docs/templates/demo.md): host
4086
3585
  collects the PR, the model records, then comments.
3586
+ - [Keep a code wiki current after merge](/docs/templates/code-wiki.md):
3587
+ update in-repo `wiki/` pages when a pull request merges.
3588
+ - [Keep AGENTS.md current from last week's work](/docs/templates/agents-md.md):
3589
+ pull rules out of merged PRs and Slack, then open a follow-up PR.
4087
3590
  - [Security reviewer](/docs/templates/security-reviewer.md): review pull
4088
3591
  requests for exploitable bugs and post one comment.
4089
3592
  - [Answer security questions in Slack](/docs/templates/security-help.md):
@@ -4117,8 +3620,8 @@ npx @cursor/july docs
4117
3620
  - [Human-in-the-loop approvals](/docs/guides/human-in-the-loop.md): park a
4118
3621
  tool call until a person signs off.
4119
3622
  - [Host MCP OAuth](/docs/guides/mcp-oauth.md): authorize
4120
- `oauth: true` connections, store tokens locally, and `--store` them
4121
- on hosted deployments.
3623
+ `oauth: true` connections, store tokens locally, and persist them
3624
+ on hosted deployments (`--store`).
4122
3625
  - [Agent-to-agent](/docs/guides/agent-to-agent.md): every agent is an MCP
4123
3626
  server; agents can delegate to each other.
4124
3627
  - [Cloud runtime](/docs/guides/cloud-runtime.md): run turns on Cursor cloud
@@ -4725,8 +4228,8 @@ When every slot is busy, newly admitted turns queue FIFO instead of
4725
4228
  failing: the stream records a durable `turn.queued` event with the
4726
4229
  queue position, `GET /v1/sessions` reports `queued: true`, and each
4727
4230
  queued turn starts as soon as a slot frees. A queued turn still counts
4728
- as running for busy semantics: follow-ups preempt it, and direct tool
4729
- calls get `409 session_busy`. Omit for unlimited.
4231
+ as running for busy semantics: follow-ups preempt it, and direct
4232
+ write-effect tool calls get `409 session_busy`. Omit for unlimited.
4730
4233
 
4731
4234
  ```ts
4732
4235
  export default defineAgent({
@@ -5505,8 +5008,9 @@ the value before execution. A local call needs no inference credential.
5505
5008
  A hosted call still needs Cursor credentials to reach the deployment.
5506
5009
 
5507
5010
  `--session` runs the tool inside an existing session and records it on
5508
- the event stream. If a model turn is active or pending, the server
5509
- returns `session_busy`; retry after the turn finishes. The command
5011
+ the event stream. If a model turn is active or pending, a read-effect
5012
+ tool runs alongside it and a write-effect tool gets `session_busy`;
5013
+ retry after the turn finishes. The command
5510
5014
  prints the server's JSON response and exits non-zero unless the HTTP
5511
5015
  response succeeds with `ok: true`. See
5512
5016
  [Tools](/docs/reference/tools.md#call-a-tool-without-a-model-turn).
@@ -5577,6 +5081,8 @@ non-zero when the reconstructed trajectory failed.
5577
5081
  ```bash
5578
5082
  agent-sdk init ./my-agent # scaffold package.json, tsconfig.json, agent/ + a demo tool
5579
5083
  agent-sdk init ./my-demo --template demo # record a PR walkthrough
5084
+ agent-sdk init ./code-wiki --template code-wiki # keep wiki pages current after merge
5085
+ agent-sdk init ./agents-md --template agents-md # keep AGENTS.md current from last week's PRs and Slack
5580
5086
  agent-sdk init ./my-reviewer --template security-reviewer # review PRs for security bugs
5581
5087
  agent-sdk init ./security-help --template security-help # answer security questions in Slack
5582
5088
  agent-sdk init ./my-triage --template triage-linear # comment on Linear issues
@@ -5594,8 +5100,9 @@ agent-sdk init # no directory: print the setup guide
5594
5100
  `@cursor/july` resolves for `dev` and `run`.
5595
5101
 
5596
5102
  Templates may ship `init.json`. On a TTY, `init` asks those questions
5597
- before writing files. `pr-autofixer` and `security-help` ask for GitHub
5598
- repos. Repeat
5103
+ before writing files. `code-wiki`, `pr-autofixer`, `security-help`, and
5104
+ `agents-md` ask for GitHub repos. `agents-md` also asks for Slack
5105
+ channels. Repeat
5599
5106
  `--var id=value` to answer without a prompt.
5600
5107
  `--json` and non-TTY hosts skip the interview unless `--var` is set.
5601
5108
 
@@ -5753,7 +5260,8 @@ commands with an explicit `--json` flag skip this automatic check.
5753
5260
  agent-sdk deploy [--dir <path>] [--slug <slug> | --all] [--team <id>]
5754
5261
  [--repo <https-url>] [--ref <git-ref>] [--path <agent-path>]
5755
5262
  [--cursor-events-repo owner/name]...
5756
- [--allow-domain <domain>]... [--no-wait] [--json]
5263
+ [--allow-domain <domain>]... [--multi-tenant]
5264
+ [--no-wait] [--json]
5757
5265
  ```
5758
5266
 
5759
5267
  Managed hosting requires team-admin permission and the team's
@@ -5780,6 +5288,12 @@ be a lowercase hostname with at least two labels and an alphabetic
5780
5288
  top-level domain. One leading `*.` wildcard is allowed. A deployment
5781
5289
  can declare at most 20 domains.
5782
5290
 
5291
+ `--multi-tenant` adds a release to an existing Cursor-managed
5292
+ (multi-tenant) product such as `security-reviewer`. It is valid only
5293
+ for `architecture: "v2"` and cannot create a new multi-tenant
5294
+ application — those stay on the operator seed path. Without the flag,
5295
+ HTTP deploy stays single-tenant and a managed slug 409s.
5296
+
5783
5297
  By default, the command polls every three seconds for up to ten minutes
5784
5298
  and succeeds only when the deployment reaches `running`. `--no-wait`
5785
5299
  returns after the deployment request is accepted. Multi-agent deploys
@@ -5906,6 +5420,8 @@ URL connections run a browser PKCE flow. Tokens are written to
5906
5420
  `mcp-auth.json` under the CLI config directory (override with
5907
5421
  `AGENT_SERVE_CONFIG_DIR`). Pass `--store` to upsert matching
5908
5422
  `MCP_OAUTH_<CONNECTION>_*` secrets on the hosted deployment.
5423
+ `--store` is the path for the next deploy. Hosted Connect lets the
5424
+ current process retry.
5909
5425
 
5910
5426
  Cursor-account connections authorize the hosted deployment's service
5911
5427
  account through the Cursor backend's connector consent flow. Those
@@ -5984,6 +5500,7 @@ agent-sdk slack icon <https-url-or-file> [--dir <path>] [--prod]
5984
5500
  [--slack-team <T…>] [--team <id>] [--json]
5985
5501
  agent-sdk slack init --manual [--dir <path>] [--name <name>]
5986
5502
  [--prefix <prefix> | --no-prefix] [--channel-posts]
5503
+ [--install | --no-install] [--slack-team <T…>] [--prod]
5987
5504
  agent-sdk slack manifest [--dir <path>] [--name <name>]
5988
5505
  [--env dev|prod|both] [--channel-posts] [--print]
5989
5506
  agent-sdk slack doctor [--dir <path>] [--prefix <prefix> | --no-prefix] [--json]
@@ -6012,17 +5529,26 @@ a local png, jpg, or gif file of at most 512KB.
6012
5529
 
6013
5530
  `slack init` without `--manual` exits non-zero and writes no files. Use
6014
5531
  `slack create` for the dashboard wizard. `slack init --manual` writes
6015
- the channel file, development and production manifests, `env.example`,
6016
- and setup status under the project. You paste those manifests at
6017
- api.slack.com. The command refuses to overwrite a target file. If a
6018
- collision occurs, it exits non-zero; files created earlier in the run
6019
- remain. The token prefix defaults to the directory basename normalized
6020
- to uppercase snake case. Explicit `--prefix` values use the same
6021
- normalization. For example, `pr-approver` becomes
6022
- `PR_APPROVER_SLACK_BOT_TOKEN`. `--no-prefix` uses shared
6023
- `SLACK_BOT_TOKEN` and `SLACK_APP_TOKEN`. `--channel-posts` subscribes
6024
- the manifests to channel-post events. The command always prints a JSON
6025
- summary.
5532
+ the channel file, development and production manifests, a Slack CLI
5533
+ `.slack/` project (hook + manifests, committed with the repo). When
5534
+ Slack CLI is logged in, it installs the app. Otherwise `next` asks
5535
+ you to install it. `--install` requires that install. `--no-install`
5536
+ skips it. `--prod` selects the deployed app.
5537
+ `--slack-team` picks the workspace. Slack CLI keeps install tokens in
5538
+ that process; copy `xoxb` and mint `xapp` (`connections:write`) into
5539
+ `.env.local`. Tokens that appear in `.env` during that install are
5540
+ copied onto the prefixed names. Paste `.slack/manifest.dev.json` at
5541
+ api.slack.com when the Slack CLI is missing. Do not run
5542
+ `slack deploy`. The command refuses to overwrite the channel file.
5543
+ It updates the Slack CLI hook and manifests when `.slack/` already
5544
+ exists. If a collision occurs, it exits non-zero; files created
5545
+ earlier in the run remain. The token prefix defaults to the directory
5546
+ basename normalized to uppercase snake case.
5547
+ Explicit `--prefix` values use the same normalization. For example,
5548
+ `pr-approver` becomes `PR_APPROVER_SLACK_BOT_TOKEN`. `--no-prefix`
5549
+ uses shared `SLACK_BOT_TOKEN` and `SLACK_APP_TOKEN`.
5550
+ `--channel-posts` subscribes the manifests to channel-post events.
5551
+ The command always prints a JSON summary.
6026
5552
 
6027
5553
  `slack manifest` regenerates selected manifest files. `--env` defaults
6028
5554
  to `both`, and `--name` defaults to the directory name. `--print` writes
@@ -6153,8 +5679,10 @@ Tokens come from env vars. Never hardcode them in the file.
6153
5679
  ## Host MCP OAuth
6154
5680
 
6155
5681
  For servers that speak OAuth, set `oauth: true` and authorize with the
6156
- CLI. Tokens live in `mcp-auth.json` under the CLI config directory. `--store`
6157
- copies them onto the hosted deployment as `MCP_OAUTH_<NAME>_*` secrets.
5682
+ CLI or mid-run Connect. Tokens live in `mcp-auth.json` under the CLI
5683
+ config directory. `--store` copies them onto the deployment as
5684
+ `MCP_OAUTH_<NAME>_*` secrets. Hosted Connect lets the current
5685
+ process retry.
6158
5686
 
6159
5687
  ```ts
6160
5688
  export default defineConnection({
@@ -6166,6 +5694,7 @@ export default defineConnection({
6166
5694
  ```bash
6167
5695
  agent-sdk mcp oauth inventory # browser PKCE → local mcp-auth.json
6168
5696
  agent-sdk mcp oauth inventory --store # also upsert deployment secrets
5697
+ # Hosted Connect retries this process. Self-hosted stays file-only.
6169
5698
  ```
6170
5699
 
6171
5700
  Full walkthrough: [Host MCP OAuth](/docs/guides/mcp-oauth.md). Companion
@@ -6384,7 +5913,7 @@ lazily on first use.
6384
5913
 
6385
5914
  Continue with these pages:
6386
5915
 
6387
- - [Host MCP OAuth](/docs/guides/mcp-oauth.md): `mcp oauth`, `--store`
5916
+ - [Host MCP OAuth](/docs/guides/mcp-oauth.md): `mcp oauth`, Connect, `--store`
6388
5917
  - [Agent-to-agent](/docs/guides/agent-to-agent.md): peers in depth
6389
5918
  - [Tools](/docs/reference/tools.md): authored tools that wrap MCP connections
6390
5919
  - [Webhooks](/docs/guides/webhooks.md): calling MCP connections from handlers
@@ -6626,7 +6155,8 @@ curl -X POST http://127.0.0.1:3000/<slug>/v1/tools/inspect_pr \
6626
6155
  It runs an authored server tool in-process: schema-validated, no model
6627
6156
  turn. An optional `"sessionId"` in the body runs it inside an existing
6628
6157
  session and records it on that session's stream (`409 session_busy`
6629
- while a turn runs). Agent-execution tools are rejected with `400`, and
6158
+ for a write-effect call while a turn runs; reads run alongside the
6159
+ turn). Agent-execution tools are rejected with `400`, and
6630
6160
  unknown tools with `404` and the list of available names. For the
6631
6161
  semantics, see [Tools](/docs/reference/tools.md#call-a-tool-without-a-model-turn).
6632
6162
 
@@ -7342,8 +6872,10 @@ message. Interrupted turns record `turn.failed` with
7342
6872
  Slack `stop` / `@agent stop` does the same for that thread and clears
7343
6873
  pending coalesced nudges.
7344
6874
 
7345
- Session-bound deterministic tool calls share the same execution lock.
7346
- They return `409 session_busy` while a model turn is running.
6875
+ Session-bound deterministic tool calls share the lock only for writes: a
6876
+ write-effect call returns `409 session_busy` while a model turn is
6877
+ running, a read-effect call runs alongside the turn (see
6878
+ [Tools](/docs/reference/tools.md#call-a-tool-without-a-model-turn)).
7347
6879
 
7348
6880
  ## Which events can I stream?
7349
6881
 
@@ -7866,7 +7398,14 @@ when the call returns. Pass a `sessionId` (a body field over
7866
7398
  HTTP, `--session` on the CLI, `options.sessionId` programmatically) to
7867
7399
  run inside an existing session instead: the tool sees that session's
7868
7400
  workspace, and the call is recorded on the session's event stream.
7869
- Session-bound calls return `409 session_busy` while a turn runs. When the
7401
+ While a model turn is running, a session-bound call is admitted by its
7402
+ effect: a read-effect call (a declared `effect: "read"`, or an advertised
7403
+ MCP tool whose server annotates it read-only) runs alongside the turn,
7404
+ reading the workspace as the turn has left it, and is recorded under its
7405
+ own per-call `turnId` so trajectories keep it apart from the turn's own
7406
+ calls; a write-effect call — including an undeclared tool, which counts
7407
+ as a write — returns `409 session_busy` until the turn finishes, because
7408
+ a running turn owns the workspace. When the
7870
7409
  session's harness cwd cannot be materialized, a read-effect call runs
7871
7410
  in a scratch workspace instead and the outcome carries
7872
7411
  `scratchWorkspace: true`; a write-effect call fails with
@@ -7876,7 +7415,7 @@ A session can also be addressed by its continuation token: an optional
7876
7415
  `continuationToken` (`<channelId>:<key>`, as `/v1/sessions` lists it;
7877
7416
  mutually exclusive with `sessionId`). A token that maps to a live
7878
7417
  session behaves exactly like passing that session's id — same ownership
7879
- check, same `409 session_busy`, same event recording. A token with no
7418
+ check, same busy semantics, same event recording. A token with no
7880
7419
  session behind it runs the call scratch-bound with the token's channel
7881
7420
  id and continuation key as the call's session identity, so a deployment
7882
7421
  whose tools resolve state from the continuation key can serve it with
@@ -8330,6 +7869,212 @@ sessions skip GitHub writes.
8330
7869
 
8331
7870
  ---
8332
7871
 
7872
+ Source: /docs/templates/agents-md.md
7873
+
7874
+ # Keep AGENTS.md current from last week's work
7875
+
7876
+ This agent runs every Monday at 09:00 UTC. It reads last week's merged
7877
+ pull requests and the Slack channels you list. When a durable rule
7878
+ showed up, `apply_agents` parks the write until a person approves it,
7879
+ then opens a draft follow-up pull request against the default branch.
7880
+ Chores and rules the file already states stay quiet.
7881
+
7882
+ This template is one model turn: read the week, then call
7883
+ `apply_agents`.
7884
+
7885
+ Init once per app. Pass a different repo and channel list each time.
7886
+
7887
+ ## Scaffold
7888
+
7889
+ ```bash
7890
+ npx @cursor/july init ./agents-md --template agents-md
7891
+ ```
7892
+
7893
+ `init` asks which GitHub repo to watch and which Slack channels to
7894
+ read. Pass `--var repos=acme/api --var slack=#eng-api,#api-private`
7895
+ to skip the prompt. Use `--var slack=none` when Slack is out of
7896
+ scope.
7897
+
7898
+ The answers land in `agent/lib/config.ts`. Edit that file when the
7899
+ set changes.
7900
+
7901
+ ## Connect GitHub and Slack
7902
+
7903
+ Connect GitHub in Cursor for that repository (Settings or
7904
+ [cursor.com/dashboard](https://cursor.com/dashboard)). Sign the host
7905
+ in:
7906
+
7907
+ ```bash
7908
+ cd agents-md
7909
+ agent-sdk login
7910
+ ```
7911
+
7912
+ `cursorAccount` mints a short-lived, repo-scoped credential with
7913
+ `contents-write` so the agent can open the follow-up PR. See the
7914
+ [GitHub guide](/docs/guides/github.md).
7915
+
7916
+ Create the Slack app and invite the bot to each listed channel,
7917
+ including private ones:
7918
+
7919
+ ```bash
7920
+ agent-sdk slack create --dir .
7921
+ ```
7922
+
7923
+ See the [Slack guide](/docs/guides/slack.md).
7924
+
7925
+ ## First weekly run
7926
+
7927
+ ```bash
7928
+ agent-sdk dev
7929
+ ```
7930
+
7931
+ Schedules never fire under `dev`. Dispatch the same path production
7932
+ uses:
7933
+
7934
+ ```bash
7935
+ curl -X POST http://127.0.0.1:3000/v1/dev/schedules/weekly
7936
+ ```
7937
+
7938
+ The playground can run `/queue/run` too.
7939
+
7940
+ The host writes `week/prs.md`, `week/slack.md`, `week/window.txt`,
7941
+ and `week/tree/**.txt` snapshots of the current `AGENTS.md` files,
7942
+ then starts a model turn. The
7943
+ model calls `apply_agents` once. A skip finishes. An update parks in
7944
+ the playground until someone approves; then a draft PR opens against
7945
+ the repository default branch. Later updates to the same base stack
7946
+ on `agents-md/<base>`. Pull requests from those branches are ignored
7947
+ so the follow-up cannot feed the next week.
7948
+
7949
+ Chat replies stay in the playground. `apply_agents` records a skip,
7950
+ or parks the write. Approve there or with
7951
+ `POST /v1/session/:id/approvals/:callId`.
7952
+
7953
+ ## What to edit
7954
+
7955
+ - `agent/lib/config.ts`: repo and Slack channels
7956
+ - `agent/instructions.md`: what counts as an update
7957
+ - `evals/agents.eval.ts`: smoke cases
7958
+
7959
+ ## Evals
7960
+
7961
+ Four smoke cases: a lint-only week, a billing rule that parks the
7962
+ write, the same rule already in `AGENTS.md`, and an empty week.
7963
+
7964
+ ```bash
7965
+ agent-sdk eval
7966
+ ```
7967
+
7968
+ Eval sessions skip the GitHub write.
7969
+
7970
+ ## Deploy
7971
+
7972
+ ```bash
7973
+ agent-sdk deploy
7974
+ ```
7975
+
7976
+ Run it from the agent's git checkout. The command infers repository,
7977
+ ref, path, and slug. Production fires the Monday cron. The deployment
7978
+ uses the team's Cursor GitHub connection for the watched repo.
7979
+
7980
+ ---
7981
+
7982
+ Source: /docs/templates/code-wiki.md
7983
+
7984
+ # Keep a code wiki current after merge
7985
+
7986
+ This agent wakes when a watched pull request merges. It reads the diff
7987
+ and the in-repo `wiki/` pages. When a durable fact changed, it opens a
7988
+ follow-up pull request with the page edits. Chores, cherry-picks, and
7989
+ wiki-only merges stay quiet.
7990
+
7991
+ This template is one model turn: read the merge, then call `apply_wiki`.
7992
+
7993
+ ## Scaffold
7994
+
7995
+ ```bash
7996
+ npx @cursor/july init ./code-wiki --template code-wiki
7997
+ ```
7998
+
7999
+ `init` asks which GitHub repos to watch. Every repo must share one
8000
+ owner. Pass `--var repos=acme/api,acme/web` to skip the prompt.
8001
+
8002
+ The list lands in `agent/lib/repos.ts`. The GitHub channel reads it for
8003
+ `cursorAccount` and for the wake filter. Edit that file when the set
8004
+ changes.
8005
+
8006
+ Pages live in `wiki/` at the repository root. Keep them flat markdown.
8007
+ Add `wiki/_index.md` as the catalog.
8008
+
8009
+ ## Connect GitHub through Cursor
8010
+
8011
+ Connect GitHub in Cursor for those repositories (Settings or
8012
+ [cursor.com/dashboard](https://cursor.com/dashboard)). Sign the host in:
8013
+
8014
+ ```bash
8015
+ cd code-wiki
8016
+ agent-sdk login
8017
+ ```
8018
+
8019
+ `cursorAccount` pulls SCM events from Cursor and mints a short-lived,
8020
+ repo-scoped credential with `contents-write` so the agent can open the
8021
+ follow-up PR. See the [GitHub guide](/docs/guides/github.md).
8022
+
8023
+ ## First update
8024
+
8025
+ ```bash
8026
+ agent-sdk dev
8027
+ ```
8028
+
8029
+ `dev` starts the Cursor event relay for the watched repos. To drive a
8030
+ known merge without waiting on a live push:
8031
+
8032
+ ```bash
8033
+ agent-sdk github replay https://github.com/acme/api/pull/12 --dir . --action closed
8034
+ ```
8035
+
8036
+ `replay` needs pull access. The payload must be a merged PR (`closed`
8037
+ and `merged`). Repos outside `agent/lib/repos.ts`, wiki-only merges,
8038
+ and branches named `wiki/*` are ignored so the follow-up PR cannot
8039
+ wake the agent again.
8040
+
8041
+ The channel writes `pr/base.ref`, `pr/files.txt`, `pr/diff.patch`, and
8042
+ the current `wiki/` pages, then starts a model turn. The model calls
8043
+ `apply_wiki` once. The follow-up PR targets that merge's base. Later
8044
+ updates to the same base stack on `wiki/<base>`.
8045
+
8046
+ Chat replies stay in the playground. `apply_wiki` opens the GitHub
8047
+ pull request, or records a skip.
8048
+
8049
+ ## What to edit
8050
+
8051
+ - `agent/lib/repos.ts`: watched repos
8052
+ - `agent/instructions.md`: what counts as an update
8053
+ - `evals/wiki.eval.ts`: smoke cases
8054
+
8055
+ ## Evals
8056
+
8057
+ Four smoke cases drawn from a busy merge day: a lint fix, a new
8058
+ protobuf contract, a markdown-only change, and a cherry-pick.
8059
+
8060
+ ```bash
8061
+ agent-sdk eval
8062
+ ```
8063
+
8064
+ Eval sessions skip the GitHub write.
8065
+
8066
+ ## Deploy
8067
+
8068
+ ```bash
8069
+ agent-sdk deploy
8070
+ ```
8071
+
8072
+ Run it from the agent's git checkout. The command infers repository,
8073
+ ref, path, and slug. The deployment uses the team's Cursor GitHub
8074
+ connection for the same watched repos.
8075
+
8076
+ ---
8077
+
8333
8078
  Source: /docs/templates/demo.md
8334
8079
 
8335
8080
  # Record a walkthrough from a collected PR
@@ -8840,7 +8585,7 @@ not on `PATH`, use `npx @cursor/july`.
8840
8585
  | What you see | What to do |
8841
8586
  | --- | --- |
8842
8587
  | `409` on a follow-up message | Refresh the `continuationToken` or confirm the session is a chat session. Task sessions do not accept follow-ups. |
8843
- | `409 session_busy` on `call --session` | Wait for the model turn to finish, or omit `--session` for a one-off call. |
8588
+ | `409 session_busy` on `call --session` | The tool is a write (or declares no effect) and a model turn is running. Wait for the turn to finish, omit `--session` for a one-off call, or declare `effect: "read"` on a tool that only reads so it runs alongside turns. |
8844
8589
  | `403` on stream or follow-up | Use the same auth identity that created the session. Off localhost, pass `--bearer-token` and send it on every request. |
8845
8590
  | Works on localhost; blocked through a tunnel or LAN | Default auth allows only direct loopback callers. Share the host with `--bearer-token <secret>` (or authored `bearerAuth`). Use `--allow-anonymous` only on a trusted private network. |
8846
8591
  | A channel route fails to compile with a schema type error | `GET` routes need a Zod `querySchema`. `POST` / `PUT` / `PATCH` need a Zod `bodySchema`. Use `z.object({})` or `z.unknown()` for open shapes. |
@@ -8868,7 +8613,7 @@ not on `PATH`, use `npx @cursor/july`.
8868
8613
  | What you see | What to do |
8869
8614
  | --- | --- |
8870
8615
  | `must be defineConnection({ url, oauth: true })` | The connection file needs `oauth: true`, or you passed the wrong connection name to `agent-sdk mcp oauth`. |
8871
- | Local auth works; hosted calls unauthorized | Run `agent-sdk mcp oauth <name> --store`, confirm names with `agent-sdk secrets list <slug>`, then redeploy. |
8616
+ | Local auth works; hosted calls unauthorized | Finish Connect on the hosted engine, or run `agent-sdk mcp oauth <name> --store`. Confirm names with `agent-sdk secrets list <slug>`, then redeploy. |
8872
8617
  | Model asks for `mcp_auth` or IDE MCP for a connector it already has | Attached MCP is behind meta-tools. Set `advertiseTools: true` for named tools on local turns, or call it from a host tool via `ctx.host.mcp`. |
8873
8618
 
8874
8619
  See [Host MCP OAuth](/docs/guides/mcp-oauth.md) and