Skip to content
Back to search

dsh-deepseek-delegator

SkillWorks with Claude CodeGitHub

全局强制外包与拆单编排规则:将 Antigravity 主模型作为总架构师(大脑),默认主动将任务拆解并通过 dsh-deepseek MCP 的 delegate_parallel / delegate_task 并发外包给 DeepSeek worker 池执行。

Safety scan

A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.

Badge for your README
findsafeskills safety rating

Markdown

[![findsafeskills safety rating](/api/listings/773archer--dsh-deepseek-mcp/badge.svg)](/listings/773archer--dsh-deepseek-mcp)

HTML

<a href="/listings/773archer--dsh-deepseek-mcp"><img src="/api/listings/773archer--dsh-deepseek-mcp/badge.svg" alt="findsafeskills safety rating" /></a>

Install

i

Install instructions from the README

As written by the repo's author. findsafeskills has not verified these steps.

1. Prerequisites

- **Node.js** `>= 18` - **DeepSeek Harness (`@deepseek-ai/dsh`)** installed with an `sdk` profile configured (`~/.dsh/profiles/sdk`).

2. Install Dependencies

git clone https://github.com/773Archer/dsh-deepseek-mcp.git
cd dsh-deepseek-mcp
npm install

3. Register in Google Antigravity (`mcp_config.json`)

Add `dsh-deepseek` to `~/.gemini/config/mcp_config.json` (or `~/.gemini/antigravity/mcp_config.json`):

{
  "mcpServers": {
    "dsh-deepseek": {
      "command": "node",
      "args": ["D:/path/to/dsh-deepseek-mcp/server.mjs"],
      "env": {
        "POOL_MAX": "4",
        "PARALLEL_MAX": "4",
        "DEFAULT_WORKSPACE_CWD": "d:/agy"
      }
    }
  }
}

4. (Required for Auto-Delegation) Install the Global Orchestrator Plugin

In **Google Antigravity 2.0**, loose files in `~/.gemini/config/rules/` are ignored after plugin migration—global rules **must** live inside an enabled plugin (`~/.gemini/config/plugins/<name>/rules/AGENTS.md`).

Install the bundled `dsh-deepseek-delegator` plugin so Antigravity **proactively delegates without waiting to be asked**, **enforces multi-part decomposition via `delegate_parallel`** (`>120` lines or `>=2` modules), and **automatically switches to Multi-Wave Rolling Concurrency** on mega-tasks (`>4` units/maps/scenes, capping each worker turn at `1–2` units and running multiple waves of `delegate_parallel(4)` while reusing `worker-1`..`worker-4` `sessionKey`s to hit 98% KV cache without timing out):

mkdir -p ~/.gemini/config/plugins/dsh-deepseek-delegator/rules
cp plugin.json ~/.gemini/config/plugins/dsh-deepseek-delegator/plugin.json
cp delegate-to-dsh.md ~/.gemini/config/plugins/dsh-deepseek-delegator/rules/AGENTS.md

---

What was scanned

The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.

plugin.json · Manifest · 6 lines
  1. {
  2. "name": "dsh-deepseek-delegator",
  3. "displayName": "DeepSeek 智能拆单外包编排器",
  4. "version": "2.5.0",
  5. "description": "全局强制外包与拆单编排规则:将 Antigravity 主模型作为总架构师(大脑),默认主动将任务拆解并通过 dsh-deepseek MCP 的 delegate_parallel / delegate_task 并发外包给 DeepSeek worker 池执行。"
  6. }
