@xwss/agentbell 0.1.0 → 0.1.2

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.
package/README.md CHANGED
@@ -1,969 +1,334 @@
1
1
  # AgentBell
2
2
 
3
- AgentBell: get notified when your AI coding agent finishes.
3
+ AgentBell notifies your phone when AI coding agents finish a task.
4
4
 
5
- AgentBell 閺勵垯绔存稉顏囨硶楠炲啿褰?CLI 瀹搞儱鍙块敍宀€鏁ゆ禍搴℃躬 Claude Code閵嗕竼odex閵嗕箓S Code Copilot Agent 缁?AI coding agent 鐎瑰本鍨氭禒璇插閵嗕礁浠犲銏g箥鐞涘被鈧胶鐡戝鍛扮翻閸忋儲鍨ㄩ棁鈧憰浣规綀闂勬劖妞傞敍宀冨殰閸斻劌鎮滈幍瀣簚閸欐垿鈧焦褰侀柋鎺嬧偓?
6
- 缁楊兛绔撮悧鍫滅喘閸忓牊鏁幐?ntfy閵嗗倸褰傞柅浣侯伂閸欘亪娓剁憰浣藉厴鐠佸潡妫舵径鏍秹楠炶泛褰傞崙?HTTP 鐠囬攱鐪伴敍宀勨偓鍌氭値閺堫剙婀撮悽浣冨壋閵嗕浇绻欑粙?SSH閵嗕箘SL閵嗕笍ev Container閵嗕浇绻欓幒褏鏁搁懘鎴犵搼閸︾儤娅欓妴?
7
- ## Why Not Bluetooth
5
+ It is a small CLI for developers who run long AI coding tasks and want a reliable phone notification when the agent stops, asks for attention, or finishes a workflow. It currently uses ntfy for Android push notifications and installs hook wrappers for Codex, Claude Code, and VS Code Copilot Agent.
8
6
 
9
- AgentBell 娑撳秴浠涢拑婵堝閻╃绻涢幍瀣箚閵嗗倽鎽戦悧娆戞纯鏉╃偤娓剁憰浣割槱閻炲棝鍘ょ€靛箍鈧胶閮寸紒鐔告綀闂勬劑鈧礁宸堕崯鍡楀礂鐠侇喓鈧礁鎮楅崣棰佺箽濞茶鎷扮捄銊ラ挬閸欐澘妯婂鍌︾礉閸欘垶娼幀褍绶㈤梾鍙ョ箽鐠囦降鈧?
10
- 閹恒劏宕橀柧鎹愮熅閺勵垽绱?
11
- 1. AI coding hook 閸︺劌鐤勯梽鍛扮箥鐞?agent 閻ㄥ嫭婧€閸c劋绗傞幍褑顢戦妴?2. AgentBell 闁俺绻?HTTP 閹跺﹪鈧氨鐓¢崣鎴濆煂 ntfy閵?3. 鐎瑰宕滈幍瀣簚閺€璺哄煂 ntfy 闁氨鐓¢妴?4. 缁崵绮洪崪灞惧閻?App 鐠愮喕鐭楅幎濠団偓姘辩叀鏉烆剙褰傞崚鐗堝閻滎垬鈧?
12
- 鏉╂瑦鐗辨潻婊呪柤閺堝搫娅掗崣顏囶洣閸欘垯浜掔拋鍧楁6 ntfy server閿涘苯姘ㄩ懗鑺ュ絹闁辨帊缍橀惃鍕閺堟亽鈧?
13
- ## Android Setup
7
+ Core features:
14
8
 
15
- 1. 鐎瑰顥?ntfy Android閵?2. 鐠併垽妲勬稉鈧稉顏堟閺堟亽鈧椒绗夐崣顖滃閻?topic閵?3. 閸忎浇顔?ntfy 閻ㄥ嫰鈧氨鐓¢弶鍐閵?4. 閸忔娊妫?ntfy 閻ㄥ嫮鏁稿Ч鐘辩喘閸栨牠妾洪崚韬测偓?5. 閸︺劍澧滈悳?App 娑擃厼鍘戠拋姝屾祮閸?ntfy 閻ㄥ嫰鈧氨鐓¢妴?
16
- 婵″倹鐏夋担璺ㄦ暏 `https://ntfy.sh` 閸忣剙鍙¢張宥呭閿涘矁顕幎?topic 瑜版挷缍?bearer secret閵嗗倻鐓¢柆?topic 閻ㄥ嫪姹夐柅姘埗鐏忚精鍏橀崥鎴n嚉 topic 閸欐垶绉烽幁顖涘灗鐠併垽妲勫☉鍫熶紖閿涘本澧嶆禒銉ょ瑝鐟曚椒濞囬悽銊ヮ潣閸氬秲鈧線銆嶉惄顔兼倳閵嗕線鍋栫粻渚库偓浣稿彆閸欑鎮曟潻娆戣閸欘垳瀵?topic閵?
17
- ## Installation
9
+ - Phone notifications for AI coding workflows
10
+ - ntfy Android support
11
+ - `agentbell setup` first-run wizard
12
+ - `agentbell verify` installation and hook diagnostics
13
+ - Codex VS Code extension Stop hook
14
+ - Claude Code Stop and Notification hooks
15
+ - VS Code Copilot Agent Stop hook
16
+ - Rich notification context: machine name, project name, task name, path, branch, and time
18
17
 
19
- Install AgentBell from npm:
18
+ ## Installation
20
19
 
21
20
  ```bash
22
21
  npm install -g @xwss/agentbell
23
- agentbell setup
24
22
  ```
25
23
 
26
- Although the npm package is scoped as `@xwss/agentbell`, the installed CLI command is still `agentbell`.
27
-
28
- For beta builds:
29
-
30
- ```bash
31
- npm install -g @xwss/agentbell@beta
32
- ```
33
-
34
- AgentBell requires Node.js 20 or newer.
35
-
36
- ## Development Install
37
-
38
- For local development:
24
+ Although the npm package is scoped as `@xwss/agentbell`, the installed CLI command is still:
39
25
 
40
26
  ```bash
41
- git clone <your-agentbell-repo-url>
42
- cd AgentBell
43
- npm install
44
- npm run build
45
- node dist/cli.js setup
27
+ agentbell
46
28
  ```
47
29
 
48
- ## Local Package Test
30
+ AgentBell requires Node.js 20 or newer.
49
31
 
50
- Before publishing, test the npm package locally:
32
+ For beta builds:
51
33
 
52
34
  ```bash
53
- npm run build
54
- npm pack
55
- npm install -g ./xwss-agentbell-0.1.0.tgz
56
- agentbell --help
57
- agentbell setup --dry-run --yes --targets none --no-test
35
+ npm install -g @xwss/agentbell@beta
58
36
  ```
59
37
 
60
- ## Uninstall
61
-
62
- ```bash
63
- npm uninstall -g @xwss/agentbell
64
- ```
65
38
  ## Quick Start
66
39
 
67
- ```bash
68
- npm install -g @xwss/agentbell
69
- agentbell setup
70
- ```
71
-
72
- 閺堫剙婀村鈧崣鎴g箥鐞涘矉绱?
73
- ```bash
74
- npm install
75
- npm run build
76
- npm test
77
- npm run dev -- test
78
- ```
79
-
80
- ## Setup Wizard
81
-
82
- `agentbell setup` is the recommended first command on a new machine. It is a guided setup flow that:
83
-
84
- - generates a random ntfy topic
85
- - writes `~/.agentbell/config.json`
86
- - asks for a machine display name
87
- - guides Android ntfy subscription
88
- - sends a setup test notification
89
- - installs selected AI coding hooks
90
-
91
- Examples:
40
+ Run the setup wizard:
92
41
 
