dsh-wsl-first: Prioritizing WSL for Command Execution in DSH on Windows

Preface

When using DeepSeek Harness (DSH) on Windows, the command-execution tool that the model receives by default is often pwsh. If WSL is already installed on the machine, this default ordering imposes extra costs: the model is more accustomed to writing bash and POSIX pipelines, and when forced into PowerShell, quoting, path, and pipeline semantics are easily mangled, so a single failure triggers another round of retries that burn tokens. The output format is also inconsistent — Linux commands are mostly compact plain text, while PowerShell defaults often carry tables and object properties, so the same information occupies a longer context window.

The following introduces the community plugin dsh-wsl-first (maintained by yishuiliufang), categorized as a workflow. It does not add any tools, nor does it disable any tools; it merely inserts a configurable “Shell routing” section into the system prompt, guiding the model to prefer calling wsl first and to fall back to pwsh when Windows-native capabilities are needed. The DSH ecosystem is “everything is a plugin”; the plugin directory site SkillHub is independently maintained by the community and has no official affiliation with DeepSeek / High-Flyer.

What Is This

dsh-wsl-first is a configurable router built on the systemPrompt service: it appends a “prefer wsl for command execution” section to the system prompt, changing the default selection order rather than replacing or hiding pwsh. The routing text only lists executors that are registered in the current profile; uninstalled tools never appear in the prompt, avoiding the model being instructed to call tools that do not exist.

The plugin itself registers no tools; the routing targets are provided by other plugins. Without dsh-wsl-tool, there is no wsl to prefer, and the corresponding section renders empty.

Core Features

  1. WSL first: the default preferred is wsl, and discouraged contains pwsh; the model is guided to run bash on the Linux side first.
  2. Keep a Windows escape hatch: pwsh remains in the tool list, only as a last resort when “Windows-native capabilities are genuinely required.”
  3. Configurable order: the preferred executor can be changed to bash, or only wsl can be advertised, with the alternatives and discouraged lists cleared.
  4. Dynamic tool table: the task-tool table inside the section is generated from the currently registered tools; for example, if the profile does not register bash, no bash row appears in the rendered output.
  5. Process-level patch: the package ships with cordis.patch.yml, which, once mounted via the profile’s bundle, carries this prompt section across agent presets without each one needing to declare it separately.

Environment and Dependencies

Item Requirement
DSH >=0.1.7-rc.2 (engines.dsh in package.json)
Service systemPrompt (bundled with the standard profile)
Dependency plugin dsh-wsl-tool (provides wsl / wsl-path / wsl-env / wsl-doctor)
WSL WSL2, at least one registered distribution, wsl.exe on PATH
Platform The routing logic is platform-independent; the primary motivating scenario is Windows

Installation and Activation

First install the package with npm (consistent with the README; do not stitch together other install commands yourself):

npm install dsh-wsl-first

In the profile’s package.json, add the bundle to dsh.profile.bundles:

{
  "dsh": {
    "profile": {
      "bundles": ["...", "dsh-wsl-first"]
    }
  }
}

The bundle loads its bundled cordis.patch.yml and inserts the routing lines process-wide. After modifying the bundle, DSH must be restarted (or the profile restarted); the loader reads the composition at startup.

If the wsl tool is not yet installed, install the dependency plugin first:

npm install dsh-wsl-tool

