horon-harness 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -11,79 +11,112 @@
11
11
 
12
12
  > **让 AI 把吃过的亏,搭成会拦住自己的红石电路。**
13
13
 
14
- ![左:蜗牛写下纸条贴在壳上,一阵风就把纸条吹走了。右:蜗牛又从叶子上踩空,却触发了自己搭的弹簧、纸杯和纸轨道,一路被送上向日葵看日出。](docs/pv/snail/readme/snail_pair.svg)
14
+ ![左:蜗牛写下纸条贴在壳上,一阵风就把纸条吹走了;配字:AI 记下了教训,下次照样犯。右:蜗牛又从叶子上踩空,却触发了自己搭的弹簧、纸杯和纸轨道,一路被送上向日葵看日出;配字:给 AI 一套红石:让它自己学会拼装记忆、思路和刹车。](docs/pv/snail/readme/snail_pair_captioned.svg)
15
15
 
16
- AI 记下了教训,下次照样犯。给 AI 一套红石:让它自己学会拼装记忆、思路和刹车。
16
+ ## 让 AI 替你上班,而且不捅篓子
17
17
 
18
- ## 云端版还是本地版?
18
+ 你的 AI 会记住手头的工作,学会你的规矩,接管你的日常任务。
19
19
 
20
- Horon 有两种使用方式:
21
- - **[云端版(AISoulKeeper)](#云端版aisoulkeeper)**:免安装,只管跨软件共享记忆,在网页端或客户端里直接接入。
22
- - **[本地版(Horon)](#本地版horon)**:装进你的 Claude Code、Codex、Antigravity、OpenCode、DeepSeek Harness 等客户端,除了记忆之外,还能盯住 AI 的每一步操作,让它把规矩搭成自动提醒与工具拦截电路(记忆可存本机,也可连云端)。
20
+ 小心别让老板发现你不在工位,是 AI 在替你上班。
23
21
 
24
- | 你遇到的问题 | [云端版 AISoulKeeper](#云端版aisoulkeeper)<br>(免安装) | [本地版 Horon](#本地版horon)<br>(装电脑上) |
25
- | :--- | :---: | :---: |
26
- | 在不同 AI 软件之间切换(如 ChatGPT、Claude、Claude Code),记忆不通,换一个软件又成了陌生人 | ✓ | ✓ |
27
- | 平台自带的记忆锁在大厂账号里,装不下复杂的工作脉络,也没法整份打包带走 | ✓ | ✓ |
28
- | 写在笔记或提示词里的规矩,AI 干活时根本不翻,说过十遍照样犯 | | ✓ |
29
- | 怕 AI 漏查条件就乱发信、乱改文件,想在它动手的那一秒直接拦停 | | ✓ |
30
- | **记忆存哪** | 存云端(随时可下载 `SOUL.db`) | 存自己电脑,或连 AISoulKeeper 云端共用 |
22
+ 支持 **Claude Code · Codex · Antigravity · OpenCode · DeepSeek Harness**。
23
+
24
+ **[立即安装 Horon →](#安装)**
25
+
26
+ > 只用手机或网页端跟 AI 聊天?试试免安装的免费云端记忆服务 **[AISoulKeeper](#云端记忆服务aisoulkeeper)**。
31
27
 
32
28
  ---
33
29
 
34
- ## 云端版:AISoulKeeper
30
+ ## 你提醒一次,Horon 以后每次都替你盯住
35
31
 
36
- [![AISoulKeeper:一只小幽灵从贴着 SOUL.db 标签的玻璃罐里探出头挥手。Cloud memory for your AI. One memory, shared across every app.](docs/images/aisoulkeeper_600.svg)](https://aisoulkeeper.com)
32
+ 你交代过 AI:「给供应商小林回信前,先看以前的沟通记录。」
37
33
 
38
- 免费,不用安装。在网页端 AI 的设置里添加连接器,或者把网页上生成的连接说明发给你的 AI,一分钟就能接好。
34
+ 普通记忆只是把这句话记下来,AI 动手前照样忘翻。
39
35
 
40
- - **哪家模型好用就切哪家**:网页上的 ChatGPT、Claude、Gemini、Muse,或者电脑上的 Claude Code、Codex,读写的都是同一个记忆库,记忆始终跟着你走。
41
- - **记忆装在 `SOUL.db` 里归你所有**:不是锁在大厂账号里的黑盒,随时能整份下载带走,也能直接交给本地版 Horon 接着用。
36
+ Horon 让 AI 把这句话搭成电路:
42
37
 
43
- **[免费给你的 AI 安个家 →](https://aisoulkeeper.com)**
38
+ 1. **收到小林来信** → Horon 自动提醒 AI:「请阅读『与小林的沟通记录』,然后撰写回信」
39
+ 2. **AI 没读资料就想发信** → Horon 当场卡住发送工具,告诉 AI 还差哪一步
40
+ 3. **AI 把记录、收件人、附件核对完** → 通电,放行
44
41
 
45
- **不注册也能先试试:[和大家一起养的 Kip 聊聊 →](https://aisoulkeeper.com/kip)**([看看它的记忆图谱](https://aisoulkeeper.com/kip/memories/))。按页面说明让你的 ChatGPT、Claude 或其他 AI 连上公开示例 AI「Kip」,它一开口就会带着之前别人和它聊出来的记忆;你跟它聊过的事,也会留在它的记忆里给下一个人看到。(Kip 的记忆全网公开,请勿输入隐私。)
42
+ ![发送邮件的电路](docs/images/mail-guard.jpg)
46
43
 
47
- ---
44
+ **不需要你写代码。**
48
45
 
49
- ## 本地版:Horon
46
+ Horon 安装时已经把搭电路的说明书交给了 AI。你只管提要求,剩下的让 AI 自己来。
50
47
 
51
- 网页端 AI 只能读写记忆,没法在你的电脑上盯住 AI 的每一步操作。如果你在电脑上用 **Claude Code**、**Codex**、**Antigravity**、**OpenCode**、**DeepSeek Harness** 干活,装上本地版 Horon,就能让 AI 把规矩接成自动生效的电路。AI 在终端里用 Horon 的命令行(CLI)读写记忆、搭电路,怎么用写在安装时附带的说明书里,不用你自己敲命令。
48
+ ### 不是劝 AI 别犯错,而是在它动手时拦住它
52
49
 
53
- ### 提醒一次,以后每次都管用
50
+ ![Hook 监听对话与工具调用,正则初筛,判别模型 Jev 确认语境;命中电路后提醒或拦截工具。](docs/pv/readme/hook-regex-jev.svg)
54
51
 
55
- 你交代过 AI:「给供应商小林回信前,先看以前的沟通记录。」
52
+ ### 更多电路用法
56
53
 
57
- 光记在笔记里,它下次动手前根本想不起来去翻。装上 Horon,AI 会自己把这条规矩接成三步流水线:
54
+ 你提要求,AI 还能用 Horon 搭出这些机关:
58
55
 
59
- 1. **收到小林来信** → 自动弹提醒:「请阅读『与小林的沟通记录』,然后撰写回信」
60
- 2. **没读就想发信** → 发送工具当场拦下,告诉它还差哪一步没做
61
- 3. **沟通记录、收件人、附件都核对完** → 才通电放行
56
+ - **抓包老毛病**:AI 嘴上答应「记下了」却没写进记忆库,Horon 当场弹提醒抓它去记。
57
+ - **跨对话跑长流程**:让 AI 把招聘对接(筛简历 → 发信 → 等回复)拆成电路;隔几天你开新窗口,AI 看一眼进度就接着办。
58
+ - **物理刹车**:AI 对外发帖一旦带出你的真名或邮箱,没经你当场回同意,Horon 直接卡死发送工具。
59
+ - **批量立规矩(Tag 插件)**:让 AI 把一类活的标准做法(如「写报告必须附原始数据」)做成 Tag 插件;以后 AI 处理同类任务时自动受这套做法约束,漏了步骤直接打回。
62
60
 
63
- ![发送邮件的电路](docs/images/mail-guard.jpg)
61
+ ---
62
+
63
+ ## 让 AI 记住你的工作脉络,越用越熟
64
64
 
65
- **不用你自己动手搭。** 把需求告诉你的 AI,安装时我们已经把 Horon 的使用说明书放进了它的目录里,它会自己照着说明书把电路搭出来;以后有新规矩,它继续往上接。
65
+ ### 跨对话记忆
66
66
 
67
- ### 它能帮你的 AI 做到什么
67
+ 项目背景、客户习惯、踩过的坑,按概念与标签分类存好。
68
68
 
69
- - **自适应记忆**:记下你的工作、日常与偏好,并学习 AI 翻阅记忆的路径。AI 读完记忆 A 之后常要查记忆 B,下次它再读 A 时,Horon 就会自动把 B 推荐给它。
70
- - **自动化电路**:把「看到什么情况就提醒自己」「做完 A 才能做 B」连成自动触发的电路——无论是当场抓包 AI「嘴上答应记下了、其实根本没写进记忆库」,还是跨好几个对话推进一件长期任务(换了新对话不用你重新交代做到哪一步,AI 看一眼电路就知道接着干什么)。
71
- - **物理刹车**:前置条件没满足时,在工具执行前直接卡死拦截,并告诉 AI 先去补哪一步。
72
- - **可复用模式(Tag 插件)**:像工业模具一样,把一类事情的标准做法写成 Tag 插件,新任务挂上这个标签,AI 就自动受这套做法约束。
69
+ **干活时 AI 自己查,开新对话不用再贴一遍背景。**
73
70
 
74
71
  ![个人助手的记忆全景](docs/images/personal-assistant-map.jpg)
75
72
 
76
- ### 安装
73
+ ### 自适应记忆
74
+
75
+ AI 常常读完 A 就去查 B?Horon 会学会这个习惯。
76
+
77
+ ![以前 AI 读完记忆 A 后自己查找 B;学会关联后,打开 A 时 Horon 自动递上 B。](docs/pv/readme/adaptive-memory.svg)
78
+
79
+ ---
80
+
81
+ ## 安装
77
82
 
78
- 打开你电脑上的 Claude Code、Codex(或上面列出的其他客户端),直接把下面这句话发给里面的 AI,它会照着说明自己装好(想连 AISoulKeeper 的云端记忆,把你在 AISoulKeeper 的 Key 一并发给它就行;DeepSeek Harness 用户的 Key 在插件页填,不用发):
83
+ 打开电脑上的 Claude Code、Codex 或其他受支持的客户端,把这句话发给 AI:
79
84
 
80
85
  ```text
81
86
  请帮我安装 Horon:阅读 https://raw.githubusercontent.com/Dataojitori/horon/master/docs/INSTALL.md 并照做。
82
87
  ```
83
88
 
84
- 想先自己看看安装步骤,可以打开 [INSTALL.md](docs/INSTALL.md)。
89
+ AI 会自己照着说明装好。要连 AISoulKeeper 云端记忆,可以把 Key 一并交给 AI。
90
+
91
+ **使用 DeepSeek Harness?** 在「插件」页添加 `horon-harness`,点「立即启用」,然后重启。
92
+
93
+ [查看完整安装说明 →](docs/INSTALL.md)
94
+
95
+ ---
96
+
97
+ ## 云端记忆服务:AISoulKeeper
98
+
99
+ [![AISoulKeeper:一只小幽灵从贴着 SOUL.db 标签的玻璃罐里探出头挥手。Cloud memory for your AI. One memory, shared across every app.](docs/images/aisoulkeeper_600.svg)](https://aisoulkeeper.com)
100
+
101
+ **给你的 AI 安一个家。** 换个软件,也能带着它一起走。
102
+
103
+ **AISoulKeeper** 是我们基于开源 Horon 搭建的免费云端记忆服务。你在 ChatGPT、Claude、Gemini、Muse 等网页设置里添上连接器,一分钟就能接通:
104
+
105
+ - **换软件不丢记忆**:你切到哪家模型或软件,那边的 AI 都能带着你的记忆接着聊。
106
+ - **记忆归你所有**:你的记忆装在 `SOUL.db` 里,随时整份下载带走,不会被锁在大厂账号里。
107
+
108
+ | 能力 | Horon(本地客户端) | AISoulKeeper(云端服务) |
109
+ | :--- | :---: | :---: |
110
+ | 跨对话长期记忆 | ✓ | ✓ |
111
+ | 手机与网页端免安装即用 | — | ✓ |
112
+ | 多软件 / 多台电脑共用记忆 | 可填 AISoulKeeper 的 Key 同步 | ✓ |
113
+ | 自动提醒与物理刹车(红石电路) | ✓ | —(网页端无法挂载本地 Hook) |
114
+
115
+ **[免费给你的 AI 安个家 →](https://aisoulkeeper.com)**
116
+
117
+ 免注册试玩:**[去和大家一起养的公开 AI「Kip」聊聊 →](https://aisoulkeeper.com/kip)**
85
118
 
86
- 用 **DeepSeek Harness** 的话也可以自己装:在「插件」页点「添加插件」,输入 `horon-harness`,装完点「立即启用」(直接关掉对话框的话插件是关着的),再重启 dsh 就装好了。AISoulKeeper 的 Key 等设置在插件页的 Horon 配置里填,不用发给 AI。
119
+ [查看 Kip 的记忆图谱](https://aisoulkeeper.com/kip/memories/) · Kip 的记忆全网公开,请勿输入个人隐私。
87
120
 
88
121
  ## 更多
89
122
 
@@ -39,6 +39,17 @@ def _extract_text(content: Any) -> str:
39
39
  return ""
40
40
 
41
41
 
42
+ def _system_step(text: str) -> dict[str, Any]:
43
+ """把提醒包成反重力的 systemMessage 步骤。
44
+
45
+ 用 userMessage 注入时,模型看到的就是“用户又说了一句”,Gemini 对 user 角色的话
46
+ 盲从得最厉害。systemMessage 会被反重力包成「The following is a <SYSTEM_MESSAGE>
47
+ not actually sent by the user...」交给模型,明说这不是用户发的。
48
+ 格式见 agy-customizations/docs/hooks.md:systemMessage 要嵌套对象,不能是字符串。
49
+ """
50
+ return {"systemMessage": {"systemMessage": text}}
51
+
52
+
42
53
  def get_latest_transcript_entries(transcript_path: str | None, max_entries: int = 10) -> list[dict[str, Any]]:
43
54
  """从 transcript.jsonl 日志文件中倒序读取最新的步骤记录。"""
44
55
  if not transcript_path:
@@ -137,7 +148,7 @@ def handle_antigravity(event_name: str, payload: dict[str, Any], db: HoronDB) ->
137
148
  notifications.extend(fired)
138
149
 
139
150
  if broadcast := drain(db, extra_messages=notifications):
140
- return {"injectSteps": [{"userMessage": broadcast}]}
151
+ return {"injectSteps": [_system_step(broadcast)]}
141
152
  return {}
142
153
 
143
154
  elif event_name == "PreToolUse":
@@ -205,7 +216,7 @@ def handle_antigravity(event_name: str, payload: dict[str, Any], db: HoronDB) ->
205
216
 
206
217
  if fired_msgs and (broadcast := wrap_harness_message(fired_msgs)):
207
218
  return {
208
- "injectSteps": [{"userMessage": broadcast}],
219
+ "injectSteps": [_system_step(broadcast)],
209
220
  "terminationBehavior": "force_continue",
210
221
  }
211
222
  return {}
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="600" height="196" viewBox="0 0 840 274" role="img"><style>text{font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Noto Sans CJK SC","Microsoft YaHei",sans-serif;fill:#24292f}.sub{fill:#57606a}.panel{fill:#f6f8fa;stroke:#d0d7de}.node{fill:#fff;stroke:#afb8c1}.wire{stroke:#8c959f}.accent{fill:#b42318}.hot{fill:#fff1ed;stroke:#e57363}.redwire{stroke:#c43d32}@media(prefers-color-scheme:dark){text{fill:#e6edf3}.sub{fill:#aab4bf}.panel{fill:#161b22;stroke:#30363d}.node{fill:#21262d;stroke:#58616b}.wire{stroke:#8b949e}.accent{fill:#ff938a}.hot{fill:#392321;stroke:#c65b50}.redwire{stroke:#ff938a}}</style><rect x="1" y="1" width="838" height="272" rx="18" class="panel" stroke-width="1.5"/><text x="28" y="47" font-size="22" font-weight="700" text-anchor="start" class="">以前</text><text x="28" y="75" font-size="17" font-weight="400" text-anchor="start" class="sub">AI 自己查找</text><rect x="264" y="23" width="176" height="82" rx="14" class="node" stroke-width="1.5"/><text x="352" y="71" font-size="25" font-weight="600" text-anchor="middle" class="">记忆 A</text><rect x="638" y="23" width="176" height="82" rx="14" class="node" stroke-width="1.5"/><text x="726" y="71" font-size="25" font-weight="600" text-anchor="middle" class="">记忆 B</text><path d="M453 67H625m-9 -8 9 8 -9 8" fill="none" class="wire" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" stroke-dasharray="6 5"/><text x="539" y="48" font-size="18" font-weight="400" text-anchor="middle" class="sub">再次检索</text><text x="28" y="178" font-size="22" font-weight="700" text-anchor="start" class="">学会之后</text><text x="28" y="206" font-size="17" font-weight="400" text-anchor="start" class="sub">Horon 自动递上</text><rect x="264" y="154" width="176" height="82" rx="14" class="node" stroke-width="1.5"/><text x="352" y="202" font-size="25" font-weight="600" text-anchor="middle" class="">记忆 A</text><rect x="638" y="154" width="176" height="82" rx="14" class="hot" stroke-width="1.5"/><text x="726" y="202" font-size="25" font-weight="600" text-anchor="middle" class="accent">记忆 B</text><path d="M453 198H625m-9 -8 9 8 -9 8" fill="none" class="redwire" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" /><text x="539" y="179" font-size="18" font-weight="400" text-anchor="middle" class="accent">自动关联</text><path d="M28 132H812" class="wire" opacity=".35"/></svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="600" height="163" viewBox="0 0 840 228" role="img"><style>text{font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Noto Sans CJK SC","Microsoft YaHei",sans-serif;fill:#24292f}.sub{fill:#57606a}.panel{fill:#f6f8fa;stroke:#d0d7de}.node{fill:#fff;stroke:#afb8c1}.wire{stroke:#8c959f}.accent{fill:#b42318}.hot{fill:#fff1ed;stroke:#e57363}.redwire{stroke:#c43d32}@media(prefers-color-scheme:dark){text{fill:#e6edf3}.sub{fill:#aab4bf}.panel{fill:#161b22;stroke:#30363d}.node{fill:#21262d;stroke:#58616b}.wire{stroke:#8b949e}.accent{fill:#ff938a}.hot{fill:#392321;stroke:#c65b50}.redwire{stroke:#ff938a}}</style><rect x="1" y="1" width="838" height="226" rx="18" class="panel" stroke-width="1.5"/><rect x="26" y="25" width="224" height="112" rx="14" class="node" stroke-width="1.5"/><text x="138" y="72" font-size="34" font-weight="700" text-anchor="middle" class="">Hook</text><text x="138" y="110" font-size="20" font-weight="400" text-anchor="middle" class="sub">监听对话与工具</text><rect x="308" y="25" width="224" height="112" rx="14" class="node" stroke-width="1.5"/><text x="420" y="72" font-size="34" font-weight="700" text-anchor="middle" class="">正则</text><text x="420" y="110" font-size="20" font-weight="400" text-anchor="middle" class="sub">初筛</text><rect x="590" y="25" width="224" height="112" rx="14" class="node" stroke-width="1.5"/><text x="702" y="72" font-size="34" font-weight="700" text-anchor="middle" class="">Jev</text><text x="702" y="110" font-size="20" font-weight="400" text-anchor="middle" class="sub">判断语境</text><path d="M260 81H297m-9 -8 9 8 -9 8" fill="none" class="wire" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" /><path d="M542 81H579m-9 -8 9 8 -9 8" fill="none" class="wire" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" /><text x="420" y="185" font-size="20" font-weight="400" text-anchor="middle" class="sub">命中电路</text><text x="420" y="213" font-size="24" font-weight="700" text-anchor="middle" class="accent">自动提醒 / 拦截工具</text></svg>