Skip to main content

deepseek-harness-desktop/packages/dsh-liangshen

156Stars5Forks6Issues0Watchers

Install the "Liang Shen Mode" two-stage anchoring agent preset for DSH: the first round exposes the Minimal dual-tool guidance trajectory, and after anchoring, switch to PTC Mode to unlock all capabilities.

Evidence5/5methodologySourceInstallMaintenanceDSH versionSecurity scan
Machine-auditedInstall commandRepo verifieddsh-plugin topicLicenseREADMEAI wiki

ⓘ This plugin is a sub-package of the ningbainb/deepseek-harness-desktop monorepo — stars and activity count the whole repository.

Language
TypeScript
License
BSD-3-Clause
Branch
main
ai-agentai-coding-assistantcodexdeepseekdeepseek-harnessdesktop-appdshdsh-plugin

Install

cmdweb profile
$ dsh plugin --profile web add @linxin666/dsh-liangshen

Run the command above in your terminal to install this plugin via the dsh CLI. You can switch Profile in the top-right corner. New to dsh? Read the beginner tutorial

Install via your agent

Install the DeepSeek Harness plugin ningbainb/deepseek-harness-desktop/packages/dsh-liangshen for me: review the repository at https://github.com/ningbainb/deepseek-harness-desktop first, then run the install command and verify the plugin loads successfully.

Paste this instruction to the DSH Web GUI assistant — it will install and verify for you.

One-Line Description

Turn the community experiment's "Anchored Standard" approach into a DSH one-click install plugin: when the host process starts, synchronize the built-in "Liangshen Mode" preset to ~/.dsh/.agent-presets, and select "Liangshen Mode" in the preset selector when creating a new session to enable it. The first round of the session only exposes the official Minimal preset's two tools (persistent bash + str_replace_editor) and a single persona line, anchoring the model's execution trajectory to Minimal; after the anchor is established, automatically switch to PTC Mode (single run_code tool), restoring full tool capabilities, with no manual configuration required throughout.

