Community plugin

mokuyoaxis / @mokuyoaxis/agent-guard

Make destructive AI-agent actions reversible by default — quarantine + audit + human escalation for rm/git destructive operations. Reliability infrastructure, not a sandbox.

  • Python
  • MIT
  • 25 stars
  • Nov 22, 2026

About this plugin

Written by the registry from verified metadata, not from the README.

@mokuyoaxis/agent-guard is a DSH plugin published from the mokuyoaxis/agent-guard repository.

  • Listing statusManifest verified
  • Manifest checkedNov 21, 2026
  • Package@mokuyoaxis/agent-guard
  • Package version0.3.1
  • DSH engine0.1.5-rc.1 || 0.2.0-rc.2 || 0.2.1-alpha.4
  • Source commit9ffb7c4
  • Repository createdAug 22, 2026

Capabilities and topics

ai-agentsdeepseek-harnessllm-toolssafety
From the repository README

README

Everything below this line is the repository's own document, cached here. This site did not write or review it.

Cached versionView on GitHub

Coding agents fail in predictable ways: an over-broad rm wipes uncommitted work, a diagnostic dump leaks credentials, or a CLI update silently breaks a hook. Agent Guard puts deterministic safety checkpoints and empirical verification around your coding agent, backed by a shared Python Core (3.9+) and optional host integrations.

[!IMPORTANT] AI agents configuring this repository: Before editing host configuration or bridges, read adapters/INTEGRATION.md, the setup workflow, and the adapter guide for your target host. Verify against the live host version and its official hook docs, then report only observed coverage—installing a Skill or copying config does not prove interception is active.

Capabilities at a glance

CapabilityWhat it doesGuides & contracts
Delete-guardRecoverable deletion and Git snapshots before destructive overwrites; Cleanup Copilot inventory and reviewed maintenance tasks; workspace budgets, rate/repeat limits, and protected paths; transaction restore, manual GC, and optional local MCP toolsSkill & CLI · Cleanup Copilot · Deletion limits · Recovery & GC · MCP tools · MCP doctor
Exfil-guardOutbound scanning for documented credential formats, secret source references, and host-identifying paths; plan-verified redaction; scalar-free JSON/dotenv inspection (safe_view)Skill & CLI · Rules · Safe config view
Guard-labControlled experiments in disposable fixtures using four zero-model calibration controls, synthetic markers, declared-channel observers, and matched guard-off / guard-on runsLab guide · Four-control example · Evidence levels

Core and adapters form shared infrastructure across all three modules. After an incident, recovery-audit provides a separate workflow for reconstructing a workspace from surviving Git, session, and cache records.

How Agent Guard works (and what it does not claim)

  • Guidance vs. enforcement: Skills teach the agent safe habits, while automatic interception depends on an active host hook (PreToolUse or the DSH plugin) and its covered tools. The optional local MCP server exposes explicit maintenance tools—it does not intercept native shell or editor calls that bypass it.
  • Reliability infrastructure, not an OS sandbox: Agent Guard runs with the same OS privileges as the agent. It is built to catch mistakes—wrong working directories, mis-expanded commands, accidental leaks—rather than contain a determined adversary sharing the same user account (Threat model).
  • Fail-closed decisions on destructive operations: All paths share a single verdict protocol (ALLOW · SANITIZE · RELOCATE · SNAPSHOT · ASK · BLOCK, aggregated with BLOCK > ASK > RELOCATE/SNAPSHOT > SANITIZE > ALLOW). When Delete-guard recognizes a supported destructive command (or encounters unparseable shell syntax) and cannot statically determine its targets or effects—such as unresolved shell variables, command substitution, unbalanced quotes, indirect interpreters, or stdin-fed targets—it refuses with BLOCK rather than guessing. Unrecognized benign commands (such as printf "$PWD" or $(pwd)) still return ALLOW_NOOP (Policy contract).
  • Per-workspace policies: Delete-guard budgets, rate limits, and protected paths apply per workspace root via .agent-guard/delete-policy.json, falling back to built-in defaults for omitted keys (Workspace configuration).

