kxh4892636/pi-deepseek-anchor
pi extension: DeepSeek V4 Pro Minimal-anchored bootstrap, then full Standard tools (port of dsh-anchored-standard)
项目介绍Project Overview
pi-deepseek-anchor 是 pi 编辑器的扩展,通过在请求 #1 临时使用官方 Minimal 工具集(bash + str_replace_editor),并在首个助手消息或工具调用后恢复完整目录,使 DeepSeek V4 Pro 从首轮起就以锚定标准模式运行,避免“让我……”式回退。适用于调用 deepseek-v4-pro、希望获得上游报告的 98–99 分表现的会话;支持 /dsh-anchor 命令与 PI_DSH_ANCHOR_DEBUG 调试。注意:仅针对 deepseek-v4-pro 模型与 Minimal 预设设计,其他模型或工具集未必受益。
pi-deepseek-anchor is a pi extension that runs DeepSeek V4 Pro in an anchored standard mode by temporarily applying the official Minimal tool preset (bash + str_replace_editor) to request #1, then promoting to the full pi tool catalog after the first assistant message or tool call. Use it when invoking deepseek-v4-pro to recover the upstream-reported 98–99 score range instead of the default 91–92 trajectory. It exposes a /dsh-anchor slash command and PI_DSH_ANCHOR_DEBUG payload logging for inspection. Caveat: behavior is purpose-built for deepseek-v4-pro with the Minimal preset; other models or tool sets are not validated.
请帮我了解并安装插件:【pi-deepseek-anchor】【https://github.com/kxh4892636/pi-deepseek-anchor】
把上面这条消息直接发给当前会话里的 DSH,让它帮你了解并安装。安装命令不一定准确,发给 DSH 更稳。Send this message to DSH in your current session. CLI install commands may not be accurate across systems — DSH will figure it out for you.
或使用命令行安装(适合开发者)Or use CLI install (for developers)
命令行安装CLI Install
dsh plugin --profile web add github:kxh4892636/pi-deepseek-anchor
把 kxh4892636/pi-deepseek-anchor 加入你的 DSH 配置(web profile)即可启用。
READMEREADME
pi-deepseek-anchor
中文说明:README.zh-CN.md
pi-deepseek-anchor enables the full-powered DeepSeek V4 Pro to run at full strength in pi, with significantly improved results (Project2: 91–92 → 98–99).
Cause DeepSeek V4 Pro selects its trajectory based on the API-visible tool catalog. With the default full catalog, the first response typically starts with "Let me..." and follows the Standard trajectory (Project2: 91–92). With the official Minimal pair (bash + str_replace_editor), the first response starts with "We need..." and produces zero let me (Project2: 98–99). Staying on Minimal permanently loses the full toolset. This extension applies Minimal only to request #1 and restores the full catalog from request #2, so both are retained in one session.
Install
pi install npm:pi-deepseek-anchor
Or from GitHub:
pi install git:github.com/kxh4892636/pi-deepseek-anchor@v1.0.0
Then /reload or restart pi. Works with the full-powered DeepSeek V4 Pro official release.
Manual fallback: copy index.ts to ~/.pi/agent/extensions/anchored-standard/index.ts (global) or <project>/.pi/extensions/anchored-standard/index.ts (project-local).
Behavior
| Request #1 (bootstrap) | Request #2+ (promoted) | |
|---|---|---|
| Tools | bash + str_replace_editor, byte-identical to the official Minimal preset |
full pi tool catalog |
| System prompt | You are a helpful software engineer assistant. (46 chars) |
persona remains; stripped pi context returns as a user message |
| Output budget | adapter default (no cap; bootstrapMaxTokens is opt-in) |
adapter default |
Promotion fires on the first durable signal: the first assistant message or the first tool call, whichever comes first (promoteOn: "either" default). State is durable, so /resume and reload preserve the phase.
pi adaptation
| Upstream (dsh preset) | pi port |
|---|---|
| Minimal tool rows | pi.registerTool overrides: bash uses the byte-identical Minimal description and delegates to pi's built-in createBashTool; str_replace_editor implements the official schema and upstream filesystem semantics (view / create / str_replace / insert, 16000-char truncation, exact error messages) |
tool-bootstrap pre-step filter |
before_agent_start + before_provider_request: request #1 is Minimal-exact; late appends (e.g. pi-memory) are dropped on request #1 and moved to a user message after promotion |
Persona row (complete: true) |
minimalPersona + personaScope: "always" (default): persona remains the system prompt for the whole session; stripped context is re-delivered as a user message from request #2 |
| Durable event scan | phase derived from pi's durable session branch plus a dsh-anchored-state custom entry |
| Zero-Anchored Standard mode | zeroAnchor: true in PI_DSH_ANCHOR_CONFIG |
Verification
End-to-end with official deepseek-v4-pro, reasoningEffort=max, --mode rpc:
REQ#1: tools=[bash, str_replace_editor]
system='You are a helpful software engineer assistant.' (46 chars)
first thinking: "We need answer briefly about repository. Need inspect. Use tools."
REQ#2: full tool catalog + normal pi context (delivered as a user message)
Configuration
Edit DEFAULT_CONFIG in index.ts, or override at runtime:
{"promoteOn": "tool-call", "bootstrapMaxTokens": 1024, "personaScope": "always"}
Keys: bootstrapTools (default ["bash","str_replace_editor"]), promoteOn (either | tool-call | assistant-message), bootstrapMaxTokens (optional; unset = no cap), minimalPersona (default true), personaScope (always | bootstrap, default always), personaText, stripContext, zeroAnchor (default false), zeroAnchorText, editorMaxOutputChars (default 16000).
Verify & debug
/dsh-anchorprints the phase;/dsh-anchor promotepromotes now;/dsh-anchor on|offre-arms/disables the bootstrap for the session.- The TUI footer shows
bootstrap: bash/str_replace_editoruntil promotion. PI_DSH_ANCHOR_DEBUG=1dumps assembled payloads toPI_DSH_ANCHOR_DEBUG_FILE(default/tmp/dsh-anchor-debug.jsonl).
Type check
npx tsc -p tsconfig.check.json
Adjust the three paths entries in tsconfig.check.json to the installed pi type-definition locations.
Files
package.json— pi package manifestindex.ts— pi extension (single file, zero runtime deps)README.zh-CN.md— Chinese documentationtsconfig.check.json— type-check configLICENSE— MIT, including upstream copyright noticesNOTICE— upstream derivation notice
License
MIT. index.ts is a port of the MIT-licensed upstream preset; original copyright notices are retained.
Upstream
This project is a pi port of xiaobright/dsh-anchored-standard. The upstream README and methodology are the basis for this port:
- Repository: https://github.com/xiaobright/dsh-anchored-standard
- README: English · 中文
nexu-io/open-design
ruvnet/ruflo
amruthpillai/reactive-resume
esengine/DeepSeek-Reasonix
volcengine/OpenViking
Molunerfinn/PicGo
titanwings/distilly
titanwings/colleague-skill