opencode-skills-doctor 0.3.3 → 0.3.4
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 +37 -6
- package/README.zh-CN.md +38 -7
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -8,9 +8,24 @@ Local scanner, linter, fixer, updater and **OpenCode plugin** for skills — zer
|
|
|
8
8
|
|
|
9
9
|
## Why
|
|
10
10
|
|
|
11
|
-
On every model step, OpenCode advertises every skill that has a `description` — the model sees `ID + name + description` for each of them.
|
|
11
|
+
On every model step, OpenCode advertises every skill that has a `description` — the model sees `ID + name + description` for each of them. Skills are not free: they are a permanent context tax on every request.
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
**What this costs.** 29 skills with long descriptions ≈ **3,000+ tokens every step**. Over a 100-step session that is ~300k tokens of pure overhead — spent before the model reads a single line of your code.
|
|
14
|
+
|
|
15
|
+
**What can go wrong.** As skills pile up:
|
|
16
|
+
- duplicate IDs silently shadow each other — you may be editing a file that never loads;
|
|
17
|
+
- descriptions drift until the model picks the wrong skill;
|
|
18
|
+
- half the catalog is dead weight nobody noticed.
|
|
19
|
+
|
|
20
|
+
**What `skills-doctor` does.** It measures the cost, shows which definition actually wins, and fixes it:
|
|
21
|
+
|
|
22
|
+
- `check` — report duplicates/shadowing, long descriptions, oversized bodies and the per-step token budget, with fix hints;
|
|
23
|
+
- `scan` — list every skill with its source, precedence and cost;
|
|
24
|
+
- `fix` — archive shadowed duplicates (reversible) or hide low-frequency skills (`autoinvoke: false`, still loadable with `@id`);
|
|
25
|
+
- `update` — sync skills from HTTP catalogs by version, with a lockfile and drift detection;
|
|
26
|
+
- plugin — expose the audit as a `skills_doctor` tool / `/skills-doctor` command inside OpenCode.
|
|
27
|
+
|
|
28
|
+
Works as a CLI and a plugin on **OpenCode 1.x and 2.x**.
|
|
14
29
|
|
|
15
30
|
## Quick start
|
|
16
31
|
|
|
@@ -183,12 +198,28 @@ It registers the same `skills_doctor` tool (1.x has no `/skills-doctor` command
|
|
|
183
198
|
|
|
184
199
|
`check --json`, `scan --json` and `update --json` all print structured JSON, ready for CI or a web report. Fields include `summary`, `findings[]` and `skills[]` (with `managed: { version, url, root }`).
|
|
185
200
|
|
|
186
|
-
##
|
|
201
|
+
## Caveats and known limitations
|
|
202
|
+
|
|
203
|
+
**Install / plugin**
|
|
204
|
+
|
|
205
|
+
- OpenCode **2.x**: add `"plugins": ["opencode-skills-doctor"]` to `opencode.jsonc` — done.
|
|
206
|
+
- OpenCode **1.x**: needs `npm i --prefix ~/.config/opencode opencode-skills-doctor` plus a one-line local plugin file (`export { SkillsDoctorPlugin } from "opencode-skills-doctor/v1"`), because 1.x resolves plugins differently and `@opencode-ai/plugin` is an optional peer.
|
|
207
|
+
- 1.x has **no `/skills-doctor` command** — only the `skills_doctor` tool.
|
|
208
|
+
|
|
209
|
+
**Safety / behavior**
|
|
210
|
+
|
|
211
|
+
- `fix` defaults to **project-only**; pass `--all` to touch global sources. Archived files go to `.skills-doctor-archive/<timestamp>/` (reversible; originals are moved, not deleted).
|
|
212
|
+
- `fix` only touches **shadowed** definitions. It never edits the effective skill and never rewrites descriptions or bodies.
|
|
213
|
+
- `fix --hide` only adds `metadata.opencode/autoinvoke: false`; the skill stays loadable with `@id`.
|
|
214
|
+
- Shadowing follows OpenCode's precedence: later registration wins; on a tie, the `SKILL.md` directory form wins. If the runtime disagrees, trust the runtime.
|
|
215
|
+
- This is **not** a security sandbox: it audits configuration and files, it does not constrain what the agent can do.
|
|
216
|
+
|
|
217
|
+
**Measurement**
|
|
187
218
|
|
|
188
|
-
- `
|
|
219
|
+
- The default `budget` (1200 tokens) is a recommendation, not a hard limit. Tune it with `.skills-doctor.json` or `--budget`.
|
|
189
220
|
- Token counts are heuristic (CJK ≈ 1.7 chars/token, the rest ≈ 4 chars/token) — good for comparisons, not for billing.
|
|
190
|
-
-
|
|
191
|
-
-
|
|
221
|
+
- `check` is offline; ask a catalog for new versions with `update --check-only`.
|
|
222
|
+
- Config precedence is assumed: global config < project config < `skills` array order.
|
|
192
223
|
|
|
193
224
|
## Roadmap
|
|
194
225
|
|
package/README.zh-CN.md
CHANGED
|
@@ -8,9 +8,24 @@ OpenCode skill 的**本地检测器 + 更新器 + 修复器**,并附带 **Open
|
|
|
8
8
|
|
|
9
9
|
## 为什么需要它
|
|
10
10
|
|
|
11
|
-
opencode 每个模型步骤都会把所有「有 description 的 skill」展示给模型(`ID + name + description`)。skill
|
|
11
|
+
opencode 每个模型步骤都会把所有「有 description 的 skill」展示给模型(`ID + name + description`)。skill 不是免费的——它是**每一次请求都要交的上下文税**。
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
**成本有多大**:29 个 skill、描述偏长,就是**每步 3000+ tokens**。一次 100 步的会话,光 skill 目录就烧掉约 30 万 tokens,模型还没开始读你一行代码。
|
|
14
|
+
|
|
15
|
+
**会出什么问题**:skill 越攒越多,就会出现
|
|
16
|
+
- 同 ID 互相遮蔽——你改的可能是一份永远不会加载的文件;
|
|
17
|
+
- 描述越来越像,模型选错 skill;
|
|
18
|
+
- 一堆没人注意的死重。
|
|
19
|
+
|
|
20
|
+
**`skills-doctor` 做什么**:把成本量出来、把「谁真正生效」指出来,并直接修:
|
|
21
|
+
|
|
22
|
+
- `check` —— 报告重复/遮蔽、超长描述、超大正文、每步 token 预算,并给修复建议;
|
|
23
|
+
- `scan` —— 列出每个 skill 的来源、优先级和成本;
|
|
24
|
+
- `fix` —— 归档被遮蔽的重复定义(可逆),或隐藏低频 skill(`autoinvoke: false`,仍可 `@id` 加载);
|
|
25
|
+
- `update` —— 按版本从 HTTP catalog 同步 skill,带 lockfile 和 drift 检测;
|
|
26
|
+
- 插件 —— 在 OpenCode 会话里暴露 `skills_doctor` 工具 / `/skills-doctor` 命令。
|
|
27
|
+
|
|
28
|
+
CLI 和插件都同时支持 **OpenCode 1.x 和 2.x**。
|
|
14
29
|
|
|
15
30
|
## 快速开始
|
|
16
31
|
|
|
@@ -183,12 +198,28 @@ export { SkillsDoctorPlugin } from "opencode-skills-doctor/v1"
|
|
|
183
198
|
|
|
184
199
|
`check --json` / `scan --json` / `update --json` 都会输出结构化 JSON,方便接 CI 或做网页报告。字段包括 `summary`、`findings[]`、`skills[]`(含 `managed: { version, url, root }`)。
|
|
185
200
|
|
|
186
|
-
##
|
|
201
|
+
## 注意事项与已知限制
|
|
202
|
+
|
|
203
|
+
**安装 / 插件**
|
|
204
|
+
|
|
205
|
+
- OpenCode **2.x**:在 `opencode.jsonc` 加 `"plugins": ["opencode-skills-doctor"]` 即可。
|
|
206
|
+
- OpenCode **1.x**:需要 `npm i --prefix ~/.config/opencode opencode-skills-doctor`,再加一个一行本地插件文件(`export { SkillsDoctorPlugin } from "opencode-skills-doctor/v1"`)——因为 1.x 解析插件的机制不同,且 `@opencode-ai/plugin` 是可选 peer 依赖。
|
|
207
|
+
- 1.x **没有 `/skills-doctor` 命令**,只有 `skills_doctor` 工具。
|
|
208
|
+
|
|
209
|
+
**安全性 / 行为**
|
|
210
|
+
|
|
211
|
+
- `fix` 默认**只处理项目内**;要动全局来源加 `--all`。归档文件进入 `.skills-doctor-archive/<时间戳>/`(可逆,是移动不是删除)。
|
|
212
|
+
- `fix` 只处理**被遮蔽**的定义,永远不改生效版本,也不会重写描述或正文。
|
|
213
|
+
- `fix --hide` 只加 `metadata.opencode/autoinvoke: false`,skill 仍可用 `@id` 加载。
|
|
214
|
+
- 遮蔽判定遵循 OpenCode 优先级:注册越后越优先;同序时 `SKILL.md` 目录形式优先。如与实际运行不一致,以实际运行为准。
|
|
215
|
+
- 它**不是安全沙箱**:只审计配置和文件,不限制 agent 能做什么。
|
|
216
|
+
|
|
217
|
+
**度量**
|
|
187
218
|
|
|
188
|
-
-
|
|
189
|
-
- token
|
|
190
|
-
-
|
|
191
|
-
-
|
|
219
|
+
- 默认 `budget`(1200 tokens)是建议值,不是硬限制;用 `.skills-doctor.json` 或 `--budget` 调整。
|
|
220
|
+
- token 是启发式估算(CJK 约 1.7 字/token,其余约 4 字符/token),用于横向比较,不是精确计费。
|
|
221
|
+
- `check` 不联网;要看 catalog 新版本用 `update --check-only`。
|
|
222
|
+
- 配置优先级假设:全局配置 < 项目配置 < `skills` 数组顺序。
|
|
192
223
|
|
|
193
224
|
## Roadmap
|
|
194
225
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-skills-doctor",
|
|
3
|
-
"version": "0.3.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.3.4",
|
|
4
|
+
"description": "Audit, fix and update OpenCode skills: measure per-step context cost, catch shadowed duplicates, archive safely and sync from catalogs. Works on OpenCode 1.x and 2.x.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
7
7
|
".": "./src/plugin.mjs",
|