containerize-dsh
Run DeepSeek Harness in an isolated Docker sandbox with external project plugins and Git-based host/agent change transfer.
Run DeepSeek Harness (DSH), a coding agent, in Docker and bring its changes back to Git for review. dsh-task gives each session a separate checkout, records its work, and helps you review, integrate, and clean up when you're done. Git bundles carry work between the host and container. Optional plugins supply project tools and MCP configuration. You need Python 3.10+, Git, and Docker with Compose v2. On Windows, set Docker Desktop to Linux containers. The host scripts use only Python's standard library.
Summary extracted from the README.
DSH sandbox
Run DeepSeek Harness (DSH), a
coding agent, in Docker and bring its changes back to Git for review. dsh-task
gives each session a separate checkout, records its work, and helps you review,
integrate, and clean up when you're done. Git bundles carry work between the host
and container. Optional plugins supply project tools and MCP configuration.
Requirements
You need Python 3.10+, Git, and Docker with Compose v2. On Windows, set Docker Desktop to Linux containers. The host scripts use only Python's standard library. Start from a Git repository with at least one commit; configure your Git author name and email if you plan to integrate changes.
Quick start
From this checkout, install the command:
python scripts/install_workflow.py
On Windows, reopen your terminal to pick up the updated user PATH. On Linux/macOS,
put ~/.local/bin on PATH. The installer also adds the optional dsh-work skill
for Codex and Claude Code; neither app is required to use the sandbox. Invoke it
as $dsh-work in Codex or /dsh-work in Claude Code. Keep this checkout and
Python interpreter in place, or rerun the installer after moving them.
Then, from the repository you want DeepSeek to work on:
dsh-task start --task fix-parser --open
This transfers HEAD and opens DSH in your browser. The current branch becomes
the integration target; choose another with --target. Enter provider credentials
in the UI, or set DEEPSEEK_API_KEY before starting the task. The UI can start
without a provider key. To save a key file or select project plugins, use a
saved profile:
dsh-task start --task fix-parser --profile my-project --open
Saved profiles can compose an ordered capability stack:
{
"omnigame": {
"plugins": ["/plugins/dotnet", "/plugins/rea", "/projects/omnigame/.dsh-plugin"],
"repo": "/projects/omnigame"
}
}
The legacy singular plugin field still works; a profile cannot contain both
forms. Duplicate paths and incompatible contributions fail with clear errors.
See the composition contract. These example
capability paths do not add .NET or REA integrations to this repository.
Without a profile, the defaults are the current repository, no plugin, and port
11111. Each start creates a unique task ID and its own home/workspace volumes.
Use --port 11128 for another simultaneous task. Startup builds missing images;
pass --rebuild after changing image inputs to replace a cached image.
The base image includes curl and wget alongside Node.js, Python, and Git.
Project SDKs such as .NET belong in a project plugin, selected
through a saved profile. Install them at image build time;
the running agent cannot use apt against the read-only root filesystem.
New sessions and the browser's initial directory default to /workspace; home
remains /home/agent for credentials, history, and caches. DSH is pinned to
0.2.1-rc.2. This release still
needs a small build-time directory-browser patch for this default; image builds
fail if an upstream change makes that patch incompatible.
Rebuild cached images after upgrading: use dsh-task start ... --rebuild, or
python dsh.py ... build followed by up. Existing running tasks keep their
original container image. See the upgrade notes
for upstream configuration and native-plugin compatibility changes.
To send your current edits instead of committed HEAD, add --snapshot.
Add --include-untracked only after checking which new files you want to share:
dsh-task start --task fix-parser --snapshot --include-untracked --open
Snapshots capture file contents without changing your real index or branch. They don't preserve the staged/unstaged split, and concurrent host edits can produce an inconsistent snapshot. See transfer rules for file selection and repository limits.
If you prefer to skip installation, replace dsh-task in these commands with
python /path/to/containerize-dsh/dsh_task.py.
For an automated task without a browser:
dsh-task run --task fix-parser --prompt-file /private/prompt.txt --timeout 600 --events /private/events.ndjson
dsh-task export <task-id> --snapshot --include-untracked --bundle /private/work.bundle
run uses the same profiles, transfers, plugins, images, and isolated volumes as
start, with no published port. Supply DEEPSEEK_API_KEY or a profile's key_file;
headless mode ignores credentials saved in the GUI. Use --prompt-file - to read
stdin. The task ID is printed first, followed by the events file path. Without
--events, the stream goes into the task's state directory. Exit status is 0 only
when DSH exits 0 and its final event reports completed; failures and timeouts
exit 1. show includes the outcome and session ID. resume opens the web UI on the
same volumes to inspect or continue the session. See
headless options for model and effort selection.
Work on a task
After a browser session or headless run, export when you're ready to review:
dsh-task export <task-id>
Export stops DeepSeek and leaves it stopped. It captures committed and uncommitted
tracked work, saves a recovery bundle, and creates a new review branch in the host
repository. It refuses new, uncommitted files unless you add --include-untracked.
The output includes the exported revision and review branch; show includes the
transferred base. Compare against that base so any edits you supplied at startup
stay out of the agent's diff:
dsh-task show <task-id>
git diff <base> <review-branch>
git log <base>..<review-branch>
Write your findings in a nonempty report, then record the exact exported revision and prepare the change. Keep review and checks reports outside the host and integration worktrees so they stay clean:
dsh-task reviewed <task-id> --revision <exported-oid> --report <review-report>
dsh-task prepare <task-id>
prepare applies the diff from the transferred base in a separate host worktree
and commits it there. Inspect that worktree, run the project's checks, and save
the results in a checks report. To finish:
dsh-task finalize <task-id> --checks <checks-report>
dsh-task cleanup <task-id> --require-integrated
finalize fast-forwards the intended target branch. It requires the original host
checkout to be clean, on that branch, and still at the commit used by prepare.
Conflicts during preparation or a changed target leave the prepared branch
available for recovery. Review and checks reports record your verification; the
launcher doesn't judge code quality or run those checks for you.
Cleanup refuses work that changed after export, ignored files, and work it cannot preserve in the review. It removes the task container, workspace volume, and clean recorded integration worktrees, while keeping DSH home/session history and recovery records. You can also clean up a reviewed task without integrating it; see the task lifecycle for the conditions.
To continue working, use dsh-task resume <task-id>. dsh-task url <task-id> prints
the login URL again, and dsh-task list finds saved task IDs from any directory.
Its states come from local records, so active doesn't prove a container is
running. For a disposable session, dsh-task discard <task-id> asks for confirmation
and permanently deletes all container workspace files, including uncommitted,
untracked, and ignored work, without a review.
Isolation and security
The agent gets full DSH permissions inside the container. The core runs as UID/GID
10001 with a read-only root, dropped capabilities, no-new-privileges, writable
temporary filesystems, and persistent home/workspace volumes. Internet access stays
enabled for DSH and package downloads.
The host checkout, its .git, credential stores, SSH keys, and Docker socket stay
outside the container. The agent can read credentials you supply to DSH, plugin
runtime files, and any secrets in transferred Git history. Keep bundles and task
records private, and review what you transfer. Plugins are trusted inputs; the
Compose checks catch configuration mistakes, not hostile plugin code.
The web UI publishes only on localhost. Its login URL contains a browser token: treat the URL as a credential and don't forward the port publicly. Provider authentication is separate from browser access. Credentials entered in DSH persist in its home volume.
Reference
- Profiles: saved paths, ports, plugins, and key files.
- Transfers: snapshots, direct bundle export, imports, and manual review.
- Task lifecycle: command options, records, recovery, cleanup, and the Codex/Claude Code helpers.
- Isolation details: mounts, authentication, build inputs, and trust boundaries.
- Low-level launcher:
dsh.pycommands for managing a sandbox directly. - Plugin contract: project tooling, runtime hooks, and the hello example.
- Testing: local tests and Docker smoke tests.