rocky-mem-dsh 0.1.0 → 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 CHANGED
@@ -4,6 +4,46 @@ All notable changes to this project are documented here.
4
4
  The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/)
5
5
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
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
+
7
47
  ## [Unreleased]
8
48
 
9
49
  ### Added
package/README.md CHANGED
@@ -1,67 +1,117 @@
1
- # rocky-mem-dsh
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
- **rocky-mem for DeepSeek Harness.** Session-start context injection, optional
4
- task-time retrieval, and the portable `rocky-mem` skill — installed as one
5
- plugin, decoupled from the server by its public contract.
5
+ <h1 align="center">rocky-mem-dsh</h1>
6
6
 
7
- > 记忆是状态,经验是台账。这个插件负责**时机**:什么时候把台账递给 agent。
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>
8
9
 
9
- ## What it does
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>
10
18
 
11
- | Layer | Responsibility | Where it lives |
12
- |---|---|---|
13
- | Correctness | gates, ranking, pack assembly, conflict handling | `rocky-mem` (Go service) |
14
- | Timing | when to inject, budgets, circuit breaker, degradation | **this plugin** |
15
- | Behaviour | how the agent should use the tools | `rocky-mem-skill` (bundled) |
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.
16
38
 
17
- Three pieces, wired together:
39
+ ![Injected context block](https://raw.githubusercontent.com/linyu19872008/rocky-mem-dsh/main/docs/img/injected.png)
18
40
 
19
- 1. **`rockymem-runtime`** — a Host plugin. On `agent/created` it asks the daemon
20
- for `mem_context` and injects the pack as a tagged user message. On
21
- `agent/pre-step` (opt-in) it can retrieve a task pack before the first step.
22
- 2. **`mcp-rockymem`** — `@deepseek-ai/dsh-mcp-client` exposing the six
23
- `mem_*` tools over stdio.
24
- 3. **Skill** — a packaged skill provider reading `rocky-mem-skill`; a short
25
- embedded body is used when that package is absent.
41
+ ![`/rockymem status` output](https://raw.githubusercontent.com/linyu19872008/rocky-mem-dsh/main/docs/img/status.png)
26
42
 
27
- ## Install
43
+ ## Quick start
44
+
45
+ Two moving parts: the ledger daemon, and this bundle.
28
46
 
29
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
30
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
31
56
  ```
32
57
 
33
- Then start the daemon the plugin talks to:
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 |
34
80
 
35
- ```sh
36
- rockymem serve --dsn sqlite://$HOME/.local/share/rocky-mem/rocky-mem.db
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
37
85
  ```
38
86
 
39
- Restart `dsh web`. On the Plugins page the bundle appears as **rocky-mem**.
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.
40
90
 
41
- ## Configure
91
+ ## Configuration
42
92
 
43
- Everything has a working default; edit the `rockymem-runtime` entry only when
44
- your daemon lives elsewhere.
93
+ Everything has a working default. Overrides go in the profile's
94
+ `cordis.patch.yml`, keyed by entry id (`rockymem-runtime`, `mcp-rockymem`).
45
95
 
46
96
  | Key | Default | Meaning |
47
97
  |---|---|---|
48
98
  | `endpoint` | `http://127.0.0.1:7432` | daemon base URL (`ROCKYMEM_URL` wins) |
49
99
  | `tokenFile` | `~/.local/share/rocky-mem/rocky-mem.token` | bearer token (`ROCKYMEM_TOKEN` wins) |
50
- | `doctorCacheMs` | `60000` | capability probe cache |
100
+ | `doctorCacheMs` | `60000` | capability-probe cache |
51
101
  | `inject.enabled` | `true` | session-start injection |
52
102
  | `inject.onSources` | `[startup, clear]` | `SessionStartSource` values that receive it |
53
103
  | `inject.budgetTokens` | `500` | pack ceiling |
54
104
  | `inject.timeoutMs` | `150` | hard per-call budget |
55
- | `preStep.enabled` | **`false`** | task-time retrieval (see below) |
105
+ | `preStep.enabled` | **`false`** | task-time retrieval |
56
106
  | `preStep.budgetTokens` | `400` | pack ceiling per turn |
57
107
  | `preStep.minPromptChars` | `12` | shorter prompts are never searched |
58
108
 
59
- ### Why `preStep` ships off
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
60
113
 
61
- `agent/pre-step` runs on every step. Enabling it makes retrieval *deterministic*
62
- instead of hoping the model calls `mem_search`, at the cost of one HTTP call and
63
- up to 400 tokens per turn. Turn it on after you have checked the logs on your
64
- own host:
114
+ `agent/pre-step` runs on every step, so this is opt-in:
65
115
 
66
116
  ```yaml
67
117
  - id: rockymem-runtime
@@ -70,12 +120,27 @@ own host:
70
120
  enabled: true
71
121
  ```
72
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
+
73
137
  ## Transports
74
138
 
75
- The MCP entry ships on **stdio** because it needs no secret in configuration:
76
- `rockymem mcp` reads the token file itself and proxies to a running daemon.
77
- Switch to **Streamable HTTP** when the daemon is remote or you would rather not
78
- spawn a child process per client:
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:
79
144
 
80
145
  ```yaml
81
146
  - id: mcp-rockymem
@@ -86,9 +151,9 @@ spawn a child process per client:
86
151
  Authorization: !!js '`Bearer ${process.env.ROCKYMEM_TOKEN}`'
87
152
  ```
88
153
 
89
- The HTTP transport is stateless; `GET /mcp` answers 405 by design.
154
+ The HTTP transport is stateless; `GET /mcp` answers `405` by design.
90
155
 
91
- ## Degradation
156
+ ## Failure behaviour
92
157
 
93
158
  A memory service that is down must never slow a session down.
94
159
 
@@ -99,20 +164,69 @@ A memory service that is down must never slow a session down.
99
164
  | 3 consecutive failures | circuit opens for 60 s; no calls are attempted |
100
165
  | `doctor` lacks `context` | injection skipped (older server) |
101
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).
102
178
 
103
179
  ## Compatibility
104
180
 
105
- - DSH `>= 0.2.2-rc.1` (`engines.dsh`), Node `^22.19 || >=24`.
106
- - rocky-mem contract `>= 1`; the plugin degrades when the server lacks a feature.
107
- - The plugin never reads rocky-mem's database or config files.
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.
108
209
 
109
210
  ## Development
110
211
 
111
212
  ```sh
112
- node --check lib/index.js
113
- npm pack --dry-run
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
114
216
  ```
115
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
+
116
229
  ## License
117
230
 
118
- MIT — see [LICENSE](LICENSE).
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
package/docs/DETAIL.md CHANGED
@@ -1,77 +1,70 @@
1
1
  # rocky-mem
2
2
 
3
- **工程经验台账 for DeepSeek Harness.**
3
+ Engineering experience ledger for DeepSeek Harness.
4
4
 
5
5
  ## What you get
6
6
 
7
- - **Session-start context.** Each new session receives your standing
7
+ - **Standing context at session start.** Each new session receives your
8
8
  preferences and pinned lessons for the current working directory, in a
9
9
  `<rockymem-context>` block, before the first turn.
10
- - **Six tools** under the `mcp__rockymem__*` namespace: `mem_context`,
11
- `mem_search`, `mem_get`, `mem_record`, `mem_remember`, `mem_feedback`.
10
+ - **Six tools** under `mcp__rockymem__*`: `mem_context`, `mem_search`,
11
+ `mem_get`, `mem_record`, `mem_remember`, `mem_feedback`.
12
12
  - **The `rocky-mem` skill**, so the agent knows when to consult the ledger and
13
13
  when a recorded lesson must not be applied.
14
14
  - **A ledger, not a log.** Entries carry evidence, a confidence, and an
15
- `invalid_when` boundary. Contradictions stay visible instead of being
16
- overwritten.
15
+ `invalid_when` boundary. Contradictions stay visible as contested pairs until
16
+ a human rules on them.
17
17
 
18
- ## How it is wired
18
+ ## What gets installed
19
19
 
20
- ```
21
- agent/created ──▶ rockymem-runtime ──HTTP──▶ GET /api/v1/doctor
22
- └────▶ POST /api/v1/context ──▶ agent.inject(...)
23
- agent/pre-step ─▶ (opt-in) ────────────────▶ POST /api/v1/search ──▶ appended message
24
- MCP tool call ──▶ dsh-mcp-client ──stdio──▶ rockymem mcp ──▶ daemon
25
- ```
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 |
26
24
 
27
- Only the public REST contract and the MCP protocol are used. There is no
28
- shared code, no database access, and no assumption about internal tables.
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.
29
28
 
30
29
  ## Configuration
31
30
 
32
- | Key | Default | Notes |
31
+ | Key | Default | Meaning |
33
32
  |---|---|---|
34
- | `endpoint` | `http://127.0.0.1:7432` | `ROCKYMEM_URL` overrides |
35
- | `tokenFile` | `~/.local/share/rocky-mem/rocky-mem.token` | `ROCKYMEM_TOKEN` overrides |
36
- | `inject.enabled` | `true` | session-start pack |
37
- | `inject.onSources` | `[startup, clear]` | skip `resume`/`compact` |
38
- | `preStep.enabled` | `false` | task-time retrieval |
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
39
 
40
- The token is written by `rockymem serve` next to its database
41
- (`<db-stem>.token`, mode 600) or under `$ROCKYMEM_HOME/pg-<hash>/` for
42
- PostgreSQL.
40
+ Overrides live in the profile's `cordis.patch.yml`, keyed by entry id.
43
41
 
44
42
  ## Failure behaviour
45
43
 
46
- The plugin treats every failure as "no context this time":
47
-
48
- - unreachable daemon → skip, warn once;
49
- - 150 ms budget exceeded → drop that injection;
50
- - 3 consecutive failures → 60-second circuit, no calls attempted;
51
- - server without the `context` feature → no injection, tools still available.
44
+ A memory service that is down must never slow a session down.
52
45
 
53
- No path blocks, delays, or fails a turn.
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.
54
51
 
55
- ## Verify it works
52
+ ## Verify
56
53
 
57
- 1. Start the daemon: `rockymem serve`.
58
- 2. Open a new DSH session in a project that has at least one memory entry.
59
- 3. The first message should contain a `<rockymem-context kind="standing">` block.
60
- 4. Ask the agent to record a lesson; `mem_record` should answer with
61
- `status: pending_review` unless evidence, `applies_when`, and confidence
62
- all pass the gate.
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.
63
58
 
64
- ## Known limitations (0.1.0)
59
+ ## Known limitations
65
60
 
66
- - `preStep` ships disabled; enable it after checking your host's logs.
67
- - The plugin builds injected messages locally (UUID + deep freeze) and only
68
- uses `@deepseek-ai/dsh-llm`'s constructor when that package resolves from the
69
- profile. The local factory mirrors the upstream shape field for field; a
70
- future message field would be missed until the plugin is updated.
71
- - MCP ships on stdio. Streamable HTTP is supported by the server and can be
72
- selected in `mcp-rockymem` for remote daemons.
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.
73
66
 
74
- ## Uninstall
67
+ ## Links
75
68
 
76
- Remove the bundle on the Plugins page (or `dsh plugin --profile web remove
77
- rocky-mem-dsh`). Nothing outside the profile is written.
69
+ - Server and contract: https://github.com/linyu19872008/rocky-mem
70
+ - Repository: https://github.com/linyu19872008/rocky-mem-dsh
@@ -0,0 +1,57 @@
1
+ # rocky-mem
2
+
3
+ 面向 DeepSeek Harness 的工程经验台账。
4
+
5
+ ## 你会得到什么
6
+
7
+ - **会话启动时的常驻上下文。** 每个新会话在第一轮对话前,都会收到当前工作目录的偏好与置顶经验,包在 `<rockymem-context>` 块里。
8
+ - **六个工具**,命名空间 `mcp__rockymem__*`:`mem_context`、`mem_search`、`mem_get`、`mem_record`、`mem_remember`、`mem_feedback`。
9
+ - **`rocky-mem` 技能**:让 agent 知道什么时候该查台账,以及某条经验在什么条件下不该用。
10
+ - **台账,不是日志。** 条目带证据、置信度和 `invalid_when` 边界;矛盾会以"有争议"成对保留,直到人来裁定。
11
+
12
+ ## 装了哪些东西
13
+
14
+ | 条目 | 类型 | 作用 |
15
+ |---|---|---|
16
+ | `rockymem-runtime` | Host 插件 | 在 `agent/created` 注入上下文;可选地在 `agent/pre-step` 检索;提供技能与 `/rockymem` 命令 |
17
+ | `mcp-rockymem` | MCP 客户端 | 用 stdio 暴露六个 `mem_*` 工具 |
18
+
19
+ 插件通过守护进程的公开 REST 契约通信(`GET /api/v1/doctor`、`POST /api/v1/context`、`POST /api/v1/search`)。它不读数据库、不调用 shell、没有运行时依赖。
20
+
21
+ ## 配置
22
+
23
+ | 键 | 默认 | 含义 |
24
+ |---|---|---|
25
+ | `endpoint` | `http://127.0.0.1:7432` | 守护进程地址(`ROCKYMEM_URL` 优先) |
26
+ | `tokenFile` | `~/.local/share/rocky-mem/rocky-mem.token` | bearer token(`ROCKYMEM_TOKEN` 优先) |
27
+ | `inject.enabled` | `true` | 会话启动注入 |
28
+ | `inject.budgetTokens` | `500` | 单个上下文包上限 |
29
+ | `inject.timeoutMs` | `150` | 单次调用硬超时 |
30
+ | `preStep.enabled` | `false` | 首步之前的任务检索 |
31
+
32
+ 覆盖项写在 profile 的 `cordis.patch.yml` 里,按条目 id 定位。
33
+
34
+ ## 失败行为
35
+
36
+ 记忆服务挂掉,绝不能把会话拖垮。
37
+
38
+ - 守护进程连不上:不注入,加载时一条警告;
39
+ - 调用超预算:丢弃这次注入;
40
+ - 连续三次失败:熔断 60 秒;
41
+ - 服务端没有 `context` 特性:跳过注入;
42
+ - 子 agent 会话:永不注入。
43
+
44
+ ## 如何验证
45
+
46
+ 在任意会话里执行 `/rockymem status`:它会打印地址、契约与服务端版本、注入次数,以及跳过原因。`/rockymem on`、`/rockymem off`、`/rockymem prestep` 只影响当前进程。
47
+
48
+ ## 已知限制
49
+
50
+ - 任务检索默认关闭;需要你自己在宿主机上看过日志、确认 token 成本可接受后再打开。
51
+ - 插件只降级不补发:守护进程不可用期间错过的上下文,恢复后不会补上。
52
+ - 检索质量由服务端负责,插件只决定"什么时候问"。
53
+
54
+ ## 链接
55
+
56
+ - 服务端与契约:https://github.com/linyu19872008/rocky-mem
57
+ - 仓库:https://github.com/linyu19872008/rocky-mem-dsh
Binary file
Binary file
package/locale/en.json CHANGED
@@ -1,4 +1,7 @@
1
1
  {
2
- "name": "rocky-mem",
3
- "description": "Engineering experience ledger for coding agents: standing preferences injected at session start, provenance-backed lessons retrieved before work."
2
+ "meta": {
3
+ "title": "rocky-mem",
4
+ "description": "Engineering experience ledger for coding agents: standing preferences injected at session start, provenance-backed lessons retrieved before work, and an explicit record of when each lesson stops applying.",
5
+ "detail": "docs/DETAIL.md"
6
+ }
4
7
  }
package/locale/zh-CN.json CHANGED
@@ -1,4 +1,7 @@
1
1
  {
2
- "name": "rocky-mem 经验台账",
3
- "description": "面向编码 agent 的工程经验台账:会话启动注入常驻偏好,任务前检索带出处的经验。"
2
+ "meta": {
3
+ "title": "rocky-mem 经验台账",
4
+ "description": "面向编码 agent 的工程经验台账:会话启动注入常驻偏好,任务前检索带出处的经验,并明确记录每一条在什么条件下不再适用。",
5
+ "detail": "docs/DETAIL.zh.md"
6
+ }
4
7
  }
package/package.json CHANGED
@@ -1,21 +1,23 @@
1
1
  {
2
2
  "name": "rocky-mem-dsh",
3
- "version": "0.1.0",
3
+ "version": "0.1.3",
4
4
  "description": "rocky-mem for DeepSeek Harness: session-start context injection, task-time retrieval, and the portable rocky-mem skill.",
5
5
  "type": "module",
6
6
  "main": "./lib/index.js",
7
7
  "exports": {
8
- ".": "./lib/index.js"
8
+ ".": "./lib/index.js",
9
+ "./locale/*.json": "./locale/*.json"
9
10
  },
10
11
  "files": [
11
12
  "lib",
12
13
  "cordis.patch.yml",
13
14
  "docs",
14
15
  "locale",
15
- "icon.svg",
16
16
  "LICENSE",
17
17
  "README.md",
18
- "CHANGELOG.md"
18
+ "CHANGELOG.md",
19
+ "assets/brand/icon-256.png",
20
+ "README.zh-CN.md"
19
21
  ],
20
22
  "keywords": [
21
23
  "dsh-plugin",
@@ -43,5 +45,22 @@
43
45
  },
44
46
  "scripts": {
45
47
  "test": "node --test test/*.test.mjs"
48
+ },
49
+ "peerDependenciesMeta": {
50
+ "@deepseek-ai/dsh-llm": {
51
+ "optional": true
52
+ },
53
+ "@deepseek-ai/dsh-mcp-client": {
54
+ "optional": true
55
+ }
56
+ },
57
+ "icon": "./assets/brand/icon-256.png",
58
+ "repository": {
59
+ "type": "git",
60
+ "url": "git+https://github.com/linyu19872008/rocky-mem-dsh.git"
61
+ },
62
+ "homepage": "https://github.com/linyu19872008/rocky-mem-dsh#readme",
63
+ "bugs": {
64
+ "url": "https://github.com/linyu19872008/rocky-mem-dsh/issues"
46
65
  }
47
66
  }
package/icon.svg DELETED
@@ -1,13 +0,0 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" width="64" height="64" role="img" aria-label="rocky-mem">
2
- <defs>
3
- <linearGradient id="g" x1="0" y1="0" x2="1" y2="1">
4
- <stop offset="0" stop-color="#4b5563"/>
5
- <stop offset="1" stop-color="#111827"/>
6
- </linearGradient>
7
- </defs>
8
- <rect width="64" height="64" rx="14" fill="url(#g)"/>
9
- <path d="M20 40c0-7 5-12 12-12s12 5 12 12c0 4-3 7-7 7H27c-4 0-7-3-7-7z" fill="#e5e7eb"/>
10
- <circle cx="27" cy="38" r="2.2" fill="#111827"/>
11
- <circle cx="37" cy="38" r="2.2" fill="#111827"/>
12
- <path d="M28 45c2 1.6 6 1.6 8 0" stroke="#111827" stroke-width="2" fill="none" stroke-linecap="round"/>
13
- </svg>