Communitygithub.com

oc1s/agent-notify

一個讓主機端編碼代理在任務完成時發送桌面通知的技能。

agent-notify 是什麼?

agent-notify 是一個為 AI 編碼代理(如 Claude Code、Cursor、Codex 等)設計的桌面通知技能。它能在代理完成一個回合(turn)的運算時,向開發者發送桌面通知,讓開發者無需持續監控命令列視窗。技能支援 Codex、Claude、Cursor、Qoder、Kimi 和 OpenCode 等主流平台,並透過自動安裝腳本將通知指令(notify.sh)與鉤子(hook)注入到各平台的設定檔中。安裝過程是冪等的(idempotent),重複執行不會造成問題。對於 Windows 使用者,技能特別強調使用 Git Bash 而非 PowerShell 的複雜轉義,以避免因路徑與引號處理錯誤而導致安裝失敗。

相容平台✓Claude Code✓Codex CLI✓Cursor✓OpenCode
npx skills add oc1s/agent-notify

在你喜歡的 AI 中提問

開啟一個已預先載入此 Agent Skill 的新對話。

說明文件

agent-notify 是做什麼的?

在主機編碼代理完成一個回合時,新增桌面通知。冪等設計 — 可安全重複執行。

安裝內容

腳本複製到 ~/.agent-notify/:

  • notify.sh — 統一通知器(自動偵測 argv[1] 或 stdin)
  • notify-turn-start.sh — 供基於鉤子的代理記錄回合開始時間使用
  • notify-wrap.sh — 供沒有鉤子的代理使用的通用 CLI 包裝器
  • opencode-plugin.ts — OpenCode TS 外掛

設定的設定檔(僅限其 home 目錄存在的):

  • ~/.codex/config.toml → notify = [".../notify.sh"]
  • ~/.codex/hooks.json → PermissionRequest + UserPromptSubmit
  • ~/.claude/settings.json → Stop + UserPromptSubmit + Notification 鉤子
  • ~/.cursor/hooks.json → stop + beforeSubmitPrompt 鉤子
  • ~/.qoder/settings.json → Stop + UserPromptSubmit + Notification 鉤子
  • ~/.kimi/config.toml → [[hooks]] 項目
  • ~/.config/opencode/plugins/ → 放入 agent-notify.ts

請參閱 reference/agent-hooks.md 以取得上游文件與功能結論。

如何執行

bash <skill-dir>/assets/install.sh

標誌:--target codex|claude|cursor|qoder|kimi|opencode,--uninstall

可選:AGENT_NOTIFY_HOME=/path/to/home 強制指定哪個設定檔接收設定(在 WSL 下很有用)。

代理執行步驟

當被呼叫時:

  1. 解析此技能的 assets/install.sh 的絕對路徑(不要依賴當前工作目錄 cwd)。

  2. 使用 bash 執行它,並轉發使用者標誌(--uninstall、--target、…):

    • macOS / Linux:bash <abs>/assets/install.sh
    • Windows(建議):Git Bash
      "C:\Program Files\Git\bin\bash.exe" "<abs>\assets\install.sh"
    • Windows + WSL(備用):使用單引號包住 -c 參數,將 HOME 指向 Windows 設定檔,按路徑執行:
      wsl -e bash -lc 'export HOME=/mnt/c/Users/<you>; bash /mnt/c/Users/<you>/.agents/skills/agent-notify/assets/install.sh'
      
  3. 硬性規則(Windows 代理):

    • 不要將腳本透過管道傳給 bash(sed … | bash,cat … | bash)——這會破壞 $0 並導致資產遺失。
    • 不要在 PowerShell 的雙引號 wsl … -c "…" 字串內使用 $(…) ——PowerShell 會展開它們,並可能在專案當前工作目錄中建立垃圾檔案。
    • 建議使用 Git Bash,而不是發明 WSL+PowerShell 的引號轉義變通方案。
  4. 顯示安裝程式的 stdout。

  5. 提醒使用者重新啟動其代理會話。

相關技能