pi-deepseekx
A Pi extension for configurable minimal prompting and neutral bash safeguards.
Package details
Install pi-deepseekx from npm and Pi will load the resources declared by the package manifest.
$ pi install npm:pi-deepseekx- Package
pi-deepseekx- Version
0.1.0- Published
- Aug 15, 2026
- Downloads
- 171/mo · 16/wk
- Author
- dashxio
- License
- MIT
- Types
- extension
- Size
- 34.3 KB
- Dependencies
- 0 dependencies · 1 peer
Pi manifest JSON
{
"extensions": [
"./src/bash-guard.ts",
"./src/index.ts"
]
}Security note
Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.
README
Pi DeepSeekX
这是一个面向 Pi 的实验性扩展,用于复现 DeepSeek V4 Flash/Pro 在 minimal harness 中表现出的 轨迹入口,同时提供不改变提示词的中立 Bash Guard。
这是非官方社区项目,与 DeepSeek 及 Pi 项目没有隶属或背书关系。
它不承诺凭空提高模型能力,也不会生成或伪造思维链。实际收益必须通过不同任务上的 A/B 测试确认。
安装与运行
从 npm 安装到 Pi 的用户配置:
pi install npm:pi-deepseekx
pi
从源码安装(直接克隆 GitHub 仓库,可用 @tag 或 @commit 锁定版本):
pi install git:github.com/dashxio/pi-deepseek-minimal-mode
pi
从本地 checkout 开发或运行:
npm install --ignore-scripts
npm run check
pi --no-extensions `
--extension . `
--ds-mode minimal `
--thinking max
传入项目目录 --extension . 时,Pi 会从 package.json 同时加载 prompt mode 和 Bash Guard。
只加载 src/bash-guard.ts 则只启用中立保护,不改变提示词。
Prompt mode
扩展提供三个模式:
| 模式 | 生效范围 | 行为 |
|---|---|---|
off |
无 | 保留 Pi 原始 system prompt 和工具集 |
minimal |
DeepSeek V4 Flash/Pro 的所有 thinking level | 使用固定 minimal prompt,并在首次请求中只暴露 bash/read |
minimal-all |
所有模型 | 对所有模型应用与 minimal 相同的行为 |
minimal prompt 固定为:
You are a helpful software engineer assistant.
第一次工具执行完成后恢复原有工具集。后续模型请求继续使用同一条 minimal system prompt, 不会向 conversation 反复追加提示消息。
交互模式中使用:
/ds-mode
/ds-mode off
/ds-mode minimal
/ds-mode minimal-all
状态栏只显示当前配置,例如:
prompt-mode minimal
不带参数的 /ds-mode 会额外显示当前阶段、模型和工具集。
启动时也可配置:
pi --no-extensions --extension . --ds-mode minimal --thinking max
或使用环境变量:
$env:PI_DS_MODE = 'minimal' # off | minimal | minimal-all
pi --no-extensions --extension . --thinking max
Bash Guard
Bash Guard 是独立的中立扩展,不修改 system prompt。默认配置为:
mode=strict
default timeout=300s
maximum timeout=900s
| Guard 模式 | 自动补/cap timeout | 阻止宽泛系统目录递归搜索 |
|---|---|---|
off |
否 | 否 |
timeout |
是 | 否 |
strict |
是 | 是 |
strict 会阻止 grep -R、rg、find、ls -R 以 /、/proc、/sys、/dev
为搜索根,但不会因为 2>/dev/null、cat /proc/cpuinfo 或搜索 /app 而误拦截。
交互命令:
/bash-timeout
/bash-timeout 300
/bash-timeout reset
/bash-guard
/bash-guard off
/bash-guard timeout
/bash-guard strict
启动配置:
--bash-guard-mode strict
--bash-default-timeout 300
--bash-max-timeout 900
对应环境变量:
PI_BASH_GUARD_MODE
PI_BASH_DEFAULT_TIMEOUT_SECONDS
PI_BASH_MAX_TIMEOUT_SECONDS
DeepSWE A/B
本项目的 DeepSWE 实验按下列条件对照:
- control:只加载
src/bash-guard.ts; - treatment:加载本包,因此同时启用 Bash Guard 与 prompt mode;
- treatment 默认为
prompt-mode minimal; - 两组固定相同 Pi 版本、模型、thinking level、任务、网络及 Bash Guard 参数。
扩展会把 prompt mode、anchor 转换、timeout 注入/cap 次数和根目录搜索拦截次数写入不参与模型 上下文的 session entry,供评测结果和 transcript 审计。
当前实验结果(2026-08-15)
以下运行均使用 Pi 0.84.2、deepseek/deepseek-v4-pro、thinking level max,
且没有启用长度自动续跑。reward=1 表示 F2P 和 P2P 全部通过;partial 用于
展示未获得二进制奖励时的完成度。
| DeepSWE case | Control:prompt-mode off |
Treatment:prompt-mode minimal |
结果 |
|---|---|---|---|
httpx-streaming-json-iteration |
reward 0;F2P 106/108;P2P 1403/1404;partial 99.80% | reward 1;F2P 108/108;P2P 1404/1404;partial 100% | treatment 通过全部测试 |
koota-entity-snapshot-rollback |
reward 1;F2P 84/84;P2P 47/47;partial 100% | reward 1;F2P 84/84;P2P 47/47;partial 100% | 两组都有一次成功运行;treatment 数据来自重跑 |
etree-xml-diff-patch |
reward 0;F2P 51/52;P2P 15/15;partial 98.51% | reward 1;F2P 52/52;P2P 15/15;partial 100% | treatment 通过全部测试 |
运行成本并未呈现 treatment 稳定更低的趋势:
| Case | Control 墙钟时间 / 工具调用 | Treatment 墙钟时间 / 工具调用 | Control input / cache / output tokens | Treatment input / cache / output tokens |
|---|---|---|---|---|
| HTTPX | 17.2 min / 68 | 29.2 min / 136 | 34,364 / 3,132,672 / 64,693 | 62,684 / 11,712,896 / 91,423 |
| Koota | 29.1 min / 168 | 28.0 min / 161 | 81,048 / 15,037,440 / 97,238 | 100,540 / 14,380,544 / 89,803 |
| etree | 45.8 min / 81 | 48.6 min / 169 | 42,267 / 11,592,832 / 188,413 | 57,887 / 21,523,456 / 163,022 |
HTTPX 是同时启动的成对运行,但使用的是早期 anchor 版本,当时还没有 Bash Guard。
Koota 的首次 treatment 因 AgentTimeoutError 结束(reward 0,partial 35.88%);表中使用的
是之后单独重跑并成功的 treatment,因此 Koota 不是严格的同轮 A/B,也不能把表中的
三个 treatment 成功样本解读为 pass@1 3/3。
etree 是当前配置下的成对运行:两组均使用 Bash Guard strict,主要实验变量为
off 与 minimal。原始 verifier 曾因 Windows CRLF 导致 Linux 下的 tests/test.sh
无法执行;修复换行后,两组都只对已保存的 model.patch 重新评分,没有再调用模型。
Control 唯一未通过的隐藏测试是 MOVE 操作的 DiffOperation.String() 缺少目标路径;
treatment 通过了全部 67 项测试。
这三个 case 是可行性样本,不是具有统计显著性的 benchmark。当前结果说明 minimal mode 在 HTTPX 和 etree 的单次运行中补足了 control 遗漏的隐藏要求,但还需要对每个 condition/case 做至少 3 次独立重复,才能评估稳定胜率。为保持插件发布仓库精简, DeepSWE case、oracle solution、本地 harness、session 和 transcript 均不包含在发布内容中。
已知边界
- Pi 的
bash/readschema 与 DeepSeek Harness 的bash/str_replace_editor并不完全相同; - 当前实验仍是“minimal prompt + 首轮两工具”组合,尚未拆分两个变量的独立贡献;
- minimal prompt 会覆盖 Pi 默认 system prompt,不适合无提示地全局启用;
- Bash Guard 只识别已支持的宽泛递归搜索形式,不是完整 Shell 安全沙箱;
- provider 未返回 reasoning 内容时,扩展无法也不会暴露隐藏推理。
致谢
特别声明:本扩展的灵感与实验依据直接来自 xiaobright/modeltest (LLM 工程维护能力自测套件,V4.1b frozen)及其开发者 xiaobright 的公开研究:
- 该仓库的 DeepSeek V4 Pro 专项报告(2026-08-14)首次系统性地把 minimal preset
的高分归因于「首轮 RL 对齐 scaffold」,而非 Linux、官方 harness 或
run_code; - 其触发机制消融实验(system persona、首轮工具目录、动态工具晋升)直接促成了
anchored-standard策略,也就是本扩展minimal模式「首轮只暴露bash/read, 首次工具执行后恢复完整工具集」的实现原型; - 配套的 xiaobright/dsh-anchored-standard 实验 preset 为本扩展提供了直接参照。
衷心感谢 xiaobright 公开上述评测台账、轨迹统计与可复算证据,没有这些工作, 本项目无从成立。