dsh-plugin-debug-mode: Replicating Cursor-style Debug Mode in DSH

Preface

When using agents to fix bugs, the common path is: Agent reads code, guesses the cause, makes a fix, you test it locally, and if it’s wrong, guesses again. When the phenomenon is intermittent and the paths are complex, this kind of “inference without on-site evidence” often takes multiple rounds to align.

DeepSeek Harness (DSH) supports extending host capabilities through plugins. The community directory at skillhub.cn has dsh-plugin-debug-mode (maintainer rh666666, category: client) that takes a different path: first embed probes on suspicious paths, you reproduce once, then Agent reads logs before deciding to fix or continue collecting evidence. Below introduces its positioning, workflow, installation, and usage.

What Is This

dsh-plugin-debug-mode is an npm package dsh-plugin-debug-mode, GitHub repository rh666666/dsh-plugin-debug-mode. The README describes it as “a DSH plugin entirely written by DSH”, aiming for a Cursor Agent-style Debug mode: letting Agent embed removable probes in the codebase, writing runtime scenes to logs, rather than just relying on static reading to guess root causes.

The entire debugging loop does not depend on Agent executing shell commands; Agent mainly advances through dsh_debug_* tools and source code changes (probe insertion/fixes), while “running to reproduce” is done by you locally or in the target environment.

What Problems It Solves

Typical scenario similar to the README example: “After clicking save, the list occasionally doesn’t refresh.”

Traditional Agent debugging easily becomes multi-round guessing. The Debug mode order is:

  1. You describe the phenomenon (or supplement after initiating via /debug).
  2. Agent analyzes and embeds probes on suspicious paths (with dsh-debug:probe etc. markers for easy removal during cleanup).
  3. Probes write to task logs via the host HTTP channel (default in user temp directory, see “Artifact Location” below).
  4. You follow the reproduction steps given by Agent and operate once.
  5. Agent reads log summary via dsh_debug_read (full exception capture, grouped counts, etc.).
  6. The debug panel above the input box expands; you choose “Issue resolved” or “Issue reproduced, needs further fixing”.

When choosing “resolved”: delete logs and remove all probe code from this round; when choosing “reproduced”: logs are kept, Agent should read logs first before entering the next round (dsh_debug_continue will clear logs, hash unchanged).

How to Enter Debug Mode

The only entry point is the slash command. The description will be sent as-is as your user message, and the host simultaneously injects debug mode system guidelines (similar to Plan mode: mode via injection, input via message).

/debug After saving, the list occasionally doesn't refresh, happens once every ten-plus minutes

Press Enter to start; no long instructions you didn’t say will appear in the conversation. If no description is written after the command, no message will be sent out of thin air; you can describe the phenomenon, expectations, and reproduction paths in the next message.

dsh_debug_start must hold the ticket issued by /debug; calls without a ticket will be rejected by the host. The plugin does not recognize conversation intent, does not provide toolbar buttons—probe insertion will modify the codebase, requiring you to explicitly initiate with /debug.

Core Mechanism Overview

Five Signal Tools

Signal Trigger Effect
Start Debug After /debug, Agent calls dsh_debug_start Generates unique task hash, creates logs, probe stubs, and example snippets
Report Probes Agent dsh_debug_report Submits analysis and reproduction checklist, waits for you to reproduce
Continue Debug Agent dsh_debug_continue Starts next round (logs cleared at this point, hash unchanged)
Read Logs Agent dsh_debug_read Host outputs log summary, no need for Agent to browse files itself
End Debug Agent dsh_debug_end after user selects “resolved” Removes probes and temp blocks, deletes task directory after proving clean

Code Modification Rules During Debugging

  • Round 1 defaults to evidence collection only, no behavior changes (unless the gate rejects when the dsh-debug:change marker appears—probe insertion itself doesn’t count as a behavior change).
  • From Round 2, you can first modify based on hypotheses, then embed probes to verify “reproduced before fix, not reproduced after fix”.
  • Probes (dsh-debug:probe <hash>), temp blocks (dsh-debug:temp), fixes (dsh-debug:change <hash>) are accounted separately; during cleanup only probes and temp blocks are deleted, your fixes are not rolled back; overall git checkout rollback is explicitly forbidden.

Probes and HTTP Channel

Log writing is uniformly implemented by the host. Probes just POST JSON to a fixed path:

curl -s 'http://127.0.0.1:<DSH port>/dsh-debug-mode/probe?h=<hash>'