93
42
  ```bash
94
43
  agentbell setup
95
- agentbell setup --yes --targets none --no-test
96
- agentbell setup --targets codex,claude-code
97
- agentbell setup --dry-run
98
44
  ```
99
45
 
100
- Useful options:
46
+ The wizard will:
101
47
 
102
- - `--config <path>` writes a specific config file.
103
- - `--topic <topic>` uses a specific ntfy topic.
104
- - `--machine-name <name>` sets the display name used in notifications.
105
- - `--server <url>` sets the ntfy server.
106
- - `--targets <targets>` accepts `all`, `none`, or comma-separated `codex,claude-code,vscode-agent`.
107
- - `--yes` uses defaults for prompts.
108
- - `--no-test` skips the phone test notification.
109
- - `--dry-run` previews setup without writing files, sending notifications, or installing hooks.
48
+ - Generate a random ntfy topic
49
+ - Write `~/.agentbell/config.json`
50
+ - Guide Android ntfy subscription
51
+ - Send a test notification
52
+ - Install AI coding hooks
110
53
 
111
- ## Topic and Machine Name
54
+ ## Android ntfy Setup
112
55
 
113
- The ntfy topic is a secret transport address, not a display name. Anyone who knows the topic can usually publish to it, so use a long random topic and do not commit it to a public repository.
56
+ During `agentbell setup`, AgentBell generates a long random ntfy topic. Subscribe to that topic on your Android phone:
114
57
 
115
- The machine display name is safe human context for notifications, for example `宸ヤ綔绔?鍙穈, `MacBook Pro`, or `GPU-Server-01`.
58
+ 1. Install ntfy Android.
59
+ 2. Open ntfy and subscribe to the generated topic.
60
+ 3. Allow notification permission.
61
+ 4. Allow background running if your phone prompts for it.
62
+ 5. Disable battery optimization for ntfy if notifications are delayed.
116
63
 
117
- A good default model is one user-owned random topic shared across your machines, with each machine using a different display name. Example notification:
118
-
119
- ```text
120
- 宸ヤ綔绔?鍙?路 Codex task finished
121
- ```
64
+ The topic is a secret transport address. Do not publish it, commit it, or share it in logs.
122
65
 
123
- ## Manual Setup
66
+ ## Tool Compatibility Matrix
124
67
 
125
- Advanced users can still use the lower-level commands directly:
126
-
127
- ```bash
128
- agentbell init
129
- agentbell test
130
- agentbell init-hooks --target codex
131
- agentbell init-hooks --target claude-code
132
- agentbell init-hooks --target vscode-agent
133
- ```
134
-
135
- Use manual setup when you want to provide your own topic, skip the guided Android flow, or install hooks one tool at a time.
136
- ## Commands
137
-
138
- ### `agentbell send`
139
-
140
- 閻劋绨悮?hook 鐠嬪啰鏁ら敍灞藉絺闁椒绔村▎锟犫偓姘辩叀閵?
141
- ```bash
142
- agentbell send --tool codex --event stop --title "Codex 鐎瑰本鍨氭禍? --message "鏉╂粎鈻奸張鍝勬珤娑撳﹦娈?Codex 瀹歌尙绮ㄩ弶鐔告拱鏉烆喕鎹㈤崝?
143
- ```
144
-
145
- 鐢摜鏁ら崣鍌涙殶閿?
146
- - `--tool`: `claude-code`閵嗕梗codex`閵嗕梗vscode-agent`閵嗕梗custom`
147
- - `--event`: `stop`閵嗕梗notification`閵嗕梗error`閵嗕梗permission`閵嗕梗custom`
148
- - `--title`: 闁氨鐓¢弽鍥暯閿涘苯褰查柅?- `--message`: 闁氨鐓¢崘鍛啇閿涘苯褰查柅?- `--priority`: ntfy priority閿涘苯褰查柅?- `--tags`: ntfy tags閿涘矂鈧褰块崚鍡涙閿涘苯褰查柅?- `--config`: 閹稿洤鐣鹃柊宥囩枂閺傚洣娆㈢捄顖氱窞閿涘苯褰查柅?
149
- 婵″倹鐏夋稉宥勭炊 `title` 閹?`message`閿涘瓑gentBell 娴兼俺鍤滈崝銊ф晸閹存劙绮拋銈呭敶鐎圭櫢绱濋獮鑸电壌閹诡噣鍘ょ純顔煎瘶閸?`tool`閵嗕梗event`閵嗕梗hostname`閵嗕梗cwd`閵嗕梗timestamp`閵?
150
- ### `agentbell test`
151
-
152
- 閸欐垿鈧焦绁寸拠鏇⑩偓姘辩叀閿?
153
- ```bash
154
- agentbell test
155
- ```
156
-
157
- 閺嶅洭顣介敍姝欰gentBell 濞村鐦痐
158
-
159
- 閸愬懎顔愰敍姝氭俊鍌涚亯娴g姷婀呴崚棰佺啊鏉╂瑦娼柅姘辩叀閿涘矁顕╅弰?AgentBell 瀹歌尙绮¢柊宥囩枂閹存劕濮涢妴淇?
160
- ### `agentbell verify`
161
-
162
- Checks whether AgentBell is still installed correctly: config, provider settings, hook files, wrapper files, recent wrapper logs, stale paths, and optional manual notification / wrapper execution.
68
+ | Tool | Surface | Hook type | Config location | Wrapper location | Status | Notes |
69
+ |---|---|---|---|---|---|---|
70
+ | Codex | VS Code extension | Stop | `~/.codex/hooks.json` | `~/.agentbell/hooks/codex-stop.cmd` | Verified on Windows | User-level hook, usually works across projects |
71
+ | Claude Code | CLI / VS Code terminal mode | Stop / Notification | `~/.claude/settings.json` | `<project>/.agentbell-hooks/*.sh` | Stop verified, Notification prepared | Windows requires Git Bash for `.sh` wrapper |
72
+ | VS Code Copilot Agent | VS Code Agent mode | Stop | `<project>/.github/hooks/agentbell.json` | `<project>/.agentbell-hooks/copilot-stop.cmd` | Verified on Windows | Project-level hook; VS Code Agent hooks are Preview |
163
73
 
164
- Common uses:
74
+ ## Important Differences Between Tools
165
75
 
166
- - A task finished but no phone notification arrived.
167
- - You moved the project directory.
168
- - You renamed or moved the project and suspect stale old-project paths.
169
- - You deleted or regenerated wrapper files.
170
- - You reinstalled Node.js.
171
- - You updated Codex, Claude Code, or VS Code.
172
- - Hooks were trusted but still do not send notifications.
76
+ Codex:
173
77
 
174
- Examples:
78
+ - Uses a user-level hook.
79
+ - After setup, it usually works across projects.
80
+ - You do not usually need to run `init-hooks` in every project.
81
+ - To refresh the wrapper, run:
175
82
 
176
83
  ```bash
177
- agentbell verify
178
- agentbell verify --target codex
179
- agentbell verify --target vscode-agent --run-wrapper
180
- agentbell verify --send-test
181
- agentbell verify --json > agentbell-verify.json
84
+ agentbell init-hooks --target codex
182
85
  ```
183
86
 
184
- Options:
185
-
186
- - `--target <target>` checks `codex`, `claude-code`, `vscode-agent`, or `all`.
187
- - `--send-test` sends an `AgentBell verify test` phone notification.
188
- - `--run-wrapper` manually runs the selected wrapper command to verify it can call AgentBell.
189
- - `--dry-run` only inspects files and config; it does not send notifications or run wrappers.
190
- - `--json` prints a structured report with masked topic values.
191
- Log parsing note:
192
-
193
- `verify` evaluates the latest hook run block, not every historical line in the log. Old failures are ignored once a newer successful wrapper run is recorded.
87
+ Claude Code:
194
88
 
