mirage
strukto-ai
The World's First Unified Virtual Filesystem For AI Agents
PROJECT TOPICS
INSTALL REFERENCE
dsh plugin --profile web add github:Asuna486-desuwa/dsh-safety-net
该命令指向仓库当前默认分支;尚无绑定当前 commit 的完整验证结果。
PROJECT README
Self-protection guardrails for the DeepSeek Harness (DSH). When an agent runs autonomously, a wrong write can silently destroy the harness itself — this plugin makes that damage impossible by default and reversible by command.
中文文档见 README.zh-CN.md · Chinese docs live in README.zh-CN.md
DSH's own runtime state lives in plain files under ~/.dsh (profiles,
session state, patches) and under the plugin data directory. An agent that
misreads its sandbox boundaries can write/edit those files, corrupt the
harness, and leave you unable to start DSH at all. dsh-safety-net is the
seatbelt: it hard-blocks mutations on DSH critical assets, snapshots files
before refusing, and keeps a CLI recovery channel that works even when the
GUI is gone.
fs/write-intent and fs/edit-intent waterfall listeners hard-block any
mutation that targets a DSH critical path. Protected by default:
| Rule id | Path |
|---|---|
dsh-home |
~/.dsh (the DSH data root, $DSH_HOME override) |
plugin-data |
~/.claude/plugins/data/dsh-deepseek-dsh |
profile-manifest / profile-patch |
~/.dsh/profiles (profile manifests & patches) |
session-state |
~/.dsh/state (session state) |
A blocked mutation raises an FS_POLICY_DENIED error — the agent cannot
silently retry its way past it. Extra paths can be added via
safetyNet.extraProtectedPaths (see Configuration).
Before a protected path is refused, the original file is snapshotted into the backup store. Nothing is ever destroyed: every blocked write/edit leaves a restorable copy behind (unless the snapshot itself fails), so the worst case is one command away from being undone.
Five slash commands, registered on the DSH CLI surface, work even when the GUI is down:
/safety-net-status — guardrail health report (protected rules, backups, strict mode)/safety-net-backup — manual full snapshot of protected assets/safety-net-restore — list backups, or restore one by id/safety-net-repair — detect missing critical files and print recovery instructions/safety-net-approve <path> — one-time approval to write a protected path (grants a single bypass, then the guard is re-armed)See Commands for details.
Strict mode is on by default: safety-net declares a read-only default
sandbox mode and warns when the host sandbox default is wider
(workspace-write / danger-full-access). The declaration is advisory —
actual enforcement stays with the host sandbox backend, which safety-net
cannot force. Turn strict off only if you understand the trade-off
(safetyNet.strict: false).
Requires Node.js ≥ 20 and a running DeepSeek Harness (DSH) host.
Dependencies:
@deepseek-ai/cordisand@deepseek-ai/dsh-fsare declared as peer dependencies — they are provided by the DSH host runtime itself and are not fetched from the public npm registry (thedsh-fsversion DSH ships may not exist on public npm). Install this plugin inside a DSH profile; do notnpm installit standalone.
From npm:
dsh plugin add dsh-safety-net
From git:
dsh plugin add git+https://github.com/Asuna486-desuwa/dsh-safety-net.git
Manual mount: clone the repository and wire it into your DSH plugin flow
as usual — cordis.patch.yml already declares the bundle patch, and
package.json carries the dsh.bundle metadata.
All options live under the safetyNet key:
safetyNet:
# Strict mode: declares a read-only default and warns if the host sandbox
# default is not tightened. Default: true
strict: true
# Additional paths to protect (beyond the built-in DSH critical paths)
extraProtectedPaths: []
# Reserved — retention-based pruning wiring lands in a later release. Default: 30
backupRetention: 30
| Key | Type | Default | Description |
|---|---|---|---|
safetyNet.strict |
boolean | true |
Declares a read-only default sandbox mode; warns when the host sandbox default is wider (workspace-write / danger-full-access). |
safetyNet.extraProtectedPaths |
string[] | [] |
Extra paths treated as DSH critical assets. |
safetyNet.backupRetention |
number | 30 |
Max snapshots kept in the backup store before pruning (reserved; pruning wiring lands in a later release). |
safetyNet.dshHome |
string | env DSH_HOME or ~/.dsh |
Override the DSH data root (used by the guard, the backup store and the status report alike). |
safetyNet.pluginDataRoot |
string | ~/.claude/plugins/data |
Override the plugin data root (mainly for tests/injection). |
The backup store is created under <DSH_HOME>/safety-net/backups/.
Command names are registered without a slash (safety-net-status, ...) and
are shown below with a leading / as they appear in the DSH UI/CLI.
| Command | Behavior |
|---|---|
/safety-net-status |
Reports guardrail health: number of protected rules, stored backups, strict mode, and the resolved DSH home. |
/safety-net-backup |
Manually snapshots every protected asset into the backup store. |
/safety-net-restore |
With no argument, lists all backups (newest first). |
/safety-net-restore <id> |
Restores the files of the given backup id to their original locations. |
/safety-net-repair |
Detects missing critical files and prints recovery instructions (never auto-modifies anything). |
/safety-net-approve <path> |
Grants a one-time write bypass for a protected path (calls guard.approveOnce); the next matching mutation passes, then the guard re-arms. |
If a legitimate write is blocked — e.g. you really need to modify a file under a protected path — keep this in mind:
/safety-net-approve <path> grants a single write
approval for that path; the next matching mutation passes, then the guard
re-arms. (This wires guard.approveOnce into the CLI.)safetyNet.extraProtectedPaths are add-only at
runtime: to stop protecting one, remove the entry from the config and
restart DSH;~/.dsh, profiles, state, plugin data) cannot be
removed through configuration. strict only declares the sandbox posture
and does not lift path interception. To modify a built-in protected
file, unload this plugin first (dsh plugin remove dsh-safety-net), do the
edit, then re-add it.A runtime one-time approval channel (approveOnce, already unit-tested on the
guard) is planned for v0.2; until then the blocked error message points at the
two options above.
<DSH_HOME>/safety-net/backups/
└── <timestamp-id>/ # e.g. 1750000000000-a1b2c3
├── _meta.json # maps each snapshot file back to its EXACT original path
└── <relative-path> # original path, drive letter stripped, '/' separators
Each snapshot is one directory named by a time-based id; the original relative
path is preserved beneath it, and _meta.json records the full original path
(drive letter included) so restore writes every file back to exactly where it
came from — even across Windows drive letters.
This plugin intentionally does not:
<DSH_HOME>/safety-net/backups/;node --test tests/*.test.mjs
Tests run against an injected fake fs adapter and injected dshHome /
pluginDataRoot overrides — they never touch your real ~/.dsh.
MIT
CLASSIFICATION EVIDENCE
系统优先读取 GitHub Topics,再与站内分类词典和词根规则比对。当前命中: guardrails、safety。