@pushary/agent-hooks 1.0.0 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. package/data/SKILL.md +250 -49
  2. package/data/cursor-plugin/scripts/pushary-gate.mjs +24 -0
  3. package/data/cursor-plugin/skills/pushary/SKILL.md +250 -49
  4. package/data/vscode-plugin/scripts/pushary-gate.mjs +24 -0
  5. package/data/vscode-plugin/skills/pushary/SKILL.md +250 -49
  6. package/dist/bin/pushary-bell-hook.js +18 -18
  7. package/dist/bin/pushary-bell.js +6 -6
  8. package/dist/bin/pushary-claude.js +18 -18
  9. package/dist/bin/pushary-clean.js +19 -19
  10. package/dist/bin/pushary-codex-bridge.js +10 -10
  11. package/dist/bin/pushary-codex-hook.js +22 -22
  12. package/dist/bin/pushary-codex.js +6 -6
  13. package/dist/bin/pushary-connect.js +6 -6
  14. package/dist/bin/pushary-cowork.js +3 -3
  15. package/dist/bin/pushary-daemon.js +22 -22
  16. package/dist/bin/pushary-disconnect.js +10 -10
  17. package/dist/bin/pushary-doctor.js +50 -20
  18. package/dist/bin/pushary-elicitation-hook.js +17 -17
  19. package/dist/bin/pushary-gemini-bridge.js +9 -9
  20. package/dist/bin/pushary-gemini-hook.js +19 -19
  21. package/dist/bin/pushary-hook.js +23 -23
  22. package/dist/bin/pushary-login.js +7 -7
  23. package/dist/bin/pushary-logout.js +4 -4
  24. package/dist/bin/pushary-mode.js +3 -3
  25. package/dist/bin/pushary-notification-hook.js +20 -20
  26. package/dist/bin/pushary-opencode-hook.js +19 -19
  27. package/dist/bin/pushary-permission-denied-hook.js +24 -24
  28. package/dist/bin/pushary-permission-hook.js +23 -23
  29. package/dist/bin/pushary-post-hook.js +20 -20
  30. package/dist/bin/pushary-prompt-hook.js +20 -20
  31. package/dist/bin/pushary-session-end-hook.js +20 -20
  32. package/dist/bin/pushary-session-start-hook.js +22 -22
  33. package/dist/bin/pushary-setup.js +26 -26
  34. package/dist/bin/pushary-stats.js +2 -2
  35. package/dist/bin/pushary-status.js +10 -10
  36. package/dist/bin/pushary-stop-hook.js +20 -20
  37. package/dist/bin/pushary-stopfailure-hook.js +20 -20
  38. package/dist/bin/pushary-transcript-register.js +16 -16
  39. package/dist/bin/pushary-transcripts.js +4 -4
  40. package/dist/bin/pushary-upgrade.js +14 -14
  41. package/dist/bin/pushary-wait.js +3 -3
  42. package/dist/{chunk-IBU7UU3R.js → chunk-2MOQUNFL.js} +1 -1
  43. package/dist/{chunk-MSOFZYI3.js → chunk-6JUCFMSF.js} +3 -3
  44. package/dist/{chunk-MGI6MLFU.js → chunk-6T4OINZB.js} +3 -3
  45. package/dist/{chunk-TVY7AT6O.js → chunk-76ZCJZBK.js} +1 -1
  46. package/dist/{chunk-XK34HTMW.js → chunk-AH5OO2YZ.js} +3 -3
  47. package/dist/{chunk-7ZDFVWRR.js → chunk-BBUZD7MU.js} +1 -1
  48. package/dist/{chunk-I3TWY7GH.js → chunk-DKTFZCLQ.js} +6 -6
  49. package/dist/{chunk-2SL5X7UB.js → chunk-DZYIAMKR.js} +4 -4
  50. package/dist/{chunk-A3D43VXO.js → chunk-E3WQMDCE.js} +1 -1
  51. package/dist/{chunk-LTPQKBJH.js → chunk-EWQZISYV.js} +1 -1
  52. package/dist/{chunk-R744XA2M.js → chunk-EZ3GX3NS.js} +5 -5
  53. package/dist/{chunk-GTR72MIU.js → chunk-FO4HHPMO.js} +1 -1
  54. package/dist/{chunk-3C4ERARU.js → chunk-IH7YUPFN.js} +3 -3
  55. package/dist/{chunk-EMCNSBF3.js → chunk-INBTKFT6.js} +1 -1
  56. package/dist/{chunk-Y55JNI2I.js → chunk-IPDBFJ2M.js} +1 -1
  57. package/dist/{chunk-DMJTWULU.js → chunk-ISELLVBP.js} +1 -1
  58. package/dist/{chunk-7WMFPYR5.js → chunk-J7PJALS2.js} +1 -1
  59. package/dist/{chunk-IWZG2Y4Z.js → chunk-LQ3BHPPZ.js} +1 -1
  60. package/dist/{chunk-BOZETFXB.js → chunk-LUYYB6V2.js} +1 -1
  61. package/dist/{chunk-447SBIC7.js → chunk-MR2PWE62.js} +5 -4
  62. package/dist/{chunk-IYA3NCZG.js → chunk-MZUXTN7X.js} +2 -2
  63. package/dist/{chunk-3UUAK2AK.js → chunk-OYYQHJAO.js} +1 -1
  64. package/dist/{chunk-BPD4P3NN.js → chunk-PHJOSAXW.js} +2 -2
  65. package/dist/{chunk-XKDKUFMP.js → chunk-PQG6NTPT.js} +1 -1
  66. package/dist/{chunk-RFNMSC6N.js → chunk-PUDQJ772.js} +1 -1
  67. package/dist/{chunk-HGEI7SVM.js → chunk-PWIMJP4U.js} +6 -6
  68. package/dist/{chunk-ZZIUQVAN.js → chunk-QACXZYDA.js} +4 -4
  69. package/dist/{chunk-D2N2EJH2.js → chunk-RZTH4MIY.js} +2 -2
  70. package/dist/{chunk-XNXIMIFY.js → chunk-S2BNTXP6.js} +1 -1
  71. package/dist/{chunk-UWQVODHT.js → chunk-SA6UB3GD.js} +1 -1
  72. package/dist/{chunk-CDTGL7TT.js → chunk-SLEWDZOA.js} +1 -1
  73. package/dist/{chunk-HS2KEAFD.js → chunk-SM54HHVY.js} +5 -5
  74. package/dist/{chunk-DOYARIYB.js → chunk-UP7NZXJU.js} +1 -1
  75. package/dist/{chunk-DUOG74E7.js → chunk-VACFOGF3.js} +1 -1
  76. package/dist/{chunk-TTBRBWAK.js → chunk-VQYARC2K.js} +1 -0
  77. package/dist/{chunk-MDV7ZRAT.js → chunk-WTT24AUA.js} +4 -4
  78. package/dist/{chunk-S2W4ZSHE.js → chunk-XIHKSZHL.js} +1 -1
  79. package/dist/{chunk-2PS3DTHQ.js → chunk-YM4G6CFN.js} +3 -3
  80. package/dist/{reapply-I4NB5SSM.js → reapply-STSGYPF2.js} +8 -8
  81. package/dist/src/index.js +12 -12
  82. package/package.json +1 -1