195
- 中文说明:`verify` 只根据最近一次 hook/wrapper 运行判断当前状态。历史日志里的旧项目路径 / `MODULE_NOT_FOUND` 不会在最新运行成功后继续导致 `error`。
196
- If verify reports stale old-project paths or a missing `dist/cli.js`, refresh hooks with:
89
+ - Uses `~/.claude/settings.json`.
90
+ - On Windows, AgentBell uses Git Bash to run project-local `.sh` wrappers.
91
+ - If `agentbell verify --run-wrapper` cannot find bash, set:
197
92
 
198
- ```bash
199
- node dist\cli.js init-hooks --target all
200
- ```
201
- ### `agentbell doctor`
202
-
203
- 鏉堟挸鍤悳顖氼暔鐠囧﹥鏌囨穱鈩冧紖閿涘矂鈧倸鎮庢径宥呭煑缂佹瑥鍩嗘禍鐑樺笓閺屻儻绱?
204
- ```bash
205
- agentbell doctor
93
+ ```cmd
94
+ set AGENTBELL_BASH_PATH=C:\Path\To\bash.exe
206
95
  ```
207
96
 
208
- 閸栧懎鎯堥柊宥囩枂閸欘垵顕伴幀褋鈧垢rovider閵嗕苟tfy server閵嗕辜opic 閺勵垰鎯佺€涙ê婀妴浣搁挬閸欒埇鈧弓ostname閵嗕菇sername閵嗕恭wd閵嗕腐ode 閻楀牊婀伴妴涓哃I 鐠嬪啰鏁ょ捄顖氱窞閸滃本甯归懡?hook 閸涙垝鎶ら妴?
209
- ### `agentbell init`
97
+ VS Code Copilot Agent:
210
98
 
211
- 娴溿倓绨板蹇曟晸閹存劙鍘ょ純顕嗙窗
99
+ - Uses a project-level hook file.
100
+ - Each project needs `<project>/.github/hooks/agentbell.json`.
101
+ - Run this inside each project where you want Copilot Agent notifications:
212
102
 
213
103
  ```bash
214
- agentbell init
215
- ```
216
-
217
- 姒涙顓婚崘娆忓弳閿?
218
- ```text
219
- ~/.agentbell/config.json
220
- ```
221
-
222
- 闁板秶鐤嗙粈杞扮伐閿?
223
- ```json
224
- {
225
- "provider": "ntfy",
226
- "ntfy": {
227
- "server": "https://ntfy.sh",
228
- "topic": "your-long-random-topic",
229
- "priority": "high",
230
- "tags": ["computer"]
231
- },
232
- "localNotification": {
233
- "enabled": true
234
- },
235
- "includeContext": {
236
- "hostname": true,
237
- "cwd": true,
238
- "timestamp": true
239
- }
240
- }
241
- ```
242
-
243
- 閸?macOS/Linux 娑撳绱濋柊宥囩枂閺傚洣娆㈡导姘晼闁插繗顔曠純顔昏礋 `600` 閺夊啴妾洪妴淇塱ndows 娑撳﹣绱扮捄瀹犵箖 POSIX 閺夊啴妾虹拋鍓х枂閵?
244
- ### `agentbell init-hooks`
245
-
246
- 閻㈢喐鍨?hook 闁板秶鐤嗗Ο鈩冩緲閿?
247
- ```bash
248
- agentbell init-hooks --target claude-code
249
- agentbell init-hooks --target codex
250
104
  agentbell init-hooks --target vscode-agent
251
- agentbell init-hooks --target all
252
- ```
253
-
254
- AgentBell 娑撳秳绱扮划妤佹瘹鐟曞棛娲婂鍙夋箒闁板秶鐤嗛妴鍌氬嚒閺?JSON 閺傚洣娆㈡导姘帥婢跺洣鍞ゆ稉?`.bak-閺冨爼妫块幋鐮㈤敍宀€鍔ч崥搴℃晼闁插繐浠?JSON merge閵嗗倸顩ч弸婊冨嚒閺堝鏋冩禒鏈电瑝閺勵垰鎮庡▔?JSON閿涘奔绱伴悽鐔稿灇 snippet 閺傚洣娆㈤獮鑸靛絹缁€杞版眽瀹搞儱鎮庨獮韬测偓?
255
- Preview hook changes without writing files:
256
-
257
- ```bash
258
- agentbell init-hooks --target codex --dry-run
259
- agentbell init-hooks --target all --dry-run
260
105
  ```
261
106
 
262
- Dry-run prints the target config paths, whether existing config was detected, what a real run would merge, and the hook snippet that would be generated. It does not write files and does not create backups.
263
-
264
- ## Claude Code Example
265
-
266
- 閻╊喗鐖i弬鍥︽閿?
267
- ```text
268
- ~/.claude/settings.json
269
- ```
270
-
271
- 閻╊喗鐖i弫鍫熺亯閿?
272
- ```json
273
- {
274
- "hooks": {
275
- "Stop": [
276
- {
277
- "matcher": "",
278
- "hooks": [
279
- {
280
- "type": "command",
281
- "command": "agentbell send --tool claude-code --event stop"
282
- }
283
- ]
284
- }
285
- ],
286
- "Notification": [
287
- {
288
- "matcher": "",
289
- "hooks": [
290
- {
291
- "type": "command",
292
- "command": "agentbell send --tool claude-code --event notification"
293
- }
294
- ]
295
- }
296
- ]
297
- }
298
- }
299
- ```
107
+ ## Rich Notification Context
300
108
 
301
- ## Codex Example
109
+ AgentBell can generate notifications such as:
302
110
 
303
- 閻╊喗鐖i弬鍥︽閿?
304
111
  ```text
305
- ~/.codex/hooks.json
306
- ```
307
-
308
- 閻╊喗鐖i弫鍫熺亯閿?
309
- ```json
310
- {
311
- "hooks": {
312
- "stop": [
313
- {
314
- "command": "agentbell send --tool codex --event stop"
315
- }
316
- ]
317
- }
318
- }
319
- ```
112
+ Workstation-01 · Codex audit task finished
320
113
 
321
- AgentBell 鏉╂ü绱伴悽鐔稿灇閿?
322
- ```text
323
- ~/.agentbell/snippets/codex-hooks.json
114
+ Project: AgentBell
115
+ Path: G:\learning\AgentBell
116
+ Branch: main
117
+ Event: stop
118
+ Time: 2026-05-23 22:45
324
119
  ```
325
120
 
326
- Codex hook 闁板秶鐤嗛弽鐓庣础閸欘垵鍏橀梾蹇曞閺堫剙褰夐崠鏍モ偓鍌濆娴g姷娈?Codex 閻楀牊婀版担璺ㄦ暏娑撳秴鎮?schema閿涘矁顕幎?snippet 娑擃厾娈戦崨鎴掓姢鏉╀胶些閸掓媽顕氶悧鍫熸拱鐟曚焦鐪伴惃鍕秴缂冾喓鈧?
327
- ### Codex Windows Wrapper
328
-
329
- On Windows, AgentBell writes a `.cmd` wrapper and points Codex to that wrapper instead of embedding a long `node.exe ... cli.js ...` command directly in `hooks.json`.
330
-
331
- Target files:
121
+ Project name priority:
332
122
 
