@cursor/july 0.1.95 → 0.1.96

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 (220) hide show
  1. package/AGENTS.md +3 -4
  2. package/dist/channels/deployments/types.d.ts +1 -1
  3. package/dist/channels/deployments/types.d.ts.map +1 -1
  4. package/dist/channels/deployments/types.js +1 -0
  5. package/dist/channels/origin/api.d.ts +59 -13
  6. package/dist/channels/origin/api.d.ts.map +1 -1
  7. package/dist/channels/origin/api.js +168 -27
  8. package/dist/channels/origin/binding.d.ts +2 -2
  9. package/dist/channels/origin/checks.d.ts +6 -6
  10. package/dist/channels/origin/checks.js +6 -6
  11. package/dist/channels/origin/cursor-account.d.ts +5 -3
  12. package/dist/channels/origin/cursor-account.d.ts.map +1 -1
  13. package/dist/channels/origin/cursor-account.js +5 -3
  14. package/dist/channels/slack/api.d.ts +9 -0
  15. package/dist/channels/slack/api.d.ts.map +1 -1
  16. package/dist/channels/slack/api.js +36 -5
  17. package/dist/channels/slack/defaults.d.ts.map +1 -1
  18. package/dist/channels/slack/defaults.js +17 -46
  19. package/dist/channels/slack/dispatch.d.ts +7 -1
  20. package/dist/channels/slack/dispatch.d.ts.map +1 -1
  21. package/dist/channels/slack/dispatch.js +47 -23
  22. package/dist/channels/slack/inbound.d.ts +8 -0
  23. package/dist/channels/slack/inbound.d.ts.map +1 -1
  24. package/dist/channels/slack/inbound.js +32 -0
  25. package/dist/channels/slack/live-delivery.d.ts +26 -29
  26. package/dist/channels/slack/live-delivery.d.ts.map +1 -1
  27. package/dist/channels/slack/live-delivery.js +172 -73
  28. package/dist/channels/slack/manifest.d.ts.map +1 -1
  29. package/dist/channels/slack/manifest.js +5 -1
  30. package/dist/channels/slack/nudge-carrier.d.ts +2 -0
  31. package/dist/channels/slack/nudge-carrier.d.ts.map +1 -1
  32. package/dist/channels/slack/nudge-carrier.js +48 -1
  33. package/dist/channels/slack/slack-channel.d.ts.map +1 -1
  34. package/dist/channels/slack/slack-channel.js +2 -2
  35. package/dist/docs/404.html +2 -2
  36. package/dist/docs/ab.html +4 -4
  37. package/dist/docs/assets/{app.BBj0klBO.js → app.jXleCmOc.js} +1 -1
  38. package/dist/docs/assets/chunks/@localSearchIndexroot.DFoGuETX.js +1 -0
  39. package/dist/docs/assets/chunks/{VPLocalSearchBox.CUEXpL78.js → VPLocalSearchBox.8LhyglIT.js} +1 -1
  40. package/dist/docs/assets/chunks/{theme.DabmQnia.js → theme.9ged-pr2.js} +2 -2
  41. package/dist/docs/assets/index.md.CI93Ltlb.js +5 -0
  42. package/dist/docs/assets/{index.md.BoHaMdeZ.lean.js → index.md.CI93Ltlb.lean.js} +1 -1
  43. package/dist/docs/assets/{reference_cli.md.BsMOxDvh.js → reference_cli.md.CCnG-nJx.js} +2 -1
  44. package/dist/docs/assets/templates_code-wiki.md.CDYZIBFN.js +2 -0
  45. package/dist/docs/assets/templates_code-wiki.md.CDYZIBFN.lean.js +1 -0
  46. package/dist/docs/building-with-agents.html +4 -4
  47. package/dist/docs/concepts.html +4 -4
  48. package/dist/docs/deployment.html +4 -4
  49. package/dist/docs/evals.html +4 -4
  50. package/dist/docs/guides/agent-to-agent.html +4 -4
  51. package/dist/docs/guides/cloud-runtime.html +4 -4
  52. package/dist/docs/guides/convert-automation.html +4 -4
  53. package/dist/docs/guides/github.html +4 -4
  54. package/dist/docs/guides/human-in-the-loop.html +4 -4
  55. package/dist/docs/guides/mcp-oauth.html +4 -4
  56. package/dist/docs/guides/opentelemetry.html +4 -4
  57. package/dist/docs/guides/slack.html +4 -4
  58. package/dist/docs/guides/webhooks.html +4 -4
  59. package/dist/docs/hashmap.json +1 -1
  60. package/dist/docs/hillclimbing.html +4 -4
  61. package/dist/docs/index.html +6 -6
  62. package/dist/docs/index.md +3 -1
  63. package/dist/docs/llms-full.txt +102 -3
  64. package/dist/docs/llms.txt +1 -0
  65. package/dist/docs/quickstart.html +4 -4
  66. package/dist/docs/reference/agent-config.html +4 -4
  67. package/dist/docs/reference/artifacts.html +4 -4
  68. package/dist/docs/reference/channels.html +4 -4
  69. package/dist/docs/reference/cli.html +7 -6
  70. package/dist/docs/reference/cli.md +3 -2
  71. package/dist/docs/reference/connections.html +4 -4
  72. package/dist/docs/reference/hooks.html +4 -4
  73. package/dist/docs/reference/http-api.html +4 -4
  74. package/dist/docs/reference/instructions.html +4 -4
  75. package/dist/docs/reference/playground.html +4 -4
  76. package/dist/docs/reference/project-layout.html +4 -4
  77. package/dist/docs/reference/prompt.html +4 -4
  78. package/dist/docs/reference/schedules.html +4 -4
  79. package/dist/docs/reference/sessions.html +4 -4
  80. package/dist/docs/reference/skills.html +4 -4
  81. package/dist/docs/reference/subagents.html +4 -4
  82. package/dist/docs/reference/tools.html +4 -4
  83. package/dist/docs/scaffolding-agents.html +4 -4
  84. package/dist/docs/storage.html +4 -4
  85. package/dist/docs/templates/agentic-owners.html +4 -4
  86. package/dist/docs/templates/code-wiki.html +28 -0
  87. package/dist/docs/templates/code-wiki.md +91 -0
  88. package/dist/docs/templates/demo.html +5 -5
  89. package/dist/docs/templates/pr-autofixer.html +4 -4
  90. package/dist/docs/templates/security-help.html +4 -4
  91. package/dist/docs/templates/security-reviewer.html +5 -5
  92. package/dist/docs/templates/triage.html +4 -4
  93. package/dist/docs/troubleshooting.html +4 -4
  94. package/dist/files-backends/cursor-hosted.d.ts +26 -4
  95. package/dist/files-backends/cursor-hosted.d.ts.map +1 -1
  96. package/dist/files-backends/cursor-hosted.js +32 -4
  97. package/dist/internal/advertise-tools.d.ts +2 -0
  98. package/dist/internal/advertise-tools.d.ts.map +1 -1
  99. package/dist/internal/advertise-tools.js +15 -1
  100. package/dist/internal/bounded.d.ts +7 -0
  101. package/dist/internal/bounded.d.ts.map +1 -0
  102. package/dist/internal/bounded.js +32 -0
  103. package/dist/internal/cli-deploy.d.ts.map +1 -1
  104. package/dist/internal/cli-deploy.js +7 -1
  105. package/dist/internal/conversation-mirror.d.ts +11 -8
  106. package/dist/internal/conversation-mirror.d.ts.map +1 -1
  107. package/dist/internal/conversation-mirror.js +116 -55
  108. package/dist/internal/cursor/backend-client.d.ts.map +1 -1
  109. package/dist/internal/cursor/backend-client.js +22 -48
  110. package/dist/internal/cursor/session-token.d.ts +45 -0
  111. package/dist/internal/cursor/session-token.d.ts.map +1 -0
  112. package/dist/internal/cursor/session-token.js +99 -0
  113. package/dist/internal/cursor-agent-template.d.ts +1 -1
  114. package/dist/internal/cursor-agent-template.d.ts.map +1 -1
  115. package/dist/internal/cursor-agent-template.js +1 -0
  116. package/dist/internal/framework-file-storage.d.ts +61 -0
  117. package/dist/internal/framework-file-storage.d.ts.map +1 -0
  118. package/dist/internal/framework-file-storage.js +204 -0
  119. package/dist/internal/framework-storage-selection.d.ts +11 -5
  120. package/dist/internal/framework-storage-selection.d.ts.map +1 -1
  121. package/dist/internal/framework-storage-selection.js +38 -11
  122. package/dist/internal/hosted-delivery.d.ts +7 -0
  123. package/dist/internal/hosted-delivery.d.ts.map +1 -1
  124. package/dist/internal/hosted-delivery.js +4 -0
  125. package/dist/internal/init-project.d.ts.map +1 -1
  126. package/dist/internal/init-project.js +2 -0
  127. package/dist/internal/install-cursor-skills.d.ts.map +1 -1
  128. package/dist/internal/install-cursor-skills.js +1 -3
  129. package/dist/internal/managed-delivery.d.ts +80 -0
  130. package/dist/internal/managed-delivery.d.ts.map +1 -0
  131. package/dist/internal/managed-delivery.js +86 -0
  132. package/dist/internal/runtime-dispatch-runner.d.ts +5 -1
  133. package/dist/internal/runtime-dispatch-runner.d.ts.map +1 -1
  134. package/dist/internal/runtime-dispatch-runner.js +7 -0
  135. package/dist/internal/sdk-runner.d.ts +11 -0
  136. package/dist/internal/sdk-runner.d.ts.map +1 -1
  137. package/dist/internal/sdk-runner.js +39 -8
  138. package/dist/internal/server.js +1 -0
  139. package/dist/internal/session-engine.d.ts +13 -0
  140. package/dist/internal/session-engine.d.ts.map +1 -1
  141. package/dist/internal/session-engine.js +62 -3
  142. package/dist/internal/steering.d.ts +15 -0
  143. package/dist/internal/steering.d.ts.map +1 -0
  144. package/dist/internal/steering.js +18 -0
  145. package/dist/playground/assets/index-B1DDvBeC.css +1 -0
  146. package/dist/playground/assets/{index-CZA1uEWA.js → index-Cx9CclK_.js} +51 -51
  147. package/dist/playground/index.html +2 -2
  148. package/dist/storage-backends/cursor-hosted.d.ts +8 -5
  149. package/dist/storage-backends/cursor-hosted.d.ts.map +1 -1
  150. package/dist/storage-backends/cursor-hosted.js +4 -3
  151. package/dist/types.d.ts +2 -1
  152. package/dist/types.d.ts.map +1 -1
  153. package/docs/README.md +3 -1
  154. package/docs/reference/cli.md +3 -2
  155. package/docs/templates/code-wiki.md +96 -0
  156. package/package.json +2 -2
  157. package/skills/ab/SKILL.md +13 -97
  158. package/skills/create-agent/SKILL.md +123 -223
  159. package/skills/debug/SKILL.md +34 -68
  160. package/skills/evals/SKILL.md +55 -180
  161. package/skills/framework-map/SKILL.md +83 -145
  162. package/skills/github/SKILL.md +53 -111
  163. package/skills/hillclimb/SKILL.md +40 -163
  164. package/skills/mcp-auth/SKILL.md +48 -107
  165. package/skills/otel/SKILL.md +22 -68
  166. package/skills/setup-slack/SKILL.md +77 -208
  167. package/src/channels/deployments/types.ts +1 -0
  168. package/src/channels/origin/api.ts +242 -30
  169. package/src/channels/origin/binding.ts +2 -2
  170. package/src/channels/origin/checks.ts +6 -6
  171. package/src/channels/origin/cursor-account.ts +5 -3
  172. package/src/channels/slack/api.ts +41 -5
  173. package/src/channels/slack/defaults.ts +15 -49
  174. package/src/channels/slack/dispatch.ts +56 -22
  175. package/src/channels/slack/inbound.ts +43 -0
  176. package/src/channels/slack/live-delivery.ts +235 -114
  177. package/src/channels/slack/manifest.ts +5 -1
  178. package/src/channels/slack/nudge-carrier.ts +48 -1
  179. package/src/channels/slack/slack-channel.ts +2 -0
  180. package/src/files-backends/cursor-hosted.ts +40 -7
  181. package/src/internal/advertise-tools.ts +18 -2
  182. package/src/internal/bounded.ts +28 -0
  183. package/src/internal/cli-deploy.ts +12 -0
  184. package/src/internal/conversation-mirror.ts +145 -69
  185. package/src/internal/cursor/backend-client.ts +34 -58
  186. package/src/internal/cursor/session-token.ts +115 -0
  187. package/src/internal/cursor-agent-template.ts +1 -0
  188. package/src/internal/framework-file-storage.ts +222 -0
  189. package/src/internal/framework-storage-selection.ts +51 -11
  190. package/src/internal/hosted-delivery.ts +10 -0
  191. package/src/internal/init-project.ts +2 -0
  192. package/src/internal/install-cursor-skills.ts +1 -4
  193. package/src/internal/managed-delivery.ts +125 -0
  194. package/src/internal/runtime-dispatch-runner.ts +10 -0
  195. package/src/internal/sdk-runner.ts +56 -8
  196. package/src/internal/server.ts +2 -0
  197. package/src/internal/session-engine.ts +64 -4
  198. package/src/internal/steering.ts +17 -0
  199. package/src/storage-backends/cursor-hosted.ts +9 -7
  200. package/src/types.ts +2 -1
  201. package/templates/code-wiki/README.md +34 -0
  202. package/templates/code-wiki/agent/agent.ts +8 -0
  203. package/templates/code-wiki/agent/channels/github.ts +144 -0
  204. package/templates/code-wiki/agent/instructions.md +39 -0
  205. package/templates/code-wiki/agent/lib/repos.ts +5 -0
  206. package/templates/code-wiki/agent/lib/wiki.ts +22 -0
  207. package/templates/code-wiki/agent/tools/apply_wiki.ts +219 -0
  208. package/templates/code-wiki/evals/evals.config.ts +5 -0
  209. package/templates/code-wiki/evals/wiki.eval.ts +132 -0
  210. package/templates/code-wiki/init.json +25 -0
  211. package/templates/code-wiki/package.json +18 -0
  212. package/templates/code-wiki/tsconfig.json +12 -0
  213. package/dist/docs/assets/chunks/@localSearchIndexroot.oqPawjiD.js +0 -1
  214. package/dist/docs/assets/index.md.BoHaMdeZ.js +0 -5
  215. package/dist/internal/deployment-scm-event-stream.d.ts +0 -116
  216. package/dist/internal/deployment-scm-event-stream.d.ts.map +0 -1
  217. package/dist/internal/deployment-scm-event-stream.js +0 -474
  218. package/dist/playground/assets/index-CF7hUDnQ.css +0 -1
  219. package/src/internal/deployment-scm-event-stream.ts +0 -593
  220. /package/dist/docs/assets/{reference_cli.md.BsMOxDvh.lean.js → reference_cli.md.CCnG-nJx.lean.js} +0 -0
