dsh-plugin-backup: Categorized Backup and Verifiable Recovery for DeepSeek Harness

Preface

After running DeepSeek Harness (DSH) for a while, $DSH_HOME accumulates settings patches, skill trees, plugin profiles, sessions, and local storage. Manually copying the entire directory makes it hard to tell apart “what should be backed up,” and just as hard to confirm after problems arise whether an archive is complete and can be safely written back. The community plugin dsh-plugin-backup (maintainer shiinakaze) turns backup into a workflow that packages by category, is verifiable, restorable, and downloadable, with optional GitHub sync; the Web settings page, model tools, and CLI all share the same engine and a single-run lock.

What Is This

dsh-plugin-backup is a backup plugin for DSH (npm package name dsh-plugin-backup, current version 1.0.0, MIT license). It packages $DSH_HOME into verifiable, restorable, downloadable archives by category, following the naming convention dsh-backup-<YYYYMMDD>-<HHmmss>. When $DSH_HOME is not set, it falls back to ~/.dsh. The plugin has no build step and no third-party runtime dependencies: the host side is pure ESM, and the browser side is a directly loadable CommonJS factory.

Core Features

Backup Categories

Category key Primary sources relative to $DSH_HOME Backed up by default
settings settings.yaml*, cordis.patch.yml*, .credentials.yaml*, .anonymous-user-id, dsh-skill-hub.json, skills-market-sync.json On
skills skills-management/** On
plugins profiles/*/package.json, pnpm-lock.yaml, pnpm-workspace.yaml, cordis.patch.yml*, and plugins/** On
sessions sessions/** Off
storages storages/** Off

Always excluded at any depth: node_modules, .git*, symlinks, and the backup root directory itself (to avoid recursion when the backup directory is nested inside $DSH_HOME).

What a Single Backup Produces

Each backup directory contains per-category *.tar.gz archives plus a last atomically written manifest.json (with schema, host info, per-category file counts/bytes/sha256/archive info, and the latest verification result). In-progress files carry a .part suffix; leftovers from crashes are cleaned up or ignored at the start of the next run.

Existing backups support: download (per category or manifest), verify, preview restore, restore, delete (restore/delete require secondary confirmation).

Settings (Web: Settings → Data backup)

  • Backup settings: backup path (if empty, C:\Users\<user>\dsh_backups on Windows, ~/dsh_backups elsewhere; supports ~ and ${DSH_HOME} expansion), schedule interval (off / 15 minutes / hourly / 6 hours / daily / weekly), number of backups to keep, verify immediately after creation.
  • Backup categories: check the categories to include in this run or the default scheduled task; “Back up now” only backs up the checked items, and after saving the settings, this selection also serves as the scheduled default.
  • GitHub sync: toggle, owner/repo (a full URL also works), branch, subdirectory, token environment variable name, whether the token is detected, and push / pull.

User-level settings are written to $DSH_HOME/dsh-plugin-backup/settings.json (permissions 0600), shallow-merged with the deployment baseline in the profile’s cordis.patch.yml (user level takes precedence).

Model Tools

Tool Main parameters Purpose
backup_run categories?, label? Create a backup immediately
backup_list limit? List backups, newest first
backup_verify id Recompute sha256 and check tar structure
backup_restore id, categories?, dryRun?, force? Restore; dryRun only outputs the plan
backup_delete id, force? Delete; protects the newest backup when older ones exist
backup_sync direction, ids? Push or pull via GitHub

Typical flow: backup_run before risky changes, backup_verify afterwards, and backup_restore if necessary. backup_restore verifies first; corrupted backups are refused by default unless force is set.

GitHub Sync

  1. Enable sync on the settings page and fill in owner/repo, branch, and subdirectory.
  2. Token resolution order: environment variable (default DSH_BACKUP_GITHUB_TOKEN, can be renamed in settings); or $DSH_HOME/dsh-plugin-backup/github-token.json ({"token":"…"}, mode 0600). Tokens are never written to configuration, logs, or tool output.
  3. Push uploads files one by one through the Contents API — archives first, manifest.json last; remote files with identical content are skipped. Pull only downloads backups missing locally and verifies each archive against the sha256 in the manifest; mismatches are discarded with a reason.

Remote layout: <subdir>/<backupId>/{manifest.json,<category>.tar.gz}.

Installation and Activation

The plugin targets the 0.1.7 and 0.2.0 lines of @deepseek-ai/dsh (engines.dsh and peerDependencies are ^0.1.7-rc.2 || ^0.2.0-rc.1). Desktop uses the desktop profile; install via the in-app plugin manager (or dsh plugin --profile desktop add …) and restart the application.

Web profile installation example (from the repository README):

# Local development directory
dsh plugin --profile web add file:C:/path/to/dsh-plugin-backup

# Or from GitHub
dsh plugin --profile web add github:shiinakaze/dsh-plugin-backup

dsh plugin add records the dependency and writes the package name into dsh.profile.bundles. After installation, reload or restart the Web interface and open Settings → Data backup.

Note: file: installation is a snapshot; after modifying the plugin source, you need to run dsh plugin --profile web remove <name> and then re-add it. For non-Web profiles (no webServer service), download is unavailable, but all other features and tools remain usable.

Typical Usage

Manual Backup in Web

  1. Go to Settings → Data backup.
  2. Check the desired categories under Backup categories (e.g., the defaults: settings, skills, plugins).
  3. Click Back up now (N categories) and view the id, time, size, and verification result in Existing backups.
  4. Use the inline verify or download menu if needed.

Pre/Post-Change Protection with Model Tools

In sessions that support DSH tools, you can create a backup before modifying configuration or plugins:

  • backup_run: package immediately (optional categories, label).
  • After changes, backup_verify (passing the backup id).
  • If a rollback is needed: backup_restore, first with dryRun: true to preview the plan, then perform the actual restore.

Large Skill Trees and Retention Policy

The README has been tested on a real harness home: the skills category may still exceed 100 MiB after compression; the default per-category archive limit is 512 MiB. If exceeded, you can raise maxArchiveBytes in the settings, or disable the skills category and switch to manual backups. With skills enabled and 20 backups retained, local storage may reach the ~3 GB range — plan your disk space and retention count accordingly.

Use Cases and Caveats

Suitable for: regularly backing up DSH settings, skills, and plugin combinations, or backing up before changes; syncing the backup directory across multiple machines via GitHub; wanting verification and dry-run before restoring.

Caveats:

  • The plugin reads and writes $DSH_HOME and the backup path with the permissions of the current DSH process; before installing, read the source code and the MIT license, and understand which categories will back up sensitive files such as .credentials.yaml*.
  • sessions and storages are disabled by default; confirm size and privacy before enabling them.
  • Backup ids must match ^dsh-backup-\d{8}-\d{6}$; archive entries reject unsafe items such as absolute paths (see the README’s security boundary table for details).
  • The community catalog skillhub.cn plugin page and the GitHub repository are maintained by the community and have no official affiliation with DeepSeek / High-Flyer; star counts and descriptions are subject to the catalog page.

Conclusion

dsh-plugin-backup splits DSH’s local state into five manageable archive categories and provides consistent creation, verification, restoration, and optional GitHub mirroring across the Web UI, model tools, and CLI. If you are already using DSH for long-term development or deployment, install it with the commands above, complete the path and category configuration in Settings → Data backup, and then perform your first Back up now.

羽毛球分组比赛记分
小程序二维码

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

Xiaoye