dsh-agent-delegate: Enforcing Delegation Boundaries over DSH Sub-Agents

Foreword

DeepSeek Harness (DSH) can spawn subagents via ctx.subagents to perform parallel or divided tasks. As subagents grow in number, problems such as overly deep delegation chains, overly broad role permissions, multiple write-type children modifying the same workspace simultaneously, and difficulty in reclaiming subtask results by generation may arise. The community plugin dsh-agent-delegate (GitHub: xingyingyuzhui/dsh-agent-delegate) is positioned as the delegation Broker of governance suite Phase 3: it adds a layer of policy and isolation on top of the official subagent capability, and does not provide a control-plane UI. After uninstalling the plugin, it falls back to DSH’s original subagent behavior (as well as other still-installed plugins like dsh-agent-gate).

What This Is

dsh-agent-delegate is released by maintainer xingyingyuzhui under the MIT license. The current package version is 0.2.10, requiring Node >= 20. In one sentence: within the Harness, it counts delegation depth along the real parent chain, narrows child policies by role, limits the number of parallel children, and assigns an independent Git worktree to write-type children. The parent task then merges the patch only after accepting via handoff.

Community directories such as SkillHub may display the same plugin under different slugs; installation and behavior should be based on the GitHub README and repository source code.

Core Features

Delegation Depth and Rejection Policy

The plugin counts delegation depth along the real parent chain. Any subagent call exceeding the configured policy.delegation.maxDepth will be directly rejected, preventing infinite nesting of delegation.

Role and Policy Intersection

Roles can be specified via the role field, [research] tags, or prompts like role: reviewer. The effective policy for a child is parent ∩ role preset; roles not listed in delegation.roles are directly rejected. The README states that developer by default can only spawn research / reviewer.

Concurrency and Handoff Size

By default, at most 4 unfinished children / parallel write tasks are allowed; exceeding delegation.maxChildren will be rejected. Handoffs are truncated to 64KiB by default.

Collecting Results by task + generation

The parent collects subagent results by task + generation. Once a new generation for the same task appears, the old child’s report / return values become invalid, preventing the mixing of stale conclusions.

Child Policy and Sandbox

The child policy = parent ∩ child (the stricter side takes effect). If a write-type child has files.write: all, it receives the workspace context.

For research / reviewer / public (or when sandbox.requireEnforcement: full), when the sandbox reports partial, file operations will be rejected rather than being allowed through as a downgrade.

Write-type Children and Git Worktree

Only write-type children and background write tasks are assigned an independent Git worktree; the main session and foreground bash still write to the project root.

When creating a worktree, the parent workspace’s uncommitted changes and non-ignored untracked files are copied into the worktree. Before the child finishes, the child’s diff relative to the seed commit is written to:

~/.dsh/agent-delegate/handoffs/<id>.patch

with status pending. No automatic merge is performed.

After the parent task accepts it, it calls delegate_handoff, supporting accept / reject / list:

  • accept: runs git apply on the parent repo (with --3way if necessary)
  • If the merge fails, it is marked conflicted, and the parent working tree remains unchanged

Installation and Enablement

For the Web profile, the official installation command is as follows:

dsh plugin --profile web add github:xingyingyuzhui/dsh-agent-delegate

The README recommends also installing dsh-session-permissions and dsh-agent-gate. After installation, restart dsh web.

For local development, you can link a local directory (replace the path with your absolute path):

dsh plugin --profile web add link:/abs/path/to/dsh-agent-delegate

Uninstallation:

dsh plugin --profile web remove dsh-agent-delegate

Typical Usage (Workflow Level)

Below is the usage approach consistent with the README. Specific prompts and policy fields depend on your current DSH configuration.

  1. In the main session, spawn a child via subagent and specify a role as needed (such as research / reviewer), so that the child’s policy takes effect within the intersection of the parent and the role preset.
  2. For children that need to modify files, the plugin executes writes within an independent worktree; the main session continues operating at the project root, reducing parallel write conflicts.
  3. After the child finishes, check the corresponding patch and pending status in ~/.dsh/agent-delegate/handoffs/.
  4. After the parent task reviews the diff, call delegate_handoff: use list to view pending items, accept to merge or reject to discard; if an apply conflict occurs, handle it manually in the parent repo according to the conflicted status.

Through the above steps, delegation depth, roles, and parallel writes are intercepted by the Broker, and merging is explicitly accepted by you rather than being automatically applied to the main tree after the subagent finishes.

Use Cases and Caveats

Who it’s for: Teams or individuals already running development / research / review divisions in DSH Web or multi-subagent workflows who need depth caps, role decay, write isolation, and patch-based merging.

Be sure to note:

  • The plugin runs with the current dsh process permissions; before installing, please read the source code and MIT license of the GitHub repository to confirm that the policy fields and handoff paths meet your security expectations.
  • Community directories (such as the SkillHub plugin page) have no official affiliation with DeepSeek / High-Flyer; the DSH ecosystem emphasizes “everything is a plugin”, and versions and commands are based on the README.
  • After uninstalling this plugin, no more worktrees are created, and no depth/decay-type interception is performed; behavior reverts to DSH’s default subagents (and any other governance plugins still installed).

Conclusion

dsh-agent-delegate adds delegation depth, roles, concurrency budgets, and write worktrees on top of ctx.subagents, and turns merging into a handoff flow that the parent task can control. To install or check for changes, see GitHub: xingyingyuzhui/dsh-agent-delegate; for community indexing, refer to the SkillHub directory entry.

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

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

Xiaoye