Skip to main content

dsh-web-ui/packages/dsh-liangshen

5.1kStars311Forks49Issues5Watchers

Install the "Liang Shen Mode" two-stage anchoring agent preset for DSH: the first round only exposes the official Minimal dual-tool guided reasoning trajectory, then switches to PTC Mode after anchoring to unlock all tool capabilities.

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

ⓘ This plugin is a sub-package of the zhu1090093659/dsh-web-ui monorepo — stars and activity count the whole repository.

Language
TypeScript
License
Apache-2.0
Branch
dev
deepseek-harnessdshdsh-pluginweb-ui

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 zhu1090093659/dsh-web-ui/packages/dsh-liangshen for me: review the repository at https://github.com/zhu1090093659/dsh-web 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 "Anchored Standard" approach into a one-click install plugin for the DSH suite: sync built-in presets to ~/.dsh/.agent-presets when the host process starts, select "Liangshen Mode" in the preset selector for new sessions to enable. The first turn only exposes the official Minimal preset's dual tools (persistent bash + str_replace_editor) and a one-line persona, anchoring the model's execution trace to Minimal; after anchoring is established, automatically switch to PTC Mode (single run_code tool), restoring full tool capabilities, with no manual configuration required throughout.

Core Features

  • Sync built-in Liangshen presets to the host directory (~/.dsh/.agent-presets/liangshen), making "Liangshen Mode" directly selectable in the preset selector for new sessions; after plugin upgrade, updates automatically on next restart
  • First request only exposes Minimal preset's precise dual tools and one-line persona, clears runtime context and only whitelists messages (user direct messages and /goal auto-turns), anchoring the model's execution trace to Minimal
  • After the first tool/call, switch to PTC Mode through a gate ("first reasoning chunk contains we and no let me" or four-step fallback, or auto-promotion after first turn response with no tool): single run_code tool, full tool registry via generated SDK calls
  • After promotion, restore all prompt sections (including plan mode's plan:policy), append selected workspace path to persona end, and delay workspace instructions and skill directory injection by one step to avoid tool directory switch and injection impact landing in the same frame
  • Declare plugin existence, working principles, and limitations to the model via system-prompt section (enabled by default), enabling the model to collaborate when user mentions "Liangshen Mode / Anchored Standard"
  • Includes 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) + small amount of .mjs (preset's runtime logic)
  • Key Dependencies: @deepseek-ai/cordis (cordis plugin runtime), @deepseek-ai/dsh-system-prompt (prompt section registration), schemastery (Config schema)
  • Architecture Pattern: cordis bundle package (host half single instance mount, browser half does not exist); wait for prompt assembly via inject: ['systemPrompt'] then register declaration section; presets mounted to host .agent-presets directory as presets/liangshen/agent.cordis.yml, parsed by host preset loader; core two-phase logic in preset's tool-bootstrap.mjs, implemented via system-prompt/assemble / agent/pre-step / agent/request hooks for tool directory trimming, message whitelisting, and maxTokens ceiling
  • 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

Ordinary and advanced users who want to stably reproduce the trajectory pattern "first turn answers in Minimal style, then unlocks full capabilities" on DeepSeek V4 Pro. When standard presets or PTC Mode perform poorly on first-turn tasks, and you don't want to stay permanently in the Minimal state with only two tools, this plugin provides a middle path: precisely align with Minimal's byte-level surface on first turn to stabilize trajectory, then automatically return to PTC Mode's full capabilities after anchoring.

Prerequisites & Compatibility

DependencyMinimum VersionDescription
DSH0.1.0-rc.5+Requires preset mechanism and system-prompt/assemble hook (README.md:80)
Node^22.19.0 or >=24.0.0From package.json engines; below 22.19 has Node 22 regression with fs.cpSync crash on non-ASCII paths (src/sync.ts:104-113)
PlatformmacOS / Windows / LinuxmacOS and Linux use persistent PTY shell; Windows uses custom-bash.mjs (Git Bash), state not persistent, no OS sandbox (presets/liangshen/agent.cordis.yml:112-149)
Native ModulesNoneOnly uses built-in modules like node:fs / node:path / node:os

Installation

dsh plugin --profile web add github:zhu1090093659/dsh-web-ui/packages/dsh-liangshen

Configuration

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

ConfigTypeDescriptionDefault
enabledBooleanMaster switch; when off, neither syncs presets nor declares plugin existencetrue
announceToAgentBooleanWhether to register a system-prompt section declaring plugin's working principles and limitationstrue

Adjustable parameters in preset's tool-bootstrap section (requires host restart after modification, default values correspond to tested high-hit window):

ConfigTypeDescriptionDefault
shellToolsString ArrayPersistent shell tool names exposed in phase-1[bash]
commonToolsString ArrayAnother resident tool exposed in phase-1[str_replace_editor]
messageSourcesString ArrayMessage sources whitelisted in phase-1 (user messages + goal auto-turns; removing goal triggers #578 deadlock)[user, goal]
anchorGateBooleanAfter first tool/call, whether to wait for first minimal-like reasoning chunk before promotingtrue
maxBootstrapStepsNumberFallback promotion steps when anchoring gate times out4
promoteAfterFirstResponseBooleanPromote immediately after first-turn response with no tool calls; anchoring gate sessions also release at first turn turn/endtrue
bootstrapMaxTokensNumberOutput budget ceiling for phase-1 requests; automatically stripped after promotion to avoid affecting subsequent requests1024
compactionToolsString ArrayCore working set exposed after compaction until next promotion[read, write, edit, glob, grep, todo_write, ask_user_question]
deferredSourcesString ArrayMessage sources to inject with delay after promotion[agent-instructions, skill-catalog]
deferredGraceStepsNumberSteps to delay injection of above sources after promotion1
promotedPresentationStringTool directory presentation form after promotion (code means PTC Mode single run_code)code
instructionHintBooleanAfter promotion, use non-imperative hint instead of full AGENTS.md injection (issue #关闭); turning off restores old full injectiontrue
phase1FirstCallInstructionStringOptional instruction appended to phase-1 persona; when enabled, deviates from byte-level Minimal surface, hence off by defaultNot set

FAQ

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

A: No. Minimal only retains two tools but sacrifices full capabilities; Liangshen Mode is a "two-phase" solution that precisely aligns with Minimal's byte-level surface on the first turn to stabilize execution trajectory, then automatically switches to PTC Mode (single run_code tool) after anchoring to restore full tool capabilities.

Q: When does the tool directory change?

A: Only changes once: when the session has its first persistent tool/call and passes the anchoring gate (first reasoning chunk contains we and no let me, four-step fallback), or promotes immediately when first-turn response calls no tools. After promotion, all requests appear as PTC Mode (single run_code). Therefore, one prefix cache invalidation occurs between the first and second requests.

Q: Is Windows supported?

A: Yes. On Windows, DSH's PTY backend is unavailable, so the plugin automatically switches to custom-bash.mjs (calls Git Bash via regular cross-platform subprocess channel), still registering the bash tool with the same name; however, on Windows, bash state does not persist between calls, and there is no OS-level sandbox protection (README.md:17). bashPath can explicitly override the inferred Git Bash path.

Q: How to verify the plugin is actually working?

A: Export session JSONL and check request/header: the first header should only contain bash/str_replace_editor; the header changed after the 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 to uninstall?

A: Run dsh plugin --profile web remove @linxin666/dsh-liangshen and fully restart dsh web. If you previously installed the dsh-web-ui-all aggregate package, both will mount the same preset, so you need to remove the other one first before installing this one to avoid dual-source mount conflicts (README.md:43-45).

Q: Any manual configuration needed 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 for new sessions.

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

A: Not recommended. The preset's working principle is to anchor the first-turn request trajectory to Minimal; a session with existing content has no "first turn," so switching may not work as expected (README.md:79).

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

A: No. Both source code and documentation explicitly state the plugin makes no network requests and adds no telemetry (README.md:78).

Difficulty

Beginner — After installing the plugin, just select "Liangshen Mode" in the preset selector for new sessions; no file editing or command-line parameters needed.

Known Issues & Limitations

  • Windows behavior differences: PTY backend unavailable, phase-1 bash switches to custom-bash.mjs (Git Bash), state does not persist between calls, and there is no OS-level sandbox protection (README.md:17 / agent.cordis.yml:139-149).
  • First-turn capability questions may be answered based on trimmed view: Phase-1 intentionally exposes only dual tools; questions like "can it access the internet" or "can it read PDFs" may be answered based on the trimmed tool set, corrected only after promotion; optionally enable phase1FirstCallInstruction (off by default) to require the model make a grounding tool call first, or ask task-type questions directly on first turn (README.md:75).
  • Prefix cache will invalidate once between first and second requests: Because the tool directory changes only once, there will be one prefix cache change between the two requests (README.md:76).
  • goal must be kept in messageSources: If /goal auto-turn is removed from the whitelist, no response/tool call after filtering will trigger any promotion branch, causing goal's resume/pause loop deadlock (issue #578, tool-bootstrap.mjs:80-83).
  • instructionHint enabled by default: Issue #388 decided to use non-imperative hint instead of full AGENTS.md injection after promotion; if you explicitly turn this off to restore full injection, note that it will flip the anchored trajectory (agent.cordis.yml:85-91).
  • Do not switch presets mid-session with existing content: Switching may not work as expected (README.md:79).
  • Preset and shell access have the same trust level: Preset files are maintained by the plugin at ~/.dsh/.agent-presets, you can review presets/liangshen/ before installation; the plugin does not modify DSH source code (README.md:77).

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/zhu1090093659/dsh-web-ui/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