@@ -1,28 +1,26 @@
1
1
  ---
2
2
  name: agentsdk-github
3
3
  description: >-
4
- Build and test GitHub-webhook-driven Agent SDK agents: githubChannel
5
- hooks (auth turn vs host task), signature modes, and testing tiers
6
- (fixtures, github replay, github forward, serve --cursor-events). Use
7
- when wiring GitHub events, replaying PR webhooks, or debugging delivery.
4
+ Build and test GitHub-driven Agent SDK agents: githubChannel hooks
5
+ (auth turn vs host task), cursorAccount / --cursor-events, and
6
+ local test tiers (fixtures, replay, forward). Use when wiring
7
+ GitHub events or debugging delivery.
8
8
  ---
9
9
 
10
10
  # GitHub channels in the Agent SDK
11
11
 
12
- Public docs index: `node_modules/@cursor/july/dist/docs/llms.txt`. A running
13
- host serves the same index at `/docs/llms.txt`.
12
+ Author `agent/channels/github.ts`. Production wakes:
13
+ `cursorAccount` + `serve --cursor-events`. No public webhook URL.
14
+ Use the HTTP route for fixtures, replay, and hosts that already
15
+ terminate GitHub webhooks.
14
16
 
15
- Author `agent/channels/github.ts` with `githubChannel()` from
16
- `@cursor/july/channels/github`. It mounts
17
- `POST /<slug>/v1/channels/github` and publishes the events it dispatches on
18
- (derived from declared hooks, or pinned via `webhookEvents`) so the CLI can
19
- auto-derive forwarding.
17
+ Guide: `docs/guides/github.md`.
20
18
 