Installation & versions

Core requires Python 3.9+ and Git (examples assume a POSIX shell). The optional local MCP server requires Python 3.10+ and its separately installed pinned MCP SDK.

Install the current 0.3.1 release into a stable, user-owned prefix:

npm install --prefix /absolute/path/to/agent-guard-install @mokuyoaxis/agent-guard@0.3.1

Your package root is /absolute/path/to/agent-guard-install/node_modules/@mokuyoaxis/agent-guard (keep the @mokuyoaxis/ scope). You can also run directly from a Git checkout:

git clone https://github.com/mokuyoaxis/agent-guard.git
cd agent-guard

Verify exact publication details on GitHub Releases (0.3.1) or npm (0.3.1). See Getting started for offline tarball installation, upgrades, and full dependency details (including Node 22 for the optional DSH read prototype and Python 3.11+ for Kimi TOML helpers).

ReleaseKey additions
0.3.1Cleanup terminal review overhaul (permanent-first, readable/exact sizes, >20-root summary + read-only list), unique CLI ID prefixes, multi-target --targets-file handoff, exact-txid and gc.py --task GC guidance, staged cross-filesystem recovery & manual_review_items, agent-guard-delete-policy CLI, three-Skill installer
0.3.0Reviewed maintenance workflow (saved target plans, single-step operator approval, agent task execution/query), optional quarantine requirement, linked Skill installer, optional Codex native confirmation form
0.2.9Read-only Cleanup directory overview (--discover) and targeted measurement (--measure), two read-only MCP tools, faster plan scans
0.2.8Local MCP service diagnostics (doctor.py mcp) and protocol-interruption recovery checks
0.2.7Cleanup Copilot plans, shared deletion admission (capacity, budgets, rate/repeat limits, protected paths), optional local MCP server
0.2.6Optional Kimi Stop recovery feedback and doctor checks, DSH Lab preflight diagnostics, DSH 0.2.1-alpha.4 deletion support, Kimi 2.3.0 Bash profile
0.2.5 / 0.2.4Earlier stable releases (explicit storage/GC/NOOP feedback, durable relocation, trash_index queries)
0.2.5-rc3 / 0.2.4-hotfix.1Opt-in channels (npm tags rc and hotfix; neither replaces latest). 0.2.4-hotfix.1 backports quarantine control-path protection onto 0.2.4

Note: Deletion admission limits introduced in 0.2.7 can refuse high-volume or unprotected deletions that succeeded on 0.2.6 and earlier. Upgrading from an older version requires an explicit install/upgrade step; global Skills and host configurations are not updated automatically.

Core workflows

1. Recoverable deletion & reviewed cleanup (Delete-guard)

Run safe_delete.py from the workspace root you are protecting, pointing to your installed package or checkout root:

python3 /absolute/path/to/agent-guard/skills/delete-guard/scripts/safe_delete.py src/old_module.py --dry-run
python3 /absolute/path/to/agent-guard/skills/delete-guard/scripts/safe_delete.py src/old_module.py
python3 /absolute/path/to/agent-guard/skills/delete-guard/scripts/restore.py list
python3 /absolute/path/to/agent-guard/skills/delete-guard/scripts/restore.py '<txid>'

Execution & recovery guarantees:

  • Relocate vs. discard: Valuable files move into workspace quarantine with exact recovery paths recorded in a transaction manifest. Provably regenerable, Git-ignored build artifacts may be deleted directly unless the operator requires quarantine.
  • Git & restore safety: Supported Git overwrites snapshot tracked state first, and hard-reset collisions with untracked or ignored content are refused. --force restore moves the current occupant to a separate quarantine transaction before restoring.
  • Non-destructive dry runs & advisory checks: check.py and safe_delete.py --dry-run leave command targets untouched (they may create quarantine/audit metadata and a local Git exclude entry). Exit code 0 from an advisory check reports assessment completion—never permission to run a BLOCK or ASK command.
  • Operational accounting: Quarantined files still occupy disk until you run manual garbage collection (GC). ALLOW_NOOP means no supported destructive pattern was matched, not that arbitrary shell scripts are safe. Failed operations can leave partial state—check reported txids before retrying. See Recovery & GC and Audit metadata.

