DeepSHPlugins
dsh-minimal-anchor 项目预览
GITHUB / COMMUNITY PROJECT

dsh-minimal-anchor

生态与开发TypeScriptMIT

只在会话首轮把工具清单裁剪到白名单并注入一段结构化前言,之后每一轮原样放行。

2 Starsrand0wn 更新时间 2026-08-19
访问 GitHub 仓库
dsh-minimal-anchor 项目预览

项目介绍

中文

只在会话首轮把工具清单裁剪到白名单并注入一段结构化前言,之后每一轮原样放行。

English

Prunes the tool schema to a whitelist and injects a structural preamble on a session's first turn only, then passes every later turn through untouched.

项目信息与收录信号

快照 2026-09-11
作者 / 组织
rand0wn
仓库
rand0wn/dsh-minimal-anchor
GitHub Stars
2
Forks
0
开发语言
TypeScript
许可证
MIT
最近推送
2026-08-19
Manifest
数据中检测到声明

公开仓库不自动等于可商用;许可证与当前兼容性以原项目文档为准。Manifest 和数据评分不构成安装安全认证。

数据评分

58/ 100
维护活跃
85
文档与实用信息
100
生态关注度
14
安装便捷信号
100
项目声明信号
100

近 23 天仍在更新;README 含完整安装与使用说明;关注度尚低(2)。

评分来自已有数据快照的五维模型,仅作浏览参考,不是实际使用评测或安全检测结论。

安装与使用

所有项目资料与许可均以对应 GitHub 仓库为准。

dsh plugin --profile web add github:rand0wn/dsh-minimal-anchor

复制命令不会自动执行。请先阅读仓库文档,确认环境要求与许可证。

项目截图

仓库 README

GitHub 原文

已保存的仓库文档快照;文档抓取时间未记录,可能与上方目录介绍处于不同版本。安装前请核对当前仓库说明。

dsh-minimal-anchor

CI

A DeepSeek Harness (dsh) plugin that shields turn 1 from tool-schema overload.

Why

A fresh dsh session hands the model the *entire* configured toolset — file edits, bash, subagents, jobs — on message one, even when the first message is just "look at this repo and tell me what's going on." A smaller, focused schema on that first turn keeps the model's early reasoning on exploration instead of premature action, without touching how any later turn behaves.

dsh-minimal-anchor hooks the harness's own prompt-assembly pipeline to:

  1. Prune tools on turn 1 only — down to a configurable whitelist (default: read, glob, grep).
  2. Prepend a short structural preamble on that same turn, framing the session as exploration-first.
  3. Get out of the way from turn 2 onward — every later assembly for that session passes through completely untouched, full toolset restored.

Install

dsh plugin --profile <name> add dsh-minimal-anchor

or from a local checkout:

dsh plugin --profile <name> add /path/to/dsh-minimal-anchor

This adds the package as a dependency of the profile, but does not by itself activate it — dsh only applies a package's dsh.bundle patch for packages listed in that profile's dsh.profile.bundles. Add the package name to that list in profiles/<name>/package.json:

{
  "dsh": {
    "profile": {
      "bundles": [
        "@deepseek-ai/dsh-base",
        "@deepseek-ai/dsh-headless",
        "dsh-minimal-anchor"
      ]
    }
  }
}

Confirm it composed with dsh --profile <name> --dump-config — you should see a minimal-anchor entry. (An equivalent alternative that skips the bundles list entirely: insert it directly in your own profiles/<name>/cordis.patch.yml — see Configuration.)

Usage

Nothing to invoke — it's a passive plugin. Boot your profile as usual (dsh web, dsh --profile headless "...", etc.) and the first turn of every new session goes out with the pruned tool list and preamble automatically.

Configuration

# profiles/<name>/cordis.patch.yml
- insert:
    - id: minimal-anchor
      name: 'dsh-minimal-anchor'
      config:
        whitelistedTools: [read, glob, grep]
        enforcePreamble: true
        customPreamble: 'Your own turn-1 framing text.'
FieldDefaultDescription
whitelistedTools[read, glob, grep]Tool names kept on turn 1. Must match the exact registered tool names in your profile — check dsh --profile <name> --dump-config if unsure, names differ from plugin to plugin.
enforcePreambletrueWhether to prepend the structural preamble section on turn 1.
customPreamble(built-in exploration-framing text)Preamble text, used only when enforcePreamble is true.

Extending rather than replacing the default whitelist? DEFAULT_WHITELISTED_TOOLS and DEFAULT_PREAMBLE are exported from the package if you're composing config in TypeScript rather than YAML.

How it works

Hooks the system-prompt/assemble waterfall from @deepseek-ai/dsh-system-prompt, which runs once per turn and produces the PromptAssembly (sections, tools, contexts) actually sent to the model. A WeakSet keyed on the assembly's scope tracks whether that scope has assembled before; the first time, it filters assembly.tools to the whitelist and unshifts the preamble section, then calls next() so every other listener in the waterfall still runs normally. Every later assembly for that scope short-circuits straight to next() — no mutation, no persisted per-session state beyond the WeakSet entry, which needs no explicit teardown since it dies with the scope object.

There is no agent/request or per-message hook in the real harness — this plugin does not use one, unlike an earlier draft of this same idea that assumed events that don't exist in dsh.

Troubleshooting

Turn 1's tool list came back empty. whitelistedTools matches on the exact registered tool name — these differ per harness install and per other plugins you have active. Check the real names with dsh --profile <name> --dump-config, or open the Trajectory tab in the web UI for a session and look at the Tools panel on "Initial System Prompt". An early draft of this plugin shipped with guessed names (read_file, list_dir, search_files) that don't exist in the real harness — the whitelist silently matched nothing and pruned every tool.

Plugin doesn't seem to load / no minimal-anchor entry in --dump-config. Being a listed dependency of the profile (e.g. after dsh plugin add) is not enough — the package also needs to be in that profile's dsh.profile.bundles list (see Install) before its dsh.bundle patch gets applied.

Loader crashes with Cannot read properties of undefined (reading 'validate') on a fork. A Cordis plugin's exported Config must be a schemastery schema (z.object({...})), not a plain object — the loader calls .validate on whatever Config exports.

Development

npm install
npm run typecheck
npm test

Verified against a real local dsh boot (not just types): installed into a scratch profile, patched in, and run against a live model — the outbound request on turn 1 carried exactly the whitelisted tools and the preamble text, and turn 2 carried the full toolset with no preamble.

License

MIT

使用前核对

安装步骤、兼容版本与授权范围以原项目当前文档为准。Stars 和评分是快照中的导航信号。

安装与排错 · 项目问题反馈

同类项目