21
19
  ```ts
22
20
  import { defaultGitHubAuth, githubChannel } from "@cursor/july/channels/github";
23
21
 
24
22
  export default githubChannel({
25
- botName: "my-agent", // or GITHUB_APP_SLUG; used to ignore self-comments
23
+ botName: "my-agent",
26
24
  cursorAccount: { repos: ["owner/repo"] }, // permissions?: "read" | "pr-write" | "contents-write"
27
25
 
28
26
  onPullRequest: (ctx, pr) =>
@@ -33,39 +31,44 @@ export default githubChannel({
33
31
  ```
34
32
 
35
33
  Hooks: `onPullRequest`, `onComment`, `onIssue`, `onCheckSuite`,
36
- `onCheckRun`, `onWorkflowRun`, `onStatus`, plus catch-all `onEvent` and
37
- lifecycle `onStart`/`onStop`. Each hook returns one of:
34
+ `onCheckRun`, `onWorkflowRun`, `onStatus`, plus `onEvent` and
35
+ `onStart`/`onStop`.
38
36
 
39
37
  | Return | Meaning |
40
38
  | --- | --- |
41
- | `{ auth }` | Start/continue a **model turn** as that actor (a chat session exists; shows in the playground) |
42
- | `{ task }` | **Host-side work**, 202-ACKed immediately so it can run past GitHub's ~10s delivery timeout (no chat session) |
43
- | `null` | Skip this delivery |
44
-
45
- Use `{ task }` for deterministic pipelines (a security reviewer can run its
46
- whole review loop this way and report via commit status); use `{ auth }` when
47
- the model should reason about the event.
48
-
49
- ## Auth modes
50
-
51
- - **`cursorAccount`** the signed-in Cursor principal supplies both the SCM
52
- event stream and a short-lived, repo-scoped GitHub credential. It works in
53
- local dev (`agent-sdk login`) and hosted deployments (`CURSOR_API_KEY`).
54
- `ctx.github`, `ctx.host.github`, and child `gh` commands share the lease.
55
- Use `{ repos: ["owner/repo"] }`, or `true` with `serve --cursor-events
56
- --repo owner/repo`. One host credential covers up to 20 repositories under
57
- one GitHub owner; it cannot span owners.
58
- - **Secret set** → route auth is `allowAll()` + `X-Hub-Signature-256`
59
- verification before parsing; the HMAC becomes the request principal.
60
- - **No secret** `localDevStrict()` (loopback only) except under
61
- `serve --dev`, which admits **unsigned loopback** deliveries so fixtures
62
- and forwarding work with zero config.
63
- - Non-dev targets always need the secret; keep the same value on the
64
- server and whatever signs deliveries.
65
-
66
- ## Testing tiers pick deliberately
67
-
68
- ### 1. Saved fixtures (offline, free)
39
+ | `{ auth }` | Model turn. Session shows in the playground. `workspaceFiles` can be a function. |
40
+ | `{ task }` | Host work. No chat session. Use when the work can outlive a webhook timeout. |
41
+ | `null` | Skip |
42
+
43
+ To keep repo scope in deploy config, use `cursorAccount: true`
44
+ and pass `--repo owner/name` at serve / `--cursor-events-repo`
45
+ at deploy. Repos must share one GitHub owner.
46
+
47
+ ## Event sources
48
+
49
+ | Source | When |
50
+ | --- | --- |
51
+ | `cursorAccount` + `serve --cursor-events` | Preferred. Signed-in host (`agent-sdk login` / `CURSOR_API_KEY`). Repos from the channel and from repeatable `--repo owner/name`. Cap 20, one GitHub owner |
52
+ | HTTP `POST /<slug>/v1/channels/github` with a webhook secret | `allowAll()` + `X-Hub-Signature-256` |
53
+ | HTTP, no secret | Loopback only. `serve --dev` also admits unsigned loopback (fixtures / forward) |
54
+
55
+ `permissions`: `"read"` inspect; `"pr-write"` (default) comments /
56
+ PR writes; `"contents-write"` push or merge-box checks.
57
+ `progress.commitStatus` needs check-write; see the GitHub guide.
58
+ Set `checks: true` when channel code posts its own Checks API
59
+ runs through `ctx.github.createCheck`. The flag grants access.
60
+ It does not post a check.
61
+
62
+ Without `cursorAccount`, outbound calls prefer App installation
63
+ tokens (`GITHUB_APP_ID` + `GITHUB_APP_PRIVATE_KEY`). Local tests
64
+ can use `GITHUB_TOKEN` / `gh auth login`.
65
+
66
+ The Cursor stream is metadata, not full webhook bodies. Re-read
67
+ the PR from GitHub.
68
+
69
+ ## Test locally
70
+
71
+ 1. **Fixtures** (offline, `--dev`, no signature):
69
72
 