Reviewed batch maintenance (0.3.0): For multi-root cleanup, Cleanup Copilot separates proposal, human approval, and agent execution. Save an explicit target list (optionally requiring quarantine for regenerable artifacts), review the full selection in your terminal and approve once—or, when using the optional Codex native form, open the exported complete list (host_approval.review.file), review the selected targets, and confirm in the form—then let the agent execute and query by task ID via CLI or MCP while keeping all path protections, budgets, and rate limits active. Default read-only discovery/measurement (--discover, --measure) never authorizes deletion; --save-plan and --approve persist control metadata locally without moving files.

2. Outbound inspection & redaction (Exfil-guard)

Before writing drafts or sending prompts externally, scan with check_span.py or rewrite with sanitize.py. Call them from your workspace pointing to your installed package or checkout root (or omit the prefix when already at the repository root):

python3 /absolute/path/to/agent-guard/skills/exfil-guard/scripts/check_span.py --channel file-write --json < draft.md
python3 /absolute/path/to/agent-guard/skills/exfil-guard/scripts/sanitize.py --channel file-write < draft.md

Try a synthetic credential constructed at runtime:

python3 -c 'print("config: sk-proj-" + "AbCdEf0123456789GhIjKl")' |
  python3 /absolute/path/to/agent-guard/skills/exfil-guard/scripts/sanitize.py --channel file-write
# -> config: sk-<REDACTED>

Design split:

  • check_span.py is read-only: Returns a verdict (ALLOW, SANITIZE, ASK, BLOCK) and a verified redaction plan without modifying input. Exit 0 indicates ALLOW/SANITIZE.
  • sanitize.py rewrites only on safe paths: Outputs allowed or redacted text to stdout on ALLOW/SANITIZE; suppresses stdout completely on ASK, BLOCK, or validation errors.
  • What is covered: Documented credential formats, value-free secret source references (e.g., environment dumps), and host-identifying paths—not general repository-wide secret auditing or deliberate encoding obfuscation. The caller remains responsible for emission and egress audit logging.
  • Configuration structure without secrets: Use safe_view to inspect supported JSON and .env schemas without displaying scalar values; it is a read-only view, not an automatic read hook.

See the Exfil-guard Skill, Detection rules, and Channel contract.

3. Controlled behavioral verification (Guard-lab)

Guard-lab tests whether a real harness and guard integration behave as expected without using real secrets. It seeds a disposable fixture with non-secret synthetic markers and harmless bait while keeping the controller and tamper-detecting hash-chained evidence outside the workspace exposed to the agent.

Its methodology enforces three steps:

  1. Calibrate: Confirm observers, marker scans, and the hash-chained evidence pipeline pass all four zero-model controls.
  2. Establish baseline exposure: Confirm an unguarded trial triggers the target channel (a silent unguarded run cannot prove mitigation).
  3. Compare guarded runs: Re-run with guards active under identical host version, model, task, protocol, and non-guard settings.

From the installed package root or checkout root, run a single zero-model calibration control (installed packages also expose agent-guard-lab):

lab_run="$(mktemp -d)"
python3 guard_lab.py run --case clean --output-dir "$lab_run/clean" --json

Or from a package or checkout containing the calibration example, run all four zero-model controls (clean, mock-positive, mock-injection, snapshot-positive):

blue_run="$(mktemp -d)"
python3 docs/lab/examples/blue-team-calibration.py --output-dir "$blue_run/controls"