package/data/SKILL.md CHANGED
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: pushary
3
- version: 0.9.4
3
+ version: 0.10.0
4
4
  description: Push notifications and human-in-the-loop for AI agents. Use this whenever a running agent needs a human and nobody is at the terminal, such as before an irreversible or destructive action, before spending money, deploying, force-pushing or deleting, when blocked on a decision outside your authority, when running unattended and you hit a genuine ambiguity, when another skill's workflow says to confirm with the user, and when a long task finishes or fails with nobody watching. Also use it when the user says things like keep going and ping me on my phone if you need anything, notify me when my agent needs me, approve from my phone, ask me questions while I am away from the terminal, run this overnight, keep working while I am in a meeting, I am stepping away, do not wait for me, or wants a long task to run unattended. Send alerts when tasks finish or fail, ask questions (yes/no, multiple choice, or free text) via push, and get answers from their connected devices. Use these tools proactively - do not wait for the user to ask for notifications. Every question and answer is recorded, so an unattended run stays reviewable afterwards. Works with Claude Code, Codex, Cursor, VS Code, Windsurf, Hermes, Lovable, or any MCP client; no Claude Max subscription required. Pushary is a hosted service, $9.99/mo after a 3-day card-first trial.
5
5
  metadata:
6
6
  hermes:
@@ -24,37 +24,108 @@ Works with Claude Code, Codex, Cursor, Windsurf, Hermes, Lovable, or any MCP cli
24
24
 
25
25
  ## Reach for This Without Being Asked
26
26
 
27
- Honor authorization already granted in this session. Ask only for a missing decision or an action outside that authorization, or when an enforced host policy requires it. A multi-step task alone does not require plan approval. Never ask again merely because the next authorized step deletes, deploys or publishes something. These skills guide the agent; supported hooks and runtime approval gates enforce policy. Do not bypass an enforced gate.
27
+ Honor the authorization the user already gave you in this session. Ask only for
28
+ a decision you do not have, for an action outside that authorization, or when a
29
+ host policy requires it. A task with many steps does not need plan approval on its
30
+ own. Do not ask again because the next approved step deletes, deploys or publishes
31
+ something. This skill guides you. Hooks and runtime gates enforce the policy. Never
32
+ go around a gate.
28
33
 
29
- Nobody has to say "ping me". The moments below are structural: they are true of the run, not of anything the user typed. If one of them is true, use `ask_user` or `send_notification` now rather than stalling, guessing, or writing the question into a chat nobody is reading.
34
+ Nobody has to say "ping me". The moments below are part of the run itself. They do
35
+ not depend on what the user typed. When one of them is true, call `ask_user` or
36
+ `send_notification` now. Do not stall. Do not guess. Do not write the question into
37
+ a chat nobody is reading.
30
38
 