70
73
  ```bash
71
74
  curl -s -X POST http://127.0.0.1:3000/<slug>/v1/channels/github \
@@ -74,87 +77,26 @@ curl -s -X POST http://127.0.0.1:3000/<slug>/v1/channels/github \
74
77
  -d @fixtures/github/pull_request.synchronize.json
75
78
  ```
76
79
 
77
- No signature needed against `--dev`. Snapshot fixtures with replay's
78
- `--dry-run --out` (below) instead of hand-writing payloads.
79
-
80
- ### 2. `github replay` — deterministic, read-only (the hillclimbing tier)
81
-
82
- Reads a real PR via `gh api` (**pull access is enough** — `GITHUB_TOKEN`
83
- is fine here), synthesizes GitHub-shaped payloads, signs them when a secret
84
- is configured, and POSTs them at the channel. Fully deterministic.
80
+ 2. **Replay** (hillclimb tier; pull access is enough):
85
81
 
86
82
  ```bash
87
- agent-sdk github replay https://github.com/owner/repo/pull/123 --dir <project>
88
- agent-sdk github replay owner/repo#123 --dir <project> --events '*' --conclusion failure
83
+ agent-sdk github replay owner/repo#123 --dir <project>
89
84
  agent-sdk github replay owner/repo#123 --dir <project> --events '*' --dry-run --out fixtures/github
90
85
  ```
91
86
 
92
- `--events` defaults to `pull_request` (`'*'` = the channel's declared
93
- set); `--action` / `--conclusion` / `--comment` / `--context` shape each
94
- event; `--secret` or `GITHUB_WEBHOOK_SECRET` signs.
95
-
96
- ### 3. `github forward` — live deliveries (needs repo admin)
97
-
98
- Wraps `gh webhook forward`: registers a real webhook and relays deliveries
99
- to loopback. URL + events auto-derived; repo inferred from the git remote.
87
+ 3. **Forward** (live; repo admin). One forwarder per repo. Blank
88
+ `GITHUB_TOKEN`/`GH_TOKEN` or every delivery 401s:
100
89
 
101
90
  ```bash
102
- agent-sdk github doctor --install # one-time: gh + cli/gh-webhook
103
- agent-sdk github events --dir <parent> --json # what would be forwarded
91
+ agent-sdk github doctor --install
104
92
  GITHUB_TOKEN= GH_TOKEN= agent-sdk github forward --dir <project>
105
93
  ```
106
94
 