Core Features

  • Synchronize the built-in "Liangshen Mode" preset to the host directory (~/.dsh/.agent-presets/liangshen), directly selectable in the preset selector when creating a new sessions; after plugin upgrades, a full restart automatically updates the preset files
  • First round requests only expose the Minimal precise two tools (persistent bash + str_replace_editor) with a single persona, clear the runtime context and only allow user messages through, anchoring the model's execution trajectory to Minimal
  • After the first tool/call, switch to PTC Mode through a gate (first reasoning block contains we and no let me, or four-step fallback / automatic promotion after first round tool-less response): single run_code tool, full tool registry invoked via generated SDK
  • After promotion, restore all prompt sections (including plan:policy for plan mode), append the selected workspace path to the persona end, with workspace instructions and skill directory injected one step deferred to avoid landing in the same frame as directory switching
  • Declare the plugin's existence, working principles, and limitations to the model through a system-prompt section (enabled by default), enabling the model to cooperate when users mention "Liangshen Mode / Anchored Mode / Anchored Standard"
  • Comes with tools/analyze-session.mjs offline analyzer, which can measure session trajectory markers (we / let me / let's / I) and promotion boundaries without reading raw reasoning

Technical Implementation

  • Language: TypeScript (host side) + JavaScript / .mjs (runtime logic in presets)
  • Key Dependencies: @deepseek-ai/cordis (cordis plugin runtime), @deepseek-ai/dsh-system-prompt (prompt section registration), schemastery (Config schema validation)
  • Architecture Pattern: cordis bundle package (host half single instance mount, no browser half); register the declaration segment via inject: ['systemPrompt'] after waiting for prompt assembly; preset mounted as presets/liangshen/agent.cordis.yml into host .agent-preset directory, parsed by host preset loader; two-phase core logic in preset's tool-bootstrap.mjs, implementing tool registry trimming, message whitelist, and promotion judgment through system-prompt/assemble / agent/pre-step hooks and session/event listeners
  • Entry Files: src/index.ts (cordis plugin host entry) + presets/liangshen/agent.cordis.yml (preset manifest) + presets/liangshen/tool-bootstrap.mjs (two-phase anchoring core logic)

Use Cases

For regular and advanced users who want to stably reproduce the trajectory pattern "first round answers in Minimal style, then unlocks full capabilities" on DeepSeek V4 Pro. When standard presets or PTC Mode don't perform well on first-round tasks, and you don't want to stay in the Minimal state with only two tools long-term, this plugin provides an intermediate path: first round precisely aligns with Minimal's byte-level surface to stabilize the trajectory, and after anchor is established, automatically returns to PTC Mode's full capabilities. The original experiment achieved 98 / 99 (average 98.5) on community benchmarks (DeepSeek V4 Pro, max, V4.1b questions), with no let me traces in the second round.

Prerequisites and Compatibility

DependencyMin VersionDescription
DSH0.1.0-rc.5+Requires preset mechanism and system-prompt/assemble hook; devDependencies locks @deepseek-ai/dsh-system-prompt@^0.1.0-rc.7 (README.md:74 / package.json:39)
Node.js^22.19.0 or >=24.0.0From package.json engines (package.json:7-9)
PlatformmacOS / Linux / WindowsPreset uses persistent PTY shell (@deepseek-ai/dsh-tool-bash-persistent) as phase-1 bash; agent.cordis.yml has no explicit Windows fallback (presets/liangshen/agent.cordis.yml:84-115)
Native ModulesNoneOnly uses built-in modules like node:fs / node:path / node:os / node:url

Installation

dsh plugin --profile web add github:ningbainb/deepseek-harness-desktop/packages/dsh-liangshen

Configuration Options

Plugin host-level switches (written to host agent.cordis.yml liangshen row config section):

ConfigTypeDescriptionDefault
enabledBooleanMaster switch; when disabled, neither syncs presets nor declares plugin existence to the modeltrue
announceToAgentBooleanWhether to register a system-prompt section declaring the plugin's working principles and limitations to the model; when disabled, the model won't know this plugin existstrue

Adjustable parameters in preset's tool-bootstrap section (requires host restart after modification):

ConfigTypeDescriptionDefault
shellToolsString ArrayPersistent shell tool names exposed in phase-1[bash]
commonToolsString ArrayAnother persistent tool exposed in phase-1[str_replace_editor]
messageSourcesString ArrayMessage sources allowed in phase-1[user]
anchorGateBooleanWhether to wait for first minimal-like reasoning block before promoting after first tool/calltrue
maxBootstrapStepsNumberFallback promotion steps when anchor gate fails4
promoteAfterFirstResponseBooleanPromotes immediately after first round response with no tool calls; anchor gate sessions also release at first round turn/endtrue
deferredSourcesString ArrayMessage sources deferred for injection after promotion[agent-instructions, skill-catalog]
deferredGraceStepsNumberSteps to defer injection of above sources after promotion1
promotedPresentationStringPresentation format of tool registry after promotion (code is PTC Mode single run_code)code

Parameters beyond enabled and announceToAgent are already tuned to实测 high-hit windows by default; regular users don't need to adjust them.

FAQ

Q: Is Liangshen Mode the same as the official Minimal preset?

A: No. Minimal only keeps two tools but sacrifices full capabilities; Liangshen Mode is a "two-phase" solution, first round precisely aligns with Minimal's byte-level surface to stabilize execution trajectory, then after anchor is established, automatically switches to PTC Mode (single run_code tool), restoring full tool capabilities.

Q: When does the tool registry change?

A: Only changes once. After the session's first persistent tool/call passes the anchor gate (first reasoning block contains we and no let me, four-step fallback), it switches to PTC Mode; if the first round response doesn't call any tools, it also auto-promotes after the response. The switch happens at step boundary; the current step's native tool calls won't be interrupted.

Q: Do I need any manual configuration after installation?

A: No. The plugin host automatically syncs presets/liangshen to ~/.dsh/.agent-presets on startup, just select "Liangshen Mode" in the preset selector when creating a new session. After upgrading the plugin, a full restart of dsh web automatically refreshes the preset files.

Q: How do I verify the plugin is actually working?

A: Export session JSONL and check request/header: the first header should only contain bash/str_replace_editor (persistent shell + sandboxed editor); the header changed after first tool call should be exactly run_code (PTC). You can also run the repo's built-in node tools/analyze-session.mjs <session.jsonl> to automatically summarize trajectory markers (we / let me / let's / I) and promotion boundaries.

