Introduction

Under DSH’s plugin mechanism, tools like subagent / subagent_fork already support per-call overrides for model, provider, persona, and toolFilter. If you need a specific sub-agent call to run within a designated working directory, dsh-subagent-cwd provides this capability: it adds per-call cwd capabilities on top of dsh-subagent-tools, along with two necessary in-process provider patches.

What is this

dsh-subagent-cwd is a DSH plugin maintained by lynx-gt, licensed under MIT. It continues to expose the subagent / subagent_fork toolface, supports per-call model / provider / persona / toolFilter overrides, @preset: references, and provider/model composite ids, and adds a new per-call cwd parameter.

Core Features

  • Provides the delegation toolface for subagent / subagent_fork.
  • Supports per-call overrides: model, provider, persona, toolFilter.
  • Supports @preset: references and provider/model composite ids.
  • Adds a per-call cwd parameter to specify the working directory for a specific sub-agent call.
  • cwd requires two provider patches; the plugin includes these two in-process provider patches to enable the per-call cwd to be passed through.

Installation and Enabling

First, install the plugin:

dsh plugin --profile web add dsh-subagent-cwd

Then apply the two provider patches required by cwd. On Windows:

powershell -ExecutionPolicy Bypass -File patches\install.ps1

On POSIX environments:

./patches/install.sh

If running in a Web session, you also need the preset adapter. On Windows:

powershell -ExecutionPolicy Bypass -File install-preset.ps1

On POSIX:

./install-preset.sh

After completion, restart the Web process and start a new session:

dsh --profile web

Once the new session takes effect, the Web session is ready for use. headless and other non-web profiles do not need a preset adapter.

Note: dsh-subagent-tools and dsh-subagent-cwd are mutually exclusive; do not install both. Both expose the same subagent / subagent_fork tool names, and installing both will cause a conflict for the tool names.

Typical Usage

Here is an example:

subagent(description="Summarize this file", prompt="...", cwd="D:\\projects\\scratch\\notes")

The cwd here is a per-call parameter, indicating that this subagent call uses the specified directory. Other verified calling capabilities can still be used, such as model, provider, persona, toolFilter, @preset: references, and provider/model composite ids.

Applicable Scenarios and Notes

Suitable for situations:

  • Need a specific sub-agent call to run in a specified directory.
  • Want to retain model / provider / persona / toolFilter overrides in DSH’s subagent / subagent_fork calls.
  • Using Web profile and willing to create a new session after enabling.

Before installation:

  • The plugin runs with the current DSH process permissions; check the source code and MIT license before installing.
  • Install only one of dsh-subagent-cwd or dsh-subagent-tools, not both.

Upgrade and Patches:

  • dsh upgrades will rewrite node_modules and clear the two provider patches. After upgrading, you need to re-run the installer, for example:
powershell -ExecutionPolicy Bypass -File patches\install.ps1
  • POSIX environments can re-run the corresponding installer after upgrading.

Preset and Persona:

  • Web sessions need a preset adapter; presets are read when the session is created, so you need to start a new session after changing a preset.
  • headless and other non-web profiles do not need a preset adapter.
  • preset related patches are currently only implemented in Windows’s install.ps1; the preset hunks in POSIX install.sh will be added later. On Linux, the preset parameter can be accepted, but it won’t recompose until the patches are applied.
  • Under router-style presets, even with patch v2, the per-call persona may still not enter the system prompt. An optional approach is to use a non-router-style preset, inject role definitions via the message layer, or accept the dynamic persona included with the preset.

Conclusion

The purpose of dsh-subagent-cwd is to combine the delegation capabilities of dsh-subagent-tools with the truly usable per-call cwd, accompanied by the necessary provider patches. GitHub address: https://github.com/lynx-gt/dsh-subagent-cwd. The community directory can be searched by the plugin name dsh-subagent-cwd.