107
- Traps, in order of hours lost:
108
-
109
- 1. **`GITHUB_TOKEN`/`GH_TOKEN` in the env → every delivery 401s** while
110
- hook creation still succeeds. The relay authenticates with the gh CLI
111
- login and rejects env tokens. Blank them for the command. `doctor` and
112
- `forward` warn about this.
113
- 2. **One forwarder per repo** (GitHub limit). Point one
114
- `forward --dir <parent>` at a folder of agents and it fans out each raw,
115
- still-signed delivery to every channel whose event set matches; N
116
- separate forwarders collide with `Hook already exists`.
117
- 3. Requires **admin** on the repo (org owner for `--org`) — if you lack
118
- it, use replay.
119
- 4. Best-effort dev relay: deliveries while the process is down are lost.
120
-
121
- `--repo owner/repo` / `--org ORG` override the target, `--events` narrows,
122
- `--url` points at a tunnel, `--slug` / `--channel` target one agent.
123
-
124
- ### 4. `serve --cursor-events` — pull from Cursor (`/v0/scm-events`)
95
+ 4. **Cursor pull** (same as production):
125
96
 
126
97
  ```bash
127
98
  agent-sdk serve --dir <project> --cursor-events --repo owner/repo
128
99
  ```
129
100
 
130
- Reads the stream as the host's Cursor user, so it **requires sign-in**
131
- (`agent-sdk login` / `CURSOR_API_KEY`) `serve` refuses to start signed
132
- out instead of running a relay that can never receive events. No public URL
133
- or repo admin. Registers before consuming; offset + consumer id under
134
- `<state-root>/cursor-events/`. `CURSOR_API_BASE_URL` for a non-default
135
- backend. Each event includes the verified webhook payload when the API
136
- stored it.
137
-
138
- ## Production-shaped channel patterns
139
-
140
- Steal these when an agent must survive real webhook volume — each one
141
- against its measured load signal, not as a starter kit. Debounce needs
142
- event bursts you have seen; persisted buffers need wakes you cannot afford
143
- to drop; affinity stores need cross-channel resume you actually do.
144
- Preinstalling all of them is how a channel file hits 400 lines before the
145
- first real delivery.
146
-
147
- - **Debounce per PR** (~3s, latest event wins) and re-buffer while CI
148
- settles; skip a flush when a turn for that PR is already in flight.
149
- - **Persist the buffer before ACKing** the webhook in `host.kv`, then
150
- restore it on channel start. A restart must not drop buffered wakes.
151
- - **Stable continuation key** `pr:owner/repo#N` so every wake resumes the
152
- PR's session. Cross-channel resume needs an affinity store mapping PR →
153
- SDK agent id (write it from an `agent.bound` hook with `ctx.host.kv`).
154
- - **Discard payload details in wake prompts** — send a generic "re-check
155
- the PR" refresh; the agent re-reads ground truth instead of trusting a
156
- stale payload.
157
- - **Cancel PR-scoped reminders on `pull_request.closed`.**
158
- - No repo allowlist means the channel wakes for whatever deliveries
159
- reach it — decide explicitly what repos an agent may act on, and
160
- remember each wake spends real model budget.
101
+ Volume, debounce, and `progress.commitStatus` / `progress.banner`
102
+ live in `docs/guides/github.md`. Do not preinstall them.
@@ -1,186 +1,63 @@
1
1
  ---
2
2
  name: agentsdk-hillclimb
3
3
  description: >-
4
- Iterate on a specific Agent SDK agent by running the local server,
5
- sending real requests, measuring correctness/efficiency, and proposing
6
- the next harness or prompt change. Read this skill when improving an
7
- existing agent.
8
- paths:
9
- - packages/agent-serve/**/*
4
+ Improve one existing Agent SDK agent: pin fixtures, measure, change
5
+ one lever, remeasure, lock the win with an eval. Use when an agent
6
+ already runs and needs better results.
10
7
  ---
11
8
 
12
9
  # Agent SDK hillclimb
13
10
 
14
- Public docs index: `node_modules/@cursor/july/dist/docs/llms.txt`. A running
15
- host serves the same index at `/docs/llms.txt`.
11
+ Measure change one lever → remeasure. One failure mode per round.
16
12
 
17
- Optimize one Agent SDK agent project
18
- with a tight measure → change → remeasure loop. Do not redesign the
19
- whole framework; climb one concrete failure mode at a time. Sibling skills:
20
- `framework-map` (orientation), `evals` (the ratchet), `ab` (live variant
21
- metrics under serve), `github` (deterministic webhook replay), `debug`
22
- (when a run misbehaves rather than underperforms).
13
+ Siblings: `skills/evals/SKILL.md`, `skills/github/SKILL.md`,
14
+ `skills/debug/SKILL.md`.
23
15
 
24
16
  ## Preconditions
25
17
 
26
- Confirm with the user (or take from the invoking message):
18
+ From the user or the invoking message:
27
19
 
28
- 1. **Target agent** — path or slug, e.g. `./my-agent`
29
- 2. **Fixture(s)** fixed inputs to compare across runs (PR URL, webhook
30
- payload, playground prompt, etc.)
31
- 3. **Success criteria** what “better” means this round (fewer tools, faster
32
- wall time, higher finding quality, fewer wrong side-effects, …)
33
- 4. **Freeze line** — what must not change (API contracts, public output shape)
20
+ 1. **Target.** Path or slug
21
+ 2. **Fixtures.** Fixed inputs
22
+ 3. **Success.** What better means this round
23
+ 4. **Freeze line.** What must not change
34
24
 
35
- If those are missing, ask before editing.
25
+ Ask before editing if any are missing. A moving fixture is noise.
36
26
 