333
- ```text
334
- ~/.codex/hooks.json
335
- ~/.agentbell/hooks/codex-stop.cmd
336
- ~/.agentbell/snippets/codex-hooks.json
337
- ```
123
+ 1. CLI `--project`
124
+ 2. `.agentbell.json` `projectName`
125
+ 3. `package.json` `name`
126
+ 4. Current folder name
338
127
 
339
- Verified Windows hook shape:
128
+ If you are happy with the folder name, you do not need `.agentbell.json`.
340
129
 
341
- ```json
342
- {
343
- "hooks": {
344
- "Stop": [
345
- {
346
- "hooks": [
347
- {
348
- "type": "command",
349
- "commandWindows": "cmd /d /s /c \"C:\\Users\\<user>\\.agentbell\\hooks\\codex-stop.cmd\"",
350
- "command": "cmd /d /s /c \"C:\\Users\\<user>\\.agentbell\\hooks\\codex-stop.cmd\"",
351
- "timeout": 30,
352
- "statusMessage": "Sending AgentBell notification"
353
- }
354
- ]
355
- }
356
- ]
357
- }
358
- }
359
- ```
130
+ To customize project context:
360
131
 
361
- The wrapper logs to:
362
-
363
- ```text
364
- ~/.agentbell/codex-hook-fired.log
132
+ ```bash
133
+ agentbell project init --name MyProject --task "AI coding task"
365
134
  ```
366
135
 
367
- If the log contains `Notification sent.` but your phone does not receive anything, troubleshoot ntfy, Android notification permissions, and battery optimization. If the log file does not exist, Codex did not execute the hook or the hook was not trusted.
136
+ Example `.agentbell.json`:
368
137
 
369
- ## VS Code Agent Example
370
-
371
- 閻╊喗鐖i弬鍥︽閺勵垰浼愭担婊冨隘缁狙囧帳缂冾噯绱?
372
- ```text
373
- .github/hooks/agentbell.json
374
- ```
375
-
376
- 閻╊喗鐖i弫鍫熺亯閿?
377
138
  ```json
378
139
  {
379
- "name": "agentbell",
380
- "description": "Notify Android via AgentBell when VS Code Agent / Copilot Agent stops.",
381
- "hooks": {
382
- "stop": [
383
- {
384
- "command": "agentbell send --tool vscode-agent --event stop"
385
- }
386
- ]
387
- }
140
+ "projectName": "MyProject",
141
+ "defaultTaskName": "AI coding task"
388
142
  }
389
143
  ```
390
144
 
391
- 閸楀厖濞囪ぐ鎾冲閻╊喖缍嶆稉宥嗘Ц git 妞ゅ湱娲伴敍瀛塯entBell 娑旂喎鍘戠拋鍝ユ晸閹存劘绻栨稉?workspace hook 閺傚洣娆㈤敍灞借嫙娴兼碍褰佺粈杞扮稑绾喛顓荤€圭偤妾銉ュ徔閺勵垰鎯佺拠璇插絿鐎瑰啨鈧?
392
- ## Real Hook Verification
393
-
394
- Hook schemas can change across AI coding tools. AgentBell keeps the templates small and visible so you can verify them with the tool version you actually run.
395
-
396
- ### Codex
397
-
398
- Preview the Codex hook first:
399
-
400
- ```bash
401
- agentbell init-hooks --target codex --dry-run
402
- ```
403
-
404
- Then write the hook:
405
-
406
- ```bash
407
- agentbell init-hooks --target codex
408
- ```
409
-
410
- Run a minimal Codex task, for example asking it to inspect a tiny file or answer a short codebase question. When the task stops, you should receive an ntfy notification from `agentbell send --tool codex --event stop`.
411
-
412
- If no notification arrives, run:
145
+ ## Commands
413
146
 
414
147
  ```bash
415
- agentbell doctor
416
- agentbell doctor --json
148
+ agentbell setup
417
149
  agentbell test
418
- ```
419
-
420
- Check that the config path exists, the ntfy server is reachable, and the command shown in the dry-run output is valid in the same shell/environment where Codex runs.
421
-
422
- ### Claude Code
423
-
424
- Preview or write Claude Code hooks:
425
-
426
- ```bash
427
- agentbell init-hooks --target claude-code --dry-run
428
- agentbell init-hooks --target claude-code
429
- ```
430
-
431
- To verify the Stop hook, run a small Claude Code task and let it finish normally. You should receive a notification for `--tool claude-code --event stop`.
432
-
433
- To verify the Notification hook, trigger a Claude Code state that asks for user attention, such as waiting for input or a permission-related notification. You should receive a notification for `--tool claude-code --event notification`.
434
-
435
- Use the event name to distinguish states:
436
-
437
- - `stop`: the agent finished the current task or turn.
438
- - `notification`: the agent is asking for attention, often because it is waiting for input or needs user action.
439
-
440
- If the Stop hook works but Notification does not, inspect the installed Claude Code version and its hook documentation. The event name or schema may have changed.
441
-
442
- ## Claude Code Verification
443
-
444
- AgentBell prepares Claude Code hooks with this shape:
445
-
446
- ```text
447
- hooks.Stop[].hooks[]
448
- hooks.Notification[].hooks[]
449
- ```
450
-
451
- Each handler uses `type: "command"` and calls `agentbell send`. On Windows, Claude Code runs hook commands through Git Bash / shell, so AgentBell writes project-local `.sh` wrappers instead of `.cmd` wrappers:
452
-
453
- ```text
454
- <projectRoot>\.agentbell-hooks\claude-stop.sh
455
- <projectRoot>\.agentbell-hooks\claude-notification.sh
456
- ```
457
-
458
- Both wrappers log to:
459
-
460
- ```text
461
- <projectRoot>\.agentbell-hooks\claude-hook-fired.log
462
- ```
463
-
464
- The generated Claude Code commands look like:
465
-
466
- ```bash
467
- bash G:/learning/AgentBell/.agentbell-hooks/claude-stop.sh
468
- bash G:/learning/AgentBell/.agentbell-hooks/claude-notification.sh
469
- ```
470
-
471
- Wrapper timestamps use an ASCII-safe UTC format, `date -u +"%Y-%m-%dT%H:%M:%SZ"`, to avoid mojibake on Windows systems with non-English locale output.
472
-
473
- Preview the files:
474
-
475
- ```bash
476
- agentbell init-hooks --target claude-code --dry-run
477
- ```
478
-
479
- Write the hooks:
480
-
481
- ```bash
482
- agentbell init-hooks --target claude-code
483
- ```
484
-
485
- After changing Claude Code hooks, trust or allow the hook if Claude Code prompts you. To verify `Stop`, run a tiny Claude Code task and let it finish. To verify `Notification`, trigger a state where Claude Code waits for user attention, such as input or permission. If no phone notification arrives, check `<projectRoot>\.agentbell-hooks\claude-hook-fired.log` first. If the log file does not exist, Claude Code did not execute or trust the hook. If the log contains `Notification sent.`, troubleshoot ntfy and Android notification delivery.
486
-
487
- ### VS Code Agent / Copilot Agent
488
-
489
- VS Code Agent / Copilot Agent support is treated as a workspace hook. AgentBell writes:
490
-
491
- ```text
492
- .github/hooks/agentbell.json
493
- ```
494
-
495
- Preview or write it from the workspace root:
496
-
497
- ```bash
498
- agentbell init-hooks --target vscode-agent --dry-run
499
- agentbell init-hooks --target vscode-agent
500
- ```
501
-
502
- This capability may vary by VS Code and Copilot Agent version. After writing the file, reload VS Code, run a small workspace agent task, and confirm whether the hook command is executed. If it is not triggered, manually compare `.github/hooks/agentbell.json` with the hook format expected by your VS Code version, then move the command into the supported location.
503
-
504
- Use `agentbell doctor` inside the same workspace terminal to confirm the CLI path, Node version, current working directory, and config file location.
505
-
506
- ## Verified: Codex VS Code Extension on Windows
507
-
508
- The VS Code Codex extension has been manually verified on Windows with AgentBell:
509
-
510
- - `UserPromptSubmit` and `Stop` hooks can be triggered by the extension.
511
- - `Stop` hook successfully calls AgentBell through the generated `.cmd` wrapper.
512
- - The full path works: Codex Stop hook -> `.cmd` wrapper -> AgentBell -> ntfy -> Android phone notification.
513
- - The successful wrapper log is written to `~/.agentbell/codex-hook-fired.log`.
514
-
515
- After changing hooks, Codex may require you to trust the updated hook again. If you use WSL, configure AgentBell separately inside WSL because Windows, WSL, Remote SSH, and Dev Containers have different home directories, Node paths, and hook execution environments.
516
-
517
- ## Local Desktop Notifications
518
-
519
- 闂勩倓绨?ntfy 閹靛婧€閹恒劑鈧緤绱滱gentBell 閸欘垯浜掔悰銉ュ帠閺堫剙婀村宀勬桨闁氨鐓¢敍?
520
- - macOS: `osascript display notification`
521
- - Linux: 娴兼ê鍘?`notify-send`閿涘奔绗夌€涙ê婀崚娆掔儲鏉?- Windows: MVP 闂冭埖顔岀捄瀹犵箖閸欘垶娼幀褌绗夌搾宕囨畱閺堫剙婀?toast閿涘苯鑻熺紒娆忓毉閹绘劗銇?
522
- 閺堫剙婀撮柅姘辩叀婢惰精瑙︽稉宥勭窗瑜板崬鎼?ntfy 閹靛婧€閹恒劑鈧降鈧?
523
- ## Remote SSH / WSL / Dev Container
524
-
525
- Hook 鎼存棁顕氶崷銊ョ杽闂勫懓绻嶇悰?AI coding agent 閻ㄥ嫭婧€閸c劋绗傞幍褑顢戦妴鍌涚槷婵″偊绱?
526
- - Remote SSH: hook 閸︺劏绻欑粙?Linux 娑撶粯婧€閹笛嗩攽閵?- WSL: hook 閸?WSL 閻滎垰顣ㄩ幍褑顢戦妴?- Dev Container: hook 閸?container 閸愬懏澧界悰灞烩偓?- 鏉╂粍甯堕悽浣冨壋: hook 閸︺劏顫︽潻婊勫付閻絻鍓抽幍褑顢戦妴?
527
- 閸ョ姵顒濇担鐘绘付鐟曚礁婀柇锝勯嚋閻滎垰顣ㄩ柌灞界暔鐟?Node.js 20+閵嗕礁鐣ㄧ憗?AgentBell閵嗕浇绻嶇悰?`agentbell init`閿涘苯鑻熺涵顔荤箽鐠囥儳骞嗘晶鍐厴鐠佸潡妫?ntfy server閵?
528
- ## Troubleshooting
529
-
530
- ### 閹靛婧€閺€鏈电瑝閸掍即鈧氨鐓?
531
- 閸忓牐绻嶇悰宀嬬窗
532
-
533
- ```bash
150
+ agentbell send --tool codex --event stop --task "audit task"
151
+ agentbell project init --name MyProject --task "AI coding task"
152
+ agentbell init-hooks --target all
153
+ agentbell verify
534
154
  agentbell doctor
