Introduction¶
One of the core design principles of DeepSeek Harness (DSH) is “Everything Is a Plugin”. In long agent sessions, frequent file rewrites can easily lead to uncontrolled state. When an error occurs in a turn, developers usually need to manually run git commands to roll back, or simply lose the development trail. dsh-turnsnap aims to solve this problem by listening to DSH’s event stream and automatically converting each completed agent turn into a rollback-capable Git checkpoint.
Installation¶
This plugin requires no additional configuration and works immediately after installation.
dsh plugin --profile <your-profile> add dsh-turnsnap
After installation, the plugin hot-reloads and takes effect in all Git workspace sessions under the current profile.
How It Works¶
The plugin listens for Harness’s agent/turn-stopping event. When the event is triggered, the system checks the session workspace (agent.session.header.cwd):
1. If the directory is not a Git repository, or the working tree is clean (no uncommitted changes), skip.
2. Otherwise, run git add -A to stage all changes and create a commit labeled with [turnsnap].
3. The commit message format is fixed as: [turnsnap] turn N · M files · HH:MM:SS.
To prevent concurrent conflicts, the plugin internally uses a serialization queue to process checkpoint creation. Git commands are run through Harness’s shell service to ensure permission isolation.
Tools¶
Three tools are provided to control checkpoint behavior in a session:
| Tool Name | Effect |
|---|---|
turnsnap_pause |
Pause automatic commits until resume is called |
turnsnap_resume |
Resume automatic commits |
turnsnap_status |
Report the plugin’s enabled status, counters, and the last commit message |
You can ask the model to say “pause turnsnap” in a session, or call the above tools directly in a script.
Cautions¶
- Staged Changes:
git add -Awill merge staged but uncommitted changes into the current checkpoint. If you retain a specific staging state at a turn boundary, callturnsnap_pausefirst. - Ignored Files:
.gitignorerules still apply duringadd -A, and ignored files are not committed. - Pre-commit Hooks: Checkpoint commits use the
--no-verifyflag and do not run local pre-commit hooks. - Concurrency Limit: Only one checkpoint is generated per repository per turn. When child agents and parent sessions share a workspace, they generate the same commit.