Version compatibility note: This plugin declares no @deepseek-ai/* peer dependencies. DSH performs a compatibility check on bundles at startup; if a peer range does not match the running version, the entire bundle may be skipped, manifesting as “installed but no effect.” If it stops working after upgrading to a major DSH version, look for skipping profile bundle in stderr and confirm that engines.dsh still covers the current version.

The plugin runs with the permissions of the current DSH process; before installing, it is recommended to read the GitHub repository source and the MIT license (current package.json version 0.1.0).

Configuration

Fields can be written in the profile patch (- id: wsl-first-routing / config:) or in environment variables. Priority: inline config > environment variable > built-in default.

Field Default Environment variable Meaning
preferred wsl DSH_WSL_FIRST_PREFERRED Preferred executor
alternatives ['bash'] DSH_WSL_FIRST_ALTERNATIVES Tried after the preferred one (comma-separated)
discouraged ['pwsh'] DSH_WSL_FIRST_DISCOURAGED Pushed to the end (comma-separated)
promptPolicy true — Whether to publish this section
sectionOrder 3260 — Section ordering
sectionName dsh-wsl-first:shell-routing — Stable section name
extraGuidance '' — Extra guidance appended to the section
labels built-in — Tool and task description table
requirePreferred false — Publish only when preferred is visible

Only WSL, no alternatives (in environments without wsl installed, the entire section does not appear):

- id: wsl-first-routing
  config:
    preferred: wsl
    alternatives: []
    discouraged: []

Change the preferred executor to bash (the plugin is essentially a generic executor router; wsl is just the default):

- id: wsl-first-routing
  config:
    preferred: bash
    alternatives: []
    discouraged: []

Configuration constraints: the same tool cannot appear in both preferred/alternatives and discouraged, otherwise an error is thrown; if preferred also appears in alternatives, it is de-duplicated.

Effect in the System Prompt

Once enabled, a section similar to the one below is inserted into the system prompt (the actual content varies with the registered tools; the example below comes from a live-session read-back in the README, and because that profile does not register bash, there is no bash row):

# Shell routing: wsl first

**For every command execution, call `wsl` as the first and default tool.**

| Task | Tool |
| --- | --- |
| Any command, build, git, pipeline, script, file listing, search | `wsl` |
| Windows-native only: registry, services, COM, cmdlets with no Linux equivalent | `pwsh` (last resort) |

## Rules

- `wsl` is the primary command executor. Reach for it first, every time.
- Use `pwsh` **only** when the task genuinely requires functionality no other available tool provides — and say why in the same reply.
- Never use `pwsh` merely because it appears first in a tool list, and never as a fallback when a `wsl` command fails: fix the command and retry there.
- Do not mix shell syntaxes. A `wsl` call contains the syntax of the shell that tool runs; each executor has its own quoting and path rules.
- `wsl` paths are Linux paths (`/mnt/c/...`). Windows paths in `command`/`workdir` are translated automatically; pass `translatePaths: false` to hand a native path to a Windows program.

dsh-wsl-tool handles the C:\... to /mnt/c/... path translation on the wsl side, so in most scenarios the model does not need to convert manually.

Use Cases and Caveats

Suitable for: Windows with WSL2 and dsh-wsl-tool installed, where you want the agent to run git, builds, pipelines, and common CLIs in the Linux environment by default, reducing PowerShell syntax friction and retries.

Not suitable for, or requires extra preparation: environments without WSL or without dsh-wsl-tool installed — the routing section is empty or cannot point to wsl.

Known issue (does not affect runtime logic): When toggling this plugin on or off in the plugin manager, you may see “Deactivation failed: dsh: profile reload requires the root Include entry” or “Activation failed: dsh: warning: 1 entry did not activate.” The routing section still takes effect; after restarting DSH, the toggle state and the prompt return to normal according to the startup load. Directly editing the profile’s cordis.patch.yml while running may strip tools from the live session; after making changes, restart instead of relying on hot reload.

If you want to hard-remove pwsh (rather than merely routing), you need to disable the corresponding sandbox line yourself in the profile patch (e.g. - id: pwsh-sandbox / disabled: true, subject to the real id in the loader tree) — this is a different level of choice from this plugin’s design of “only changing the default order, not hiding tools.”

Conclusion

dsh-wsl-first uses a dynamically generated system-prompt section to move the default command-execution order from pwsh to wsl, letting the model work with more natural bash habits without depriving it of Windows-native capabilities. See the SkillHub plugin page for the directory and details, and GitHub: yishuiliufang/dsh-wsl-first for the source and full documentation.

羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye