Skip to content

v0.19.0 — Hermes Agent backend (4th client supported)

Latest

Choose a tag to compare

@jhaizhou-ops jhaizhou-ops released this 19 May 11:13
· 1 commit to main since this release

pinrule v0.19.0 — Hermes Agent backend 真完整支持 (第 4 家客户端)

真新增能力

NousResearch Hermes Agent v0.14.0+ (持久 server agent + plugin hooks) 真加入 Claude / Codex / Cursor 之外第 4 家 backend.

pip install --upgrade pinrule  # → 0.19.0
pinrule install-hooks --backend hermes  # 真全自动, 0 手工步骤

装完后 hermes 真发任何 tool call (hermes -z "...") 都会真触发 pinrule hook 检测违反 / 注入规则 context, 跟 Claude / Codex / Cursor 同款体验.

真技术亮点

真按源码 ground 不靠 docs 单边猜

真 clone NousResearch/hermes-agent 源码, 每个协议细节都 ground 在:

  • agent/shell_hooks.py:_serialize_payload — 真 stdin payload 构造
  • agent/shell_hooks.py:_parse_response — block output 真 normalize
  • agent/conversation_loop.py:pre_llm_call — context 注入真 kwargs
  • hermes_constants.py:get_config_path / get_skills_dir — 真路径

真 line-based surgical operator (深挖根因 fix)

第一版 hermes backend 真撞 Hermes 默认 ~/.hermes/config.yaml 的多行字符串续行 + unicode escape continuation, 让 user 要手工 append hooks: 段 — 真糟糕装机体验.

真深挖发现根因: pinrule 真没必要 parse 整个 hermes config (它只关心 hooks 段). v0.19.0 改用:

  • _extract_hooks_section(raw): 字符串扫描找顶层 hooks:
  • _strip_hooks_section(raw): surgical 删 hooks: 段, 其他段原样保留
  • load_settings: extract → parse subset (hooks 段简单语法)
  • save_settings: read raw → strip 旧 hooks → append 新 hooks → atomic write

Hermes 其他段 (model: / agent.personalities: 含多行字符串 + unicode escape 续行等) 全部原样保留 — 真不破坏 user config.

真协议映射

pinrule canonical Hermes 真 event role
UserPromptSubmit pre_llm_call inject (顶层 {context: "..."})
PreToolUse pre_tool_call gate (Claude {decision: block, reason: ...} 真接受)
PostToolUse post_tool_call audit
SessionStart on_session_start inject baseline
Stop on_session_end audit (无 transcript graceful no-op)

Tool name 真归一化: terminal / shell / execute_shellBash, read_fileRead, write_fileWrite, patch_file / edit_fileEdit.

真端到端验证 evidence

$ pinrule install-hooks --backend hermes
→ Hermes Agent(hermes)
  生成: ~/.hermes/agent-hooks/pinrule_user_prompt_submit.py  (× 5)
  已配置 ~/.hermes/config.yaml(5 个 hook event)

$ hermes -z "Use the terminal tool to run: sleep 30"
I couldn't run `sleep 30` because the terminal tool is blocked by
the local pinrule "non-blocking-parallel" check for long waits.

$ tail -2 ~/.pinrule/violations.jsonl
{"rule_id": "non-blocking-parallel", "snippet": "sleep 30", ...}
{"rule_id": "non-blocking-parallel", "snippet": "sleep 30", ...}

真 Hermes 自己识别 pinrule 拦截 + violations 真录入.

真测试

  • 959 真 passed (901 baseline + 42 hermes 单元 + 16 contract parametrized)
  • ruff / mypy 全过
  • 真本机 Hermes Agent v0.14.0 + favorais.com 中转站 + gpt-5.5 端到端真验证

升级路径

pip install --upgrade pinrule  # → 0.19.0

无 breaking API. 现有 Claude / Codex / Cursor 用户真不受影响.

真鸣谢

感谢 user 真本机 dogfood 抓到 v0.19.0 首版的 "user 要手工 append" 真糟糕体验, 真促成 line-based surgical operator 根因 fix.