Introduction

DSH’s philosophy is to turn capabilities into plugins. The community directory is an independent site with no official affiliation to DeepSeek or Fanghu; it should not be understood as an official app store.

For agent developers, a specific requirement is: to connect a local DSH agent to WeChat private chats, receive user messages, output replies segmented by WeChat bubbles, and handle multi-user sessions, long-term memory, scheduled prompts, login renewal, and exception reconnections. The following introduces the dsh-weixin plugin. It integrates WeChat iLink/ClawBot private chats into a DSH agent, supporting both plugin mode and standalone mode.

What is this

dsh-weixin is DSH’s WeChat channel plugin. The repository address is Stu-KatoMegumi/dsh-weixin, and the README notes the developer as STU-XIE; the name in package.json is @deepseek-ai/dsh-weixin.

It requires node >=22 and declares dependencies:

  • @deepseek-ai/schemastery ^3.18.1
  • qrcode ^1.5.4

The materials list a LICENSE file but do not specify the license type.

Its core positioning is: to allow WeChat private chat messages to enter the DSH agent, and to manage model replies, long-term memory, scheduled tasks, whitelist, file transfer, and login renewal back into the WeChat session.

Core Functions

Two Connection Modes

  • Plugin mode directly uses the DSH apiProxy.
  • Standalone mode connects via DSH Web HTTP RPC + WebSocket event stream.

Both modes target WeChat iLink/ClawBot private chat scenarios; the difference mainly lies in the execution method and log troubleshooting approach.

Messages and Replies

  • Each new user message can interrupt the reply generation from the previous round, prioritizing the latest input.
  • Supports WeChat “typing…” status, automatically closing when the task ends.
  • Persistence of user-to-DSH session mapping, conversation history separated by sessions, error logs, and single-instance lock.

Streaming Bubbles

WeChat replies are segmented by the model:

  • A separate line of --- serves as a new bubble.
  • A maximum of 10 items per round.
  • Forced segmentation when the current bubble accumulates more than streamFlushChars (default 800 characters).
  • Forced flushing when idle for more than streamFlushMs (default 30000 milliseconds).
  • WX_BOT_SEND_INTERVAL_MS defaults to 200 milliseconds, used to control the minimum interval between two WeChat message sends; setting 0 disables throttling.

Prompt and Long-term Memory

Supports Prompt customization:

  • system-prompt
  • soul
  • rules

These three are static files. Long-term memory is automatically maintained by the LLM and can be edited via the web page.

Limitations of long-term memory are as follows:

  • A maximum of 5 operations per round
  • A maximum of 500 characters per memory entry
  • File limit 60 KiB
  • A maximum of 200 automatic memories

Media and Access Control

Supports:

  • Image, voice, video, and file reception
  • File sending
  • Private chat access policy
  • Whitelist
  • Send directory boundary
  • 50 MB media limit

AES-128-ECB decryption is used when receiving images, voice, video, and files.

Connection and Renewal

Features:

  • Long-polling watchdog
  • Exponential backoff reconnection
  • Connection state logging

Before the login expires (approximately 24 hours), the plugin will generate a renewal QR code image locally and notify all known users; the old token continues to work until the scan is completed.

The DSH settings page supports:

  • Status
  • Scan
  • Permissions
  • Streaming parameters
  • Scheduled task hot update

It also supports five-segment cron scheduled prompt tasks.

Installation and Enablement

First, install the plugin mode. After entering the dsh-weixin project directory, execute:

npm install
npm run install:dsh

If you wish to specify the DSH root directory or profile, you can first set optional environment variables:

$env:DSH_ROOT = 'D:\Program Files\dsh'
$env:DSH_PROFILE = 'web'
npm install
npm run install:dsh

The installation script calls the official DSH plugin add logic. Here, manually concatenating the dsh plugin add github:owner/repo command is not recommended; use the installation script provided by the project directly.

After the above steps, start DSH:

pnpm dsh --profile web --dump-config
pnpm dsh --profile web

Login credentials, session mapping, and settings are persistently saved by default in:

$DSH_HOME/channels/dsh-weixin

Updating or uninstalling the plugin will not delete this directory.

