Anthropic 旗下 Claude Code 正式推出 Monitor 工具,讓 AI 代理能在背景持續監聽串流事件,不再需要在 agent loop 中反覆輪詢,有效降低 token 消耗。
(前情提要:Claude Code 新增雲端定時任務功能!不用開電腦,AI 自動審核 PR、升級)
(背景補充:Claude Code 推出頻道 Channels:能在 Telegram、Discord 與 AI 代理對話)
Claude Code 產品經理 Noah Zweben 今(10)晨在 X 上宣布:Monitor 工具現已上線,允許 Claude 在背景執行程式指令碼,並以串流(stream)方式持續監聽其標準輸出,每一行輸出都會即時轉化為事件通知,主動喚醒代理進行後續處理。
Thrilled to announce the Monitor tool which lets Claude create background scripts that wake the agent up when needed.
Big token saver and great way to move away from polling in the agent loop
Claude can now:
* Follow logs for errors
* Poll PRs via script
* and more! pic.twitter.com/eflixzi0xk— Noah Zweben (@noahzweben) April 9, 2026
告別輪詢:從被動等待到主動喚醒
過去,Claude 在 agent loop 中若需等待某個外部程式完成,必須不斷傳送請求查詢狀態,也就是俗稱的「輪詢(polling)」。這種方式不僅消耗大量 token,也讓代理的執行效率受到限制。
Monitor 工具的設計邏輯相反:由背景指令碼主動推送事件,Claude 只在收到通知時才被喚醒,有效消除無謂的等待週期。Zweben 特別強調,這是「節省 token 的重要工具」,也是 agent 架構設計上的一大進步。
適用場景:日誌監控、PR 追蹤
Monitor 工具目前已支援多種實際應用場景:追蹤應用程式日誌以偵測錯誤、透過指令碼輪詢 Pull Request 狀態、以及其他需要持續監聽的背景任務。
值得注意的是,Monitor 與 Bash 工具的 run_in_background 引數用途不同:後者適合一次性「等到做完」的工作,而 Monitor 更適合需要持續串流事件、長時間執行的監聽任務。
📍相關報導📍
Claude Code 推出頻道 Channels:能在 Telegram、Discord 與 AI 代理對話,Anthropic 正面對決 openclaw 小龍蝦
Claude Code 終極速查表:快捷鍵、Slash 指令、技能、Agents 代理、MCP 完整操作密技
Anthropic 訂閱 Claude Code 封殺龍蝦 OpenClaw!往後第三方工具僅能付費額度

