dsh-code-taste
Learns your coding taste from explicit instructions and corrections, stores it as confidence-scored rules in editable markdown, and injects them into every session.
安裝
$
npx -p @deepseek-ai/dsh dsh plugin --profile web add github:BaxterL/dsh-code-taste說明文件
閱讀完整 README ↗使用
说话就行
| 你说 | 会发生什么 |
|---|---|
| 记住:以后都用 const | 立刻写入,置信度 0.85–0.90,直接生效 |
| 永远不要用 moment.js | 立刻写入为 guardrail,0.88 |
| 不要用 any,改成 unknown | 进待处理队列,taste learn 复核后才写入 |
| 对,就这样 | 给当前注入的最强那条 +0.10 |
问句、一次性指令(“这次”“先这样”)、任何含密钥的内容,在进库之前就被丢掉了。
复核它学到的东西
纠正不会直接污染提示词,先等你确认:
taste review
taste approve id:r_8f2a1c
同一条被看到第二次时,也会自己转正。
手改规则文件
/.dsh/taste/TASTE.md
## 配置
默认 `model.source: host`:复用你当前会话的模型,装好就能用;想完全不调用模型就改成 `none`。要切换,在你自己 profile 的
`cordis.patch.yml` 里覆盖这一行:
```yaml
- id: taste
name: dsh-code-taste
config:
model:
source: custom # none | host | custom
format: openai
baseURL: https://dashscope.aliyuncs.com/compatible-mode/v1
model: qwen-plus
apiKeyEnv: DASHSCOPE_API_KEY
抽取用哪个模型
model.source | 用什么 | 需要填什么 |
|---|---|---|
none | 不调模型;显式指令与禁令照常写入,纠正以 0.5 进 pending | 无 |
host(默认) | 直接用 DSH 当前会话的模型(自带 DeepSeek,或你在设置里选的任何模型) | 无 endpoint、无 key |
custom | 第三方或本地的 OpenAI / Anthropic 兼容接口 | format、baseURL、model,本地一般不用 key |
host 是最省事的一档:不额外配置,复用你正在用的模型;代价是抽取调用会占一次你的主模型额度。
custom 适合把它固定到便宜模型或本地小模型上。
模型线路(source: custom 时)
format: openai 走任何 /chat/completions 接口:
| 线路 | baseURL | 模型示例 |
|---|---|---|
| 通义千问 / DashScope | https://dashscope.aliyuncs.com/compatible-mode/v1 | qwen-plus |
| Ollama(本地) | http://127.0.0.1:11434/v1 | qwen2.5-coder:7b |
| llama.cpp(本地) | http://127.0.0.1:8080/v1 | -m 加载的那个 |
| LM Studio(本地) | http://127.0.0.1:1234/v1 | 加载的模型 id |
| vLLM(本地) | http://127.0.0.1:8000/v1 | 服务的模型 id |
format: anthropic 走 Messages API:
format: anthropic
baseURL: https://api.anthropic.com
model: claude-sonnet-4-5
apiKeyEnv: ANTHROPIC_API_KEY
本地接口一般不需要 key:apiKey 和 apiKeyEnv 都留空即可。apiKeyEnv 填环境变量名,
apiKey 是直接写死的兜底值。不要把 key 提交进仓库——taste config 只会显示
env:NAME 或 (inline key set)。
token 预算
| 配置项 | 默认 | 含义 |
|---|---|---|
model.source | host | 复用当前会话模型 |
extract.minPending | 3 | 攒够这么多信号才调一次 |
extract.throttleMinutes | 10 | 每个会话每个窗口最多一次 |
extract.maxInputChars | 4000 | 输入约 1000 token |
model.maxOutputTokens | 256 | 输出硬上限 |
extract.maxRulesPerRun | 3 | 单次最多接受的规则数 |
injectBudgetChars | 3000 | 每轮注入约 750 token(最小 400) |
source: none 时唯一持续的开销就是注入那一段:默认约 750 token,其中大部分是固定的引导语。
嫌多可以把 injectBudgetChars 调小。
taste config 会打印当前来源、预算、线路和警告,不会打印 key。