535
- agentbell test
536
155
  ```
537
156
 
538
- 濡偓閺屻儲澧滈張鐑樻Ц閸氾箒顓归梼鍛啊閸氬奔绔存稉?topic閵嗕苟tfy 閺勵垰鎯侀張澶愨偓姘辩叀閺夊啴妾洪妴浣规Ц閸氾箑鍙ч梻顓濈啊閻㈠灚鐫滄导妯哄閵嗕辜opic 閺勵垰鎯佺搾鍐差檮闂呭繑婧€娑撴梹鐥呴張澶庣翻闁挎瑣鈧?
539
- ### 鏉╂粎鈻奸張鍝勬珤閺冪姵纭剁拋鍧楁6 ntfy.sh
540
-
541
- 鏉╂劘顢?`agentbell doctor` 閺屻儳婀?`ntfy server access`閵嗗倸顩ч弸婊冨彆閸欏摜缍夌紒婊勫灗閺堝秴濮熼崳銊х秹缂佹粓妾洪崚鎯邦問闂?`ntfy.sh`閿涘苯褰叉禒銉ㄥ殰瀵?ntfy server閿涘瞼鍔ч崥搴℃躬 `~/.agentbell/config.json` 娑擃厺鎱ㄩ弨?`ntfy.server`閵?
542
- ### hook 濞屄ば曢崣?
543
- 绾喛顓?hook 闁板秶鐤嗛弬鍥︽閸︺劌顕惔鏂夸紣閸忓嘲鐤勯梽鍛邦嚢閸欐牜娈戞担宥囩枂閵嗗倷鎱ㄩ弨?hook 閸氬函绱濋柌宥呮儙閹?reload 鐎电懓绨?AI coding 瀹搞儱鍙块妴鍌氬帥閻劋绔存稉顏勭发鐏忓繒娈?agent 娴犺濮熸宀冪槈 stop hook閵?
544
- 婵″倹鐏?Windows 娑?Codex hook 濞屸剝婀佺憴锕€褰傞柅姘辩叀閿涘矁顕Λ鈧弻?`~/.agentbell/codex-hook-fired.log`閵?
545
- ### Windows 鐠侯垰绶為梻顕€顣?
546
- 婵″倹鐏夐崗銊ョ湰 `agentbell` 閸涙垝鎶ら崷?hook 閻滎垰顣ㄩ柌灞肩瑝閸欘垵顫嗛敍灞藉讲娴犮儰濞囬悽?`agentbell doctor` 鏉堟挸鍤惃?`cli invocation for hooks`閵嗗倸婀張顒€婀村鈧崣鎴炴閿涘苯鐣犻崣顖濆厴閺?`node path/to/dist/cli.js`閵?
547
- ### WSL / Remote SSH 娑?hook 鐎圭偤妾潻鎰攽娴e秶鐤嗛梻顕€顣?
548
- 鐠囧嘲婀?agent 鐎圭偤妾潻鎰攽閻滎垰顣ㄩ柌灞惧⒔鐞?`agentbell doctor`閵嗕繅indows 娑撶粯婧€閵嗕箘SL閵嗕浇绻欑粙瀣╁瘜閺堟亽鈧笍ev Container 閺勵垯绗夐崥宀€骞嗘晶鍐跨礉閸氬嫯鍤滈張澶夌瑝閸氬瞼娈?home閵嗕赋ATH閵嗕腐ode 閸滃矂鍘ょ純顔芥瀮娴犺翰鈧?
549
- ### Cannot find module old project dist cli.js
550
-
551
- If a wrapper log contains an error like:
552
-
553
- ```text
554
- Cannot find module '...\old-project\dist\cli.js'
555
- MODULE_NOT_FOUND
556
- ```
557
-
558
- then the hook and wrapper did execute, but the active wrapper still points to an old project path. This can happen after renaming or moving the project directory.
559
-
560
- Fix:
157
+ Useful examples:
561
158
 
562
159
  ```bash
