dsh-pm2

August 22, 2026 ยท View on GitHub

PM2 process-manager plugin for the DeepSeek Harness. Keeps the Harness web server running, restarts it on crash or memory-pressure, and can be configured to start on system boot.

Quick Start

git clone https://github.com/chenjie1129/dsh-pm2.git
cd dsh-pm2
npm install
node bin/dsh-pm2.mjs start --project /path/to/deepseek-harness

Or install globally:

npm install -g dsh-pm2
dsh-pm2 start --project /path/to/deepseek-harness

Commands

CommandDescription
startStart the Harness under PM2 supervision
stopStop the PM2-managed Harness
restartRestart the PM2-managed Harness
deleteRemove the Harness from the PM2 process list
statusShow PM2 process status
logsShow PM2 logs (--lines N, default 30)
saveSave the PM2 process list for resurrection
startupConfigure PM2 to start on system boot

Options

OptionDefaultDescription
--project <path>auto-detectPath to the deepseek-harness checkout
--port <port>3080Web server port
--name <name>deepseek-harnessPM2 process name
--lines <N>30Number of log lines to show

Environment Variables

VariableDefaultDescription
PM2_HOME<project>/.pm2PM2 daemon home directory
DSH_PM2_NAMEdeepseek-harnessProcess name in pm2 list
DSH_PM2_PORT3080Web server port
DSH_PM2_MAX_MEMORY512MMax RSS before restart
DSH_PM2_DSH_HOME~/.dshDSH_HOME for the managed process
DSH_PM2_LOG_DIR$DSH_HOME/logsLog output directory
DSH_PM2_PROJECT_DIRauto-detectPath to the deepseek-harness checkout

Cordis Plugin

This package also exports a Cordis function plugin. When loaded inside a Harness composition:

# cordis.yml
- name: 'dsh-pm2'

The plugin detects PM2 supervision and logs the supervisor identity through the standard logger. @deepseek-ai/cordis and @deepseek-ai/schemastery are optional peer dependencies โ€” the plugin is a silent no-op when they are absent.

Auto-Restart

PM2 restarts the Harness automatically when:

  • The process exits unexpectedly (crash)
  • Memory exceeds DSH_PM2_MAX_MEMORY (default: 512M)

Boot-Time Startup

dsh-pm2 save
dsh-pm2 startup

Follow the printed instructions to enable PM2 to start on system boot.

License

MIT