Uninstalling the plugin:

npm run uninstall:dsh

Uninstalling removes the bundle from the specified DSH profile and cleans up the stable cache created by the installation script; it does not delete session data.

Typical Usage

WeChat Commands

The following commands can be used in WeChat private chats:

  • /help/?: View commands
  • /new: Create and switch to a new DSH session
  • /stop: Cancel the current task
  • /status: View connection and session status
  • /renew: Immediately get the renewal QR code image
  • /send <relative_path>: Send files inside outboxDir
  • /users: View users
  • /allow add|remove <ID>: Manage whitelist
  • /cron: View scheduled tasks

Streaming Output

Model replies are segmented according to the bubble contract:

  • A separate line of --- serves as a new bubble.
  • A maximum of 10 items per round.
  • Forced segmentation when the current bubble accumulates more than streamFlushChars (default 800 characters).
  • Forced flushing of the current bubble when the model is idle for more than streamFlushMs (default 30000 milliseconds).

WX_BOT_SEND_INTERVAL_MS defaults to 200 milliseconds, used to reduce the frequency of consecutive sends; setting 0 disables throttling.

WeChat Renewal

After receiving the renewal QR code, follow these steps:

  1. Display the QR code image on a computer or another device.
  2. Open WeChat on your phone and go to “Scan”.
  3. Use the camera to scan the image and complete the authorization.

Note: Long-pressing and recognizing within a WeChat chat cannot complete this renewal process.

Scheduled Tasks

Fill in a JSON array in the DSH settings page. Example:

[
  {
    "id": "morning-summary",
    "cron": "0 9 * * 1-5",
    "userId": "微信用户ID",
    "prompt": "总结今天的待办事项",
    "enabled": true
  }
]

Cron is parsed according to the local time zone where DSH is running, the five fields are in order:

分 时 日 月 星期

The example 0 9 * * 1-5 indicates triggering at 09:00 from Monday to Friday.

Standalone Mode

If you need to run the WeChat connection separately outside of DSH, you can use Standalone Mode:

npm start

Standalone mode connects by default to:

http://127.0.0.1:3080

Before starting the WeChat connection, Standalone Mode calls a read-only DSH API check service. If DSH is not started, the address is incorrect, or it is not DSH on the port, the program will prompt you to run first:

pnpm dsh web

and ends with an exit code 1, without starting the scan or WeChat polling. The check timeout defaults to 3000 milliseconds and can be adjusted using DSH_STARTUP_CHECK_TIMEOUT_MS.

In Standalone Mode, the model strategy is fixed to:

deepseek-official/deepseek-v4-flash

The policy is as follows:

  • Use off for normal messages
  • Use max for complex messages
  • Complex messages are those with a length exceeding 40 characters or containing operation-related keywords

Old persistent model settings will be normalized at runtime. If DSH does not confirm the target model combination, this round will stop, and the old model in the session will not be used.

Applicable Scenarios and Notes

Suitable for the following scenarios:

  • Integrating the DSH agent into WeChat private chats
  • Requiring streaming bubble output for WeChat messages
  • Requiring multi-user sessions, whitelist, and access policies
  • Requiring image, voice, video, and file reception, as well as file sending
  • Requiring long-term memory, scheduled prompts, and login renewal
  • Switching to Standalone Mode for complete log troubleshooting

Notes:

  • The plugin mode does not output logs; please switch to Standalone Mode npm start if you need complete logs for troubleshooting.
  • The plugin mode runs with the permissions of the current dsh process and accesses local DSH configuration, channel data, and WeChat channel data; you should check the source code, dependencies, and license before installing.
  • The materials list a LICENSE file but do not specify the license type.
  • Private chat access policy, whitelist, send directory boundary, and 50 MB media limit will restrict sending and receiving behavior.
  • Login credentials, session mapping, and settings are persistently saved by default in $DSH_HOME/channels/dsh-weixin; updating or uninstalling the plugin will not delete it.
  • The model strategy is fixed to deepseek-official/deepseek-v4-flash; if DSH does not confirm the target model combination, this round will stop, and the old model in the session will not be used.

References