opencode-haimati 1.6.0 → 1.6.1

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,9 +11,11 @@
11
11
  - 版本并发控制:基于 version 的乐观锁
12
12
  - 文件锁机制:支持网络共享挂载多用户并发写入
13
13
  - 自动工作规则提示:会话首条消息时自动注入工作流程提醒
14
+ - memo-map 文件关联:记忆与项目文件/目录建立关联,读取文件时自动提示相关记忆
14
15
  - 自动关联记忆检索(auto-read):关键词提取 → 搜索 → 注入 Top 3 相关记忆到消息上下文
15
16
  - 自动记忆写入(autoWrite,默认关闭):AI 回复完成后异步触发 AI 自主审查并写入有价值的知识
16
17
  - autoUpdate:启动时自动检查 npm registry 新版本,无需手动升级
18
+ - 启动清理:自动清除 memo-map 中已不存在的文件/目录条目
17
19
 
18
20
  ## 安装
19
21
 
@@ -74,6 +76,7 @@ bun add -g opencode-haimati
74
76
  .haimati/
75
77
  ├── .lock # 文件锁(支持网络共享挂载多用户协调)
76
78
  ├── 索引.md # 树形索引
79
+ ├── memo-map.yaml # 文件/目录与记忆的关联映射
77
80
  └── 书页/ # 记忆内容(每50个序号一分组)
78
81
  ```
79
82
 
@@ -82,11 +85,11 @@ bun add -g opencode-haimati
82
85
  | 工具 | 说明 |
83
86
  |------|------|
84
87
  | `haimati_read` | 读取记忆(单条/批量,支持分页) |
85
- | `haimati_write` | 写入新记忆(自动分配序号,不支持覆盖已存在) |
88
+ | `haimati_write` | 写入新记忆,可选 filePath 建立文件关联 |
86
89
  | `haimati_search` | 搜索(标题/分类/内容,match必填) |
87
- | `haimati_edit` | 部分修改(字符串匹配替换,隐式并发检测) |
90
+ | `haimati_edit` | 部分修改(字符串替换 + 增减文件关联) |
88
91
  | `haimati_move` | 修改分类路径和/或标题 |
89
- | `haimati_delete` | 删除记忆 |
92
+ | `haimati_delete` | 删除记忆(自动清理文件关联) |
90
93
  | `haimati_list` | 列出索引(按分类浏览,支持详细内容) |
91
94
 
92
95
  ## 使用示例
@@ -95,6 +98,12 @@ bun add -g opencode-haimati
95
98
  // 写入(title 不能以 " - 序号" 结尾)
96
99
  haimati_write({ category: "xxx项目/签章", title: "签章服务WS通信机制", content: "..." })
97
100
 
101
+ // 写入 + 文件关联
102
+ haimati_write({ category: "xxx项目/签章", title: "签章服务WS通信机制", content: "...", filePath: "src/ws.ts" })
103
+
104
+ // 写入 + 目录关联(末尾 / 表示目录,匹配该目录下所有文件)
105
+ haimati_write({ category: "xxx项目/签章", title: "签章服务WS通信机制", content: "...", filePath: "src/" })
106
+
98
107
  // 读取(单条)
99
108
  haimati_read({ query: "086" })
100
109
 
@@ -121,6 +130,12 @@ haimati_edit({
121
130
  replaceAll: true
122
131
  })
123
132
 
133
+ // 编辑 + 新增文件关联
134
+ haimati_edit({ query: "086", oldString: "...", newString: "...", filePath: "src/new.ts" })
135
+
136
+ // 编辑 + 移除文件关联
137
+ haimati_edit({ query: "086", oldString: "...", newString: "...", removeFilePath: "src/old.ts" })
138
+
124
139
  // 移动
125
140
  haimati_move({ query: "086", newCategory: "xxx项目/客户端" })
126
141
 
@@ -134,6 +149,19 @@ haimati_list()
134
149
  haimati_list({ category: "xxx项目", recursive: true, detail: true })
135
150
  ```
136
151
 
152
+ ### memo-map 文件关联
153
+
154
+ 记忆可与项目文件/目录建立关联。AI 通过 `read` 工具读取文件时,自动在输出末尾注入提示:
155
+
156
+ ```
157
+ src/index.ts和海马体#43、#44有关,建议读取记忆
158
+ ```
159
+
160
+ - `filePath="src/index.ts"` — 精确文件关联
161
+ - `filePath="src/"` — 目录关联(末尾 `/`,匹配该目录下所有文件及子目录)
162
+ - 关联关系记录在 `.haimati/memo-map.yaml`
163
+ - 插件启动时自动清理已不存在的文件/目录条目
164
+
137
165
  ### haimati_edit 使用说明
138
166
 
139
167
  **关键特性**:
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-haimati",
3
- "version": "1.6.0",
3
+ "version": "1.6.1",
4
4
  "description": "OpenCode plugin for a file-based memory system inspired by the hippocampus, providing long-term memory storage and retrieval across sessions.",
5
5
  "main": "./dist/index.js",
6
6
  "type": "module",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-haimati",
3
- "version": "1.6.0",
3
+ "version": "1.6.1",
4
4
  "description": "OpenCode plugin for a file-based memory system inspired by the hippocampus, providing long-term memory storage and retrieval across sessions.",
5
5
  "main": "./dist/index.js",
6
6
  "type": "module",