agy-guard
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
SafeLatch (safelatch)
Automatically snapshot and undo supported shell file changes in Antigravity. Audit local plugin and MCP configuration across Antigravity, Claude Code, and Cursor.
Host | SafeLatch support |
Antigravity | Shell rewind, runtime guard, and offline audit |
Claude Code / Cursor | Offline audit |
Already using cc-safety-net? See how the two tools can coexist.
English | 简体中文 | Tool Comparisons
Quickstart
1. Run the local audit without installing hooks. The first npm invocation may download the package.
npx -y safelatch@0.2.1 audit --workspace .2. Install the Antigravity plugin for shell rewind and the runtime guard.
# Antigravity CLI
agy plugin install https://github.com/safelatch-dev/safelatch
# Antigravity Desktop / Node.js (also auto-migrates legacy `agy-guard` hooks)
npx -y safelatch@0.2.1 installRelated MCP server: codescope
What SafeLatch covers
Pure runtime command blockers (cc-safety-net) stop rm -rf, yet cannot recover files corrupted by shell tools once allowed. Native Antigravity /rewind rolls back structured edit_file calls, yet misses direct shell edits (google-antigravity#851). And plugin.json manifests do not declare which hooks, scripts, or remote MCP URLs a community plugin actually runs (arXiv:2609.23809).
The SafeLatch runtime uses zero runtime dependencies, zero network calls, and zero subprocess calls.
1. Offline security and capability audit (audit)
The scanner reads recognized plugin, hook, MCP, rule, and skill files locally. Unresolved script entries appear as coverage notes.
Multi-Host Targeted Discovery: Inspects Antigravity (
~/.gemini/config,.agents/), Claude Code (~/.claude,CLAUDE_CONFIG_DIR,~/.claude.json,.claude/,.mcp.json), and Cursor (~/.cursor,.cursor/,.cursorrules) config paths directly without walking editor extension caches.Capabilities & Network X-Ray: Lists detected hook events, stdio MCP servers, configured MCP endpoints, and counts of rules and skills. URL credentials and query strings are redacted by default. The score summarizes static findings for the inspected files.
JSONC & Deep Wrapper Scanning: Parses JSONC comments/trailing commas cleanly and follows relative script imports (
scripts/hook.mjs→dist/hook.mjs).Low-Noise
A004: Standardhttps://MCP endpoints receive 0 score penalty while still appearing in your Capabilities X-Ray; only plaintexthttp:///ws://, raw IPs, ephemeral tunnels (ngrok,trycloudflare.com), and unpinnednpx -y/@latestrunners are flagged.CI & GitHub Code Scanning (
--sarif): The composite action supports optional SARIF upload. Private repositories need GitHub Code Security enabled to upload. Give each scan a distinctsarif-categorywhen uploading multiple scans from one workflow.
- uses: safelatch-dev/safelatch@v0.2.1
with:
path: "."
fail-on: "high"
upload-sarif: "true" # requires security-events: write2. Shell-Aware Pre-Write Snapshot & CLI Rewind (snapshots / diff / restore)
Antigravity’s native /rewind misses shell edits. Before supported tool calls execute, SafeLatch attempts to snapshot recognized workspace files within local storage limits.
Captures Both Structured Edits & Shell Mutations:
Editor tools:
write_file,edit_file,mcp_agy-fast_fast_apply_edits(both editedhunksANDverifyshell targets).Shell writes & deletes: output redirections (
>,>>,1>,&>,*>), GNU & macOS BSDsed -i, case-sensitiveperl -i,tee,cp/Copy-Item, PowerShellSet-Content/Add-Content/Out-File,rm/Remove-Item/del,mv/Move-Item,git checkout/restore, andmcp_agy-fast_fast_run_checksbatches.
New-file cleanup (
existed: false). Restore removes the recorded file after verifying a safety backup. If a file path has become a directory, restore stops by default.CLI-only restore. Preview with
safelatch restore <id> --dry-run. Applying changes requires--yes. Use--forceonly after inspecting a backup or file-type conflict.
3. Cross-shell runtime guard (PreToolUse)
Targeted Self-Defense (
G004,deny): Non-downgradable protection prevents runaway agents from runningagy plugin disable safelatch,safelatch uninstall, or deleting/overwriting installed~/.gemini/config/plugins/safelatch,~/.safelatch/config.json, or.agents/safelatch.jsonfiles (including$GEMINI_HOME/$PLUGIN_ROOT/$PLUGIN_DATAtoken expansion).Cross-Shell Parsing: Unwraps nested
sh -c,bash -c,cmd /c,powershell -Command, Base64-EncodedCommand,$()substitutions, and Windows PowerShellRemove-Item -Recurse -Force/irm ... | iexpipelines.Preserves Antigravity's Native UX (
passDecision: "ask"): In Antigravity'sPreToolUseprotocol, returning{}is treated as a harddeny. SafeLatch defaults unflagged calls to"decision": "ask"so your native "Always Allow" permission flow keeps working untouched (see Hook Protocol Notes).
Comparison
Capability | Antigravity Sandbox + |
| Static Skill Scanners | SafeLatch ( |
Offline capability audit and SARIF 2.1.0 | — | — | Partial | Yes |
Shell-aware file rewind ( | Misses shell ( | — | — | Yes |
Cross-shell ( | Native hooks | Yes | — | Yes |
Preserves native | Built-in | Partial | Varies | Yes |
See COMPARISONS.md for architecture trade-offs and guidance on running SafeLatch alongside cc-safety-net or Antigravity Strict Mode.
Non-Goals
Not a kernel sandbox: Complements OS containers and Antigravity Terminal Sandbox rather than replacing syscall isolation.
Not an LLM prompt-injection firewall: Deterministically checks static rule/skill markdown and gates concrete tool calls without calling any model or cloud API.
Never phones home:
src/anddist/contain zero runtime dependencies and zero network/subprocess imports.
Rule & Configuration Reference
Rule ID | Default Decision | Scope |
|
| Recursive delete targeting |
|
| Raw disk formatting ( |
|
| Shell fork bomb patterns |
|
| Self-tampering: |
|
| Destructive Git ops ( |
|
| Remote download piped into shell/evaluator ( |
|
| Command accesses credentials ( |
|
| Overly permissive |
|
| Scoped recursive delete inside workspace |
|
| File write/edit targets sensitive file or path outside workspace/artifact roots |
|
| Nested shell command exceeds the inspection depth |
Rule ID | Severity | What It Detects |
|
| Remote download piped into shell or |
|
| Obfuscated base64 / |
|
| Hardcoded local credential or SSH key paths |
|
| Plaintext remote |
|
| Hardcoded GitHub/OpenAI/AWS/Google/Slack/npm tokens or PEM keys |
|
| Prompt-injection overrides or hidden zero-width/bidi Unicode in rules/skills |
|
| Static |
|
| Bundled native binaries ( |
|
| Missing |
# 1. Security & Capability X-Ray
safelatch audit [--path <file-or-dir>] [--workspace <dir>] [--json|--md|--sarif] [--fail-on <severity>]
# 2. Shell-Aware Snapshots & Rewind
safelatch snapshots [--workspace <dir>] [--json]
safelatch diff <snapshot-id> [--workspace <dir>]
safelatch restore <snapshot-id> [--file <rel>] [--dry-run] [--yes] [--force]
# 3. Guard Dry-Run & Plugin Management
safelatch check "<command>" [--json]
safelatch install [--config <dir>] [--skip-enable]
safelatch uninstall [--config <dir>]
safelatch statusRead-only MCP tools (
safelatch_guard):safelatch_audit,safelatch_snapshots,safelatch_diff,safelatch_check(legacyagy_guard_*tool calls remain supported as aliases).Config precedence: Defaults → Global (
$PLUGIN_DATA/config.jsonor~/.safelatch/config.json, fallback~/.agy-guard/config.json) → Workspace (.agents/safelatch.json, fallback.agents/agy-guard.json). Workspace configs cannot setmode: "off",mode: "monitor",passDecision: "allow", orsnapshot.enabled: false. Only an explicit globalask-onlycan downgradeG001–G004to confirmation.
Security & License
See SECURITY.md for the security model, supply-chain SHA pinning policy, and private vulnerability disclosure.
Licensed under the MIT License.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Read-only checks for proposed orders against evidence and policy; no trading or payment authority.
Read-only MCP for identity resolution and write guardrails.
Read-only MCP server for repository context: context packs, graph impact analysis, and validation.
Run verified read-only code tools: quant diagnostics + agent-ops preflight, no source exposure.
Related MCP Servers
- FlicenseNot gradedqualityBmaintenanceEnables read-only governance and security checks for local FastMCP environments, including code security review and Trivy vulnerability scanning via MCP tools.-
- AlicenseNot gradedqualityBmaintenanceEnables read-only, allowlisted filesystem and Git inspection of explicitly configured local repositories through MCP, with bounded reads and no arbitrary path or write access.10 npmMIT
- AlicenseNot gradedqualityCmaintenanceEnables clients to read files, list tests, and run tests through MCP tool calls, while refusing apply operations.MIT
- AlicenseNot gradedqualityCmaintenanceEnables users to list GKE clusters, describe virtual machines, and retrieve billing information through MCP read tools, without applying production changes.MIT