喚醒條件
這是什麼
決定排程工作是否應喚醒 agent 的執行前信號。
白話解釋
郵件室職員會閱讀每一封進來的信件,但只轉寄那些真正需要律師注意的信件——常規續約和垃圾郵件永遠不會送到法務部門的桌上,因此那些昂貴的時間只會在信件確實值得時才被花費。喚醒條件在 Hermes 內部扮演相同的把關角色:一個小型腳本先檢查實際情況,只有當它回報有值得處理的事情時,完整的 agent(以及模型呼叫的成本)才會被調用。
為什麼重要
Cron 工作的可選執行前 script 可以透過兩種方式讓模型保持休眠:cron/scheduler.py 中的 _parse_wake_gate 在腳本最後的非空 stdout 行是像 {"wakeAgent": false} 這樣的 JSON 時跳過執行;而一個成功執行但沒有任何輸出的腳本會讓 _build_job_prompt 回傳 None——記錄為「腳本無輸出,跳過 AI 呼叫」。任何其他 stdout 都會喚醒 agent,並作為收集到的上下文摺疊到工作提示中。沒有內建的數值閾值;什麼算作「值得喚醒」是由腳本作者編寫的邏輯,Hermes 只執行最終判定。
How it works
The gate is just the same “script” field every cron job can already carry — no separate wake-condition schema exists (cron/jobs.py). In cron/scheduler.py’s run_job, that script runs once before the prompt gets built, and when its verdict says no, the code returns immediately with a silent-run marker, skipping prompt construction and the actual agent turn entirely — no tool loop, no model call. When the verdict says wake instead, the same script output is folded into the job’s prompt as collected context, giving the agent a head start on what the gate script already checked. This design keeps wake conditions a simple extension of the existing cron job model rather than a separate system — no extra schema, no new infrastructure, just a convention for what a job’s script field can return.