← Catalog

pi-dsh-optimizer

The official dsh `minimal` first request for pi. DeepSeek was post-trained on a minimal harness, so the first request carries only the dsh minimal persona and its two tools (bash, str_replace_editor); afterwards pi's full prompt returns wi…

Extension

Install

Install with PiG

pig install npm:pi-dsh-optimizer

Install with Pi

pi install npm:pi-dsh-optimizer
Review before installing

Packages run code with your permissions and influence agent behavior. Catalog inclusion is not a security audit. Review the source before installing a third-party package.

Pi manifest JSON

The pi field of package.json.

{
  "extensions": [
    "./src/index.ts"
  ]
}

README

Written by the package's publisher, shown as published in version 0.4.0 (README.md). PiG does not review it.

pi-dsh-optimizer

The official dsh minimal first request for pi — plus a chain-of-thought style that stops the "let me…" loop.

DeepSeek's models don't underperform in pi because pi is weak. They underperform because pi hands them a prompt they were never trained on.

This extension gives the model the opening it was trained on — the official minimal surface, verbatim — then hands everything back.

pi extension · zero config · DeepSeek-only by default · 52 tests


The 33-point evidence

Same model. Same benchmark. Different wrapper.

ScoreHarness
87.9official DeepSeek Harness
54.68Terminus 2 (third-party rerun)

DeepSeek V4 Pro (0813) on Terminal-Bench 2.1. A 33-point swing that started out as a "did DeepSeek cheat" fight and ended as something far more useful: proof that an agent score without its harness is a number without units.

Then the part that kills the easy explanation. The same spread shows up inside DeepSeek Harness, across its own presets:

PresetScore
minimal — 2 tools99 / 96
standard91
PTC (code)92

If V4 Pro had simply memorised "its own house", those three numbers would agree. They don't. The variable is the starting prompt and the tool schema — the model behaves best when the harness looks like the one it was post-trained against.

And the experiment that makes this extension inevitable:

Start a session with minimal mode's prompt and its two tools. After the very first tool call, restore the full 25-tool set and let the run continue normally. The score barely moves: 98 / 99.

What the model does in the first turn matters far more than what tools are nominally available for the rest of the session.

That is the whole idea. This extension is that experiment, applied to pi, automatically.


What it does

The first request of a session is rewritten into the official dsh minimal surface.

(blank)First requestFrom the next turn on
System promptYou are a helpful software engineer assistant. — 46 chars, verbatimpi's full prompt
Toolsbash + str_replace_editorpi's whole catalogue
Pi's prompt sectionsnone of themall of them
Thinking stylemodel defaultyour choice (default: the we need to… block)

Then it gets out of the way. The moment the session has produced a real turn, the anchor is released — permanently. A released session stays released across compaction, --continue, and forks. No state to store, nothing to switch off, nothing to lose.

Nothing else about pi changes. Your session files, pi's tool registry, and the UI are untouched: only the request that leaves pi is rewritten.


The other problem: the "Let me…" loop

Reasoning models loop. It is a well-documented failure mode: overthinking has its own research literature, and "keep thinking steps minimal" is standard advice for thinking models.

DeepSeek's traces have a signature version of it — narration instead of action:

Let me… Let me check… Let me think about that… Let me…

Same plan, restated, again and again, while nothing moves.

So the release step also swaps pi's official identity sentence for a short, strict we need to… block: every step is a concrete action, first-person plural, one step per sentence, with modals (I'll · I can · I should · I will) carrying the next move. Decisions only — no commentary, no restating.

In practice: shorter thinking, fewer restarts, less filler before the first tool call.

Tune it or delete it — /dsh-optimizer

