DSH Unharnessed: Running Persistent Python, Background Commands & MCP in Harness

Introduction

When performing programming tasks in DeepSeek Harness (DSH), the common approach is to rely on the model’s built-in tool calling or short-lived shell. Variables are hard to retain across multiple turns of conversation, and states are easily lost after context compression; MCP (Model Context Protocol) tools are often only exposed to the model via the native tool list, and it is impossible to filter results on the code side before delivery; image and file attachments also need to follow the host’s predefined paths.

The DSH Unharnessed introduced below (repository gulagala001/dsh-unharnessed), released by the maintainer gulagala001, is categorized as a workflow plugin. It provides a persistent Python kernel, background Bash commands, a Python bridge for reusing connected MCPs, and image and file attachment capabilities within DSH; variables can be retained after dialogue compression and recovered from checkpoints after restarting the same session.

What is this

DSH Unharnessed is an Agent preset plugin for DSH: Unharnessed. One-sentence positioning: using persistent Python, background commands, MCP, images and file attachments, and recoverable task states in DeepSeek Harness (consistent with the directory page introduction).

It does not replace DSH’s own MCP configuration and OAuth, but exposes MCP tools that are already connected in DSH to Python calls, and goes through DSH’s existing execution pipeline (parameter checking, approval, timeout, etc.).

Environment and Installation

Host and Runtime

Scope Requirements
Host DSH Desktop 0.2.2-rc.3
Runtime Environment Node.js 24.9.0+, existing Python 3.11+
Python Default priority is to use the interpreter included with DSH Desktop; kernel and dill are provided with the plugin

The plugin version in package.json is 0.2.4-dsh.0.2.2-rc.3, and engines.dsh requires >=0.2.2-rc.3 <0.2.3-0.

Installation and Selecting Presets

In Plugin → Add Plugin, paste the installation package address (you must use the original text from the README, do not splice commands yourself):

https://github.com/gulagala001/dsh-unharnessed/releases/download/v0.2.4-dsh.0.2.2-rc.3/dsh-unharnessed-0.2.4-dsh.0.2.2-rc.3.tgz

Then select Unharnessed in the Agent preset of a new chat. Existing chats may retain the plugin revision used at startup; after updating, it is recommended to start a new chat or restart DSH normally.

After installation, you can try running it with a sentence of natural language: ask it to “calculate the sum of squares from 1 to 100 using Python and save the result in a variable” to confirm that the kernel and variables are working correctly.

Core Capabilities

Persistent Python and Background Commands

Python can run without a shell. Background commands and shell checks for autonomous tasks require Bash. On Windows, you can install Git for Windows; the plugin will automatically look for common installation paths, or you can use an already enabled Git Bash plugin; WSL launchers are not supported. Custom Bash can be set in the configuration by setting bashCommand to an absolute path (e.g., C:/Tools/Git/bin/bash.exe), then execute /unharnessed-reset or start a new chat.

The typical usage is as follows.

Read a file and return its length and snippet (no shell required):

from pathlib import Path
source = Path('README.md').read_text()
len(source), source[:300]

Start a background build, returning a handle immediately; completion is notified by the host and the session is woken up during idle time:

build = bash('npm run build', timeout=600)
# Returns immediately; completion notification will arrive in the next step, and the session will be automatically woken up when idle.

In subsequent cells, await the handle and check the exit code and output tail:

result = await build
result.exit_code, result.output[-2000:]

The documentation states support for top-level await, trailing expressions, cross-cell variables and functions, async tasks, interrupt recovery, background output, and notification revocation. bash() timeout is measured in seconds; timeout=None means no limit, suitable for long-term preview services; after use, you should call kill() on the handle.

Cross-Restart Snapshots

Checkpoints are saved by default after a cell ends or when the kernel is normally destroyed. When the same session restarts, resumes, or the kernel exits unexpectedly, the new Python process will attempt to restore the most recent successfully saved variables, functions, and lambdas; the restoration results are listed in the next ipython return.

Please note the following limitations (all from README):

  • Single value limit is 16 MiB, total limit is 256 MiB; values exceeding the limit or that cannot be serialized will be logged in the unrecovered list.
  • Active processes, BashHandle, async tasks, file streams, sockets, and generators are not restored and need to be explicitly restarted.
  • Restoration binds to the session ID, working directory, sandbox policy, and Python major/minor version; forks, new sessions, permission changes, or working directory changes will start from an empty kernel.
  • /unharnessed-reset will stop the process and clear the session’s checkpoint.
  • The native /compact retains the kernel and reports names that still exist; after successfully saving the checkpoint, it clears variables exceeding the single-value limit.

