dsh-skillwright
A learning loop for DeepSeek Harness that can create skills on its own, but has to ask before changing yours.
English · 中文
Forked from
xiex16070-jpg/dsh-learn(MIT, by xiex16070-jpg), at tagv0.3.13. Upstream designed the loop, the candidate gate, the single validated writer and the curator; all of that is still its work. This fork changes who is allowed to change an existing skill, adds an approval surface, and fixes bugs found while verifying it against a real library. See Credits — the original author is the author of the substance here.
Why this fork exists
A learning loop that rewrites skills by itself is a loop you cannot audit. You find out it learned something wrong when a later session acts on it. But a loop that only proposes is a loop nobody feeds, because approving a diff should not require remembering to ask.
This fork draws the line at ownership:
upstream dsh-learn |
this fork | |
|---|---|---|
| New skill it invents | creates it | creates it — unchanged |
| Existing skill | rewrites it in place | proposes a unified diff; nothing is written until you approve |
| Where you approve | your prompt | a sidebar panel, plus /learn |
| Who may archive a skill | the curator | the curator, and only skills the loop itself created |
So: it still gets smarter on its own where it is safe to, and where it touches work you wrote, it hands you the patch.
What it actually does
Capture is free; the review is one cached call. Every turn is read from the session's own
event feed with no model call at all — that is where corrections, failures and fixes become
candidate lessons, each carrying the reason it passed or was refused. Separately, every
retrospect.everyIterations tool rounds (10 by default), the session's own model reviews
what that session used and whether any of it fell short.
That second pass is the honest correction to how this plugin used to work. It originally
judged with regexes alone, and on 2026-12-02 it filed a rule asserting that
learn_skill_manage update refuses skills the plugin did not create — false, and found only
because a human tested it. A matcher cannot judge whether a skill's guidance was adequate.
A reader can. So the reader decides now, and the cost is made explicit below.
What the review costs, and why it should be cheap
@deepseek-ai/dsh-llm ships no cache of its own — the README says so: "No retry execution,
caching, or rate limiting ships in this service." The cache that matters is the provider's
prefix cache, and it hits only when this request's leading bytes match the session's own.
So the review is built to match, and the contract is enforced in code before every request
(lib/reviewer.js, asserted in scripts/selftest.mjs):
- the session's derived history, unmodified and in order — the same bytes the loop sent;
- the review ask appended last, never prepended and never as a system message — anything at the front would diverge at token 0 and invalidate the whole prefix;
- no
system,toolsortoolHistory— each changes the request head.
A request that breaks any of the three is refused before it is sent, rather than quietly
billing a full read. retrospect.model defaults to session (the same model that just did the
work, so the same tokenizer and the same cache); set it to provider/model to use a cheaper
reviewer, and the choice is recorded in the ledger.
Honest limit: the cache is the provider's, not ours. A cold provider cache, a model override, or a provider that does not implement prefix caching means this pass costs a real read. That is why it is off by default.
Five tools: learn, learn_review, learn_curator, learn_skill_manage, learn_skills.
learn_review action=session runs the review on demand.
Two switches per skill
A sidebar panel lists every skill and shows pending proposals as diffs.
| switch | meaning | default |
|---|---|---|
| adopt | the loop may file proposals against this skill | off |
| auto-learn | the loop may apply its own proposals to this skill without asking | off |
They are deliberately separate endpoints, and auto-learn cannot be granted without adoption; withdrawing adoption withdraws auto-learn with it. Granting "suggest changes" must never silently grant "change things".
Install
dsh plugin --profile web add github:ku4nc4/dsh-skillwright
From a release tarball:
dsh plugin --profile web add -w "https://github.com/ku4nc4/dsh-skillwright/releases/latest/download/dsh-skillwright-0.4.0.tgz"
Requires DSH >= 0.2.0-rc.1 and Node >= 22.19. No runtime dependencies.
The create path shells out to skillctl for linting. If it is not on PATH, point at it with
DSH_LEARN_SKILLCTL=/path/to/skillctl; without it, new-skill creation is refused rather than
writing an unlinted file.
What is safe to trust, and what is not
Verified on a real library of 247 skills. The numbers below are counted by the test suite, not typed by hand.
33 sections 1745 assertions
1744/1745 checks passed, 1 FAILED
npm test— 33 sections, 1745 assertions on the host half, 852 assertions on the browser half.- The one failure is an assertion about Windows drive-letter paths. It fails identically on pristine upstream and cannot pass on Linux. It is environmental, and it is left failing rather than deleted, because deleting it would hide the next real failure in that section.
- Your library is not modified on install. Adoption is per skill and off by default.
Honest limits, because a README that oversells is the one thing that gets a plugin rejected here:
- The tool guard blocks direct writes to
SKILL.mdthrough thewrite,edit,str_replace_editorandapply_patchtools. It cannot stop a shell command that writes the file. Ledger, backup and lint are the controls there — not the guard. - Bulk adopt is sequential, not transactional. A failure part-way leaves the library partly adopted, and it says so.
- Approval is panel-only. There is no
learn action=approve, so a proposal can be filed from any session but applied only from the sidebar. - Automatic routing files every
TECHNIQUElesson undertool-recoveryunless you passumbrella=<skill>explicitly. That is a real design flaw in upstream's routing, still present here, and worth knowing before you trust the filing.
Credits
dsh-learn— the upstream project, by xiex16070-jpg. https://github.com/xiex16070-jpg/dsh-learn · MIT. The session capture, signal classification, candidate gate, single validated writer, curator lifecycle and the recall machinery are upstream's design and upstream's code. This fork starts from it and does not exist without it. If you want the loop without the propose-and-approve behaviour, install upstream.- Fork changes by ku4nc4: propose-only for existing skills,
the sidebar approval panel, per-skill adoption, the archive-authority restriction, and the
fixes listed in
CHANGELOG-fork.md. - MIT licence, upstream notice preserved verbatim in
LICENSE.
The full fork rationale, every mechanism, and the review findings behind them are in
README-FORK.md.
中文
一个能自己造新技能、但改动你已有技能前必须问过你的 DeepSeek Harness 学习回路。
上游是
xiex16070-jpg/dsh-learn(MIT,作者 xiex16070-jpg),起点 tagv0.3.13。会话捕获、信号分类、候选门槛、唯一的写入通道、 curator 生命周期、记忆召回——这些都是上游的设计与代码,没有它就没有这个分支。 本分支只改一件事:谁有权修改一个已经存在的技能,另外补了审批界面、修了实际核对时发现的 bug。 详见下方署名。
为什么有这个分支
一个会自己改写技能的学习回路,是一个你无法审计的回路:它学错了,你要到下一次会话照着做的时候才知道。 但一个只会提议的回路又没人喂——因为「记得去批准一个 diff」这件事本身就很难坚持。
这个分支把界线画在归属上:
上游 dsh-learn |
本分支 | |
|---|---|---|
| 它自己新造的技能 | 直接创建 | 直接创建——不变 |
| 已有技能 | 就地改写 | 只提 unified diff,你批准前什么都不写 |
| 在哪批准 | 提示词里 | 侧边栏面板,外加 /learn |
| 谁能归档技能 | curator | curator,且只能归档回路自己创建的 |
所以:在安全的地方它仍然自己变聪明;一旦碰到你写的东西,它把补丁递给你。
它做什么
捕获免费,审查是一次命中缓存的模型调用。 每个回合都只读会话自己的事件流,不调用模型——
纠正、失败与修法在这里变成候选教训,每条都带着「通过/被拒」的理由。另外,每
retrospect.everyIterations 个工具回合(默认 10),由会话自己的模型事后看一遍:这次会话用了
哪些技能,其中有没有哪里不够用。
第二段是对旧做法的诚实修正。它原本只用正则判断,结果在 2026-12-02 写进了一条假规则——说
learn_skill_manage update 会拒绝非本插件创建的技能。那条是错的,而且只有人去测才会发现。
匹配器判断不了「这个技能的指导够不够用」,读者可以。所以现在由读者判断,代价下面说清楚。
这次审查要花多少,为什么应该很便宜
@deepseek-ai/dsh-llm 自己没有缓存,它的 README 写得很明白:"No retry execution, caching, or
rate limiting ships in this service." 真正起作用的是供应商的前缀缓存,而它只在本次请求的
开头字节与会话自身完全一致时才命中。
所以这次审查是照着命中去构造的,而且这条契约在每次请求前由代码强制(lib/reviewer.js,
并在 scripts/selftest.mjs 里断言):
- 会话派生出的历史,原样、按序——与回路刚发出去的是同一批字节;
- 审查指令追加在最末尾,绝不前置、绝不做成 system 消息——放在开头就会从第 0 个 token 起分叉, 整个前缀缓存作废;
- 不带
system、tools、toolHistory——这三样任何一个改变请求头部。
违反任意一条的请求会在发出前被拒绝,而不是悄悄按全量读计费。retrospect.model 默认 session
(就用刚才干活的模型,分词器和缓存都一样);想要更便宜的审查模型就写 provider/model,这个选择会
记进账本。
如实说明: 缓存是供应商的,不是我们的。缓存冷、换了模型、或供应商不实现前缀缓存,这一次就是 实打实的全量读。这也是它默认关闭的原因。
五个工具:learn、learn_review、learn_curator、learn_skill_manage、learn_skills。
learn_review action=session 可以立刻手动跑一次审查。
每个技能两个开关
侧边栏面板列出每个技能,并把待批提案显示成 diff。
| 开关 | 含义 | 默认 |
|---|---|---|
| 采纳(adopt) | 允许回路对这个技能提提案 | 关 |
| 自动学习(auto-learn) | 允许回路不问你就把提案应用到这个技能 | 关 |
两者是不同的端点,而且自动学习必须先采纳;取消采纳会连带取消自动学习。给出「可以建议」 绝不能顺手给出「可以改」。
安装
dsh plugin --profile web add github:ku4nc4/dsh-skillwright
需要 DSH >= 0.2.0-rc.1、Node >= 22.19,运行时零依赖。
创建路径会调用 skillctl 做 lint。不在 PATH 里就用
DSH_LEARN_SKILLCTL=/路径/skillctl 指过去;没有它时宁可拒绝创建,也不写一个没过 lint 的文件。
哪些能信,哪些不能
在 247 个技能的真实库上验证过,下面的数字由自测数出来,不是手写的:宿主断言 1744/1745、浏览器断言 852/852。唯一失败的那条是 Windows 盘符路径断言,在原生上游上 同样失败、在 Linux 上不可能通过——属于环境问题,且故意留着不删:删掉它就会盖住同一段里 下一个真实的失败。
如实说明的限制(在这个列表上,夸大才是被打回的唯一原因):
- 工具守卫挡住了
write、edit、str_replace_editor、apply_patch对SKILL.md的直接写入, 但挡不住一条 shell 命令去写它。那条路靠账本、备份和 lint,不靠守卫。 - 批量采纳是顺序执行、非事务的:中途失败会留下「部分采纳」,它会照实报告。
- 批准只能在面板里做;没有
learn action=approve,所以提案可以在任何会话里提出,却只能在侧边栏应用。 - 自动归档把每条
TECHNIQUE类教训都归到tool-recovery,除非你显式传umbrella=<技能名>。 这是上游路由的真实缺陷,本分支仍然存在,值得你在依赖它之前知道。
署名
dsh-learn——上游项目,作者 xiex16070-jpg。 https://github.com/xiex16070-jpg/dsh-learn · MIT。 会话捕获、信号分类、候选门槛、唯一写入通道、curator 生命周期与召回机制,都是上游的设计与代码。 本分支从它出发,没有它就不存在。只想要学习回路、不需要「提议—批准」这一层的,请装上游。- 本分支改动 由 ku4nc4 完成:已有技能改为只提议、侧边栏审批面板、
逐技能采纳、归档权限收紧,以及
CHANGELOG-fork.md里列的修复。 - MIT 许可,上游版权声明在
LICENSE中原样保留。
完整的分支取舍、每个机制,以及支撑这些决定的复核发现,见 README-FORK.md。
No comments yet. Be the first to write one.