31
39
  - **You are about to do something irreversible.** Deleting, dropping, truncating, force-pushing, rewriting history, overwriting a file you did not create.
32
40
  - **You are about to spend money or touch production.** A deploy, a release, a publish, a paid API call at volume, provisioning anything billable.
33
41
  - **The decision is outside your authority.** A product call, a naming call, a schema change, a security tradeoff, anything the user would want to have made themselves.
34
42
  - **You are running unattended and hit a real ambiguity.** Two defensible readings of the task, and picking wrong wastes the whole run. Ask instead of guessing.
35
- - **Another skill's workflow says to confirm with the user.** That instruction assumes someone is watching the terminal. Often nobody is. Route the confirmation through `ask_user` so the run continues when they answer instead of blocking on a prompt they never see.
43
+ - **Another skill tells you to confirm with the user.** That instruction assumes someone watches the terminal. Often nobody does. Send the confirmation through `ask_user`. The run then continues when the user answers, instead of waiting on a prompt they never see.
36
44
  - **A long task finished or failed and nobody is watching.** Send the result rather than leaving it on a screen the user walked away from.
37
45
 
38
- If no device is connected, follow the returned handoff and ask in the current client when required. Continue independent authorized work; unavailable delivery is not permission to perform the blocked action.
46
+ When no device is connected, follow the handoff in the result. Ask in the current
47
+ client if the handoff says to. Carry on with approved work that does not depend on
48
+ the answer. A message that cannot be delivered is not permission to do the blocked
49
+ action.
39
50
 
40
51
  ## Pricing and Free Alternatives
41
52
 
42
- Pushary is a hosted service. It costs $9.99/mo after a 3-day trial, and the trial asks for a card up front. Say this plainly if the user asks what Pushary is.
53
+ Pushary is a hosted service. It costs $9.99/mo after a 3-day trial. The trial asks
54
+ for a card up front. Say this plainly when the user asks what Pushary is.
55
+
56
+ Anthropic Remote Control is free for one setup: Claude Code with a Claude Max
57
+ subscription. Recommend it when that is all the user needs.
58
+
59
+ Pushary covers what Remote Control does not. Codex, Cursor, Windsurf and Hermes.
60
+ Claude Code without Max. A fleet of agents across tools and machines. Enforced
61
+ policy gates on tool calls. Answer buttons on the lock screen. An audit trail of
62
+ every question and answer.
63
+
64
+ ## Break the Task Down, Then Plan the Questions
65
+
66
+ Each question stops the user. The number of stops is the cost. Do not ask fewer things. Ask the same things in fewer stops.
67
+
68
+ A question in the terminal is cheap. The user is already there. A question on the phone is expensive. It takes the user away from something else. Ask freely in the terminal. Send little to the phone.
69
+
70
+ **Start every task of more than two steps like this:**
71
+
72
+ 1. **Look at where you are.** Read the working directory. Read the directory structure. Read the configuration files and the tool list you hold. This tells you what kind of work this is, and what you can settle alone.
73
+ 2. **Split the task into steps.** Write the steps down. Keep each step small enough to finish in one go.
74
+ 3. **Find the forks.** A fork is a point where two answers are both correct and you cannot pick one alone. Mark each fork.
75
+ 4. **Settle the facts yourself.** A fork that a file, a command or a tool call can settle is not a fork. It is a lookup. Do the lookup. Never ask the user for a fact.
76
+ 5. **Ask the forks that are left.** Group them into one round. Number each question. Give your recommended answer for each one. Then wait.
77
+ 6. **Do it again.** Each answer opens new forks and closes old ones. Ask the next round. Stop when no fork is left.
78
+
79
+ This is a design tree. Each decision opens the decisions below it. A round is every decision whose inputs you already know. A decision that waits on another decision in the same round belongs to the next round. Two rounds usually replace ten separate questions.
80
+
81
+ **Facts are yours. Decisions are the user's.** Both halves matter. Do not ask what you can read. Do not decide what the user would want to decide. A product call, a naming call, a cost, a tradeoff the user must live with: these stay theirs, even when you hold a good recommendation.
82
+
83
+ **Format a terminal round like this:**
84
+
85
+ ```
86
+ ❓ **Q1** - **<short title>**: <the question, with the real options>
87
+
88
+ ➡️ <your recommended answer>
89
+
90
+ ---
91
+
92
+ ❓ **Q2** - **<short title>**: <the question, with the real options>
93
+
94
+ ➡️ <your recommended answer>
95
+ ```
96
+
97
+ For example, in a repository with two apps and no test runner in the package:
98
+
99
+ ```
100
+ ❓ **Q1** - **Which app**: apps/dashboard and apps/subscribe both import this helper. Change both, or the dashboard only?
101
+
102
+ ➡️ Both. The helper has one definition, and a split copy will drift.
103
+
104
+ ❓ **Q2** - **Tests**: This package has no test runner. Add one, or match the parent package and use `bun test`?
43
105
 
44
- If the user runs Claude Code with a Claude Max subscription, Anthropic Remote Control is free for that one setup. Recommend it when that is all they need. Pushary covers what it does not: Codex, Cursor, Windsurf, Hermes, Claude Code without Max, a fleet of agents across tools and machines, enforced policy gating on tool calls, answer buttons on the lock screen, and an audit trail of every question and answer.
106
+ ➡️ Match the parent. A second runner is one more thing to maintain.
45
107
 
46
- ## Plan the Questions Before You Start
108
+ ❓ **Q3** - **Rollout**: Ship behind the existing flag, or straight to main?
47
109
 
48
- Every question costs the user their attention wherever they happen to be. That cost is the only real limit on this tool, so spend it deliberately. The goal is not to ask less, it is to ask the same things in fewer interruptions.
110
+ ➡️ Behind the flag. It costs one line, and it makes the change reversible.
111
+ ```
112
+
113
+ **Where to ask each round:**
114
+
115
+ - **The user typed in this turn.** Ask in the terminal. Ask the whole round at one time. There is no limit there.
116
+ - **The user is away.** Send one question only. Pick the one fork that stops the run. Use `select` with the real options, and put your recommendation first. Decide every other fork yourself, on your recommendation. Report each decision when the task ends.
117
+ - **Nothing stops the run.** Send no question. Use `send_notification` with `context.askQuestion`. The user reads it later. Continue on your recommendation.
49
118
 