Checkpoints are transmitted to the host in chunks via the protocol, and the host performs an atomic commit and validates SHA-256. The default directory is unharnessed-state under the current DSH profile (or DSH home if no profile exists), isolated by session hash, and not written to the project repository.

DSH MCP Bridge

Directly reuse DSH’s configured and connected MCP tools, without copying credentials, and without adding MCP schemas back to the model’s native tool list.

await mcp.list_connections()
await mcp.search_tools('search', limit=10)
await mcp.list_tools('actual server name')
await mcp.describe_tool('actual server name', 'full tool name returned by directory')
result = await mcp.call_tool('actual server name', 'full tool name returned by directory', {'query': 'example'})

Calls go through the DSH execution pipeline; native images and file references returned by MCP go into session attachments. Connections and credentials are still managed in DSH’s original interface; this version bridges MCP tools and does not add new MCP prompt templates or independent server management entries.

Images, Files, and Rich Media

await attach_image('plot.png', 'screenshot.jpg')
await attach_file('report.pdf', 'clip.mp4', 'recording.wav')
await display({'text/html': '<h1>Report</h1>'}, name='report')
await display({'image/png': Path('plot.png').read_bytes()})

Images use DSH’s native image attachments (PNG, JPEG, WebP, GIF) and are subject to host format and size limits. Files are persisted as raw bytes. Attachments are read from the Python current working directory and are subject to kernel sandbox constraints; the default total limit for a single attachment request is 10 MiB. HTML is delivered as a file and is not executed arbitrarily in the plugin.

Goals and Autonomous Checks

Goals inherit DSH’s persistence and continue rounds; on the Python side, progress can be read and reported, but new user goals cannot be created by itself.

/goal fix parser, run tests and check boundary inputs
/goal pause
/goal resume
/goal clear
await goal.get()
await goal.complete()
await goal.block('specific blocking reason')

Autonomous mode example: at the end of each round and after all background commands exit, the host executes the configured shell gates.

/unharnessed-autonomous {"objective":"make parser accept trailing comma","gates":["npm test","npm run lint"],"maxRounds":12}

Gates are executed in the DSH working directory and host environment, and do not inherit Python’s temporary modifications to cwd/env. goal.complete() cannot bypass autonomous gates.

Skill List

await skills.list()
await skills.get('actual skill name')

Configuration

Configuration is located at preset-unharnessed → config.plugins → unharnessed → config in cordis.patch.yml. Time-related configurations are all in milliseconds. The table below lists the default values and purposes from README:

Config Default Value Purpose
pythonCommand auto Existing Python; can specify absolute path
bashCommand bash Auto-detects Bash; can also specify absolute path
maxOutputChars 16000 Upper limit for cell text return
cellTimeoutMs 600000 Upper limit for cell execution
startupTimeoutMs 15000 Deadline for kernel startup
interruptGraceMs 3000 Wait time for forced stop after interruption
gateTimeoutMs 60000 Deadline for each gate command
snapshots true Save and restore checkpoints
stateDirectory empty Automatically use profile state directory
snapshotMaxBytes 268435456 Total upper limit for checkpoints
snapshotVariableBytes 16777216 Upper limit for single-value serialization
snapshotTimeoutMs 15000 Deadline for saving checkpoints
maxAttachmentBytes 10485760 Total upper limit for a single attachment request

Use Cases and Notes

Who is it for: Developers who need to perform longer programming flows in a DSH Agent, want variables to be retained across turns and restarts, want to orchestrate bash background tasks in Python, or want to call existing MCPs via code and filter results again.

Permissions and Security: The plugin runs with the permissions of the current DSH process; Python and bash() are constrained by the working directory and sandbox, but background commands and autonomous gates will still execute shell in the host environment. Before installation, you should read the repository source code, MIT license, and the Python kernel and dill explanations in THIRD_PARTY_NOTICES.md.

Ecosystem Note: DSH’s philosophy is “everything is a plugin”. The dsh-unharnessed entry on SkillHub in the community directory is an independent site with no official affiliation with DeepSeek / Hypersphere, and should not be treated as an official app store.

Conclusion

With the steps above, you can install the Unharnessed preset on DSH Desktop 0.2.2-rc.3, use persistent Python to complete reading, writing, building, and MCP calls, and restore variables within the same session using checkpoints. See CHANGELOG.md for more version changes; see CONTRIBUTING.md for development and review processes.

  • Directory page: https://www.skillhub.cn/plugins/gulagala001/dsh-unharnessed
  • GitHub: https://github.com/gulagala001/dsh-unharnessed
羽毛球分组比赛记分
小程序二维码

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

Xiaoye