37
- ## Make the fixture deterministic first
38
-
39
- A climb over a moving input is noise. Before round 1:
40
-
41
- - **GitHub agents** — replay, don't wait for live events:
42
- `agent-sdk github replay <pr> --dir <project>` synthesizes signed,
43
- GitHub-shaped payloads from read access only, identically every run;
44
- `--dry-run --out fixtures/github` snapshots them for offline replay.
45
- - **Tool behavior** — isolate host tools from the model with
46
- `agent-sdk call <tool> --dir <project> --input '{...}'` (schema-validated,
47
- in-process, no turn). If the tool output is wrong, no prompt change fixes it.
48
- - **Chat agents** — `agent-sdk run --dir <project> --message "<fixture>"`
49
- gives a JSON trajectory plus an NDJSON trace under
50
- `<project>/.agent-serve/traces/`; `agent-sdk trajectory --events <file>`
51
- re-summarizes any saved trace.
52
- - **Manual probes** — the playground Try modal on any channel route
53
- remembers your last body per endpoint and has Copy curl; a successful Try
54
- opens the created session.
55
-
56
- ## Loop
57
-
58
- Repeat until the user stops or fixtures meet the criteria.
59
-
60
- ### 1. Baseline
61
-
62
- - Serve with Node (never Bun):
63
-
64
- ```bash
65
- agent-sdk serve --dir <project> --dev
66
- ```
67
-
68
- - Hit the agent the way a user would (channel HTTP, playground, Slack in
69
- `--dev` if that is the surface under test).
70
-
71
- Custom channels live at `http://127.0.0.1:3000/<slug>/v1/channels/<id>`.
72
- Playground: `http://127.0.0.1:3000/<slug>/playground`.
73
-
74
- - Record for each fixture:
75
- - HTTP/status and wall time
76
- - `sessionId` + playground URL
77
- - final result text / structured output
78
- - tool trajectory from session `events.ndjson` (`actions.requested` /
79
- `action.result`)
80
- - workspace footprint (what the host seeded vs what the model opened)
81
-
82
- Sessions typically live under:
83
-
84
- `<project>/.agent-serve/<slug>/sessions/<sessionId>/`
85
-
86
- ### 2. Reflect
87
-
88
- Score the run on three axes; cite evidence from the trajectory, not vibes.
89
-
90
- | Axis | Ask |
27
+ | Surface | Pin it |
91
28
  | --- | --- |
92
- | **Correctness** | Right answer / findings? Misses? Hallucinated context? |
93
- | **Efficiency** | Tool-call count, redundant reads/greps, fat evidence, latency |
94
- | **Harness fit** | Did the model invent work the host should have done? Escape the intended workspace? Fight the instructions? |
95
-
96
- Name the **single dominant failure mode** for this round (e.g. “full-file dumps
97
- trigger grep loops”, “skill not on disk so model searches the monorepo”).
98
-
99
- ### 3. Propose one change
100
-
101
- Prefer the smallest lever that addresses that failure mode — and check the
102
- subtractive lever first:
103
-
104
- 0. **Deletion** — remove the code, cache, flag, or prompt that caused the
105
- failure. A round that shrinks the agent while holding the metrics is a
106
- win, not a wash.
107
- 1. **Instructions / skills** — tighten procedure, state the output contract
108
- (shape, sections, caps), forbid escape hatches that invite thrash. First
109
- lever for quality, formatting, and wording failures.
110
- 2. **Evidence shape** — trim, split, or order artifacts so the intended file
111
- is primary
112
- 3. **Host prep** — deterministic tools / channel handlers seed only what the
113
- model needs (`workspaceFiles`, channel `callTool`, …). First lever for
114
- tool-wandering and latency failures. Prep evidence and gate side effects;
115
- do **not** move formatting, summarizing, or classification here — that is
116
- the model's job specified badly, and host code is a permanent tax (types,
117
- tests, restarts, drift).
118
- 4. **Tool surface** — remove or gate tools that enable wandering
119
- 5. **Framework changes** only if the agent cannot express the fix otherwise —
120
- but when the gap is plumbing the framework should own (posting, chunking,
121
- auth, retries), extend it or file the gap. A hand-rolled transport
122
- workaround in `agent/lib/` outlives the gap and never flows back.
123
-
124
- State the hypothesis in one sentence: *“If we X, metric Y should move because Z.”*
125
-
126
- ### 4. Apply and remeasure
29
+ | GitHub | `agent-sdk github replay <pr> --dir <project>` (`--dry-run --out fixtures/github`) |
30
+ | One tool | `agent-sdk call <tool> --dir <project> --input '{...}'` |
31
+ | Chat | `agent-sdk run --dir <project> --message "<fixture>"` |
127
32
 
128
- - Implement the change.
129
- - Restart serve if needed (agent project code or package `src/`).
130
- - Re-run the **same** fixtures.
131
- - Diff metrics side-by-side (tools, bytes, time, quality notes).
132
- - Keep the change only if the target metric improves without regressing the
133
- freeze line; otherwise revert or narrow.
134
- - **Ratchet every kept change**: land an eval that would have failed before
135
- it (tool-choice gate, `action.result` count bound, output-shape regex —
136
- see `evals/SKILL.md`), and never weaken an existing gate to make a round
137
- pass. `agent-sdk eval --dir <project> --json` is the regression check
138
- between rounds.
139
-
140
- Present a short round report to the user before starting the next climb.
141
-
142
- ## Measurement tips
143
-
144
- - Prefer `action.result` counts by `toolName` over raw event volume.
145
- - Log paths the model actually read; escape outside the session workspace is a
146
- harness smell.
147
- - Separate **host** work (channel `callTool`, prepare steps) from **model**
148
- tools when blaming latency. The biggest wins this framework has seen came
149
- from moving deterministic work to the host (one PR reviewer's host-prepared
150
- reviews cut ~8-minute tool-wandering turns to ~1 minute), not from prompt
151
- tuning.
152
- - The reverse also holds: every optimization on the deterministic path —
153
- prefetch, fingerprint dedupe, write coalescing, TTL caches — is code, tests,
154
- and flags forever. Add one only against measured pressure (wake volume,
155
- rate-limit hits, model spend) recorded in the round report; when the data
156
- says the cache would rarely hit, don't build it.
157
- - For quality, spot-check against a known-good review or oracle on at least
158
- one fixture; efficiency-only climbs will silently drop findings.
159
- - `turn.failed` with `"turn interrupted"` in a trace means a follow-up or
160
- stop preempted the turn — measurement artifact, not a regression.
161
-
162
- ## Working agreements
163
-
164
- - One failure mode per round — no mixed “also rewrite instructions while
165
- trimming evidence” bundles unless the user asks.
166
- - Climbs accrete; schedule the counter-move. Every few rounds propose a
167
- **shrink round**: dead flags, caches that never hit (the disposition
168
- metrics tell you), host renderers the model could own under an output
169
- contract. The eval suite is exactly what makes deletion safe.
170
- - Keep fixtures fixed until a climb explicitly needs a harder case.
171
- - Use mise/Node workflows already documented for this package; do not introduce
172
- Bun.
173
- - Do not deploy, post real GitHub reviews, or push unless the user asks.
174
- - Commit only when asked.
33
+ ## Loop
175
34
 
