DSH Plugins Marketplace

DSH Plugins

Plugins

/

Security & Audit

/

dsh-safe-delete

N

dsh-safe-delete

Manifest valid

Tools guard that moves agent-issued `rm` targets to the macOS Trash instead of deleting, with a shell-aware lexer covering compound and disguised commands; a switch in Settings → General turns it off.

UI (client)hasBundlePatch

dsh-safe-delete

Every rm an agent runs becomes a recoverable move to the macOS Trash.

License Platform Version DeepSeek Harness

rm → Trash Global Tools Guard Settings Switch Shell-aware Lexer Zero Dependencies

One global guard on the tools registry — ctx.tools.guard() —— no tool, prompt, or core changes

A DeepSeek Harness host-side plugin that makes agent-issued rm commands recoverable: targets are moved to the macOS Trash instead of deleted, across GUI sessions, automation runs, headless bridges, and subagents. One switch in Settings → General turns it off — disabled, commands run with native DSH behavior.

Capabilities

  • Recoverable deletion — an rm in command position is denied and rewritten to /usr/bin/trash -v; the model receives a report of exactly what was moved, so nothing silently disappears.
  • Every session, one guard — registers once on the DSH tools registry; GUI chats, scheduled automations, headless bridges, and subagents are all covered with zero per-session wiring.
  • Shell-aware interception — quote-preserving lexer catches sudo rm, /bin/rm, env/nice-prefixed rm, VAR=x rm, and xargs rm inside compound commands (&&, ||, ;, |).
  • Fail-safe by design — constructs that could hide an rm ($(...), backticks, subshells, heredocs, eval, nested sh -c) are denied with guidance instead of rewritten; a failed trash is reported, never retried as real deletion.
  • Runtime switch — toggle in the web GUI (Settings → General → Safe Delete) or via POST /safe-delete/config; the state persists across restarts in $DSH_HOME/storages/safe-delete.json.

How it works

The plugin installs one guard on the DSH tools registry. Every bash tool call is scanned before execution:

flowchart LR
    A["bash tool call"] --> B{"rm in command<br/>position?"}
    B -- "no" --> C["native execution"]
    B -- "yes" --> D{"switch on?"}
    D -- "off" --> C
    D -- "on" --> E{"safely<br/>rewritable?"}
    E -- "no: subshell, eval,<br/>heredoc, backticks" --> F["deny with guidance,<br/>nothing runs"]
    E -- "yes" --> G["run trash -v, deny the<br/>original, report targets"]

Intercepted calls are denied and re-executed as trash by the guard itself, so quoting and globs survive:

[dsh-safe-delete] intercepted `rm` — the targets were MOVED TO TRASH (recoverable),
not deleted. Original command denied. Targets: build/ dist
trash: build/ → .Trash/build/

Plain non-rm commands pass through untouched; commands that merely mention rm (echo rm, grep "rm " log) are ignored. rm flags (-f, -r, …) are stripped rather than honored: trash moves whole directories natively.

Scope and limits

CoveredNot covered
Commandsrm, sudo rm, absolute-path rm, xargs rm — simple and compoundfind -delete, unlink, git clean, language runtimes' own file APIs
Guaranteeintercepted at the guard layer, before executionthe guard is an accident-prevention net for the most common destructive verb, not a sandbox

sudo rm is intercepted before sudo ever runs, but trashing files that require root can still fail — trash errors are reported verbatim.

Install

dsh plugin --profile web add github:NattoCB/dsh-safe-delete

Restart the DSH web process — host-side bundles and their patches load at process start. On boot the plugin logs rm guard active once.

Configuration

SurfaceHow
Web GUISettings → General → Safe Delete — the switch takes effect on the next bash call, no reload
HTTPGET /safe-delete/config → { "enabled": bool }; POST /safe-delete/config with { "enabled": bool }
File$DSH_HOME/storages/safe-delete.json — { "enabled": bool }

Default: enabled. A missing or corrupt state file also resolves to enabled — installing the plugin expresses the intent to have the guard, and a corrupt file never silently downgrades protection.

Development

npm test        # node --test: lexer, rewrite matrix, guard contract, switch store/API

The lexer/rewriter is exported as exports._internals so tests exercise the real code paths (analyzeCommand, tokenize, splitSegments, makeGuard, ConfigStore, handleConfigRequest).

License

MIT — part of the awesome-dsh-plugin ecosystem.

Compatibility

DSH 0.1.7-alpha.2: failedDSH 0.1.7-rc.1: failedDSH 0.1.7-rc.2: failed

Versions

Latest versionPublishedSize
0.1.0——
0.1.1——
0.1.2——
0.1.3——
0.1.4——
0.1.5——
0.1.6——
0.1.7——
0.1.8——
0.1.9——
0.1.10——
0.1.11——
0.1.12——
0.2.0——
0.2.1——

Comments

Loading…

Similar plugins

dsh-disk-guard

by kaka-crypto

Disk guard for DeepSeek Harness: redirect downloads/artifacts/caches/temp off the C: drive, inject a path-discipline prompt into every session, disk_guard tool for status/cleanup.

Tools & CapabilitiesManifest valid

★ 4

MIT

TypeScript

Aug 28, 2026

dsh plugin --profile web add dsh-disk-guard

by AhYi8

Rewrites agent-issued delete commands (PowerShell `Remove-Item` and its aliases, Bash `rm`/`unlink`/`rmdir`, CMD `del`/`erase`/`rd`/`rmdir`) into system recycle-bin operations on Windows, Linux and ma

Security & AuditManifest valid

★ 0

Python

Oct 12, 2026

dsh plugin --profile web add dsh-agent-recycle-guard

Taints the agent when tool results carry untrusted content, gates the privileged calls that follow, and refuses credentials passed to network-capable tools in every mode.

Security & AuditDevelopment & InfrastructureManifest valid

★ 0

dsh plugin --profile web add dsh-taintguard

by xxiiiixx

Workspace Tmp for DeepSeek Harness: gives the agent a temporary directory beside the workspace for test files and scratch output, with a workspace_tmp tool and automatic deletion, so nothing pollutes

Manifest valid

★ 0

MIT

JavaScript

Oct 19, 2026

dsh plugin --profile web add dsh-workspace-tmp

by ChaoJie0

Zero-intervention permission gate for DSH agents on macOS: auto-allows local writes made reversible by git or Time Machine, blocks network, package installs, process control and sensitive-path reads,

Security & AuditManifest valid

★ 0

MIT

TypeScript

Oct 22, 2026

dsh plugin --profile web add dsh-tm-guard

by tancheng33

Runtime security gate on the tool pipeline: denies calls naming hosts outside an egress allowlist, redacts credentials from results at the canonical value rather than only the rendered content, and ap

Security & AuditDevelopment & InfrastructureManifest valid

★ 1

↓ 95/wk

MIT

TypeScript

Sep 22, 2026

dsh plugin --profile web add dsh-egress-guard