[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-76161":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":9,"language":10,"languages":9,"totalLinesOfCode":9,"stars":11,"forks":12,"watchers":13,"openIssues":14,"contributorsCount":15,"subscribersCount":15,"size":15,"stars1d":16,"stars7d":17,"stars30d":18,"stars90d":15,"forks30d":15,"starsTrendScore":12,"compositeScore":19,"rankGlobal":9,"rankLanguage":9,"license":9,"archived":20,"fork":20,"defaultBranch":21,"hasWiki":22,"hasPages":20,"topics":23,"createdAt":9,"pushedAt":9,"updatedAt":24,"readmeContent":25,"aiSummary":26,"trendingCount":15,"starSnapshotCount":15,"syncStatus":27,"lastSyncTime":28,"discoverSource":29},76161,"hermes-patches","Cyrene963\u002Fhermes-patches","Cyrene963","Hermes Agent 社区补丁合集 - Community patches for Hermes Agent",null,"Python",169,21,108,1,0,7,12,59,4.03,false,"main",true,[],"2026-06-12 02:03:40","# Hermes Agent 社区补丁合集\n\n> 一键安装，补全上游尚未合并的修复和增强。已合并的补丁会自动跳过。\n>\n> **适配版本：v0.14.0 (v2026.5.16)**\n\n## 装有什么用？\n\n**🧠 长对话不失忆**\n上下文压缩不再削弱 memory 权威性，你设定的规则在整个会话期间持续生效。\n\n**⚡ Agent 预检门控**\n工具调用前通过元认知框架检查参数，拦截危险操作：\n- `send_message` 含 MEDIA 标签 → 阻止（必须用 curl sendDocument）\n- `terminal` 含 gateway restart → 警告\n- `memory` 含注入模式（ignore previous 等）→ 阻止\n- 默认开启，可在 `~\u002F.hermes\u002Fmemory_policy.yaml` 中自定义\n\n**🔒 多用户隔离**\n- `session_search` 按用户过滤（隐藏 weixin 等平台会话）\n- `HINDSIGHT_SKIP_PLATFORMS` 环境变量控制哪些平台跳过 Hindsight 自动存储\n- Memory Graph namespace 隔离 + Hindsight bank 隔离 + per-user MEMORY.md\n\n**🧠 记忆元认知框架**\n- **记忆索引**：session 启动时注入记忆库摘要（~224 字符）\n- **查询扩展**：用户消息自动扩展为更好的搜索查询（中英文均支持，共 19 组关键词映射）\n- **预检门控**：工具调用前强制检查参数，3 条安全规则\n- **策略路由**：bug\u002Ferror 类问题自动建议读 systematic-debugging skill\n- **对话召回**：从用户消息中抽取实体并搜索相关记忆（jieba 中文分词）\n\n**🧠 Memory Router**\n- 查询自动路由：事实→Memory Graph，历史→Hindsight，规则→MEMORY.md\n- Gap Detection：不确定时明确回答\"没有找到\"，不硬凑\n- 支持中英文意图识别\n\n**🧠 Memory Graph 工具集（15 个 MCP 工具）**\n- `memory_graph_search` — 搜索记忆（替代 Hindsight 盲搜）\n- `memory_graph_read` — 读取节点内容\n- `memory_graph_create` — 创建节点（带冲突检测）\n- `memory_graph_update` — 更新节点（支持 patch 模式：old_string + new_string）\n- `memory_graph_delete` — 删除节点\n- `memory_graph_list` — 列出子节点\n- `memory_graph_alias` — 创建别名 URI\n- `memory_graph_glossary_add\u002Fscan` — 术语管理\n- `memory_graph_manage_triggers` — 绑定\u002F解绑触发词到记忆节点\n- `memory_graph_recall` — 记忆召回\n- `memory_graph_orphans` — 孤儿节点管理\n- `memory_graph_random` — 随机记忆\n- `memory_graph_diagnostics` — 系统诊断\n- `memory_graph_purge` — 清理\n\n**🧠 Memory OS 外置大脑**\n- Memory Map：每轮注入记忆目录（~1.2KB），Agent 知道自己记得什么\n- Gap Detection：低置信时回答\"未找到\"，不硬凑\n- 回归测试：10 项每日自动测试（10\u002F10 通过）\n- Diagnostic \u002F Inventory：系统健康检查和记忆盘点\n\n**🏗️ 多用户三层隔离（19\u002F19 强测试通过）**\n- **Graph namespace**：长期事实按 namespace 隔离\n- **Hindsight bank**：原始对话证据按用户独立 bank 隔离\n- **Per-user MEMORY.md**：操作规则按用户隔离\n- Alice\u002FBob\u002FCore demo fixtures，无私有数据\n\n## 一行命令安装\n\n```bash\nbash \u003C(curl -sL https:\u002F\u002Fraw.githubusercontent.com\u002FCyrene963\u002Fhermes-patches\u002Fmain\u002Finstall.sh)\n```\n\n## 兼容性说明\n\n**上游合并状态**（2026-05-19 测试，适配 v0.14.0 \u002F v2026.5.16）：\n\n上游在最近几周合并了大量社区贡献，包括：\n- Pre-flight thinking block\n- Auto-context retrieval (hindsight + session_search)\n- 14 community PRs (KV cache, secret redaction, emergency compression 等)\n- Multi-user session\u002Fmemory isolation\n- Custom provider slugs\n- MCP reconnect\n- Backup 0600 permissions\n- Secret redaction by default\n- Context compression summary redaction\n\n这些功能已内置在最新版 Hermes 中。install.sh 会自动检测并跳过已合并的补丁。\n\n**仍需本补丁集的修复**：\n- 记忆元认知框架（查询扩展 + 预检门控 + 策略路由 + 对话召回）\n- Memory Router + Gap Detection\n- Memory Graph 工具集（15 个工具）\n- 微信会话隔离（HINDSIGHT_SKIP_PLATFORMS）\n- session_search 微信隐藏\n\n## 安装内容\n\n### 补丁文件\n\n| 补丁 | 说明 | 适配版本 |\n|------|------|----------|\n| `combined-final-v14.patch` | 完整补丁（元认知+微信隔离） | v0.14.0 |\n| `memory-metacognition-v14.patch` | 仅元认知框架 | v0.14.0 |\n| `weixin-isolation-v14.patch` | 仅微信隔离 | v0.14.0 |\n| `combined-final.patch` | 旧版完整补丁 | v2026.5.7 |\n\n### 复制的文件\n\n| 文件 | 说明 |\n|------|------|\n| `agent\u002Fmemory_metacognition.py` | 记忆元认知框架（1201 行） |\n| `tools\u002Fmemory_graph_tool.py` | Memory Graph 工具集（15 个工具） |\n| `memory_policy.default.yaml` | 元认知策略默认配置 |\n\n### install.sh 自动执行\n\n1. 应用 `combined-final-v14.patch`（已冲突自动跳过）\n2. 复制 `memory_metacognition.py` 到 `agent\u002F`\n3. 复制 `memory_graph_tool.py` 到 `tools\u002F`\n4. 复制 `memory_policy.default.yaml`\n5. 注册 memory_graph 工具到 toolsets\n6. 清理旧 `.pyc` 缓存\n\n## 配置文件\n\n- `~\u002F.hermes\u002Fmemory_policy.yaml` — 元认知策略（预检规则、查询扩展、对话召回）\n- `~\u002F.hermes\u002Fdisclosure_rules.yaml` — Disclosure 触发规则\n\n## 与 hermes update 配合\n\n`hermes update` 会重置源码到上游版本。补丁会自动重新安装：\n\n```bash\nhermes update\n# 自动调用 _reapply_patches_after_update() → 运行 install.sh\n# 无需手动操作\n```\n\n如果自动安装失败，手动执行：\n\n```bash\nbash \u003C(curl -sL https:\u002F\u002Fraw.githubusercontent.com\u002FCyrene963\u002Fhermes-patches\u002Fmain\u002Finstall.sh)\n```\n\n## 许可\n\nMIT License — 与上游 Hermes Agent 一致。\n","Hermes Agent 社区补丁合集是一组用于增强 Hermes Agent 功能的补丁集合。该项目的核心功能包括长对话记忆保持、Agent 预检门控以防止危险操作、多用户隔离机制以及记忆元认知框架等，旨在提升 Hermes Agent 的安全性与实用性。技术上，通过 Python 实现的记忆索引、查询扩展、预检门控等功能增强了 Agent 对话时的信息处理能力；同时，Memory Graph 工具集提供了丰富的记忆管理工具，支持节点创建、更新、删除及搜索等操作。适合需要高级对话管理和安全控制的应用场景，如企业级聊天机器人或个人智能助手服务。",2,"2026-06-11 03:54:41","CREATED_QUERY"]