self-regulation-brake-system
Brake system that auto-stops the agent after N repeated failures, prevents token burning on loops.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Brake system that auto-stops the agent after N repeated failures, prevents token burning on loops.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Use when Hermes Agent needs X/Twitter search, public signal research, monitoring, or approval-gated account actions through the Hermes Tweet plugin.
Router Learning System — 越用越聰明嘅任務路由引擎。 每個 task 有最佳 path,Router 自動記錄經驗、動態調整、跳過爛 path。
Use when signaling work status across autonomous sessions.
Use when needing to standardize descriptions across many skill files at once — change format, fix wording, or enforce a convention like 'Use when...' prefix.
Use before making irreversible changes (deleting files, destructive git operations, large refactors). Use when you need the ability to roll back if something goes wrong. Use at the start of any task that modifies multiple files.
Use when the context window is getting full and tasks need breaking down.
| name | self-regulation-brake-system |
| description | Brake system that auto-stops the agent after N repeated failures, prevents token burning on loops. |
| tags | ["self-regulation","brake","efficiency","feedback","timeout"] |
| metadata | {"hermes":{"platform":["cursor","codex","claude-code"]},"triggers":["brake","fail limit","stop retry","regulation"]} |
| domain | agent-core |
| subdomain | safety |
| tokens | {"scan":210,"load":2340,"category":"detailed"} |
Agent can burn thousands of tokens repeating the same failed action (GitHub login, OAuth, browser loops). The user only discovers this when they see the bill.
A lightweight shell script at ~/.hermes/scripts/brake.sh that:
Brake rules 已寫入 system instructions file,透過 config.yaml 嘅 prefill_messages_file 注入:
~/.hermes/system-instructions/self-regulation.mdAlready updated. Every new session shows brake status:
=== 🧠 SELF-REGULATION CONTEXT ===
⚠️ BRAKE SYSTEM IS ACTIVE
Injected as self-regulation rules. Ensures the agent knows about brakes even after context compaction.
Whenever the agent encounters a failing loop:
# Before retrying, check if brake is triggered
bash ~/.hermes/scripts/brake.sh check "github-login-by-browser"
# exit 0 = safe, count = N
# exit 2 = STOP, ask user
# After a failure
bash ~/.hermes/scripts/brake.sh record "github-login-by-browser"
# After success
bash ~/.hermes/scripts/brake.sh reset "github-login-by-browser"
| Condition | Action |
|---|---|
| Same action fails ≥3 times | STOP → clarify user(用 clarify tool,唔好自己估) |
| 5 min of no progress | STOP → clarify user |
| Third-party auth (GitHub/Google/OAuth) | First failure → STOP, don't retry |
| Complex multi-step auth | Delegate to subagent first |
| 卡住咗唔出聲 | 違反 HARD RULE 2 — 失敗咗必須即刻報告,唔可以靜雞雞轉彎 |
做任何動作之前,先問「terminal 做唔做到」:
CUA 操作見到以下任何一個紅旗,即停 CUA,轉用 terminal/其他方法:
| 紅旗 | 原因 |
|---|---|
| 同一 CUA 操作失敗 2 次 | Pixel coord 唔準/AX tree 太複雜→唔會越試越準 |
| Accessibility tree > 500 elements | DevTools/Chrome/Electron 內部→AX tree 大得滯,無用 |
| Vision 座標 明顯唔合理 | 如話座標喺畫面範圍之外 |
| 畫面係 Canvas/WebGL 自繪 | CUA 睇唔到入面啲掣 |
CUA 只應該用喺以下場景:
❌ 失敗做法:
用 CUA pixel click 操作 DevTools 內部 UI(頁面路徑selector)
→ AX tree 971 elements,pixel coord 錯晒,失敗 5+ 次
→ 浪費大量 token,0 成果
✅ 正確做法:
改 code → terminal `bash boot.sh pre-commit` compile
→ 出錯直接改 code,唔使郁 DevTools 掣
因為 CUA 嘅 vision 同 AX tree 喺複雜 UI(DevTools、Electron app)入面非常唔可靠,而且每失敗一次就燒大量 token(screenshot + vision analysis + 再去試)。Terminal command 反而係 deterministic,成功失敗都 cheap 好多倍。
Session Start
├─ session-start.sh
│ └─ brake.sh status → context injection
│
Agent working
├─ action fails → brake.sh record
├─ before retry → brake.sh check
│ ├─ count < 3 → retry
│ └─ count ≥ 3 → BRAKE! → clarify user
│
Action succeeds → brake.sh reset
呢個 system 嘅關鍵唔係 script 本身,而係 注入層級:
點解 Agent 理論上可以「忽略」system instruction?
~/.hermes/scripts/brake.sh~/.hermes/state/brake/ (persists across sessions)~/.hermes/hooks/session-start.sh