Preface¶
In DeepSeek Harness (DSH), letting an agent modify code commonly means handing off to the model to run git add, commit, push directly in bash. When a session ends, the workspace often still has uncommitted changes, and the branch may never have been pushed; the model may not remember to clean up before the turn ends, and it is hard to see at a glance “what exactly was missed” from a single conversation.
The following introduces the community plugin stansz/dsh-git (GitHub: stansz/dsh-git, catalog page: skillhub.cn/plugins/stansz/dsh-git). It consolidates everyday git operations into a single git tool and /git command, uses guards to intercept raw git invocations in the shell that can easily bypass the workflow, and automatically commits and pushes paths recorded during the current session at turn boundaries. The goal is to make “nothing is left uncommitted” not depend on the model’s memory. The plugin is published by maintainer stansz, categorized as a client-side plugin; the current GitHub star count is 1. Licensed under MIT, the README explicitly states that this is a third-party bundle, not an official DeepSeek package.
Three Packages, Two Installation Lines¶
Git-related capabilities in the ecosystem are split across three repositories, and the installation order has a hard requirement:
| Package | Repository | Purpose |
|---|---|---|
dsh-git-core |
github.com/stansz/dsh-git-core | Shared library: unified git execution, state storage, recording files modified by the session; does not register tools, commands, or listeners |
dsh-git (subject of this article) |
github.com/stansz/dsh-git | git tool, /git, bash/pwsh guards, turn-boundary auto commit/push |
dsh-git-worktrees |
github.com/stansz/dsh-git-worktrees | Optional: create worktrees per task, worktree tool, and edit guards on protected branches |
You must install core first. dsh-git-core is a library, not a plugin; its bundle patch is an empty array. After installation, it lands in the profile’s node_modules, resolved by dsh-git via lib/core-loader.mjs. The README explains that link: installation does not hoist dependencies, so bare imports will fail to resolve.
The minimal combination is core + dsh-git, which covers tools, guards, and automatic sync. Worktree-related configuration (such as worktreeRoot, autoWorktree, worktrees) belongs to the optional package dsh-git-worktrees and is not part of this bundle’s configuration lines.
Core Features¶
Unified git Tool and /git¶
The plugin registers a git tool with DSH, presenting the model with a complete set of instructions for ten actions; humans can use /git to print the same status. The action overview is as follows (consistent with the README):
- clone: Clone from a URL;
pathis the landing path, andbranchcan specify a branch to check out at clone time. - init: Create an empty repository at
path;branchis the initial branch name. - status: Status of a single repository or all repositories under a directory: branch, ahead/behind, changed paths, worktrees; optional
pull: trueto view open Pull Requests. Read-only. - save: Commit changes recorded during the current session in this repository; when
pathsis not passed, only these files are committed, and other dirty files are reported separately to avoid sweeping in changes from other sessions;pathsandmessagecan be used to override. - publish: Push the current branch; the first push sets the upstream; protected branches are rejected by default unless
allowProtected: true.forceWithLease: trueis used to replace the remote reference for this branch after a rebase (git will refuse if the remote has advanced). - sync: Fetch and pull in the baseline; without extra parameters, fast-forwards when “this branch has no own commits yet”, otherwise reports a divergence;
rebase: trueormerge: truehandle the integration, and conflicts abort and list the paths. - pr: Open a PR for this branch, or return the already-open PR; it will not open a duplicate second one.
- merge: Merge a PR by number, or merge the PR already opened for the current branch; on success it deletes the remote branch that still points to the merged commit and fetches
origin(the result includesbaseFetched), facilitating laterprune. - finish: Finishing-unit work: save dirty changes, publish, open or reuse a PR, and report.
- prune: First dry-run, then clean up deletable branches left by this tool (task branches with no worktree and no own commits, branches proven deletable by merged PRs, etc.);
apply: trueactually deletes them.
Shell Guards (Agent Tool Calls Only)¶
For git commands executed by the agent in bash and pwsh, the plugin inspects them at the tools/pre-execute stage; your own terminal is unaffected.
- Daily workflow redirection:
git add,commit,push,pull,fetch,rebaseare rejected, with a prompt to usesave,publish,syncinstead (for the rebase scenario usesyncwithrebase: true). - Reject work loss:
reset --hard/--merge/--keep,clean, force push,branch -D,checkout -- <paths>,restore,stash drop,tag -f, history-modifying commands, as well asgc --prune=now,git prune, etc.;git prune -n/--dry-rundoes not delete objects and is allowed. - Other commands proceed normally:
config,remote,tag,branch,checkout,merge,clone,worktreeand read-only operations, along with maintenance-type commands, are not blocked;fetch --dry-run,push --dry-run,clean -n, and similar dry runs execute without sending changes.
The README states: detection is best-effort, not a security boundary (it only parses command-line tokens and does not perform expansion). Setting guardMode: warn allows all commands (including destructive ones) and does not report; for the full rejection list, see docs/guard.md in the repository.
Turn-Boundary Automatic Sync¶
It does not depend on which specific commands were used in the session to write files. Trigger times:
agent/turn-stopping, or asession/eventcarryingturn/end;- If there is a long period without a turn boundary: each tool call starts a settle timer, and after 4 seconds of silence the sync is executed; when tool calls are continuously issued, sync still happens at least once per minute.
In each repository where changes were recorded during the current session, only “session-recorded paths ∩ currently actually dirty paths” are committed; other dirty files remain in the workspace and are listed in the report. Commit messages look like dsh: turn 3 — a.mjs, b.mjs or dsh: a.mjs (the pattern is still visible in the truncated part of the README). Then it pushes what is deemed safe. The README emphasizes: this kind of behavior is deliberately not an optional thing that requires the model to “remember to do”.
Installation and Activation¶
In the profile directory (the installation target directory, not the global prefix), run:
pnpm add github:stansz/dsh-git-core # shared library, must be installed first
pnpm add github:stansz/dsh-git
package.json indicates Node >= 22; the current plugin version is 0.2.0. The README states that all settings have usable defaults and work out of the box with zero configuration; override methods are described in the README’s Settings and Changing a setting sections (this article does not expand on all fields, defer to the repository documentation). For per-task workspace isolation, install the optional dsh-git-worktrees according to docs/install.md.
Typical Usage¶
Routinely let the model go through the tool rather than shell git:
- Use
git→status(withpull: trueif needed) to see branches, changes, and PRs. - After code changes, use
saveto commit current-session changes; usepublishwhen you need to push to the remote. - Use
syncto align with the baseline; useprto open or check a PR; usefinishfor an end-to-end wrap-up. - Type
/gitin the conversation to read the same status the model sees.
If the model still tries git commit in bash, the guard will reject it and point to the actions above—this is by design, not an installation failure.
Use Cases and Notes¶
Suitable for: Teams or individuals who want agents in DSH to modify the same batch of repositories over the long term, want a consistent commit/push rhythm, and want to reduce “a dirty tree or unpushed commits left at session end”.
Notes:
- The plugin executes git and network operations with the permissions of the current dsh process; before installing, read the source code and the MIT license to confirm it meets your compliance requirements.
- The guard does not cover git operations you run in an independent local terminal; do not treat it as a sandbox against malicious commands either.
- The community catalog skillhub.cn has no official affiliation with DeepSeek / High-Flyer; the DSH ecosystem is “everything is a plugin”, and the subject of this article is a third-party bundle.
- The optional worktree capability is separated from the configuration of the main package in this article; install
dsh-git-worktreeswhen needed.
Conclusion¶
stansz/dsh-git consolidates git/GitHub operations in DSH into a predictable path: the git tool handles ten actions from clone to prune, guards steer everyday shell flows toward the same API, and automatic sync fills in commit/push at turn end or after a brief silence. If you are wiring an agent to write code in a profile, you can first install core and this package in the order given in the README, and use /git and status to verify that the status meets expectations.
- Catalog page: https://www.skillhub.cn/plugins/stansz/dsh-git
- Source code and documentation: https://github.com/stansz/dsh-git