563
- node dist\cli.js init-hooks --target all
564
- agentbell verify --dry-run
565
- ```
566
- ### setup test failed
567
-
568
- If `agentbell setup` sends a test notification but the phone does not receive it:
569
-
570
- - Check that the topic in ntfy Android exactly matches the AgentBell topic.
571
- - Check the ntfy server URL.
572
- - Open the ntfy app once to refresh the subscription.
573
- - Allow notification permission.
574
- - Allow background running / disable battery optimization.
575
- - Run `agentbell doctor` and inspect warnings.
576
-
577
- If you skipped hook installation during setup, rerun `agentbell setup` or use `agentbell init-hooks --target all` after phone delivery works.
578
-
579
- It is safe to rerun setup. Existing hook files are backed up by the hook installer before merge/write where supported.
580
- ### Cannot convert argument to a ByteString
581
-
582
- This can happen when a Node.js `fetch` header contains Chinese text, emoji, or other non-ASCII characters. ntfy supports UTF-8 header values through RFC 2047 encoded-word syntax, so AgentBell automatically encodes ntfy headers such as `Title` and `Tags`.
583
-
584
- The notification body is not header data and remains a normal UTF-8 message.
585
-
586
- If you still see this error, upgrade AgentBell and rebuild it. As a temporary workaround, use an English-only `--title` and ASCII-only `--tags`.
587
-
588
- ## Development
589
-
590
- ```bash
591
- npm install
592
- npm run build
593
- npm test
594
- npm run dev -- test
160
+ agentbell setup --yes --targets none --no-test
161
+ agentbell setup --dry-run
162
+ agentbell init-hooks --target all --dry-run
163
+ agentbell send --tool claude-code --event stop --project MyProject --task "README update"
595
164
  ```
596
165
 
597
- 濞村鐦导?mock `fetch`閿涘奔绗夋导姘辨埂閻ㄥ嫬鎮?`ntfy.sh` 閸欐垼顕Ч鍌樷偓鍌氬涧閺堝鏁ら幋閿嬫▔瀵繗绻嶇悰?`agentbell test` 閹?`agentbell send` 閺冭埖澧犳导姘絺闁胶婀$€圭偤鈧氨鐓¢妴?
598
- ## Compatibility / Verified Matrix
599
-
600
- | Tool | Surface | OS | Hook event | Wrapper strategy | Status | Log path |
601
- |---|---|---|---|---|---|---|
602
- | Codex | VS Code extension | Windows | Stop | user `.cmd` wrapper | Verified | `~/.agentbell/codex-hook-fired.log` |
603
- | Claude Code | CLI / VS Code terminal mode | Windows | Stop | project `.sh` wrapper | Verified | `<projectRoot>/.agentbell-hooks/claude-hook-fired.log` |
604
- | Claude Code | CLI / VS Code terminal mode | Windows | Notification | project `.sh` wrapper | Prepared / Partially verified | `<projectRoot>/.agentbell-hooks/claude-hook-fired.log` |
605
- | VS Code Copilot Agent | VS Code Agent mode | Windows | Stop | project `.cmd` wrapper | Verified | `<projectRoot>/.agentbell-hooks/copilot-hook-fired.log` |
606
- | Remote SSH / WSL / Dev Container | Various | Various | TBD | TBD | Not verified | TBD |
607
-
608
- Verified means the full chain reached Android notification on the author's Windows machine. Claude Code Notification is prepared but should not be treated as fully verified until a real Notification event is tested. VS Code Agent hooks are still a Preview capability, so re-verify after VS Code or Copilot updates.
166
+ ## Verification
609
167
 
610
- ## Verified: Codex VS Code Extension on Windows
611
-
612
- Verified path:
613
-
614
- ```text
615
- Codex Stop hook -> ~/.agentbell/hooks/codex-stop.cmd -> AgentBell -> ntfy -> Android
616
- ```
617
-
618
- Install or refresh the hook:
168
+ Use `verify` when a hook is not firing, a notification does not arrive, Node was reinstalled, or a project was moved.
619
169
 
620
170
  ```bash
621
- node dist\cli.js init-hooks --target codex
622
- ```
623
-
624
- Then restart or reload VS Code / Codex, trust the hook if prompted, run a small Codex task, and inspect:
625
-
626
- ```text
627
- ~/.agentbell/codex-hook-fired.log
171
+ agentbell verify --dry-run
172
+ agentbell verify --run-wrapper --send-test
173
+ agentbell verify --target codex
174
+ agentbell verify --target claude-code --run-wrapper
175
+ agentbell verify --target vscode-agent --run-wrapper
176
+ agentbell verify --json > agentbell-verify.json
628
177
  ```
629
178
 
630
- Log interpretation:
631
-
632
- - `Notification sent.` plus exit code `0`: AgentBell successfully sent the ntfy request.
633
- - No log file: Codex did not execute the hook or the hook was not trusted.
634
- - Log exists but phone did not receive notification: troubleshoot ntfy, Android background permissions, and notification permissions.
179
+ Notes:
635
180
 
636
- Why `.cmd` wrapper on Windows:
181
+ - `--dry-run` inspects files and logs but does not run wrappers or send notifications.
182
+ - Warnings are normal in dry-run mode because wrapper execution is intentionally skipped.
183
+ - `--send-test` sends a phone notification through the configured provider.
184
+ - `--run-wrapper` manually runs the generated wrapper and then re-reads the latest hook log.
185
+ - Topics are masked in verify output.
637
186
 
638
- - Directly embedding a complex `"node.exe" "cli.js" send ...` command in `~/.codex/hooks.json` is fragile on Windows because quoting, spaces, and path escaping can vary by host.
639
- - The generated `.cmd` wrapper gives Codex a short stable command and gives AgentBell a log file for troubleshooting.
640
- - Codex uses the `hooks.Stop[].hooks[]` schema and the Windows-specific `commandWindows` field.
641
- - After changing hooks, Codex may ask you to trust the updated hook again.
187
+ Log parsing behavior:
642
188
 
643
- ## Verified: Claude Code on Windows
189
+ `verify` evaluates the latest hook run block, not every historical line in the log. Old failures are ignored once a newer successful wrapper run is recorded.
644
190
 
645
- Claude Code CLI must be available:
191
+ Global install path behavior:
646
192
 
647
- ```bash
648
- claude --version
649
- ```
193
+ After `npm install -g @xwss/agentbell`, AgentBell can be run from any project directory. The current working directory is the project context for `.agentbell.json`, `.agentbell-hooks`, logs, `--cwd`, project name, and git branch detection. The AgentBell CLI path is the globally installed package path. `verify` should not require the project directory to contain `dist/cli.js`.
650
194
 
651
- Hooks should be visible with:
195
+ If verify reports that a wrapper incorrectly points to `<project>/dist/cli.js` after global install, update AgentBell and refresh hooks:
652
196
 
653
197
  ```bash
654
- claude /hooks
198
+ agentbell init-hooks --target all
655
199
  ```
656
200
 
657
- If `/hooks` cannot find `claude`, the Claude Code CLI is not installed or `PATH` is not configured in the terminal environment.
658
-
659
- Claude Code on Windows executes hook commands through Git Bash / shell. AgentBell therefore generates project-local `.sh` wrappers, not user-home `.cmd` wrappers.
660
-
661
- Verified path:
201
+ ## Troubleshooting
662
202
 
663
- ```text
664
- Claude Code Stop hook -> <projectRoot>/.agentbell-hooks/claude-stop.sh -> AgentBell -> ntfy -> Android
665
- ```
203
+ ### `agentbell` command not found
666
204
 
667
- How to verify:
205
+ - Make sure the package is installed:
668
206
 
669
207
  ```bash
