Introduction¶
When DeepSeek Harness (DSH) runs on Windows, it often needs to control workstation locking and power management so the machine stays active between conversations while avoiding accidental hibernation or shutdown. Common commands (such as shutdown /l) terminate background processes, while a simple sleep interrupts plugins that require continuous operation (e.g., WeChat uploads). The dsh-pc-guard plugin calls user32!LockWorkStation (the same API used by Win+L) to provide a set of pc_guard tools within DSH, ensuring that background tasks are not interrupted while precisely controlling lock state and display status.
What It Is¶
dsh-pc-guard is a Windows-oriented DeepSeek Harness plugin maintained by NCT-Ant. It provides the pc_guard tool, supporting one-click workstation locking, display off, wake detection, status sampling, and a UI panel. It also includes built-in CPU throttling, low-battery protection, and process-matching mechanisms, allowing the agent to automatically pause heavy-load tasks when machine load or battery level is insufficient.
Core Features¶
pc_guard { action: "lock" }: Locks the workstation and turns off the display. Background programs continue running, the machine will not hibernate/shutdown/reboot, and unlocking returns to the same desktop session.pc_guard { action: "sleep" }: Only turns off the display; the session remains unlocked. Background tasks (e.g., WeChat uploads) continue working, and touching the keyboard or mouse restores the display.pc_guard { action: "wake" }: Turns the display on without unlocking. Returns whether the state is merely dimmed or truly locked, allowing the agent to determine if a password is required.pc_guard { action: "status" }: Samples total CPU utilization, idle time, battery percentage, and power state. Also reads the real lock state and send-lease state to help the agent decide whether to execute heavy-load tasks.pc_guard { action: "ui" }: Opens the PC Guard panel (real-time CPU readings, one-click lock, auto-protection toggle). If already open, brings the window to the front.pc_guard { action: "shortcut" }: Creates a “Lock Guardian” shortcut on the desktop, launching the panel via a generatedlaunch.vbs(wscript) to avoid displaying a PowerShell console window.
The plugin also provides a standalone script assets/PcGuard.ps1 that can be run independently outside DSH, supporting command-line and windowless modes.
Installation & Setup¶
- Clone the repository to a local directory:
git clone https://github.com/NCT-Ant/dsh-pc-guard.git
- Install the plugin bundle in DSH:
plugin_manager { action: "install_bundle", target: "<absolute path to this directory>" }
Once installed, the pc_guard tool functions described above are available.
Typical Usage¶
- Lock the workstation:
pc_guard { action: "lock" }
- Turn off the display only (without locking):
pc_guard { action: "sleep" }
- Check status and determine if it’s suitable to run heavy-load tasks:
pc_guard { action: "status" }
- Open the panel:
pc_guard { action: "ui" }
- Create a desktop shortcut:
pc_guard { action: "shortcut" }
Standalone script usage:
powershell -NoProfile -ExecutionPolicy Bypass -File assets/PcGuard.ps1
powershell -NoProfile -ExecutionPolicy Bypass -File assets/PcGuard.ps1 -Action lock
powershell -NoProfile -ExecutionPolicy Bypass -File assets/PcGuard.ps1 -Action status
powershell -NoProfile -ExecutionPolicy Bypass -File assets/PcGuard.ps1 -Headless
Parameter example:
powershell -NoProfile -ExecutionPolicy Bypass -File assets/PcGuard.ps1 -CpuPause 90 -CpuResume 40 -ResumeHoldMin 5 -IntervalSec 3 -PauseStreak 3 -ForceResumeMin 30 -NoWakeIdleSec 120 -AutoLockMin 10 -LowBatteryPct 20 -LowBatteryResumePct 25
Panel Description¶
The panel uses a custom theme and supports:
- Real-time CPU readings with a threshold-aware bar (blue → yellow → red)
- Current protection status and battery icon
- Toggles: CPU guard, include DSH, keep display off, auto-lock on idle, low-battery protection
- Hit process list with custom name input; matching logic is case-insensitive process-name substring, persisted to
assets/pc-guard.custom.txt - One-click lock, pause, and resume buttons
Use Cases & Notes¶
- Windows platform only; requires PowerShell 5.1 or 7 (
powershell.exein PATH). - No admin privileges required for normal operation, but disabling device wake requires an elevated shell — the plugin intentionally does not perform that operation.
- The plugin runs with the current DSH process privileges. It is recommended to review the source code and license before installation.
- Auto-protection suspends processes via
NtSuspendProcess. Processes resume when the window is closed, manually resumed, or after-ForceResumeMinminutes.
Brief Conclusion¶
dsh-pc-guard provides a lightweight yet comprehensive Windows workstation locking and CPU throttling solution for DeepSeek Harness. Through precise API calls and status sampling, it allows the agent to safely keep the machine running between conversations. The directory page and repository links are as follows:
- Directory page: https://www.skillhub.cn/plugins/NCT-Ant/dsh-pc-guard
- GitHub: https://github.com/NCT-Ant/dsh-pc-guard