Introduction¶
In the DSH (DeepSeek Harness) plugin ecosystem, the main Agent can easily get stuck in implementation details or lack control over model selection when assigning work. The dsh-agent-lead plugin is designed to solve this problem. It locks the main Agent’s responsibilities to planning, decomposition, dispatch, and acceptance, delegates concrete code-change work to background subagents, and forces the user to select a model during every assignment.
What It Is¶
This is a workflow-type plugin used to build a “lead mode.” The main Agent only supervises and does not directly perform operations such as writing files. All change-related work must be assigned to background subagents through the assign tool. The plugin controls the mode via the /lead command, and every assignment triggers a popup for the user to select the model used by the subagent.
- Maintainer: JunguangJiang
- License: MIT
- Installation location:
~/.dsh/plugins/agent-lead/
Core Features¶
- Role Division: The main Agent is only responsible for understanding, decomposition, dispatch, acceptance, and supervision. Calls to
write/edit/str_replace_editorby the main Agent are rejected and replaced withassign. - Model Selection: The
assigntool has nomodelparameter; the user must manually select the model in the popup. The system provides candidates based on the current main model, frequent usage history, and the configured model list. - Command Control:
/lead: Toggle the lead mode switch./lead off: Force exit from lead mode./lead auto: Enable fully automatic assignment (assigndoes not show a popup and automatically uses the last selected model)./lead manual: Restore manual model selection (assignshows a popup every time).
- Responsibility Scope (
scope): Everyassignmust declarescope(summaryandpaths), serving as the subagent’s “territory contract.” The system supports path overlap warnings to prevent multiple subagents from operating on the same file. - Queue and Status: Supports
manage_queuefor managing pending messages, andlead_statusfor viewing real-time status, territory map, and assignment ledger of all subagents.
Installation and Enablement¶
After the plugin is installed, its files are located in ~/.dsh/plugins/agent-lead/. It is mounted by modifying the insert line in the host configuration file ~/.dsh/cordis.patch.yml, taking effect for all agent presets.
Add the configuration to cordis.patch.yml:
- id: agent-lead
name: '/home/jiangjunguang/.dsh/plugins/agent-lead/index.mjs'
config:
llmProvider: hfai
rulesFile: /home/jiangjunguang/.dsh/captain-rules.md
models:
- id: anthropic/claude-opus-4.6
label: Opus 4.6
description: 强,贵,适合复杂实现与重构
- id: deepseek-v4-flash
label: DeepSeek-V4-Flash
description: 快,便宜,适合批量与机械改动
Typical Usage¶
Basic Commands¶
Enter lead mode and submit a task:
/lead <任务描述>
Switch the mode state:
/lead # 切换开关
/lead off # 强制退出
/lead auto # 开启全自动派活
/lead manual # 恢复手动选模型
Combine with task submission:
/lead auto <任务> # 开启 auto 模式并提交
/lead manual <任务> # 恢复 manual 模式并提交
Tool Calls¶
Assignment: assign is the only way to create a subagent and must declare a scope.
assign({
description: "任务简述",
prompt: "任务详细说明...",
scope: {
summary: "负责数据预处理流水线",
paths: ["src/preprocess/", "tests/preprocess/"]
}
})
Status Check: You must call lead_status before assigning work to check the territory map.
lead_status # 查看所有子 agent 状态
lead_status <id> # 查看特定子 agent
Queue Management: View or operate the pending queue.
manage_queue({
action: "list" // list, clear, remove, replace, push, push_front
})
Override Instruction: Use when you need to interrupt the current work or completely change the direction.
redirect({
subagentId: "xxx",
message: "新指令...",
clearQueue: true,
scope: { ... } // 可选,用于更新职责范围
})
Workflow and Decision Logic¶
Internally, the plugin uses a “simplified work order” process and executes a decision chain before assignment:
- Planning Phase: The Agent surveys the current state, outputs a simplified work order (task name + what to do), and waits for user confirmation.
- Decision Chain (Routing):
- R1 Single Writer: If the files to be modified overlap with the territory of an active subagent, the work must be assigned to that existing agent.
- R2 Rework Returns to Original Owner: If acceptance fails, return the work to the original owner; if it still fails twice, stop the loss and replace the agent.
- R3 Independent Review Requires a New Agent: Review/acceptance tasks cannot be assigned to the original author.
- R4 Same-Domain Continuation Prefers Reuse: Continuations based on completed work should reuse the existing agent and write only incremental changes.
- R5 Independent New Domain Requires a New Agent: If there is no overlap or true parallelism is needed, create a new subagent.
- R6 Contamination Means Retirement: If a subagent is redirected more than twice or goes off track, do not assign new work to it; create a successor.
- Execution Phase: After user confirmation, choose
assign(create new),send_message(append), orredirect(override) based on the decision result. - Acceptance Phase: After a subtask completes, the main Agent reads files and reviews diffs against the acceptance criteria from the issued instruction, then reports the conclusion to the user.
Notes¶
- Human click required for every assignment: This is a design goal; if you do not want to click, use
/lead off. - Only assign resumable background subagents: The plugin has no foreground waiting path and is suitable for background tasks.
- Subagents cannot assign work again: Subagents cannot use
assignto delegate further and must write decisions back to the main Agent. - Data persistence: The assignment ledger is in-memory and is lost after process restart; assignment history is stored in a single file (
usageFile). - Scope overlap: During assignment, the system automatically detects path overlaps to prevent multiple agents from modifying the same file.
Conclusion¶
dsh-agent-lead solves responsibility attribution and resource scheduling problems in complex tasks by enforcing a main Agent supervision mode and a user-involved model selection mechanism. It is suitable for teams that require strict code style, multi-person collaboration, or are sensitive to model cost.