670
- node dist\cli.js init-hooks --target claude-code
671
- claude /hooks
208
+ npm install -g @xwss/agentbell@beta
672
209
  ```
673
210
 
674
- Confirm `Stop` and `Notification` are present, trust or allow hooks if prompted, then run a tiny Claude Code prompt:
211
+ - Make sure the npm global bin directory is in `PATH`.
212
+ - On Windows, a common npm global bin path is `%APPDATA%\npm`.
213
+ - PowerShell may block the `.ps1` shim. Try CMD or:
675
214
 
676
- ```text
677
- 璇峰洖澶嶄竴鍙?hello锛屼笉瑕佷慨鏀规枃浠躲€?```
678
-
679
- Inspect:
680
-
681
- ```text
682
- <projectRoot>/.agentbell-hooks/claude-hook-fired.log
215
+ ```cmd
216
+ cmd /d /s /c agentbell --help
683
217
  ```
684
218
 
685
- Old logs may contain mojibake from locale-specific Windows date output. The current wrapper uses ISO-style UTC timestamps such as `2026-05-23T13:28:27Z`; after clearing old logs, new entries should be ASCII-safe.
686
-
687
- The Claude Code Notification hook is prepared / partially verified. Do not treat it as fully verified until you have triggered and confirmed a real Notification event on your machine.
688
-
219
+ ### Windows local desktop notification skipped
689
220
 
690
- ### Claude verify run-wrapper on Windows
221
+ This is expected in the MVP. Phone push still works.
691
222
 
692
- `agentbell verify --target claude-code --run-wrapper` runs the Claude `.sh` wrapper with a resolved Git Bash executable. On Windows it uses this order:
223
+ ### Claude Code verify requires bash
693
224
 
694
- 1. `AGENTBELL_BASH_PATH`, if set and the file exists.
695
- 2. `bash` found on `PATH`.
696
- 3. Common Git for Windows paths such as `C:\Program Files\Git\bin\bash.exe`.
225
+ On Windows, set the Git Bash path if auto-detection fails:
697
226
 
698
- Example:
699
-
700
- ```bat
701
- set AGENTBELL_BASH_PATH=D:\software\git\bin\bash.exe
227
+ ```cmd
228
+ set AGENTBELL_BASH_PATH=C:\Program Files\Git\bin\bash.exe
702
229
  agentbell verify --target claude-code --run-wrapper
703
230
  ```
704
231
 
705
- The verify report prints the resolved bash path:
706
-
707
- ```text
708
- [Claude Code]
709
- bash: D:\software\git\bin\bash.exe
710
- ```
711
-
712
- If manual bash execution succeeds but verify fails, run:
713
-
714
- ```bash
715
- agentbell verify --target claude-code --run-wrapper --json
716
- ```
717
-
718
- Compare `bashPath`, `runWrapper`, and the latest log block status. A successful latest Claude block should include `Notification sent.` and `AgentBell exit code 0`.
719
-
720
- ## Verified: VS Code Copilot Agent on Windows
721
-
722
- VS Code Agent hooks are still Preview, but the Windows Stop path below has been verified with Copilot Agent mode.
723
-
724
- Verified path:
725
-
726
- ```text
727
- VS Code Copilot Agent Stop hook -> <projectRoot>/.agentbell-hooks/copilot-stop.cmd -> AgentBell -> ntfy -> Android
728
- ```
729
-
730
- Generated files:
731
-
732
- - Hook file: `.github/hooks/agentbell.json`
733
- - Wrapper: `<projectRoot>/.agentbell-hooks/copilot-stop.cmd`
734
- - Log: `<projectRoot>/.agentbell-hooks/copilot-hook-fired.log`
232
+ ### Hook not firing
735
233
 
736
- How to verify:
737
-
738
- ```bash
739
- node dist\cli.js init-hooks --target vscode-agent
740
- ```
234
+ Try:
741
235
 
742
- Reload VS Code, use Copilot Chat in Agent mode to run a small task, then inspect the log file above and confirm the phone notification. The generated Windows hook command uses:
236
+ 1. Restart VS Code or the target AI tool.
237
+ 2. Trust hooks if prompted.
238
+ 3. Run `agentbell verify`.
239
+ 4. Check logs:
743
240
 
744
241
  ```text
745
- cmd /d /s /c "<projectRoot>\.agentbell-hooks\copilot-stop.cmd"
242
+ Codex: ~/.agentbell/codex-hook-fired.log
243
+ Claude Code: <project>/.agentbell-hooks/claude-hook-fired.log
244
+ Copilot Agent: <project>/.agentbell-hooks/copilot-hook-fired.log
746
245
  ```
747
246
 
748
- Do not use single quotes around the wrapper path. If Windows says the wrapper path is not recognized as an internal/external command, executable program, or batch file, the hook probably used single quotes or did not pass the wrapper path through `cmd /d /s /c` with double quotes.
247
+ ### ntfy notification delay
749
248
 
750
- For hook-level debugging, open `View -> Output -> GitHub Copilot Chat Hooks`.
249
+ On Android:
751
250
 
752
- ## Android ntfy Reliability Notes
753
-
754
- If notifications arrive only after opening the ntfy app, the usual cause is Android background restriction rather than AgentBell.
755
-
756
- Recommended Android settings:
757
-
758
- - Allow notifications.
759
- - Allow lock-screen notifications.
251
+ - Allow notification permission.
760
252
  - Allow background running.
761
253
  - Disable battery optimization for ntfy.
762
- - Allow auto-start.
763
- - Allow background network access.
764
- - In the watch/band companion app, allow forwarding ntfy notifications.
765
-
766
- The F-Droid build of ntfy may rely more heavily on a background connection. If the phone has Google services, the Play Store build may be more reliable for push delivery.
767
-
768
- Treat the ntfy topic as a secret. Do not use an easy-to-guess topic and never commit it to a public repository. Use a long random topic such as `your-long-random-topic`; when showing diagnostics publicly, mask it like `agen...q4z1`.
769
-
770
- ## Known Windows Notes
771
-
772
- - Windows local desktop notification is intentionally skipped in this MVP. ntfy phone push is unaffected.
773
- - Codex has been verified with a user-home `.cmd` wrapper.
774
- - Claude Code has been verified with a project-local `.sh` wrapper.
775
- - VS Code Copilot Agent has been verified with a project-local `.cmd` wrapper.
776
- - Windows non-ASCII usernames, Git Bash path conversion, `cmd` quoting, and hook host behavior can all affect execution, so do not casually change wrapper strategy between tools.
777
- - Git dubious ownership does not affect AgentBell notifications, but it can block `git status`, `git diff`, or commits. Users should decide whether to configure `safe.directory`.
778
- - WSL, Remote SSH, Dev Containers, and Windows host shells have different home directories, Node paths, environment variables, and network behavior. Configure and verify AgentBell in the environment where the agent hook actually runs.
779
-
780
- ## Next: Verify and Rich Context
781
-
782
- Now that `agentbell setup` exists, the next product step is a dedicated `agentbell verify` command for repeatable end-to-end checks after setup.
783
-
784
- Planned improvements:
785
-
786
- 1. Verify config readability.
787
- 2. Verify ntfy delivery.
788
- 3. Verify installed hook files and wrapper paths.
789
- 4. Print tool-specific next steps for Codex, Claude Code, and VS Code Copilot Agent.
790
- 5. Expand notification templates with project and task context.
791
-
792
- Example topic values in docs should stay generic, such as `your-long-random-topic` or `agen...q4z1`.
793
-
794
- ## Future: Rich Notification Context
795
-
796
- Future AgentBell notifications can include richer context so the phone notification tells you which machine and task finished.
797
-
798
- Possible fields:
799
-
800
- - machine display name
801
- - hostname
802
- - tool
803
- - event
804
- - project name
805
- - cwd
806
- - git branch
807
- - task name
808
- - timestamp
809
-
810
- Example:
254
+ - Confirm the phone subscribed to the same topic generated by setup.
811
255
 
812
- ```text
813
- 宸ヤ綔绔?鍙?路 Codex 瀹¤浠诲姟缁撴潫
814
- 椤圭洰锛欰gentBell
815
- 璺緞锛欸:\learning\AgentBell
816
- 鍒嗘敮锛歮ain
817
- ```
818
-
819
-
820
-
821
-
822
-
823
- ## Rich Notification Context
824
-
825
- AgentBell now builds richer default notification content when `--title` or `--message` is not provided. The default context can include:
256
+ ## Manual Configuration
826
257
 
827
- - machine display name
828
- - hostname
829
- - tool display name
830
- - raw tool id
831
- - event and event label
832
- - task name
833
- - project name
834
- - cwd
835
- - git branch
836
- - local timestamp
837
- - ISO timestamp
838
-
839
- Example notification:
840
-
841
- ```text
842
- 宸ヤ綔绔?鍙?路 Codex 瀹¤浠诲姟缁撴潫
843
-
844
- 椤圭洰锛欰gentBell
845
- 璺緞锛欸:\learning\AgentBell
846
- 鍒嗘敮锛歮ain
847
- 浜嬩欢锛歴top
848
- 鏃堕棿锛?026-05-23 22:45
849
- ```
850
-
851
- Useful `send` options:
258
+ `agentbell setup` is recommended. Advanced users can use lower-level commands:
852
259
 
853
260
  ```bash