176
- ## Round report template
35
+ 1. **Serve.** `agent-sdk serve --dir <project> --mode single --dev`
36
+ Playground: `http://127.0.0.1:3000/playground`.
37
+ 2. **Hit it.** Same path a user would. Record status, wall time,
38
+ `sessionId`, output, and `action.result` counts by `toolName`.
39
+ 3. **Name the failure.** Score correctness, efficiency, harness
40
+ fit. One dominant failure this round.
41
+ 4. **Change one lever.** Smallest first. Delete the code or prompt
42
+ that caused it. Then instructions / skills, evidence shape,
43
+ host prep (`workspaceFiles`, channel `callTool`) for wandering
44
+ and latency (not formatting or judgment), remove or gate
45
+ wandering tools, framework only if the agent cannot express
46
+ the fix. Hypothesis: *If we X, metric Y should move because Z.*
47
+ 5. **Remeasure.** Same fixtures. Keep only if the target metric
48
+ improves and the freeze line holds.
49
+ 6. **Lock.** A kept change gets an eval that would have failed
50
+ before it (`skills/evals/SKILL.md`). Never weaken a gate to
51
+ pass a round.
177
52
 
178
53
  ```markdown
179
- ### Hillclimb round N — <slug>
54
+ ### Hillclimb round N. `<slug>`
180
55
  - Fixture(s): …
181
56
  - Hypothesis: …
182
- - Change: <files / one-liner>
183
- - Before → after: tools …; wall …; evidence …; quality …
57
+ - Change:
58
+ - Before → after: tools …; wall …; quality …
184
59
  - Verdict: keep | revert | narrow
185
- - Next failure mode (if any):
60
+ - Next failure mode:
186
61
  ```
62
+
63
+ Do not deploy or post real GitHub reviews unless asked.
@@ -2,139 +2,80 @@
2
2
  name: agentsdk-mcp-auth
3
3
  description: >-
4
4
  Authorize host MCP OAuth for defineConnection({ url, oauth: true }):
5
- agent-sdk mcp oauth, local mcp-auth.json, --store deployment secrets,
6
- advertiseTools, and egress. Read when wiring or debugging MCP auth.
5
+ agent-sdk mcp oauth, local tokens, --store, advertiseTools, egress.
6
+ Use when wiring or debugging MCP auth.
7
7
  ---
8
8
 
9
- # Host MCP OAuth (mcp auth)
9
+ # Host MCP OAuth
10
10
 
11
- Public docs index: `node_modules/@cursor/july/dist/docs/llms.txt`. A running
12
- host serves the same index at `/docs/llms.txt`.
13
-
14
- Use this skill when a human asks to authorize a remote MCP server on an
15
- Agent SDK host, store credentials for Cursor-managed hosting, or debug
16
- `host.mcp` auth failures for `oauth: true` connections.
17
-
18
- Sibling skills: `framework-map` for layout, `create-agent` when scaffolding,
19
- `debug` for unrelated local failures, `operate` for deploy/secrets ops.
20
-
21
- Docs: `docs/guides/mcp-oauth.md`, `docs/reference/connections.md`,
22
- `docs/reference/cli.md#mcp-oauth`.
23
-
24
- ## When to use host OAuth vs account MCP
11
+ Guide: `docs/guides/mcp-oauth.md`.
25
12
 
26
13
  | Need | Use |
27
14
  | --- | --- |
28
- | Connector already in Cursor dashboard (Linear, Notion, …) | `defineConnection({ cursorAccount: true })` or `servers: "*"` for every connected server; `servers: […]` to allowlist |
29
- | Remote URL that speaks OAuth; host must hold tokens | `defineConnection({ url, oauth: true })` + this skill |
30
- | Static bearer / API key | `headers` / env on a plain `{ url }` connection |
31
-
32
- For connectors the model should call by name on local turns (Linear,
33
- Datadog, account MCP), set `advertiseTools: true`. Host tools can still
34
- call the same connection through `ctx.host.mcp`.
35
-
36
- ## Goal checklist
37
-
38
- - [ ] `agent/mcp-connections/<name>.ts` with `url` + `oauth: true` (`advertiseTools` if the model should call it by name). Use `agent/host-connections/<name>.ts` when host tools should call it and the model should not.
39
- - [ ] `hosting.secretNames` lists `MCP_OAUTH_<NAME>_{ACCESS_TOKEN,REFRESH_TOKEN,CLIENT_ID}` when you will `--store`
40
- - [ ] Hosted engines that reach non-bootstrap hosts declare `hosting.egressDomains`
41
- - [ ] Local: `agent-sdk mcp oauth <name>` succeeds
42
- - [ ] Hosted: `agent-sdk mcp oauth <name> --store` then redeploy; `secrets list` shows the names
43
-
44
- ## Phase 0 — Author the connection (agent)
15
+ | Connector already in the Cursor dashboard | `defineConnection({ cursorAccount: true })` or `servers: "*"` / `servers: […]` |
16
+ | Remote URL that speaks OAuth; host holds tokens | `defineConnection({ url, oauth: true })` + this skill |
17
+ | Static bearer / API key | `headers` / env on `{ url }` |
18
+
19
+ `advertiseTools: true` puts named tools on local turns. Host tools
20
+ can still call `ctx.host.mcp`.
21
+
22
+ ## Checklist
23
+
24
+ 1. **Declare the connection.** `agent/mcp-connections/<name>.ts`
25
+ with `url` + `oauth: true`. Use `agent/host-connections/` when
26
+ the model must not see it.
27
+ 2. **Name the secrets** if you will `--store`:
28
+ `hosting.secretNames` lists
29
+ `MCP_OAUTH_<NAME>_{ACCESS_TOKEN,REFRESH_TOKEN,CLIENT_ID}`.
30
+ 3. **Allow egress** on hosted non-bootstrap hosts:
31
+ `hosting.egressDomains`.
32
+ 4. **Authorize.** Local: `agent-sdk mcp oauth <name>`. Hosted:
33
+ `agent-sdk mcp oauth <name> --store` then `agent-sdk deploy`.
34
+ `secrets list` shows the names.
45
35
 
