rocky-mem-dsh 0.0.0-stage → 0.1.3

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/CHANGELOG.md ADDED
@@ -0,0 +1,69 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project are documented here.
4
+ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/)
5
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
+
7
+ ## [0.1.3] - 2026-11-27
8
+
9
+ `0.1.2` was prepared but never published; it ships here.
10
+
11
+ ### Fixed
12
+
13
+ - **Plugin metadata is readable.** The restrictive `exports` map did not list
14
+ `./locale/*.json`, so Plugin Manager could not read `meta.title`,
15
+ `meta.description` or `meta.detail` and fell back to the package name and the
16
+ README. The locale files are exported now.
17
+ - `peerDependencies` are now optional: the code already degrades when
18
+ `@deepseek-ai/dsh-llm` or `@deepseek-ai/dsh-mcp-client` cannot be resolved, so
19
+ npm no longer pulls a 9 MB provider tree for a bundle with no runtime
20
+ dependencies.
21
+ - The generated plugin index ships its icon beside `index.json`, so the card
22
+ never points at a missing file.
23
+
24
+ ### Added
25
+
26
+ - Bilingual README (`README.md` in English, `README.zh-CN.md`), restructured for
27
+ a first-time reader: problem, what you get, screenshots, quick start with the
28
+ expected result, configuration, the measured reason task-time retrieval ships
29
+ off, transports, failure behaviour, privacy, compatibility, troubleshooting and
30
+ uninstall.
31
+ - `locale/*.json` now use the documented `meta.{title,description,detail}` shape,
32
+ so the Plugins page shows the detail document instead of falling back to the
33
+ README; the detail document exists in English and Chinese and no longer embeds
34
+ HTML (the page does not render it).
35
+ - `scripts/check-readme.mjs` asserts the two READMEs keep the same structure,
36
+ that each locale points at an existing detail document, and that every relative
37
+ link resolves; it runs in CI.
38
+
39
+ - Brand assets in `assets/brand/`: the full-character mascot on a transparent
40
+ background with the ground shadow removed, a soft outline for legibility on
41
+ light backgrounds, per-size icons (16-1024), a circular-safe avatar, and a
42
+ favicon. `scripts/build-brand-assets.py` rebuilds them from one source image.
43
+ - The plugin icon is the 256 px raster (`package.json` `icon`), which keeps the
44
+ bundle inside the 256 KiB icon limit without shipping a hand-traced vector of
45
+ an illustration that does not survive simplification.
46
+
47
+ ## [Unreleased]
48
+
49
+ ### Added
50
+
51
+ - Host plugin `rockymem-runtime`: injects the `mem_context` pack on
52
+ `agent/created` for `startup` and `clear` sessions.
53
+ - Optional `agent/pre-step` retrieval (disabled by default in 0.1.0).
54
+ - Circuit breaker and 150 ms budget so a stopped daemon never slows a session.
55
+ - MCP client entry exposing rocky-mem's six tools over stdio.
56
+ - Packaged skill provider reading `rocky-mem-skill`, with an embedded fallback.
57
+ - Market metadata: icon, locale, `engines.dsh`, and a release workflow that
58
+ generates a format-1 index entry.
59
+
60
+ ### Changed
61
+
62
+ - Injected messages are now built locally (`lib/message.js`: UUID + deep freeze)
63
+ instead of via a bare `@deepseek-ai/dsh-llm` import, which cannot resolve from
64
+ a profile. The upstream constructor is still preferred when available.
65
+ - Documented the Streamable HTTP transport switch for `mcp-rockymem`.
66
+
67
+ ## [0.1.0] - 2026-11-26
68
+
69
+ - First public skeleton.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 rocky-mem contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,232 @@
1
- # Temporary Holding Version
1
+ <p align="center">
2
+ <img src="https://raw.githubusercontent.com/linyu19872008/rocky-mem-dsh/main/assets/brand/icon-512.png" width="120" alt="Rocky, the rocky-mem mascot">
3
+ </p>
2
4
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
5
+ <h1 align="center">rocky-mem-dsh</h1>
6
+
7
+ <p align="center"><strong>Your agent stops re-learning what your team already knows.</strong><br>
8
+ A DeepSeek Harness bundle for the <a href="https://github.com/linyu19872008/rocky-mem">rocky-mem</a> experience ledger.</p>
9
+
10
+ <p align="center">
11
+ <a href="https://github.com/linyu19872008/rocky-mem-dsh/actions/workflows/ci.yml"><img src="https://github.com/linyu19872008/rocky-mem-dsh/actions/workflows/ci.yml/badge.svg" alt="ci"></a>
12
+ <a href="https://www.npmjs.com/package/rocky-mem-dsh"><img src="https://img.shields.io/npm/v/rocky-mem-dsh" alt="npm"></a>
13
+ <a href="LICENSE"><img src="https://img.shields.io/github/license/linyu19872008/rocky-mem-dsh" alt="license"></a>
14
+ <img src="https://img.shields.io/badge/DSH-%E2%89%A5%200.2.2--rc.1-4b5563" alt="DSH version">
15
+ <br>
16
+ <sub><strong>English</strong> · <a href="README.zh-CN.md">中文</a></sub>
17
+ </p>
18
+
19
+ ---
20
+
21
+ ## The problem
22
+
23
+ Every session starts from zero. The last investigation — what was tried, what
24
+ failed, why the fix worked, and under which conditions it breaks again — lives
25
+ in a chat log nobody reads. A commit records *what* changed, not *why*.
26
+
27
+ rocky-mem keeps that ledger. **This plugin decides when to hand it to the agent**,
28
+ and gets out of the way the rest of the time.
29
+
30
+ ## What you get
31
+
32
+ - **Context before the first turn.** Preferences and pinned lessons for the
33
+ working directory arrive as one tagged block — no tool call, no prompt.
34
+ - **Six tools** (`mcp__rockymem__*`) for search, write, read, feedback.
35
+ - **The `rocky-mem` skill**, so the agent knows when a recorded lesson must
36
+ *not* be applied.
37
+ - **Silent degradation**: if the ledger is down, the session is unaffected.
38
+
39
+ ![Injected context block](https://raw.githubusercontent.com/linyu19872008/rocky-mem-dsh/main/docs/img/injected.png)
40
+
41
+ ![`/rockymem status` output](https://raw.githubusercontent.com/linyu19872008/rocky-mem-dsh/main/docs/img/status.png)
42
+
43
+ ## Quick start
44
+
45
+ Two moving parts: the ledger daemon, and this bundle.
46
+
47
+ ```sh
48
+ # 1. the server (see its README for go install / prebuilt binaries)
49
+ rockymem serve --dsn sqlite://$HOME/.local/share/rocky-mem/rocky-mem.db
50
+
51
+ # 2. the bundle
52
+ dsh plugin --profile web add rocky-mem-dsh
53
+ # or: install "rocky-mem-dsh" from the Plugins page
54
+
55
+ # 3. restart dsh web
56
+ ```
57
+
58
+ **What you should see:** start a new session. Its first message contains a
59
+ `<rockymem-context kind="standing">` block with your preferences. Ask the agent
60
+ to run `/rockymem status` — it reports the endpoint, contract version, and how
61
+ many packs were injected:
62
+
63
+ ```
64
+ rocky-mem — http://127.0.0.1:7432
65
+ contract 1 · server 0.2.2 · features context,search,get,…,mcp.streamable-http
66
+ injected 1 · skipped none
67
+ inject=on preStep=off budget=500/400
68
+ ```
69
+
70
+ Nothing to inject yet? Record a preference once (`mem_remember`) or a lesson
71
+ (`mem_record`), then open another new session.
72
+
73
+ ## How it works
74
+
75
+ | Layer | Responsibility | Lives in |
76
+ |---|---|---|
77
+ | Correctness | gates, ranking, pack assembly, conflict handling | the `rocky-mem` server |
78
+ | **Timing** | when to inject, budgets, circuit breaker, degradation | **this plugin** |
79
+ | Behaviour | how the agent should use the tools | the `rocky-mem` skill |
80
+
81
+ ```
82
+ agent/created ──▶ rockymem-runtime ──HTTP──▶ POST /api/v1/context ──▶ agent.inject()
83
+ agent/pre-step ─▶ (opt-in) ────────────────▶ POST /api/v1/search ──▶ appended message
84
+ tool call ─────▶ dsh-mcp-client ──stdio───▶ rockymem mcp ──▶ the daemon
85
+ ```
86
+
87
+ The plugin holds no knowledge of its own: it reads `doctor` to see what the
88
+ server supports, asks for a pack, and injects it. The server owns every decision
89
+ about what is true.
90
+
91
+ ## Configuration
92
+
93
+ Everything has a working default. Overrides go in the profile's
94
+ `cordis.patch.yml`, keyed by entry id (`rockymem-runtime`, `mcp-rockymem`).
95
+
96
+ | Key | Default | Meaning |
97
+ |---|---|---|
98
+ | `endpoint` | `http://127.0.0.1:7432` | daemon base URL (`ROCKYMEM_URL` wins) |
99
+ | `tokenFile` | `~/.local/share/rocky-mem/rocky-mem.token` | bearer token (`ROCKYMEM_TOKEN` wins) |
100
+ | `doctorCacheMs` | `60000` | capability-probe cache |
101
+ | `inject.enabled` | `true` | session-start injection |
102
+ | `inject.onSources` | `[startup, clear]` | `SessionStartSource` values that receive it |
103
+ | `inject.budgetTokens` | `500` | pack ceiling |
104
+ | `inject.timeoutMs` | `150` | hard per-call budget |
105
+ | `preStep.enabled` | **`false`** | task-time retrieval |
106
+ | `preStep.budgetTokens` | `400` | pack ceiling per turn |
107
+ | `preStep.minPromptChars` | `12` | shorter prompts are never searched |
108
+
109
+ The token is written by `rockymem serve` next to its database
110
+ (`<db-stem>.token`, mode 600) or under `$ROCKYMEM_HOME/pg-<hash>/`.
111
+
112
+ ## Turn on task-time retrieval
113
+
114
+ `agent/pre-step` runs on every step, so this is opt-in:
115
+
116
+ ```yaml
117
+ - id: rockymem-runtime
118
+ config:
119
+ preStep:
120
+ enabled: true
121
+ ```
122
+
123
+ It makes retrieval *deterministic* instead of hoping the model calls
124
+ `mem_search`, at the cost of one HTTP call and up to 400 tokens per turn.
125
+
126
+ Measured on a real store, 6 realistic queries at `budget=400`:
127
+
128
+ | Result | Queries | Approx. tokens |
129
+ |---|---:|---:|
130
+ | Hit an experience section | 1 | 250 |
131
+ | Matched only the standing preference | 5 | 42 each |
132
+
133
+ The standing preference is already injected at session start, so five of six
134
+ injections would have been pure duplication. That is why a pack with no
135
+ `## Applies` or `## Do not use` section is skipped, and why the default is off.
136
+
137
+ ## Transports
138
+
139
+ The MCP entry ships on **stdio**: `rockymem mcp` reads the token file itself and
140
+ proxies to a running daemon, so no secret appears in configuration.
141
+
142
+ Switch to **Streamable HTTP** when the daemon is remote, or when you would rather
143
+ not spawn a child process per client:
144
+
145
+ ```yaml
146
+ - id: mcp-rockymem
147
+ config:
148
+ transport: streamable-http
149
+ url: http://127.0.0.1:7432/mcp
150
+ headers:
151
+ Authorization: !!js '`Bearer ${process.env.ROCKYMEM_TOKEN}`'
152
+ ```
153
+
154
+ The HTTP transport is stateless; `GET /mcp` answers `405` by design.
155
+
156
+ ## Failure behaviour
157
+
158
+ A memory service that is down must never slow a session down.
159
+
160
+ | Situation | Behaviour |
161
+ |---|---|
162
+ | daemon stopped | no injection; one warning at load; session unaffected |
163
+ | call exceeds the budget | that injection is dropped |
164
+ | 3 consecutive failures | circuit opens for 60 s; no calls are attempted |
165
+ | `doctor` lacks `context` | injection skipped (older server) |
166
+ | subagent session | never injected |
167
+ | pack has no experience section | skipped (task-time only) |
168
+
169
+ ## Privacy
170
+
171
+ - Talks only to the `endpoint` you configure; no telemetry, no other hosts.
172
+ - Sends the working directory, and when `preStep` is on, the first prompt of a
173
+ turn — only to that daemon.
174
+ - Never reads the rocky-mem database or configuration files, and runs no
175
+ install-time scripts.
176
+
177
+ Details and the threat model: [SECURITY.md](SECURITY.md).
178
+
179
+ ## Compatibility
180
+
181
+ | This bundle | DSH | rocky-mem contract |
182
+ |---|---|---|
183
+ | 0.1.x | `>= 0.2.2-rc.1` | 1 |
184
+ | Node | `^22.19` or `>=24` | — |
185
+
186
+ `engines.dsh` is declared because the bundle uses `agent/pre-step` and
187
+ `ctx.skills.registerProvider`. Marketplace cards filter on it, so an
188
+ "incompatible" label on the Plugins page means the DSH release is too old — not
189
+ that the plugin is broken.
190
+
191
+ ## Troubleshooting
192
+
193
+ | Symptom | Check |
194
+ |---|---|
195
+ | No context block appears | `/rockymem status` — `injected 0` plus a skip reason |
196
+ | `skipped no-feature` | the server predates `context`; upgrade rocky-mem |
197
+ | `skipped disabled` | something ran `/rockymem off` in this process |
198
+ | `skipped empty-pack` | the ledger has nothing for this directory yet — record something |
199
+ | Tools missing from the model | `rockymem mcp` failed to spawn; run it in a terminal and read the error |
200
+ | `daemon unreachable` at load | `rockymem serve` is not running, or `endpoint` is wrong |
201
+
202
+ Server-side diagnosis: `rockymem doctor --dsn <your DSN>`.
203
+
204
+ ## Uninstall
205
+
206
+ Remove the bundle on the Plugins page (or `dsh plugin --profile web remove
207
+ rocky-mem-dsh`). The daemon and its database are separate and untouched — remove
208
+ them only if you want the ledger gone.
209
+
210
+ ## Development
211
+
212
+ ```sh
213
+ npm test # 15 cases, no daemon, no network
214
+ npm pack --dry-run # the exact file list that ships
215
+ node scripts/check-readme.mjs # bilingual structure + links + locale metadata
216
+ ```
217
+
218
+ Read [CONTRIBUTING.md](CONTRIBUTING.md) before a change: the rule that matters
219
+ most is that a failed memory service must never become a failed session.
220
+
221
+ ## Related
222
+
223
+ | | |
224
+ |---|---|
225
+ | [rocky-mem](https://github.com/linyu19872008/rocky-mem) | the ledger server, MCP contract, ADRs |
226
+ | [rocky-mem-skill](https://www.npmjs.com/package/rocky-mem-skill) | the portable skill for other hosts |
227
+ | [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) | the host this bundle plugs into |
228
+
229
+ ## License
230
+
231
+ MIT — see [LICENSE](LICENSE). By participating you agree to the
232
+ [code of conduct](CODE_OF_CONDUCT.md).
@@ -0,0 +1,205 @@
1
+ <p align="center">
2
+ <img src="https://raw.githubusercontent.com/linyu19872008/rocky-mem-dsh/main/assets/brand/icon-512.png" width="120" alt="Rocky,rocky-mem 吉祥物">
3
+ </p>
4
+
5
+ <h1 align="center">rocky-mem-dsh</h1>
6
+
7
+ <p align="center"><strong>让 agent 不再重新踩团队已经踩过的坑。</strong><br>
8
+ 面向 <a href="https://github.com/linyu19872008/rocky-mem">rocky-mem</a> 经验台账的 DeepSeek Harness 插件包。</p>
9
+
10
+ <p align="center">
11
+ <a href="https://github.com/linyu19872008/rocky-mem-dsh/actions/workflows/ci.yml"><img src="https://github.com/linyu19872008/rocky-mem-dsh/actions/workflows/ci.yml/badge.svg" alt="ci"></a>
12
+ <a href="https://www.npmjs.com/package/rocky-mem-dsh"><img src="https://img.shields.io/npm/v/rocky-mem-dsh" alt="npm"></a>
13
+ <a href="LICENSE"><img src="https://img.shields.io/github/license/linyu19872008/rocky-mem-dsh" alt="license"></a>
14
+ <img src="https://img.shields.io/badge/DSH-%E2%89%A5%200.2.2--rc.1-4b5563" alt="DSH version">
15
+ <br>
16
+ <sub><a href="README.md">English</a> · <strong>中文</strong></sub>
17
+ </p>
18
+
19
+ ---
20
+
21
+ ## 问题
22
+
23
+ 每个会话都从零开始。上一次排查——试过什么、什么失败了、为什么最后修好了、什么条件下又会坏——全都留在没人会翻的聊天记录里。commit 只记录**改了什么**,不记录**为什么**。
24
+
25
+ rocky-mem 保存这本台账。**这个插件负责决定什么时候把台账递给 agent**,其余时间安静地待着。
26
+
27
+ ## 你会得到什么
28
+
29
+ - **第一轮对话之前就有上下文。** 当前工作目录的偏好与置顶经验,作为一个带标签的块送达——不需要工具调用,不需要提示。
30
+ - **六个工具**(`mcp__rockymem__*`),覆盖检索、写入、读取、反馈。
31
+ - **`rocky-mem` 技能**:让 agent 知道某条经验在什么条件下**不该**使用。
32
+ - **静默降级**:台账服务挂了,会话照常进行。
33
+
34
+ ![被注入的上下文块](https://raw.githubusercontent.com/linyu19872008/rocky-mem-dsh/main/docs/img/injected.png)
35
+
36
+ ![`/rockymem status` 输出](https://raw.githubusercontent.com/linyu19872008/rocky-mem-dsh/main/docs/img/status.png)
37
+
38
+ ## 快速开始
39
+
40
+ 两个部分:台账守护进程,以及这个插件包。
41
+
42
+ ```sh
43
+ # 1. 服务端(go install 或预编译二进制,见其 README)
44
+ rockymem serve --dsn sqlite://$HOME/.local/share/rocky-mem/rocky-mem.db
45
+
46
+ # 2. 插件包
47
+ dsh plugin --profile web add rocky-mem-dsh
48
+ # 或者在 Plugins 页安装 "rocky-mem-dsh"
49
+
50
+ # 3. 重启 dsh web
51
+ ```
52
+
53
+ **你应该看到:** 新建一个会话,第一条消息里出现 `<rockymem-context kind="standing">` 块,内容是当前目录的偏好。让 agent 执行 `/rockymem status`,它会报告地址、契约版本,以及注入了几个上下文包:
54
+
55
+ ```
56
+ rocky-mem — http://127.0.0.1:7432
57
+ contract 1 · server 0.2.2 · features context,search,get,…,mcp.streamable-http
58
+ injected 1 · skipped none
59
+ inject=on preStep=off budget=500/400
60
+ ```
61
+
62
+ 还没有内容可注入?先用 `mem_remember` 记一条偏好,或用 `mem_record` 记一条经验,然后再开一个新会话。
63
+
64
+ ## 工作原理
65
+
66
+ | 层 | 职责 | 位置 |
67
+ |---|---|---|
68
+ | 正确性 | 闸门、排序、上下文包装配、冲突处理 | `rocky-mem` 服务端 |
69
+ | **时机** | 何时注入、预算、熔断、降级 | **本插件** |
70
+ | 行为 | agent 该如何使用这些工具 | `rocky-mem` 技能 |
71
+
72
+ ```
73
+ agent/created ──▶ rockymem-runtime ──HTTP──▶ POST /api/v1/context ──▶ agent.inject()
74
+ agent/pre-step ─▶ (可选)─────────────────▶ POST /api/v1/search ──▶ 追加一条消息
75
+ 工具调用 ──────▶ dsh-mcp-client ──stdio───▶ rockymem mcp ──▶ 守护进程
76
+ ```
77
+
78
+ 插件本身不持有任何知识:它读 `doctor` 看服务端支持什么,请求一个上下文包,然后注入。什么为真,全部由服务端决定。
79
+
80
+ ## 配置
81
+
82
+ 所有项都有可用默认值。覆盖项写在 profile 的 `cordis.patch.yml` 里,按条目 id(`rockymem-runtime`、`mcp-rockymem`)定位。
83
+
84
+ | 键 | 默认 | 含义 |
85
+ |---|---|---|
86
+ | `endpoint` | `http://127.0.0.1:7432` | 守护进程地址(`ROCKYMEM_URL` 优先) |
87
+ | `tokenFile` | `~/.local/share/rocky-mem/rocky-mem.token` | bearer token(`ROCKYMEM_TOKEN` 优先) |
88
+ | `doctorCacheMs` | `60000` | 能力探测缓存 |
89
+ | `inject.enabled` | `true` | 会话启动注入 |
90
+ | `inject.onSources` | `[startup, clear]` | 会收到注入的 `SessionStartSource` |
91
+ | `inject.budgetTokens` | `500` | 上下文包上限 |
92
+ | `inject.timeoutMs` | `150` | 单次调用硬超时 |
93
+ | `preStep.enabled` | **`false`** | 任务检索 |
94
+ | `preStep.budgetTokens` | `400` | 每轮上下文包上限 |
95
+ | `preStep.minPromptChars` | `12` | 更短的提示词不检索 |
96
+
97
+ token 由 `rockymem serve` 写在数据库旁边(`<db-stem>.token`,权限 600),或位于 `$ROCKYMEM_HOME/pg-<hash>/`。
98
+
99
+ ## 打开任务检索
100
+
101
+ `agent/pre-step` 每一步都会触发,所以默认关闭:
102
+
103
+ ```yaml
104
+ - id: rockymem-runtime
105
+ config:
106
+ preStep:
107
+ enabled: true
108
+ ```
109
+
110
+ 它把检索从"赌模型会调 `mem_search`"变成**确定性注入**,代价是每轮一次 HTTP 调用、最多 400 token。
111
+
112
+ 在真实库上实测,6 条真实查询(`budget=400`):
113
+
114
+ | 结果 | 查询数 | 近似 token |
115
+ |---|---:|---:|
116
+ | 命中经验段 | 1 | 250 |
117
+ | 只命中常驻偏好 | 5 | 各 42 |
118
+
119
+ 常驻偏好在会话启动时已经注入过了,所以 6 次里有 5 次是纯重复。这就是"没有 `## Applies` / `## Do not use` 段的包直接跳过"以及默认关闭的原因。
120
+
121
+ ## 传输方式
122
+
123
+ MCP 条目默认走 **stdio**:`rockymem mcp` 自己读 token 文件并代理到运行中的守护进程,所以配置里不出现任何密钥。
124
+
125
+ 当守护进程在远端,或者你不想为每个客户端派生一个子进程时,切到 **Streamable HTTP**:
126
+
127
+ ```yaml
128
+ - id: mcp-rockymem
129
+ config:
130
+ transport: streamable-http
131
+ url: http://127.0.0.1:7432/mcp
132
+ headers:
133
+ Authorization: !!js '`Bearer ${process.env.ROCKYMEM_TOKEN}`'
134
+ ```
135
+
136
+ HTTP 传输是无状态的;`GET /mcp` 按设计返回 `405`。
137
+
138
+ ## 失败行为
139
+
140
+ 记忆服务挂掉,绝不能把会话拖垮。
141
+
142
+ | 情况 | 行为 |
143
+ |---|---|
144
+ | 守护进程停止 | 不注入;加载时一条警告;会话不受影响 |
145
+ | 调用超出预算 | 丢弃这次注入 |
146
+ | 连续 3 次失败 | 熔断 60 秒,期间不再发起调用 |
147
+ | `doctor` 没有 `context` | 跳过注入(服务端版本较旧) |
148
+ | 子 agent 会话 | 永不注入 |
149
+ | 上下文包没有经验段 | 跳过(仅任务检索) |
150
+
151
+ ## 隐私
152
+
153
+ - 只与你配置的 `endpoint` 通信;没有遥测,不访问其他主机。
154
+ - 会发送工作目录;开启 `preStep` 时还会发送当轮的第一条提示词——且只发给那个守护进程。
155
+ - 从不读取 rocky-mem 的数据库或配置文件,也没有安装期脚本。
156
+
157
+ 细节与威胁模型见 [SECURITY.md](SECURITY.md)。
158
+
159
+ ## 兼容性
160
+
161
+ | 本插件包 | DSH | rocky-mem 契约 |
162
+ |---|---|---|
163
+ | 0.1.x | `>= 0.2.2-rc.1` | 1 |
164
+ | Node | `^22.19` 或 `>=24` | — |
165
+
166
+ 声明 `engines.dsh` 是因为插件用到了 `agent/pre-step` 与 `ctx.skills.registerProvider`。市场卡片据此过滤,所以 Plugins 页显示"不兼容"意味着 DSH 版本太旧,而不是插件坏了。
167
+
168
+ ## 故障排查
169
+
170
+ | 症状 | 检查 |
171
+ |---|---|
172
+ | 看不到上下文块 | `/rockymem status` —— `injected 0` 并带跳过原因 |
173
+ | `skipped no-feature` | 服务端版本早于 `context`,升级 rocky-mem |
174
+ | `skipped disabled` | 当前进程执行过 `/rockymem off` |
175
+ | `skipped empty-pack` | 该目录还没有任何内容,先记一条 |
176
+ | 模型看不到工具 | `rockymem mcp` 启动失败;在终端里直接跑一遍看报错 |
177
+ | 加载时报 `daemon unreachable` | `rockymem serve` 没在运行,或 `endpoint` 写错 |
178
+
179
+ 服务端诊断:`rockymem doctor --dsn <你的 DSN>`。
180
+
181
+ ## 卸载
182
+
183
+ 在 Plugins 页移除插件包(或执行 `dsh plugin --profile web remove rocky-mem-dsh`)。守护进程与它的数据库是独立的,不会被改动——只有你确实想删掉台账时才需要清理它们。
184
+
185
+ ## 开发
186
+
187
+ ```sh
188
+ npm test # 15 个用例,不需要守护进程与网络
189
+ npm pack --dry-run # 实际会打包的文件清单
190
+ node scripts/check-readme.mjs # 双语结构 + 链接 + locale 元数据校验
191
+ ```
192
+
193
+ 改代码前请读 [CONTRIBUTING.md](CONTRIBUTING.md):最重要的一条是——**记忆服务失败,绝不能变成会话失败**。
194
+
195
+ ## 相关项目
196
+
197
+ | | |
198
+ |---|---|
199
+ | [rocky-mem](https://github.com/linyu19872008/rocky-mem) | 台账服务端、MCP 契约、ADR |
200
+ | [rocky-mem-skill](https://www.npmjs.com/package/rocky-mem-skill) | 给其他宿主的可移植技能 |
201
+ | [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) | 插件所依附的宿主 |
202
+
203
+ ## 许可证
204
+
205
+ MIT —— 见 [LICENSE](LICENSE)。参与即表示同意[行为准则](CODE_OF_CONDUCT.md)。
Binary file
@@ -0,0 +1,54 @@
1
+ # rocky-mem-dsh — DeepSeek Harness bundle patch.
2
+ #
3
+ # Two entries, one install:
4
+ # 1. rockymem-runtime — the Host plugin: session-start injection,
5
+ # optional pre-step retrieval, skill registration.
6
+ # 2. mcp-rockymem — the MCP client that exposes rocky-mem's six tools.
7
+ #
8
+ # The runtime talks to rocky-mem over its public REST contract
9
+ # (GET /api/v1/doctor, POST /api/v1/context, POST /api/v1/search).
10
+ # The tools talk over MCP (stdio by default; streamable-http once the
11
+ # server mounts /mcp).
12
+ - insert:
13
+ - id: rockymem-runtime
14
+ name: rocky-mem-dsh
15
+ config:
16
+ # Base URL of a running `rockymem serve`. Set ROCKYMEM_URL to override.
17
+ endpoint: http://127.0.0.1:7432
18
+ # Bearer token for the daemon. ROCKYMEM_TOKEN wins over this file.
19
+ # A SQLite install writes <db-stem>.token next to the database.
20
+ tokenFile: ~/.local/share/rocky-mem/rocky-mem.token
21
+ doctorCacheMs: 60000
22
+ inject:
23
+ enabled: true
24
+ # SessionStartSource values that receive the standing pack.
25
+ onSources: [startup, clear]
26
+ budgetTokens: 500
27
+ timeoutMs: 150
28
+ preStep:
29
+ # Off in 0.1.0. Turn on after verifying on your host; see docs/DETAIL.md.
30
+ enabled: false
31
+ budgetTokens: 400
32
+ minPromptChars: 12
33
+ timeoutMs: 200
34
+
35
+ # stdio needs no secret in configuration: `rockymem mcp` reads the token
36
+ # file itself and proxies to a running daemon. Switch to HTTP when the
37
+ # daemon is remote or when you would rather not spawn a child process:
38
+ #
39
+ # transport: streamable-http
40
+ # url: http://127.0.0.1:7432/mcp
41
+ # headers:
42
+ # Authorization: !!js '`Bearer ${process.env.ROCKYMEM_TOKEN}`'
43
+ #
44
+ - id: mcp-rockymem
45
+ name: '@deepseek-ai/dsh-mcp-client'
46
+ config:
47
+ serverName: rockymem
48
+ transport: stdio
49
+ command: rockymem
50
+ args: ['mcp']
51
+ toolCallTimeoutMs: 10000
52
+ failOnStartupError: false
53
+ reconnect:
54
+ enabled: true
package/docs/DETAIL.md ADDED
@@ -0,0 +1,70 @@
1
+ # rocky-mem
2
+
3
+ Engineering experience ledger for DeepSeek Harness.
4
+
5
+ ## What you get
6
+
7
+ - **Standing context at session start.** Each new session receives your
8
+ preferences and pinned lessons for the current working directory, in a
9
+ `<rockymem-context>` block, before the first turn.
10
+ - **Six tools** under `mcp__rockymem__*`: `mem_context`, `mem_search`,
11
+ `mem_get`, `mem_record`, `mem_remember`, `mem_feedback`.
12
+ - **The `rocky-mem` skill**, so the agent knows when to consult the ledger and
13
+ when a recorded lesson must not be applied.
14
+ - **A ledger, not a log.** Entries carry evidence, a confidence, and an
15
+ `invalid_when` boundary. Contradictions stay visible as contested pairs until
16
+ a human rules on them.
17
+
18
+ ## What gets installed
19
+
20
+ | Entry | Kind | Role |
21
+ |---|---|---|
22
+ | `rockymem-runtime` | Host plugin | injects context on `agent/created`; optional retrieval on `agent/pre-step`; serves the skill; registers `/rockymem` |
23
+ | `mcp-rockymem` | MCP client | exposes the six `mem_*` tools over stdio |
24
+
25
+ The plugin talks to a running `rockymem serve` over its public REST contract
26
+ (`GET /api/v1/doctor`, `POST /api/v1/context`, `POST /api/v1/search`). It never
27
+ reads the database, never shells out, and has no runtime dependencies.
28
+
29
+ ## Configuration
30
+
31
+ | Key | Default | Meaning |
32
+ |---|---|---|
33
+ | `endpoint` | `http://127.0.0.1:7432` | daemon base URL (`ROCKYMEM_URL` wins) |
34
+ | `tokenFile` | `~/.local/share/rocky-mem/rocky-mem.token` | bearer token (`ROCKYMEM_TOKEN` wins) |
35
+ | `inject.enabled` | `true` | session-start injection |
36
+ | `inject.budgetTokens` | `500` | pack ceiling |
37
+ | `inject.timeoutMs` | `150` | hard per-call budget |
38
+ | `preStep.enabled` | `false` | task-time retrieval before the first step |
39
+
40
+ Overrides live in the profile's `cordis.patch.yml`, keyed by entry id.
41
+
42
+ ## Failure behaviour
43
+
44
+ A memory service that is down must never slow a session down.
45
+
46
+ - daemon unreachable: no injection, one warning at load;
47
+ - call over budget: that injection is dropped;
48
+ - three consecutive failures: circuit opens for 60 s;
49
+ - server without the `context` feature: injection skipped;
50
+ - subagent session: never injected.
51
+
52
+ ## Verify
53
+
54
+ Run `/rockymem status` in any session: it prints the endpoint, the contract and
55
+ server version, how many packs were injected, and why injections were skipped.
56
+ `/rockymem on`, `/rockymem off`, and `/rockymem prestep` toggle behaviour for the
57
+ current process only.
58
+
59
+ ## Known limitations
60
+
61
+ - Task-time retrieval ships disabled; it is off until you have watched the logs
62
+ on your own host and decided the token cost is worth it.
63
+ - The plugin degrades rather than queues: context missed while the daemon was
64
+ down is not replayed on recovery.
65
+ - Retrieval quality is the server's; this plugin only decides when to ask.
66
+
67
+ ## Links
68
+
69
+ - Server and contract: https://github.com/linyu19872008/rocky-mem
70
+ - Repository: https://github.com/linyu19872008/rocky-mem-dsh