Q: How do I uninstall?

A: Run dsh plugin --profile web remove @linxin666/dsh-liangshen and fully restart dsh web. If the same preset is also mounted via dsh-web-ui-all aggregation package, both will write the same agent.cordis.yml, so you need to remove the other one first to avoid dual-source mount conflict.

Q: Can I switch to this preset mid-session with existing content?

A: Not recommended. The preset works by anchoring the session's first round request trajectory to Minimal; a session with existing content doesn't have a "first round", so the switch may not work as expected.

Q: Does the plugin make network requests or collect telemetry data?

A: No. The README explicitly states the plugin makes no network requests and adds no telemetry.

Getting Started Difficulty

Beginner — After installing the plugin, just select "Liangshen Mode" in the preset selector when creating a new session; no file editing or command-line parameters required.

Known Issues and Limitations

  • Don't switch presets mid-session with existing content: The switch may not work as expected because the plugin works by anchoring the session's first round request trajectory to Minimal (README.md:73).
  • Prefix cache fails once between first and second requests: Because the tool registry only changes once, there's one prefix cache invalidation between the two requests (README.md:70).
  • Presets and shell access have the same trust level: presets/liangshen/agent.cordis.yml will be written by the plugin to host ~/.dsh/.agent-presets/liangshen, registering persistent bash (PTY), str_replace_editor, and other tools; you can review this file before installation (README.md:71).
  • Phase-1 editor inherits host file sandbox: Without mounting bare dsh-fs-local, phase-1's str_replace_editor writes are constrained by host file sandbox policy; there's no local filesystem bypass (README.md:68 / agent.cordis.yml:114-122).
  • Phase-1 persistent bash lasts entire session: Unlike Standard's one-time shell, phase-1's exposed persistent bash replaces one-time shell until session end (both tools register bash name) (README.md:69 / agent.cordis.yml:84-111).
  • Depends on host PTY backend: Phase-1 bash registers @deepseek-ai/dsh-tool-bash-persistent, preset itself doesn't declare Windows custom bash backend; macOS / Linux PTY backend capability is prerequisite for phase-1 to work (presets/liangshen/agent.cordis.yml:84-111).
  • Files synced to host directory use hardcoded whitelist ID: src/index.ts syncs only the liangshen-exact subtree via syncPresetTrees(bundledPresetsRoot(), targetRoot, ['liangshen-exact']), retire list only cleans up liangshen-exact (the no-longer-bundled ID); other user-created preset directories won't be touched by the plugin (src/index.ts:81).
  • DSH_HOME environment variable can override sync target: DSH_HOME can direct preset sync to non-default location, but resolveDshHome still falls back to ~/.dsh when DSH_HOME is empty string or only whitespace (src/dsh-home.ts:24-31).

Read the usage guide →

Install steps, key points, FAQ and compatibility for this plugin — auto-derived from indexed fields.

Listing badge

Listed on deepseek-plugin.org
[![Listed on deepseek-plugin.org](https://img.shields.io/badge/listed_on-deepseek--plugin.org-007EC6)](https://deepseek-plugin.org/plugins/ningbainb/deepseek-harness-desktop/packages/dsh-liangshen)

Paste this markdown into your GitHub README to link back to this listing. The badge only states the listing — not a security endorsement.

← Back to plugin directory