Introduction¶
In DeepSeek Harness (DSH), letting models write code or run commands is usually done via the system prompt: ask first, propose a plan, and wait for the user’s nod before acting. In practice, the model still calls write, starts terminals, and modifies files—soft prompts cannot stop this.
dsh-plan-gate (maintainer male404, category: workflow) implements hard interception: execution-class tools directly reject at the tools/pre-execute layer before approval, returning PLAN_GATE_BLOCKED; plan confirmation goes through the host’s native question card, and the model cannot unilaterally claim “User agreed”. Read-only research operations proceed as normal.
What is this¶
One sentence: in every task round, first clarify genuine ambiguities, then submit a plan, and allow file changes, command execution, computer operations, or content generation only after the user clicks “Approve Execute”.
- Repository: male404/dsh-plan-gate
- Directory Page: SkillHub Plugin Page
- Version in current docs:
1.2.0(package.json), License MIT, Requires Node>=20 - Zero dependencies: Only uses Node built-in modules and DSH injected services
Typical flow:
Model wants to write file → PLAN_GATE_BLOCKED (not approved)
Model calls plan_gate_propose → Pop up plan card, block waiting
User clicks "Approve Execute" → Phase approved → Execution tools allowed
Core Features¶
Hard Gate and True Confirmation¶
| Capability | Description |
|---|---|
| Hard Gate | Execution-class tools are denied when not approved, relying on the system, not the model’s self-discipline |
| True Confirmation | Plan card goes through host’s askQuestion, with a 15-minute timeout fallback |
| Read-only Not Blocked | Reading files, searching web, viewing windows, etc. proceed as usual; research is unaffected |
The workflow works in three layers: soft guidance (systemPrompt.section), hard gate (tools/pre-execute waterfall), and true confirmation (userQuestions.askTimed()). Missing any layer makes it unreliable.
Session state is independent per round:
idle ──plan_gate_propose──> proposed ──┬──「批准执行」──> approved ──new user message──> idle
├──「需要修改」──> clarifying ──> plan_gate_propose
└──「取消」──────> idle
approved is only valid for the current round; the next user message returns to idle. Sub-agents are not root agents and do not block themselves, but they can only be spawned after the main agent’s plan is approved.
Three Tiers of Modes¶
Left dropdown in the dialog: Ask then Do · Off / Detail / Concise, default “Detail”. Tiers are independent per Session.
| Tier | Gate | Plan Form |
|---|---|---|
off Off |
Blocks no actions | — |
detail Detail (default) |
Blocks writing files / starting processes / operating computer | goal summary + goals, steps, files, acceptance criteria, risks, and rollback |
concise Concise |
Same as above | One sentence goal + files list; Concise mode only shortens the display, it does not reduce the number of confirmations |
Git Guardrails¶
When gitMode: block (default), all git write operations in this session are GIT_BLOCKED, regardless of the tier or whether the plan is approved. Read-only operations like git status, git log, and git diff are allowed; write operations like add / commit / push are rejected. For the model to operate git, set gitMode to off in the configuration, or have the user commit manually in the terminal.
Shell Write Intent Interception¶
Default shellMode: guard: after stripping comments from commands, if it does not match the write intent blacklist, it proceeds (e.g., listing directory, reading files, git status). If it matches file write/delete, starting an interpreter, network requests, system settings, etc., it is intercepted. For a strict whitelist, set shellMode: allowlist.
Tools and Questions¶
| Tool | Usage |
|---|---|
plan_gate_propose |
Submit a plan and block waiting for “Approve Execute” |
plan_gate_status |
Check current mode / phase / planTitle |
Clarification questions do not have a dedicated tool; they directly use the host’s ask_user_question (not intercepted by the gate).
Handoff to New Conversation¶
The dialog provides “Handoff New Conversation”: collects workspace facts to generate a handoff markdown, writes it to ~/.dsh/handoffs/handoff-<timestamp>.md, then opens a new session and injects the document into the input box (sessionStorage temporarily caches it, short-time retry write). This facilitates switching sessions in long tasks without losing the context skeleton.
Settings Persistence¶
The settings page “Ask then Do Default Tier” writes to ~/.dsh/plan-gate.json. Priority: this file > cordis.patch.yml’s defaultMode > detail. Only affects new conversations; the left dropdown in the current conversation is independent.
Installation and Activation¶
Prerequisite: DeepSeek Harness (DSH) is installed on the machine.
Method 1: Plugin Manager (Recommended)¶
Plugin Manager → Install bundle → Fill in specs:
github:male404/dsh-plan-gate
The installer will clone the repository and register the plugin according to dsh.bundle.patch in package.json. Pure JS, no build steps. After installation, restart DSH, or disable and re-enable it in the Plugin Manager.
Note: The git source is not version-locked; after project updates, you need to reinstall to get the new code; the directory name is created as the package name @local/plan-gate, which may conflict with previously linked same-name packages.
Method 2: Manual link¶
Suitable when modifying plugin source code: clone to a fixed directory, use link: to point to the local path in the profile’s package.json, run pnpm install then restart. The package name defaults to @local/plan-gate; changing the scope requires changing the name in package.json, the name in cordis.patch.yml, and the module id in client.js all three places.
Method 3: npm¶
If published to npm (and the @local/ prefix has been changed), simply run pnpm add <your-package-name> in the profile directory.
Typical Usage¶
- After installing and restarting, confirm that the “Ask then Do” dropdown appears on the left, defaulting to “Detail”.
- Ask the model to do something that involves writing files; it will first call
plan_gate_propose, popping up a plan card. - After clicking “Approve Execute”, changes begin; clicking “Need Modification” enters clarifying mode and re-proposes; clicking “Cancel” returns to
idle.
When you need to change default behavior, adjust the plugin config in the profile’s cordis.patch.yml, for example:
- insert:
- id: plan-gate
name: dsh-plan-gate
config:
defaultMode: detail # off / detail / concise
shellMode: guard # guard / allowlist
gitMode: block # block / off
readonlyTools: []
guardedTools: []
Non-Node tech stacks can extend parameters like keyFiles and skipDirs for handoff collection (see repository README).
Use Cases and Notes¶
Who is it for
- Development scenarios where you want the agent to show a plan before touching the disk and wait for approval.
- Teams that need to default to prohibiting the model from making git commits/pushes, leaving version control to humans.
- Long sessions that require “Handoff to New Conversation” to bring along directory trees, key file summaries, and recent changes.
Important Notes
- The plugin runs with the permissions of the current DSH process; please read the GitHub source code and the MIT license before installing to evaluate risks yourself.
shellMode: guardis an evidence-based blacklist; intentionally crafting strings to bypass might slip through; for extremely high security needs, useallowlist.- SkillHub and similar are community directories and have no official affiliation with DeepSeek / Hyperbolic. The DSH ecosystem philosophy is “everything is a plugin”; this plugin is a community-maintained workflow extension.
Conclusion¶
dsh-plan-gate turns “clarify, then plan, execute only after approval” from a prompt agreement into tool-layer rejection and native confirmation cards, accompanied by git write operation guardrails and session handoffs. If you are using DSH to build controllable coding agents, you can install github:male404/dsh-plan-gate from the Plugin Manager to try it out.
- Directory Page: https://www.skillhub.cn/plugins/male404/dsh-plan-gate
- GitHub: https://github.com/male404/dsh-plan-gate