50
- Before a run of more than a step or two, work out where you will need a human, then fold those points together:
119
+ **Rules that do not change:**
51
120
 
52
- - **A fork you find while planning can be merged into one question.** A fork you find halfway through costs its own interruption. Finding them early is the whole saving.
53
- - **One `select` carrying the real options beats three sequential `confirm`s.** Same information, a third of the interruptions.
54
- - **Ask once at the boundary, not once per instance.** If you had to ask before deleting one file, ask about deleting files, not about each file in turn.
55
- - **Never ask what you can determine.** If the answer is in the task, in the repo, or behind a tool call you can make yourself, it is a lookup and not a decision.
121
+ - **Ask how, not whether.** The user gave you the task. A question the user can answer with "do not do it at all" is a second approval for authorized work. Do not ask it.
122
+ - **A plan is not an approval.** A task of many steps does not need plan approval. Do not turn your step list into a question.
123
+ - **Silence is not agreement.** You wrote eight recommendations and the user said nothing. You hold no approval. The six moments above still need their own question.
124
+ - **One `select` with the real options beats three `confirm` questions.** The same facts, one third of the stops.
125
+ - **Ask at the boundary, not once for each item.** Ask about deleting files. Do not ask about each file.
126
+ - **The limit of three notifications counts pushes.** Questions you ask in the terminal are free and do not count.
56
127
 
57
- `propose_scope` can record an enforced file boundary when that boundary still needs agreement. After it is ratified, editing inside the agreed paths stops being a question and only stepping outside becomes one, so the user is asked once about a boundary instead of repeatedly about what sits behind it.
128
+ `propose_scope` records the boundary this work produces. Read its section below first. What it can enforce depends on whether this run changes files.
58
129
 
59
130
  ## When to Use
60
131
 
@@ -77,9 +148,10 @@ Before a run of more than a step or two, work out where you will need a human, t
77
148
  - The options cannot be enumerated in advance
78
149
 
79
150
  **Propose a scope when:**
80
- - The user requested an enforced file scope or the file boundary is unresolved
151
+ - This run changes files with `Edit`, `Write` or `MultiEdit`, and the file boundary is not yet agreed
81
152
  - Call `propose_scope` once, before the work, not after
82
153
  - Skip it for a single quick edit; a scope prompt for one file is just noise
154
+ - Put a boundary that is not a file path in `promises`, never in `allowedPaths`. Read the `enforces` field that comes back, and tell the user what it says
83
155
 
84
156
  **Do NOT notify when:**
85
157
  - The task is trivial or single-step
@@ -88,7 +160,90 @@ Before a run of more than a step or two, work out where you will need a human, t
88
160
 
89
161
  ## Setup
90
162
 