[!NOTE] A passing control verifies instrument calibration, not model safety. The hash chain flags corrupted or altered evidence as INCONCLUSIVE, though a process sharing the same OS privileges can still modify local logs and hashes. Observations apply strictly to declared channels rather than arbitrary file reads or unmonitored network egress. See the Lab guide, Four-control example, Blue-team research, and existing Kimi / DSH reports.

Host integrations & observed coverage

Give your coding agent the shared setup prompt along with adapters/INTEGRATION.md to configure the installed package root and workspace. Where available, pair MCP maintenance tools with a verified blocking hook (install_skill.py links skills/delete-guard into compatible Skill directories; see Skill installation).

In the table below, entries in the MCP & maintenance (0.3.0) column come from their respective recorded 0.3.0 pre-release checkpoints (not a per-host re-run of the final published artifact), whereas Native hook evidence retains each adapter's own recorded test checkpoint (for example, DSH 0.2.1-alpha.4 default deletion was validated at the 0.2.6 checkpoint, and scripted Claude Bash hooks at 2.1.270 / 2.1.273). Every row applies only to those tested host versions and tool paths; other combinations require separate validation (see the full Capability matrix and 0.3.0 acceptance report):

HostTested versionMCP & maintenance (0.3.0)Native hook evidence & known gapsGuides
Codex0.165.0Passed fresh-approved 71-root batch, real cache task, and optional native-form model task with independent verification & restoreNative shell/editor interception requires separate validation; terminal approval remains the defaultReport · Earlier trials
Kimi Code2.3.0Passed standard and fresh-approved MCP maintenance tasksObserved root-Bash native block -> plan -> terminal approval -> original-session execution & restore; Stop and missing/timed-out hook caveats remain separateReport · Setup
DSH0.2.0-rc.2Passed repaired original-root startup and fresh-approved MCP executionNative 0.2.0-rc.2 / 0.2.1-alpha.4 plugin evidence; a later native trial hit an OS sandbox block under PRoot (separate zero-model local control passed)Report · Compatibility · Setup
Claude Code2.1.311 / 2.1.270–2732.1.311 connected and discovered 10 MCP tools; live model maintenance deferredScripted native Bash hook evidence is from 2.1.270 / 2.1.273; 2.1.311 native hooks remain unverifiedReport · Setup
Other hosts—Skill / CLI / MCP cooperative usageUse the adaptation guide for local setup; verify actual blocking before claiming native interceptionAdaptation guide

For ongoing configuration health, doctor.py kimi|claude --probe and --check-drift inspect local wiring against compatibility profiles (PASS validates local files, not live host hook loading). Optional live sentinels test one sampled root-agent Bash call and may use provider quota. See the Host drift guide.

Documentation

DocumentFocus
Getting startedInstallation channels, setup prompt, and non-destructive verification
Documentation indexFull map of guides, design docs, Lab workflows, reports, releases, and history
ArchitectureCore pillars, Decision Protocol, dialects, compensation, and adapter data flow
Threat modelTrust assumptions, attack vectors, and security-boundary upgrade paths
CompatibilityAdapter contracts, interface guarantees, and release rules
Blue-team researchDefensive methods, sanitized studies, and calibration baseline
0.3.1 release notes · 0.3.0 notesRelease summaries, upgrade impacts, and verification scope

Contributing

Bug reports, compatibility reports, documentation improvements, and focused PRs are welcome. Please read CONTRIBUTING.md before submitting defensive research or logs, and use Issues and Pull Requests. Never commit credentials, private configuration, or unredacted incident records.

Community

LINUX DO community link

Project discussion thread on LINUX DO, maintained by the authors.

License

MIT — see LICENSE.

Badge

Listed here? Link back with this badge — paste the snippet into your repository README.

Listed on DSH Plugin badge
[![Listed on DSH Plugin](https://dsh-plugin.com/badges/listed.svg)](https://dsh-plugin.com/plugins/mokuyoaxis/agent-guard)