Provides DeepSeek Harness agents with automatic checkpoints before risky edits, structured Git tools, and approval-gated write operations in a single npm bundle.
English | 中文
- Automatic rollback protection. Before each risky operation—
write,edit,str_replace_editor, and, by default,bash—the worktree is snapshotted underrefs/harness-checkpoints/<session-id>.git_checkpoint_listshows the session's checkpoint history andgit_checkpoint_restorerolls back to any one of them — not just the latest. Because shell commands cannot be integrated directly into the agent's edit pipeline, the system prompt defines a mandatory Git safety procedure: create a checkpoint before every mutating tool call, verify the result withgit_status, and restore the checkpoint if an error occurs. - Structured repository state.
git_status,git_diff, andgit_logreturn typed data parsed fromporcelain v2, allowing the model to reason over repository state without parsing terminal formatting. - Durable, session-scoped checkpoints. Snapshots are stored as local refs under
refs/harness-checkpoints/<session-id>. They are not pushed or pruned, and rollback does not remove untracked files. If no checkpoint exists—typically during the first edit after a clean state—git_checkpoint_restorerestores fromHEAD.
All mutating tools are approval-gated through the Harness UI, using the same approval mechanism as bash.
| Tool | Purpose |
|---|---|
git_status / git_diff / git_log |
Structured reads of the working tree |
git_commit |
Commit staged changes (approval-gated) |
git_restore |
Discard worktree changes (approval-gated) |
git_checkpoint |
Manual snapshot (approval-gated) |
git_checkpoint_list |
List session checkpoints, newest first, for selection |
git_checkpoint_restore |
Roll back to a selected checkpoint, or the latest when omitted (approval-gated; falls back to HEAD when none exists) |
- DeepSeek Harness — dev checkout or local build; the
@deepseek-ai/*packages it needs come with the install and are declared as peers - A
gitexecutable on the host
Install through the Harness plugin command:
dsh plugin --profile web add dsh-gitdsh plugin runs pnpm add dsh-git inside the profile and auto-registers the bundle through its dsh.bundle.patch. Restart, and the three plugins (git-local, tool-git, git-checkpoint-policy) plus the eight git_* tools are live.
Alternatively, install the package manually and mount the plugins:
cd ~/.dsh/profiles/<profile>
npm install dsh-git- insert:
- id: git-local
name: 'dsh-git/local'
- id: tool-git
name: 'dsh-git/tool'
- id: git-checkpoint-policy
name: 'dsh-git/checkpoint-policy'Restart after editing the profile's cordis.patch.yml.
Do not mount
dsh-git/gitas a plugin entry. The definition registersctx.gitautomatically; mounting it alongsidegit-localcauses a duplicate-service error.
- Confirm that the plugin inventory in Settings contains
git-local,tool-git, andgit-checkpoint-policy. - Run
git_statusand confirm that it returns a structured report containingbranch:. - Run
git_commit, approve the operation, and confirm that it returnscommitted <sha>. - Edit a file, confirm that a checkpoint ref is created under
refs/harness-checkpoints/, list it withgit_checkpoint_list, and usegit_checkpoint_restoreto restore the pre-edit state.
The built lib/ directory is synchronized from the upstream Harness repository (packages/git/ at https://github.com/deepseek-ai/deepseek-harness) with ./sync.sh [UPSTREAM_DIR]. The script copies each component's lib/ directory to lib/<component>/, rewrites internal @deepseek-ai/dsh-git imports to the package self-reference dsh-git/git, and pins the version. The upstream repository contains src/ and tests/; this repository distributes the build output.
- Remote and pull request operations are not supported;
push,fetch, andghworkflows remain shell-driven. - Checkpoint restoration does not remove untracked files; support for
git cleanis deferred. refs/harness-checkpoints/*are local refs and are neither fetched nor pushed or pruned.- If no approval service is mounted, mutating tools run without approval gating.
- The
@deepseek-ai/*peer dependencies are provided by Harness rather than published as registry packages.dsh-gitmust be installed in a profile belonging to a compatible Harness installation.
- dsh-git-identity — pin commit authorship to the environment identity.
- dsh-gh-bridge — bridge a macOS Keychain GitHub token into sandboxed
gh. - dsh-auto-blame — automated blame.