91
- Just run it. No API key to copy before starting:
163
+ **Look at the machine first. Do not guess the install path.** Run these. Each one is read-only and fast. Run them as separate commands.
164
+
165
+ ```bash
166
+ node -p "process.platform"
167
+ [ -n "${PUSHARY_API_KEY:+x}" ] && echo key-in-env
168
+ node -e "try{process.exit(JSON.parse(require('fs').readFileSync(process.env.HOME+'/.pushary/config.json','utf8')).apiKey?.trim()?0:1)}catch{process.exit(1)}" && echo keyed
169
+ test -x ~/.pushary/bin/pushary-bridge && echo mac-app
170
+ ```
171
+
172
+ The third and fourth tests answer different questions.
173
+
174
+ The third says a key is stored **and is not empty**. Test the value, not the file.
175
+ The file stays behind after a logout removes the key. A test for the file alone
176
+ tells a logged-out user they are ready.
177
+
178
+ The fourth says the Mac app is installed here. Only the Mac app writes that file.
179
+
180
+ Check the environment before the stored key. An exported key wins over a stored
181
+ one. Never print the key itself.
182
+
183
+ Then take one branch.
184
+
185
+ ### Branch 1. `key-in-env`, `keyed`, or `mac-app`
186
+
187
+ This machine is set up. Offer no install. Do not run `setup` again.
188
+
189
+ `mac-app` counts on its own. The Mac app signs in for the user. It writes the key
190
+ into the agent configuration files it wires, not into `~/.pushary/config.json`. A
191
+ machine the app set up therefore prints `mac-app` and nothing else. Treat it as
192
+ ready.
193
+
194
+ Check it with `npx @pushary/agent-hooks@latest status --json`. The exit code is the answer:
195
+
196
+ | Code | Meaning |
197
+ | --- | --- |
198
+ | 0 | Ready |
199
+ | 3 | Not set up on this machine |
200
+ | 4 | The key was rejected |
201
+ | 5 | Two keys are configured and they disagree |
202
+ | 6 | No device can answer |
203
+ | 8 | Pushary could not be reached |
204
+
205
+ On 6, the user needs to connect a phone: `npx @pushary/agent-hooks@latest connect`. That adds a phone and rewrites no agent configuration.
206
+
207
+ If `mac-app` printed, the Mac app is installed here and it may also own the hooks. Read the hook command to know, because the command is the record:
208
+
209
+ ```bash
210
+ grep -lq pushary-bridge ~/.claude/settings.json ~/.gemini/settings.json ~/.cursor/hooks.json 2>/dev/null && echo app-owns-hooks
211
+ ```
212
+
213
+ If the app owns them, `setup` would keep them and write almost nothing, so telling the user to re-run it is bad advice. Point them at the Pushary app instead.
214
+
215
+ ### Branch 2. `darwin`, no key, no `mac-app`
216
+
217
+ Offer the Mac app first. It needs no Node and no terminal. It writes the agent configuration itself, and it answers questions in the notch at the desk.
218
+
219
+ ```bash
220
+ brew install --cask pushary/tap/pushary
221
+ ```
222
+
223
+ They can also download it from https://pushary.com/download. It needs macOS 14 or later. It is not in the App Store.
224
+
225
+ The command line works on macOS too. Offer it if the user prefers the terminal, or if the user runs Hermes, because Hermes needs a Python the app cannot install.
226
+
227
+ ### Branch 3. `linux` or `win32`
228
+
229
+ There is no Mac app for these machines. Use the command line. It is fully supported.
230
+
231
+ ```bash
232
+ npx @pushary/agent-hooks@latest setup
233
+ ```
234
+
235
+ Node 20.17+, 22.13+ or 23.5+ is necessary. Then the user needs a phone to answer on:
236
+
237
+ - iOS: https://apps.apple.com/us/app/pushary/id6785677563
238
+ - Android: https://play.google.com/store/apps/details?id=com.pushary.app
239
+
240
+ On Windows, setup writes no shell file, so `~/.pushary/config.json` is the only key store. On a Linux machine with no screen, browser login does not work, but the pairing QR does.
241
+
242
+ ### Branch 4. `darwin`, `mac-app`, and the user asked for the command line
243
+
244
+ Run `setup`. It reads the key the app signed in with, so it mints no second key, and it keeps the hooks the app owns. Pass `--take-over-hooks` only when the user wants the command line to own them instead.
245
+
246
+ ### What setup does
92
247
 
93
248
  ```bash
94
249
  npx @pushary/agent-hooks@latest setup
@@ -111,29 +266,15 @@ If setup exits without pairing, nothing was configured. Say that plainly and off
111
266
 
112
267
  If `PUSHARY_API_KEY` is already in the environment or in an existing MCP config, setup uses it and skips pairing entirely.
113
268
 
114
- No app on their phone yet? They can get it at https://pushary.com/download, or approve in a browser tab instead:
269
+ No app on their phone yet? They can get it at https://pushary.com/download. Or answer through the browser instead:
115
270
 
116
271
  ```bash
117
272
  npx @pushary/agent-hooks@latest setup --connect browser