854
- agentbell send --tool codex --event stop --task "瀹¤浠诲姟"
855
- agentbell send --tool claude-code --event stop --project AgentBell --task "README 鏇存柊"
856
- agentbell send --tool vscode-agent --event stop --cwd G:\learning\AgentBell --branch main
261
+ agentbell init
262
+ agentbell test
263
+ agentbell init-hooks --target codex
264
+ agentbell init-hooks --target claude-code
265
+ agentbell init-hooks --target vscode-agent
857
266
  ```
858
267
 
859
- Explicit `--title` and `--message` still win. Use them when a hook wrapper needs an exact fixed message.
860
-
861
- ## Machine Display Name
862
-
863
- The ntfy topic is a secret transport address, not a human-readable machine name. Do not use your topic as a display name and do not commit it to a public repository.
864
-
865
- Use `profile.name` in `~/.agentbell/config.json` for friendly notification context:
268
+ Example config:
866
269
 
867
270
  ```json
868
271
  {
272
+ "provider": "ntfy",
273
+ "ntfy": {
274
+ "server": "https://ntfy.sh",
275
+ "topic": "your-long-random-topic",
276
+ "priority": "high",
277
+ "tags": ["computer"]
278
+ },
869
279
  "profile": {
870
- "name": "宸ヤ綔绔?鍙?
280
+ "name": "Workstation-01"
281
+ },
282
+ "localNotification": {
283
+ "enabled": false
284
+ },
285
+ "includeContext": {
286
+ "hostname": true,
287
+ "cwd": true,
288
+ "timestamp": true
871
289
  }
872
290
  }
873
291
  ```
874
292
 
875
- A practical setup is one long random topic per user, shared across your own machines, with a different `profile.name` on each machine.
876
-
877
-
878
- ### Hooks use rich context by default
879
-
880
- Generated Stop wrappers now let `agentbell send` build the notification from rich context. They do not hard-code simple `--title` / `--message` values by default.
881
-
882
- To customize hook notifications, create `.agentbell.json` in the project:
293
+ ## Development
883
294
 
884
- ```json
885
- {
886
- "projectName": "AgentBell",
887
- "defaultTaskName": "瀹¤浠诲姟"
888
- }
295
+ ```bash
296
+ npm install
297
+ npm run build
298
+ npm test
299
+ npm run lint
300
+ node dist/cli.js --help
889
301
  ```
890
302
 
891
- Then regenerate hooks:
303
+ Useful local checks:
892
304
 
893
305
  ```bash
894
- agentbell init-hooks --target all
306
+ npm run check:package
307
+ npm pack --dry-run
895
308
  ```
896
309
 
897
- Project-local wrappers such as Claude Code and VS Code Copilot Agent pass `--cwd <projectRoot>` so AgentBell can read `.agentbell.json`, `package.json`, and git branch context. Codex uses a user-level wrapper and normally relies on the hook runtime cwd.
898
-
899
- Example hook notification:
900
-
901
- ```text
902
- 宸ヤ綔绔?鍙?路 Codex 瀹¤浠诲姟缁撴潫
903
- 椤圭洰锛欰gentBell
904
- 璺緞锛欸:\learning\AgentBell
905
- 鍒嗘敮锛歮ain
906
- 浜嬩欢锛歴top
907
- 鏃堕棿锛?026-05-23 22:45
908
- ```
909
- ## Project Config
310
+ ## Release
910
311
 
911
- AgentBell can also read optional project-level config from `.agentbell.json` in the current working directory.
912
-
913
- ```json
914
- {
915
- "projectName": "AgentBell",
916
- "defaultTaskName": "瀹¤浠诲姟"
917
- }
918
- ```
919
-
920
- Create it with:
312
+ - Package name: `@xwss/agentbell`
313
+ - CLI command: `agentbell`
314
+ - Publish command:
921
315
 
922
316
  ```bash
923
- agentbell project init --name AgentBell --task "瀹¤浠诲姟"
317
+ npm publish --access public --tag beta
924
318
  ```
925
319
 
926
- If `.agentbell.json` already exists, `agentbell project init` will not overwrite it unless you pass `--force`. With `--force`, AgentBell writes a `.bak-<timestamp>` backup first.
927
-
928
- Project name priority:
929
-
930
- 1. `agentbell send --project <name>`
931
- 2. `.agentbell.json` `projectName`
932
- 3. `package.json` `name`
933
- 4. current directory name
934
-
935
- Task name priority:
936
-
937
- 1. `agentbell send --task <name>`
938
- 2. `.agentbell.json` `defaultTaskName`
939
- 3. `浠诲姟`
940
-
941
- Project-level notification templates can override global templates:
320
+ Do not publish unless these pass:
942
321
 
943
- ```json
944
- {
945
- "projectName": "AgentBell",
946
- "defaultTaskName": "瀹¤浠诲姟",
947
- "notification": {
948
- "titleTemplate": "{{machine}} 路 {{tool}} {{task}}{{eventLabelSuffix}}",
949
- "messageTemplate": "椤圭洰锛歿{project}}\n璺緞锛歿{cwd}}\n鍒嗘敮锛歿{branch}}\n浜嬩欢锛歿{event}}\n鏃堕棿锛歿{timestamp}}"
950
- }
951
- }
322
+ ```bash
323
+ npm run build
324
+ npm test
325
+ npm run lint
326
+ npm run check:package
327
+ npm pack --dry-run
952
328
  ```
953
329
 
954
- Supported template variables include `machine`, `hostname`, `tool`, `toolRaw`, `event`, `eventLabel`, `task`, `project`, `cwd`, `branch`, `timestamp`, `isoTimestamp`, and `duration`.
955
-
956
- ## Setup Project Context
957
-
958
- `agentbell setup` remains safe by default and does not create `.agentbell.json` in `--yes` mode unless requested.
330
+ Before publishing, confirm no real topic, token, log, backup, local hook wrapper, `.env`, or local config file is included.
959
331
 
960
- To create project context during setup:
961
-
962
- ```bash
963
- agentbell setup --init-project --project-name AgentBell
964
- ```
332
+ ## License
965
333
 
966
- In interactive setup, AgentBell can ask whether to create `.agentbell.json` for the current project. Choosing no leaves the project untouched.
967
-
968
-
969
-
334
+ MIT