Menu itemWhat it does
textreplace the identity with your own block
modereplace (default) · remove (drop the identity sentence, add nothing) · keep (leave pi's wording alone)
previewread the exact released prompt before you commit
reset / pathback to defaults / open the config file

Install

pi install npm:pi-dsh-optimizer

Restart pi. Done. No model to declare, no provider to configure — DeepSeek is matched out of the box, every other model is left completely untouched, and the first request of each session is anchored.


Features

  • Anchored opening — the dsh minimal persona and its two official tools, verbatim, on the request that actually reaches the model.
  • Automatic, sticky release — pi's full prompt and tool catalogue return after the session's first real turn, and stay returned.
  • Swappable thinking style — we need to… by default, three modes, live preview.
  • Ships the official str_replace_editor — the same two-tool surface dsh minimal uses, so the anchor isn't a bluff.
  • DSML bridge — when the model leaks a tool call as text instead of calling it, the call still runs. Zero config.
  • Auditable — PI_DSH_OPTIMIZER_DUMP=1 writes the real outgoing request to disk, so you can verify the anchor yourself.
  • Non-destructive — nothing is patched, patched back, or left in a modified state. The anchor is a property of one request, not of your session.
  • DeepSeek-only by default — the models whitelist decides. DeepSeek matches case-insensitively (*deepseek*, and the provider counts too); every other model is left completely untouched. "models": [] hands the plugin back to all of them.

Commands & config

ThingWhat it does
/dsh-optimizermenu: thinking style, mode, preview, reset, path
pi_dsh_statustool — prints phase=, model=, active=, models=, surface=, tools=
PI_DSH_OPTIMIZER_DUMP=1dump outgoing requests for verification
~/.pi/agent/pi-dsh-optimizer.json{ "mode": "replace", "text": "…", "models": ["*deepseek*"] }

There is deliberately no enabled flag: the models whitelist is the switch, and it is case-insensitive. A model outside it is left completely alone — pi's prompt goes out untouched and the tool catalog is never narrowed — and "models": [] (or ["*"]) hands the plugin back to every model. A second switch on top of that would just be one more thing to get out of sync with reality.


FAQ

Does this only work with DeepSeek? No. The preset it ports is what DeepSeek's agent training distribution looks like, so DeepSeek gains the most. Every other model just gets a leaner first request.

Do I lose pi's rules, skills, and project context? For the first request only — that is the point. They return from the next turn on.

Is it slow? It does less work than pi's normal path: 46 characters of prompt and two tool schemas instead of tens of kilobytes of prompt and dozens of schemas.

Is the anchored request really the official one? Yes — the persona string and both tool schemas are copied from the official minimal preset. Turn on the dump and diff it.

I use standard / PTC mode in DSH. What then? This extension ports the minimal opening specifically. That is the one the numbers favour.

Does it help prompt caching? It gives DeepSeek's prefix cache the shape it likes: a tiny, stable opening and a stable released prefix. It is not a caching feature.

Will it fight my other extensions? It does not patch pi's prompt, so it does not. One caveat: it registers a tool named str_replace_editor, which is the official name — if another extension registers the same name, pi keeps one and silently drops the other.


Compatibility

(blank)(blank)
pi@earendil-works/pi-coding-agent
Modelsany — DeepSeek V4 Pro / V4 Flash / V4.1 gain the most
Related setupsDeepSeek Harness (DSH), the DSH minimal preset, pi + DeepSeek

Honest caveats

  • The 33-point gap and the 99 / 91 / 92 preset spread are community reports, not an official DeepSeek statement. Sources below — read them rather than trusting this README.
  • The first-turn anchoring experiment was run inside DSH. This extension ports it to pi, so your numbers will differ.
  • The we need to… block is a prompt-style intervention. It changes how reasoning reads and tends to shorten it; it is not a switch that guarantees a shorter trace.
  • The DSML bridge is small and has no dedicated test coverage. If it meets a leaked call it cannot parse, it leaves your stream untouched.

Sources & credits


Changelog

VersionWhat changed
0.4.0Model whitelist — DeepSeek-only by default, case-insensitive; every other model is left completely untouched. The bootstrap surface is re-aligned with the Web app's Minimal preset: bash description, the editor's null-placeholder bullet, and oneOf [X, null] parameter schemas
0.3.0First-request anchoring with automatic sticky release, thinking-style modes + preview, DSML bridge, the official str_replace_editor, request dump
0.2.xFirst public releases: minimal persona and the two-tool surface

License

MIT.