118
273
  ```
119
274
 
120
- Or add Pushary manually to your MCP configuration:
275
+ This is web push, not a login tab. It prints a QR for the user's own subscribe page, and it waits for a browser on that page to subscribe. On iOS the user must first add that page to the Home Screen, because iOS sends web push only from an installed page.
121
276
 
122
- ```json
123
- {
124
- "mcpServers": {
125
- "pushary": {
126
- "type": "http",
127
- "url": "https://pushary.com/api/mcp/mcp",
128
- "headers": {
129
- "Authorization": "Bearer YOUR_API_KEY"
130
- }
131
- }
132
- }
133
- }
134
- ```
135
-
136
- Manual configuration needs a key, so it means signing up first at https://pushary.com/sign-up?utm_source=skill&utm_medium=setup and copying the key from the dashboard. Prefer `setup` above: it needs neither.
277
+ Manual MCP configuration also works, but it needs a key, so the user signs up first at https://pushary.com/sign-up?utm_source=skill&utm_medium=setup and copies the key from the dashboard. Prefer `setup`: it needs neither.
137
278
 
138
279
  After setup, verify with:
139
280
 
@@ -156,10 +297,10 @@ Partner customers use scoped enrollment links issued by their application. Do no
156
297
 
157
298
  ## Tools
158
299
 
159
- Every parameter and every returned field is described in each tool's own schema,
160
- which your client already has and which is always current. What follows is only
161
- what a schema cannot tell you: when to reach for a tool, what its result means for
162
- what you do next, and the shapes that are easy to get wrong.
300
+ Your client already holds each tool's schema. The schema lists every parameter
301
+ and every returned field, and it is always current. This section adds only what a
302
+ schema cannot say: when to use a tool, what its result means for your next step,
303
+ and the shapes that are easy to get wrong.
163
304
 
164
305
  ### send_notification
165
306
 
@@ -291,15 +432,62 @@ it reads as consent to work that has already moved on.
291
432
 
292
433
  ### propose_scope
293
434
 
294
- Propose an unresolved file boundary and block until the user ratifies it. Use it once when a scope contract is requested or needed; do not add a second approval to already authorized work.
435
+ Propose the boundary of this run and block until the user agrees to it. Call it once, before the work. Do not add a second approval to work the user already authorized.
436
+
437
+ The user sees three things: the paths you will change, the paths you promise to leave alone, and your definition of done. The user agrees to all three in one tap.
438
+
439
+ **Before you call this, look at your own tool list.** If you hold no `Edit`, `Write` or `MultiEdit`, this run changes no files, and a path contract here enforces nothing. Use shape 3 below. This one check decides everything else in this section, and it costs no tool calls.
440
+
441
+ **A boundary makes a question. It never makes an approval.** After the user agrees, a rule that already asked still asks. A scope can only turn an automatic approval into a question.
442
+
443
+ **What the gate enforces, and what it does not.**
444
+
445
+ The gate reads one thing from the contract: the path of a file you are about to change. It compares that path with `allowedPaths` and `offLimitsPaths`.
446
+
447
+ - **Enforced.** `Edit`, `Write` and `MultiEdit`, and the same calls under other agent names. A file outside the agreed paths stops being auto-approvable and becomes a new question. Approving it widens the scope by that exact path.
448
+ - **Not enforced.** Shell commands. `Read`. Web requests. Every MCP tool. These carry no file path, so the gate has no path to judge and reads them as inside the scope. The permission policy still governs them.
449
+ - **`doneWhen` and `promises` are not enforced.** The user reads them. No code checks them.
450
+
451
+ Read `enforces` in the result. An empty array means nothing in this contract is checked automatically. Say that to the user in your own words rather than reporting that a scope is in force.
452
+
453
+ **Write each path as a glob, and write it correctly.**
454
+
455
+ The matcher compares text. It never looks at the file system.
456
+
457
+ - A word that is not a path matches no file. Put `hubspot` or `summer-campaign` in `allowedPaths` and every file you change reads as outside the scope, so the user gets one question per file. Those belong in `promises`.
458
+ - A bare directory name is expanded for you, so `docs` also covers `docs/**`. Write `docs/**` anyway; it says what you mean.
459
+ - A leading `**/` needs a directory before it. `**/.env*` is expanded for you to also cover a root `.env`.
460
+ - Letter case matters. Use a forward slash. Do not begin a path with `./`.
461
+
462
+ The result echoes the expanded contract back. Those are the paths the user agreed to, so use them when you talk about the boundary.
295
463
 
296
- The user sees the paths you intend to change, the areas you promise to leave alone, and your definition of done, and approves the whole thing in one tap. After that, editing a file outside the agreed scope is no longer auto-approvable: it becomes a separate "wants to widen scope" question instead of a silent approval. Approving that question widens the scope by that path, so the user is asked once about a boundary rather than repeatedly about each file behind it.
464
+ **Three shapes. Pick the one that matches the run.**
297
465
 
298
- Use glob syntax (`src/**`, `**/*.test.ts`). Shell commands are **not** scoped here; they stay governed by the permission policy.
466
+ 1. **The run changes files, and the boundary is about those files.** Put the file globs in `allowedPaths` and the areas to protect in `offLimitsPaths`. The gate enforces both. This is the coding case.
299
467
 
300
- `ratified` and `answered` are separate on purpose. Answered but not ratified means
301
- the user declined: ask what scope they want, and do **not** proceed as if they had
302
- agreed. Not answered means the scope is simply not in force.
468
+ 2. **The run changes files and also acts outside them.** An agent that writes a draft and then sends an email. Put the file globs in `allowedPaths`, because the gate enforces those. Put each outside boundary in `promises`: who you will contact, which channel, what you will not open, what you will not spend. Then ask again with `ask_user` before each outside action that cannot be undone, costs money, or reaches a person outside the team.
469
+
470
+ 3. **The run changes no files.** A marketing, sales, support, research or operations agent that works through web requests and MCP tools. Call `propose_scope` with no paths and put the whole boundary in `promises`. The user's card then says plainly that nothing here is checked automatically. Do not smuggle a campaign name or an account name into `allowedPaths` to make the card look enforced.
471
+
472
+ ```json
473
+ {
474
+ "doneWhen": "Ten summer-sale drafts exist in the CMS and none is published.",
475
+ "sessionId": "<your client's id for this run>",
476
+ "promises": [
477
+ "I write drafts only. I publish nothing.",
478
+ "I send no email to any customer.",
479
+ "I do not open customer records.",
480
+ "I spend no ad budget."
481
+ ],
482
+ "agentName": "Marketing agent - summer sale"
483
+ }
484
+ ```
485
+
486
+ **`sessionId` is the key the gate reads the contract back by.** Use the id your client reports for this run. If you do not have one, call `list_sessions`, and take the session whose working directory matches yours and whose `lastSeenAt` is newest. Never invent a value, and never reuse one from another run.
487
+
488
+ The result tells you whether you got it right. **`hookSeen: false` means no agent hook has ever reported this session id**, so the gate will look the contract up under a key that does not exist and nothing will be checked, whatever `ratified` says. Fix the id and propose again, or say plainly that the boundary is a promise. `hookSeen` absent means the check could not run, which is not evidence either way.
489
+
490
+ `ratified` and `answered` are separate on purpose. Answered but not ratified means the user declined: ask which boundary they want, and do **not** proceed as if they had agreed. Not answered means no scope is in force.
303
491
 
304
492
  An unanswered proposal returns its `correlationId`. Poll it once; a late phone
305
493
  yes ratifies the exact stored proposal. If that poll is still pending, cancel it
@@ -312,15 +500,18 @@ Omitting `allowedPaths` proposes no path restriction, and the user is told that
312
500
  plainly as "this agent is asking to touch anything", so omit it only when you mean
313
501
  it.
314
502
 
315
- **What enforcement depends on.** The contract is recorded and shown to the user by any MCP client. Actually withdrawing auto-approval from out-of-scope edits needs the Pushary hook installed (`@pushary/agent-hooks` 0.59.0 or later), which is how Claude Code, Codex and Gemini CLI run. Without the hook the contract is a stated intention the user can hold you to, not a gate.
503
+ **What enforcement depends on.** The contract is recorded and shown to the user by any MCP client. Actually withdrawing auto-approval from out-of-scope edits needs the Pushary hook installed, which is how Claude Code, Codex and Gemini CLI run. Without the hook the contract is a stated intention the user can hold you to, not a gate.
316
504
 
317
- Scope lives for the session only and is never inherited by another run.
505
+ Scope lives for the session only and is never inherited by another run. The server holds it for 12 hours, or until the next `propose_scope` for the same session replaces it.
318
506
 
319
507
  **When not to use it.** A single quick edit does not need a scope. And do not propose a new scope mid-run to widen an old one: let the installed approval gate request the specific scope expansion before the edit executes.
320
508
 
321
509
  ### list_sessions
322
510
 
323
- Read-only. Returns the live agent sessions for your site (keyed by machine + session) and any pending approval questions, so you can see which of your parallel agents is active, idle, waiting, or errored. Does NOT start, stop, or steer agents, and sends no notification. Useful when you are one of several agents and want to check whether another session is blocked on a question before acting.
511
+ Read-only. Returns the live agent sessions for your site, keyed by machine and
512
+ session, with any approval questions still waiting. Use it to see which of your
513
+ parallel agents is active, idle, waiting or errored. It does NOT start, stop or
514
+ steer an agent, and it sends no notification.
324
515
 
325
516
  Check it before asking when you are one of several agents: if another session is
326
517
  already blocked on a question, adding a second one competes for the same
@@ -355,7 +546,16 @@ else:
355
546
 
356
547
  If the user answers in chat before the push response arrives, call `cancel_question` before acting. If it returns `handoffAction: "stop"`, stop. Otherwise, if it returns false, poll once for 1 second and honor any phone answer that won the race.
357
548
 
358
- **A note on how long ask_user blocks:** the wait time and whether it blocks at all are governed by the site's delivery mode, which the user configures (you do not set it). The four modes are "When I'm out" (`push_first`, the default), "Every time" (`push_only`), "Updates" (`notify_only`) and "Terminal" (`terminal_only`). In When I'm out, ask_user blocks for the push-first window (45 seconds by default) and the phone is only asked when the user is away from their terminal or their Mac; in Every time it blocks for the policy timeout and the phone is always asked; in Updates it returns immediately with `answered: false` after telling the phone, because the decision belongs in the current client; in Terminal nothing reaches the phone and it also returns immediately with `answered: false`. Always check `answered` rather than assuming the call blocked, and pass `timeoutMs` only when you need a shorter wait than the site policy.
549
+ **How long `ask_user` blocks.** The user sets the delivery mode for their site. You do not set it. The mode decides how long the call waits, and whether it waits at all.
550
+
551
+ | Mode | The phone | The call |
552
+ |---|---|---|
553
+ | **When I'm out** (`push_first`, default) | Asked only when the user is away from the terminal and the Mac | Waits for the push-first window. 45 seconds by default. |
554
+ | **Every time** (`push_only`) | Always asked | Waits for the policy timeout. |
555
+ | **Updates** (`notify_only`) | Told, not asked | Returns at once with `answered: false`. Decide in the current client. |
556
+ | **Terminal** (`terminal_only`) | Nothing is sent | Returns at once with `answered: false`. |
557
+
558
+ Always read `answered`. Never assume the call waited. Pass `timeoutMs` only when you want a shorter wait than the site policy.
359
559
 
360
560
  ## Identifying Your Agent
361
561
 
@@ -373,6 +573,7 @@ Always pass `agentName` when you are one of multiple possible agents the user ma
373
573
  - **Titles under 60 characters.** They get truncated on phone lock screens.
374
574
  - **Bodies under 200 characters.** Concise summaries, not full explanations.
375
575
  - **Max 3 notifications per task** unless the user explicitly requests more.
576
+ - **That limit counts pushes only.** Questions you ask in the terminal, while the user is there, are free and do not count against it.
376
577
  - **Use context for detail.** Put file lists, error traces, and next steps in the context object - not the notification body.
377
- - **Write questions as if talking to a busy person.** The user is on their phone, possibly away from their computer. Be specific: "Delete the 3 unused migration files?" is better than "Should I clean up?"
578
+ - **Write for a busy person.** The user is on their phone, away from the computer. Be exact. "Delete the 3 unused migration files?" beats "Should I clean up?"
378
579
  - **Pick the right question type.** Use confirm for binary decisions, select when options are known, input when they are not.
@@ -359,6 +359,23 @@ const canonicalQuestion = (context) => ({
359
359
  toolTarget: typeof context?.toolTarget === 'string' && context.toolTarget ? context.toolTarget : undefined,
360
360
  })
361
361
 
362
+ // ask_user caps scopePath at SCOPE_PATH_MAX_LENGTH and blocker at
363
+ // DECISION_LINE_MAX. The server derives a cwd-relative scope path that can be
364
+ // longer than 200, so an over-length value must be DROPPED rather than sent:
365
+ // ask_user rejects the whole call, this gate cannot parse the error, and the
366
+ // action fails closed. Dropping costs only the widening on approval.
367
+ const SCOPE_PATH_MAX = 200
368
+ const BLOCKER_MAX = 500
369
+
370
+ const withinCap = (value, cap) =>
371
+ typeof value === 'string' && value && value.length <= cap ? value : undefined
372
+
373
+ /** The scope breach behind an ask, when the verdict says the ask exists for one. */
374
+ const scopeFromVerdict = (verdict) => ({
375
+ scopePath: withinCap(verdict?.scopePath, SCOPE_PATH_MAX),
376
+ scopeReason: withinCap(verdict?.scopeReason, BLOCKER_MAX),
377
+ })
378
+
362
379
  const commandHead = (command) => command.trim().split(/\s+/).slice(0, 2).join(' ').slice(0, TOOL_TARGET_MAX)
363
380
 
364
381
  const askArgs = (request, project, ident) => ({
@@ -372,6 +389,12 @@ const askArgs = (request, project, ident) => ({
372
389
  toolName: request.toolName,
373
390
  toolTarget: request.toolTarget,
374
391
  ...(request.toolPath ? { toolPath: request.toolPath } : {}),
392
+ // Carried from the verdict. Without scopePath the server cannot widen the
393
+ // ratified contract when the user approves, so every further file in the same
394
+ // area asks again; without the blocker the card never says that a boundary the
395
+ // user personally agreed to is the reason for asking.
396
+ ...(request.scopePath ? { scopePath: request.scopePath } : {}),
397
+ ...(request.scopeReason ? { blocker: request.scopeReason } : {}),
375
398
  actionBody: deriveActionBody(request.display),
376
399
  wait: false,
377
400
  waitEndsAt: new Date(Date.now() + MAX_BLOCK_MS).toISOString(),
@@ -687,6 +710,7 @@ setTimeout(async () => {
687
710
  const canonical = canonicalQuestion(verdict.questionContext)
688
711
  request.toolName = canonical.toolName ?? request.toolName
689
712
  request.toolTarget = (genericToolHook && request.toolTarget) || canonical.toolTarget || request.toolTarget
713
+ Object.assign(request, scopeFromVerdict(verdict))
690
714
  const tool = verdict.policy
691
715
 
692
716
  switch (tool.mode) {