46
36
  ```ts
47
37
  // agent/mcp-connections/inventory.ts
48
- import { defineConnection } from "@cursor/july/connections";
49
-
50
38
  export default defineConnection({
51
39
  url: "https://mcp.example.com/inventory",
52
40
  oauth: true,
53
- description: "Inventory MCP.",
54
41
  });
55
42
  ```
56
43
 
57
- In `agent/agent.ts`:
58
-
59
- ```ts
60
- hosting: {
61
- egressDomains: ["mcp.example.com"], // if hosted + non-bootstrap host
62
- secretNames: [
63
- "MCP_OAUTH_INVENTORY_ACCESS_TOKEN",
64
- "MCP_OAUTH_INVENTORY_REFRESH_TOKEN",
65
- "MCP_OAUTH_INVENTORY_CLIENT_ID",
66
- ],
67
- },
68
- ```
69
-
70
- Naming: connection file `inventory.ts` → env prefix `MCP_OAUTH_INVENTORY`.
71
- Do **not** put `CURSOR_*` or hosted-storage names in `secretNames`.
72
-
73
- Wire privileged calls through host tools:
74
-
75
44
  ```ts
76
- await ctx.host.mcp.callTool("inventory", "list_warehouses", {
77
- region: input.region,
45
+ // agent/agent.ts
46
+ export default defineAgent({
47
+ hosting: {
48
+ secretNames: [
49
+ "MCP_OAUTH_INVENTORY_ACCESS_TOKEN",
50
+ "MCP_OAUTH_INVENTORY_REFRESH_TOKEN",
51
+ "MCP_OAUTH_INVENTORY_CLIENT_ID",
52
+ ],
53
+ egressDomains: ["mcp.example.com"],
54
+ },
78
55
  });
79
56
  ```
80
57
 
81
- Set `advertiseTools: true` when the model should call the server by name
82
- instead of through MCP meta-tools.
83
-
84
- ## Phase 1 — Local authorize (agent + human)
58
+ File `inventory.ts` prefix `MCP_OAUTH_INVENTORY`. Do not put
59
+ `CURSOR_*` names in `secretNames`.
85
60
 
86
61
  ```bash
87
- cd <agent-project>
88
62
  agent-sdk mcp oauth <connection>
89
- ```
90
-
91
- Human completes the browser login. Callback:
92
- `http://localhost:8787/callback`. Tokens:
93
- `~/.config/agent-serve/mcp-auth.json` (or `$AGENT_SERVE_CONFIG_DIR`).
94
-
95
- Already authorized → command prints that and exits 0. URL change →
96
- re-run; resource URL binding drops the old entry.
97
-
98
- ## Phase 2 — Store on the deployment (agent + human)
99
-
100
- Requires `agent-sdk login` (or `CURSOR_API_KEY`) and deploy rights.
101
-
102
- ```bash
103
- agent-sdk mcp oauth <connection> --store [--slug <slug>] [--team <id>]
63
+ agent-sdk mcp oauth <connection> --store [--slug <slug>]
104
64
  agent-sdk secrets list <slug>
105
- agent-sdk deploy # or your usual deploy; secrets apply next deploy
65
+ agent-sdk deploy
106
66
  ```
107
67
 
108
- `--store` upserts access (required), refresh (if present), and client id
109
- (if present). It does not remove unrelated secrets.
110
-
111
- ## Phase 3 Verify (agent)
112
-
113
- Local:
114
-
115
- ```bash
116
- agent-sdk validate --dir .
117
- agent-sdk call <tool-that-uses-host.mcp> --dir .
118
- # or exercise the same path from the playground
119
- ```
120
-
121
- Hosted: confirm egress allowlist includes the MCP host, secrets exist,
122
- redeploy completed, then exercise the same host tool once.
123
-
124
- ## Failure table
68
+ Browser callback: `http://127.0.0.1:8787/callback`. Tokens live in
69
+ the CLI config directory (`mcp-auth.json` or
70
+ `$AGENT_SERVE_CONFIG_DIR`). URL change drops the old entry; re-run.
71
+ `--store` does not restart a running engine.
125
72
 
126
73
  | Symptom | Fix |
127
74
  | --- | --- |
128
- | `must be defineConnection({ url, oauth: true })` | Wrong connection name, or missing `oauth: true` |
129
- | `Unknown MCP connection` | Filename under `agent/mcp-connections/` or `agent/host-connections/` must match CLI arg |
130
- | Callback hang | Free port 8787; finish browser flow on this machine |
131
- | Hosted 401 / unauthorized | `secrets list`; re-run `--store`; redeploy |
132
- | Model invents `mcp_auth` / IDE MCP | Attached MCP is behind meta-tools. Set `advertiseTools: true` for named tools on local turns. |
133
- | Tokens ignored after URL edit | Expected; run `mcp oauth` again for the new resource URL |
134
-
135
- ## Don't
75
+ | `must be defineConnection({ url, oauth: true })` | Wrong name or missing `oauth: true` |
76
+ | `Unknown MCP connection` | Filename must match the CLI arg |
77
+ | Callback hang | Free port 8787; finish the browser flow here |
78
+ | Hosted 401 | `secrets list`; `--store`; redeploy |
79
+ | Model invents `mcp_auth` / IDE MCP | `advertiseTools: true` on local turns |
136
80
 
137
- - Don't put raw OAuth tokens in git or in connection source files
138
- - Don't add `BUGBOTDB_URL` / `AGENT_SERVE_DEPLOYMENT_ID` to `secretNames`
139
- - Don't use Bun for the CLI (use Node / `tsx`)
140
- - Don't expect `--store` alone to restart a running engine; redeploy
81
+ No raw tokens in git.