README.md · README · 175 lines
  1. # dsh-deepseek-mcp (v2.5.0)
  2. <p align="center">
  3. <strong>English</strong> | <a href="./README.zh-CN.md">简体中文</a>
  4. </p>
  5. > **Brain (Antigravity / Frontier LLM) × Hands (Persistent DeepSeek Worker Pool)**
  6. > A production-grade **Stdio MCP Server** that turns **DeepSeek Harness (`dsh --profile sdk`)** into a warm, stateful, parallelizable worker pool for **Google Antigravity**, Claude Code, Cursor, and any MCP-compatible host.
  7. [![Version](https://img.shields.io/badge/version-2.5.0-teal.svg)](https://github.com/773Archer/dsh-deepseek-mcp)
  8. [![MCP SDK](https://img.shields.io/badge/MCP_SDK-1.32.2-blue.svg)](https://modelcontextprotocol.io)
  9. [![Backend](https://img.shields.io/badge/Backend-DSH_SDK_JSON--RPC-purple.svg)](https://github.com/773Archer/dsh-deepseek-mcp)
  10. [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](./LICENSE)
  11. ---
  12. ## ✨ Why `dsh-deepseek-mcp`?
  13. Frontier orchestrator models (like Gemini / Claude inside **Google Antigravity**) excel at system architecture, cross-module reasoning, and final integration—but burning their context window and quota on leaf tasks, boilerplate generation, or 40-step tool loops is slow and expensive.
  14. `dsh-deepseek-mcp` implements the **Brain × Worker Shunt Architecture** without any reverse-proxying or ToS hacks:
  15. 1. **🔥 Persistent Warm Session Pool (`sessionKey` + 98%+ KV Cache Hit)**
  16. Backed by DSH's official `dsh --profile sdk` JSON-RPC runtime. Subtasks sharing the same `sessionKey` reuse the exact same warm DeepSeek agent process and memory—achieving **>98% KV Cache hit rates** (¥0.02 / 1M tokens off-peak!). Unrelated tasks use a new key (or omit it) for zero context contamination.
  17. 2. **⚡ True Server-Side Parallel Fan-Out (`delegate_parallel`)**
  18. Dispatch up to 16 independent leaf tasks in a single MCP tool call. Distinct `sessionKey`s execute concurrently across multiple `dsh --profile sdk` workers; identical `sessionKey`s automatically serialize through an `initPromise` + turn mutex lock to share memory safely.
  19. 3. **⏱️ Three-Tier Wall-Clock Anti-Runaway Timer (`15m / 25m / 30m`)**
  20. Tames runaway agent loops with a three-stage ladder:
  21. - **Warn (`warnMs`, default 15 min)**: Injects a live steering nudge via JSON-RPC to start converging.
  22. - **Force Wrap-Up (`forceMs`, default 25 min)**: Commands the worker to stop all new tool calls immediately and output its final summary.
  23. - **Hard Timeout (`timeoutMs`, default 30 min)**: Terminates the worker and its entire Windows/POSIX subprocess tree (`taskkill /T /F`), returning `timedOut: true`.
  24. 4. **🚀 `pureText` Fast Generation Mode & Configurable `reasoningEffort`**
  25. Set `pureText: true` for pure code/SVG/text generation tasks to forbid the worker from running unnecessary local shell/browser self-verification loops—cutting latency from 10+ minutes to ~30 seconds. Supports per-call `reasoningEffort` (`low` | `high` | `max`).
  26. 5. **💰 Real-Time Token & Cost Accounting (`usage` / `batchUsage`)**
  27. Intercepts live `assistant/message` token meter events from the DSH SDK stream and returns exact `uncachedInputTokens`, `cacheReadTokens`, `outputTokens`, automatic Beijing Peak/Off-Peak detection (`isOffPeak`), and real-time RMB cost (`estimatedCostCNY`).
  28. ---
  29. ## 🏗️ Architecture
  30. ```text
  31. User Request
  32. │
  33. ▼
  34. Google Antigravity / Orchestrator LLM ("The Brain")
  35. ├─ Global Rule (`delegate-to-dsh.md`): Triage complexity
  36. │ ├─ Simple / Leaf Task ──────► `delegate_task(tier: "flash")`
  37. │ └─ Complex Architecture ────► Brain designs contract & decomposes
  38. │ ├─► `delegate_parallel(tasks: [...], maxConcurrency: 4)`
  39. │ └─► Brain integrates, verifies & delivers
  40. ▼
  41. MCP Server: `dsh-deepseek-mcp` (Stdio JSON-RPC)
  42. ├─ Race-free LRU Session Pool (`POOL_MAX=4`, `POOL_TTL=30m`, `MAX_TURNS=40`)
  43. ├─ Windows Path Normalization (`D:\agy` === `d:/agy`)
  44. ├─ 3-Tier Timer Ladder (`warnMs` -> `forceMs` -> `timeoutMs` + Process Tree Kill)
  45. └─ Real-Time Stream Token & RMB Cost Meter
  46. ▼
  47. Persistent `dsh --profile sdk` Worker Processes
  48. ├─ `flash` tier: `auto/deepseek-v4.1-flash`
  49. └─ `max` tier: `trae-cn/deepseek-v4.1-flash-max` (1M Context)
  50. ```
  51. ---
  52. ## 🛠️ Exposed MCP Tools
  53. | Tool Name | Description |
  54. | :--- | :--- |
  55. | **`delegate_task`** | Delegate a single task to a DeepSeek worker. Supports `task`, `cwd`, `context`, `sessionKey`, `tier` (`flash`\|`max`), `pureText` (`boolean`), `reasoningEffort` (`low`\|`high`\|`max`), `fresh`, `warnMs`, `forceMs`, `timeoutMs`. Returns full `answer`, `toolCalls`, `elapsedMs`, `usage`, and `sessionUsage`. |
  56. | **`delegate_parallel`** | Fan out an array of `tasks` concurrently on the server (`maxConcurrency` default 4, max 16). Returns ordered per-task results (`answer` untruncated) plus aggregated `batchUsage` token & RMB cost summary. |
  57. | **`pool_status`** | Inspect active warm sessions in the pool (`key`, `sessionId`, `turns`, `busy`, `idleMs`, and cumulative `sessionUsage`). |
  58. | **`worker_info`** | Inspect server version (`2.5.0`), tier model mappings, timer defaults, and pool status. |
  59. | **`reset_session`** | Evict and kill the process tree for a specific `sessionKey` (or clear the entire pool if omitted). |
  60. | **`echo`** | Quick connectivity health check. |
  61. ---
  62. ## 🚀 Quick Start
  63. ### 1. Prerequisites
  64. - **Node.js** `>= 18`
  65. - **DeepSeek Harness (`@deepseek-ai/dsh`)** installed with an `sdk` profile configured (`~/.dsh/profiles/sdk`).
  66. ### 2. Install Dependencies
  67. ```bash
  68. git clone https://github.com/773Archer/dsh-deepseek-mcp.git
  69. cd dsh-deepseek-mcp
  70. npm install
  71. ```
  72. ### 3. Register in Google Antigravity (`mcp_config.json`)
  73. Add `dsh-deepseek` to `~/.gemini/config/mcp_config.json` (or `~/.gemini/antigravity/mcp_config.json`):
  74. ```json
  75. {
  76. "mcpServers": {
  77. "dsh-deepseek": {
  78. "command": "node",
  79. "args": ["D:/path/to/dsh-deepseek-mcp/server.mjs"],
  80. "env": {
  81. "POOL_MAX": "4",
  82. "PARALLEL_MAX": "4",
  83. "DEFAULT_WORKSPACE_CWD": "d:/agy"
  84. }
  85. }
  86. }
  87. }
  88. ```
  89. ### 4. (Required for Auto-Delegation) Install the Global Orchestrator Plugin
  90. In **Google Antigravity 2.0**, loose files in `~/.gemini/config/rules/` are ignored after plugin migration—global rules **must** live inside an enabled plugin (`~/.gemini/config/plugins/<name>/rules/AGENTS.md`).
  91. Install the bundled `dsh-deepseek-delegator` plugin so Antigravity **proactively delegates without waiting to be asked**, **enforces multi-part decomposition via `delegate_parallel`** (`>120` lines or `>=2` modules), and **automatically switches to Multi-Wave Rolling Concurrency** on mega-tasks (`>4` units/maps/scenes, capping each worker turn at `1–2` units and running multiple waves of `delegate_parallel(4)` while reusing `worker-1`..`worker-4` `sessionKey`s to hit 98% KV cache without timing out):
  92. ```bash
  93. mkdir -p ~/.gemini/config/plugins/dsh-deepseek-delegator/rules
  94. cp plugin.json ~/.gemini/config/plugins/dsh-deepseek-delegator/plugin.json
  95. cp delegate-to-dsh.md ~/.gemini/config/plugins/dsh-deepseek-delegator/rules/AGENTS.md
  96. ```
  97. ---
  98. ## 🧪 Real-World Benchmark: 245 KB Single-File SVG Animation
  99. In a live benchmark orchestrating a **245 KB multi-country picture-in-picture SVG animation** (*"Pelican cycling around the world inside hanging Polaroid photos with dynamic camera tracking"*):
  100. - **4 specialized DeepSeek workers** ran in parallel (`svg-pelican-hero`, `svg-photo-1-2`, `svg-photo-3-4`, `svg-frames-studio`).
  101. - **Total Token Throughput**: **6,413,000 Tokens** (`100,537` uncached input + `5,869,824` KV cache read + `442,639` output & reasoning tokens).
  102. - **KV Cache Hit Rate**: **`98.32%`**
  103. - **Total Official API Cost (Off-Peak)**: **¥1.99 CNY (~$0.27 USD)**!
  104. ---
  105. ## ✅ Built-In Verification Suite
  106. Run the included self-tests and E2E suites to verify your local DSH SDK runtime:
  107. ```bash
  108. # 1. Warm session memory reuse & token meter self-test
  109. npm run selftest
  110. # 2. Hard wall-clock timeout self-test (scaled to 1.2s)
  111. npm run test:timeout
  112. # 3. 3-tier timer ladder self-test (3s warn -> 6s force -> 25s cap)
  113. npm run test:ladder
  114. # 4. Full MCP stdio E2E suites
  115. npm run test:e2e
  116. npm run test:reuse
  117. npm run test:parallel
  118. ```
  119. ---
  120. ## ⚙️ Environment Variables
  121. | Variable | Default | Description |
  122. | :--- | :--- | :--- |
  123. | `DSH_NODE` | `process.execPath` | Path to Node.js binary used to spawn `dsh` |
  124. | `DSH_BIN` | `~/nodejs/node_modules/@deepseek-ai/dsh/lib/bin.js` | Path to `@deepseek-ai/dsh/lib/bin.js` |
  125. | `DSH_WORKER_PROFILE` | `sdk` | DSH profile name |
  126. | `DEFAULT_WORKSPACE_CWD` | `d:\agy` or `process.cwd()` | Safe fallback workspace when `cwd` is omitted |
  127. | `PARALLEL_MAX` | `4` | Default concurrency for `delegate_parallel` (1–16) |
  128. | `POOL_MAX` | `max(4, PARALLEL_MAX)` | Maximum warm sessions retained in the LRU pool |
  129. | `POOL_TTL_MS` | `1800000` (30 min) | Idle session TTL before automatic eviction |
  130. | `MAX_TURNS` | `40` | Maximum turns per session before automatic recycle |
  131. | `DELEGATE_WARN_MS` | `900000` (15 min) | Tier-1 gentle convergence reminder threshold |
  132. | `DELEGATE_FORCE_MS` | `1500000` (25 min) | Tier-2 forced wrap-up threshold |
  133. | `DELEGATE_TIMEOUT_MS` | `1800000` (30 min) | Tier-3 hard kill timeout threshold |
  134. ---
  135. ## 📄 License
  136. MIT

Version history

  • v2.5.011/22/2026

Ratings and comments

Sign in to rate this skill.

Sign in

Free to use. If it’s helped, pass it on.