curl -s -X POST 'http://127.0.0.1:<DSH port>/dsh-debug-mode/probe?h=<hash>' \
  -H 'content-type: text/plain' \
  --data-binary '{"probe":"app.py:42:enter","data":{"order_id":"A1"}}'

Path is /dsh-debug-mode/probe, task hash in query string ?h=. Address and port are calculated by the plugin based on DSH_WEB_URL or webServer.port; dsh_debug_start generates multi-language examples in the task directory (including runtime/probe.http.md).

When debugging static pages in the browser, you can use the script stub provided by the host (GET /dsh-debug-mode/stub.js?h=<hash>), which also works for file:// pages, no need to start a separate local web server for debugging (if CSP restrictions require adjusting script-src or pasting runtime/probe.browser.js).

Where Are Artifacts Placed

Default: os.tmpdir()/dsh-debug-mode/tasks/<hash>/, separated from the repo, deleted when task ends.

  • Falls back to <repo>/.dsh/debug-mode/ when temp directory is not writable; prompts shown in panel and tool returns.
  • Environment variable DSH_DEBUG_MODE_TMP or tool parameter tempDir can change the temp root path.
  • System cleanup of temp directories may cause in-progress tasks to be unable to continue, requiring re-initiating /debug.

Interactive Panel

During task lifetime, there’s a collapsible card above the input box: usually collapsed when Agent embeds probes; expands when it’s your turn to reproduce and choose, displaying a one-sentence conclusion, reproduction steps, and “Issue resolved” / “Issue reproduced, needs further fixing” buttons. Only after you make a selection on the panel is Agent allowed to dsh_debug_end for cleanup.

Installation and Activation

Recommended to enter the package name in the installation box in the DSH Plugins sidebar:

dsh-plugin-debug-mode

Command line equivalent:

dsh plugin --profile web add dsh-plugin-debug-mode

To specify a version, add the version number after the package name, e.g.:

dsh plugin --profile web add dsh-plugin-debug-mode@0.21.0

Can also install from GitHub:

dsh plugin --profile web add github:rh666666/dsh-plugin-debug-mode

No build needed during installation, no node_modules needed (zero runtime dependencies). package.json requires Node >=18, DSH >=0.1.5-rc.1, license MIT. After installation, /debug will appear in the host command panel.

Note: The plugin runs with the current DSH process permissions, will write probes and possible fallback directories to the workspace; before installation, it’s recommended to review the repo source code and license to confirm it meets your security and compliance requirements. The community directory site has no official affiliation with DeepSeek / High-Flyer; it’s a third-party entry in the DSH “everything is a plugin” ecosystem.

Typical Usage

  1. Execute /debug in any conversation, followed by phenomenon description (or supplement after).
  2. Wait for Agent to call dsh_debug_start and complete probe embedding and dsh_debug_report.
  3. Follow the reproduction steps in the panel and operate the program once.
  4. Agent reads logs and gives conclusion; you select on the panel whether it’s resolved.
  5. If not resolved, Agent reads logs then calls dsh_debug_continue to enter the next round.

README also notes: if Agent can determine the root cause by reading code alone (obvious null pointer, typo, missing await, etc.), it should fix directly rather than forcing the probe workflow; /debug tickets will expire, just re-initiate when needed.

Suitable Scenarios and Limitations

Suitable for: intermittent bugs, problems requiring runtime traces for root cause determination, multi-language/browser/remote processes (via HTTP probes or file stub solutions in docs), and other scenarios requiring “collect evidence first, then modify”.

Not suitable or needs to know:

  • Hot paths need aggregation before POST, avoiding thousands of HTTP requests per frame.
  • Large repo cleanup scanning has file count/time budget (default DSH_DEBUG_MODE_SCAN_MAX_FILES is 20000); when incomplete, dsh_debug_end may return scanIncomplete: true, reported probeFiles are still fully scanned.
  • Uncleaned tasks will appear on the debt board /dsh-debug-mode/board.

The repo README marks implementation status as all tests green at v0.21; the current npm version follows package.json (e.g., 0.22.1). Real click verification on the GUI panel requires a human in the host interface.

Conclusion

dsh-plugin-debug-mode turns Debug mode into a fixed workflow of “embed probes → you reproduce → read logs → panel decision → remove probes, keep fixes”, and hard-constraints “no relying on Agent running commands” to avoid permission and environment issues blocking the entire debugging chain.

羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye