Extends dsh-subagent-tools with a per-call cwd for subagents, shipped with the two in-process provider patches it requires.
Install
# from GitHub (first run asks for allowBuilds approval — follow the hint, retry)
dsh plugin --profile web add github:lynx-gt/dsh-subagent-cwd
GitHub-sourced plugins run build scripts on your machine at install time. Only install sources you trust, and pin a commit (github:owner/repo#sha).
README
Enhanced subagent delegation tools for DeepSeek Harness (dsh) with per-call working-directory control.
Everything in dsh-subagent-tools (per-call model / provider /
persona / toolFilter overrides, @preset: references, provider/model composite ids) plus a per-call
cwd parameter — shipped with the two small provider patches that make cwd actually work.
Choose one of the two packages — not both
| Package | Per-call model/provider/persona/toolFilter | @preset: |
cwd |
Patches |
|---|---|---|---|---|
| dsh-subagent-tools | ✅ | ✅ | ❌ | none (bundle only) |
| dsh-subagent-cwd (this) | ✅ | ✅ | ✅ | 2 provider patches |
Install either one. Both expose the same tool surface (subagent / subagent_fork) and colliding
installations would fight over the tool names.
Why cwd needs patches (and the other features don't)
SubagentStartRequest has no cwd field, and the in-process drive layer builds child session meta purely
from childSessionMeta(parent, ...) — a per-call cwd is never forwarded. Two code paths create in-process
children, and both must be patched or you hit the classic trap where the foreground path honors cwd
while the background path silently ignores it:
| Path | Package to patch | File |
|---|---|---|
| Foreground (one-shot) | @deepseek-ai/dsh-subagent-in-process-driver |
lib/index.js |
| Background (continuable) | @deepseek-ai/dsh-subagent |
lib/index.js (the BUNDLE — not lib/types/continuation.js!) |
The second one is a bundle trap: package.json main/exports point at lib/index.js, which contains an
inline copy of the continuation manager. Patching the source-shaped lib/types/continuation.js has no
effect — always patch and verify the bundle.
Installation
# 1. install the plugin (npm / git / local)
dsh plugin --profile web add dsh-subagent-cwd
# 2. apply the two provider patches (required for `cwd`)
powershell -ExecutionPolicy Bypass -File patches\install.ps1 # Windows
# or: ./patches/install.sh # POSIX
# 3. Web sessions: also run the preset adapter (see below)
powershell -ExecutionPolicy Bypass -File install-preset.ps1 # Windows
# or: ./install-preset.sh # POSIX
Restart dsh --profile web and start a NEW session.
Web sessions need the preset adapter
In the web profile, agent tools are provided by the mounted agent preset
(the default standard preset composes subagent / subagent_fork pointing at
@deepseek-ai/dsh-tool-subagent), not by the host plane — a bundle patch is
invisible to Web sessions. install-preset.ps1 / install-preset.sh copies
standard to $DSH_HOME/.agent-presets/standard-plus, rewrites its delegation
rows to point at this package, and switches the default preset. Presets are read
at session creation, so you must start a NEW session (live sessions cannot
switch). Revert: pick standard in the UI (General > Agent preset) and delete
standard-plus.
headlessand other non-web profiles do not need the preset adapter.
Upgrading dsh
A dsh upgrade rewrites node_modules and wipes both patches. After every upgrade:
# re-run the installer (it is idempotent; it also detects version-mismatched anchors)
powershell -ExecutionPolicy Bypass -File patches\install.ps1
If the installer reports "anchor not found", the target packages changed shape — check for a new dsh-subagent-cwd release or file an issue.
Uninstall
powershell -ExecutionPolicy Bypass -File patches\uninstall.ps1 # Windows
# or: ./patches/uninstall.sh # POSIX
dsh plugin --profile web remove dsh-subagent-cwd
Example
Let a subagent work in a directory without the repo's AGENTS.md injected:
subagent(description="Summarize this file", prompt="...", cwd="D:\\projects\\scratch\\notes")
Design
- The tool surface is a bundle. The shipped
tool-subagent/tool-subagent-forkrows are disabled and replaced by this package's rows; no official package file is modified for the tool surface itself. cwdis the one capability that cannot stay a bundle-only feature.SubagentStartRequesthas no cwd field, so a per-call cwd must be forwarded by the in-process subagent providers. That needs the two small patches (one hunk each) inpatches/— idempotent, backed up on first run, andnode --check-verified. This is the entire reason this package exists separately fromdsh-subagent-tools.- Version contract:
peerDependenciespin the public dsh packages (^0.1.0-rc.6). The patches target the same version; a dsh upgrade rewrites the dsh installation'snode_modulesand wipes both patches — re-runpatches/install.ps1/install.shafter every upgrade (see Upgrading dsh). The bundle itself lives in the profile's ownnode_modulesand survives an upgrade, but a changed public API will makepeerDependenciesrefuse to load.
Verified
Tested against a stock dsh 0.1.0-rc.6 install on Windows (headless + web):
- Everything
dsh-subagent-toolsverifies (per-call model/provider/persona/ toolFilter,@preset:,presetHints) ✅ cwdon the foreground path ✅ — the child'spwdand its sandbox workspace both switch to the requested directorycwdon the continuable (background) path ✅ — background children honor the same directory (the classic "foreground works, background silently ignores cwd" trap does not occur)toolFilterscoping ✅patches/install.ps1andpatches/uninstall.ps1round-trip ✅ (backup, apply,node --check, restore, re-verify)
Limitations
- Patches target rc.6 only. The two patches match exact anchors in the rc.6 bundle; a dsh upgrade invalidates them until re-run (or a new release).
@preset:depends on the local preset layout — same caveat asdsh-subagent-tools.- Web sessions need the preset adapter (
install-preset.ps1) for the same reason asdsh-subagent-tools.
License
MIT
Links
More in this category
liustack/modlens★ 1199
Vision bridge for text-only models: paste an image, get structured JSON evidence (OCR, layout, semantics).
Anionex/dsh-vision-toolkit★ 308
Vision tasks for text-only models: intent-aware image Q&A, long-screenshot OCR, UI reproduction, grounding, and pixel diff.
zhaoolee/notes★ 138
Export DSH conversations as Smartisan Notes-style PNGs, or create and update Markdown notes in a configured account-scoped workspace.
liustack/modsearch★ 85
Web search bridge for text-only agents: ask the web or X, get structured JSON evidence (search, fetch, citations).
Lum1104/dsh-browser★ 80
Chrome sidebar extension that lets DSH operate your browser directly, no vision capabilities required.
taxueseek/argo★ 69
Search built for agents: multilingual coverage across web, academic, code, shopping, finance, news, and encyclopedias.