<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: joejibewater</title>
    <description>The latest articles on DEV Community by joejibewater (@joejibewater).</description>
    <link>https://dev.to/joejibewater</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4284793%2F868b6efb-bb3f-4a5d-96e6-fdfb6aebe3dd.jpg</url>
      <title>DEV Community: joejibewater</title>
      <link>https://dev.to/joejibewater</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/joejibewater"/>
    <language>en</language>
    <item>
      <title>Undo `sed -i` Edits from AI Agents + 3 Hook Pitfalls Building SafeLatch</title>
      <dc:creator>joejibewater</dc:creator>
      <pubDate>Sat, 05 Dec 2026 13:25:17 +0000</pubDate>
      <link>https://dev.to/joejibewater/undo-sed-i-edits-from-ai-agents-3-hook-pitfalls-building-safelatch-22gn</link>
      <guid>https://dev.to/joejibewater/undo-sed-i-edits-from-ai-agents-3-hook-pitfalls-building-safelatch-22gn</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fo8k3fnb3l9pmtsi2520p.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fo8k3fnb3l9pmtsi2520p.png" alt=" " width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you use Claude Code, Cursor, or Google Antigravity heavily, you have probably hit two blind spots that standard workflows don't cover:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Editor rewind misses shell mutations.&lt;/strong&gt;
Structured file tools (&lt;code&gt;Edit&lt;/code&gt;, &lt;code&gt;Write&lt;/code&gt;, &lt;code&gt;edit_file&lt;/code&gt;) are easy for editors to undo, and command blockers like &lt;code&gt;cc-safety-net&lt;/code&gt; are great at stopping &lt;code&gt;rm -rf /&lt;/code&gt;. Yet if an agent runs a normal shell command — &lt;code&gt;sed -i&lt;/code&gt;, &lt;code&gt;echo ... &amp;gt; config.json&lt;/code&gt;, &lt;code&gt;tee&lt;/code&gt;, &lt;code&gt;truncate&lt;/code&gt;, &lt;code&gt;mv&lt;/code&gt;, or PowerShell &lt;code&gt;Set-Content&lt;/code&gt; — and corrupts or deletes a file, structured undo misses it and blockers can't restore what was already overwritten.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Community MCP configs and plugin hooks are opaque before you run them.&lt;/strong&gt;
A &lt;code&gt;plugin.json&lt;/code&gt; or &lt;code&gt;.mcp.json&lt;/code&gt; rarely tells you upfront what wrapper scripts it chains into, whether it invokes unpinned &lt;code&gt;npx -y @latest&lt;/code&gt; runners, or whether a Markdown skill hides zero-width/bidi Unicode overrides.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;I built &lt;strong&gt;SafeLatch&lt;/strong&gt; (&lt;a href="https://github.com/safelatch-dev/safelatch" rel="noopener noreferrer"&gt;github.com/safelatch-dev/safelatch&lt;/a&gt;, MIT, zero runtime dependencies, zero network calls, zero &lt;code&gt;child_process&lt;/code&gt; imports) to fill those gaps across Antigravity, Claude Code, and Cursor.&lt;/p&gt;

&lt;p&gt;Here are three real engineering pitfalls from building and testing &lt;code&gt;v0.3.1&lt;/code&gt; — plus how to try the read-only audit in 10 seconds.&lt;/p&gt;




&lt;h2&gt;
  
  
  Pitfall 1: Returning &lt;code&gt;{}&lt;/code&gt; from a &lt;code&gt;PreToolUse&lt;/code&gt; hook isn't always "allow"
&lt;/h2&gt;

&lt;p&gt;When writing the first Antigravity &lt;code&gt;PreToolUse&lt;/code&gt; adapter, I assumed returning an empty JSON object &lt;code&gt;{}&lt;/code&gt; meant "no objection, pass through."&lt;/p&gt;

&lt;p&gt;In practice, Antigravity treats &lt;code&gt;{}&lt;/code&gt; as a hard &lt;code&gt;deny&lt;/code&gt; (&lt;code&gt;tool call denied by pre-tool hook&lt;/code&gt;), blocking every tool call. Returning &lt;code&gt;{"decision": "allow"}&lt;/code&gt; has the opposite problem: it silently bypasses the user's native confirmation prompt and &lt;code&gt;Always Allow&lt;/code&gt; flow.&lt;/p&gt;

&lt;p&gt;Different hosts expect opposite defaults:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Antigravity&lt;/strong&gt;: Unflagged calls explicitly emit &lt;code&gt;{"decision": "ask"}&lt;/code&gt; (&lt;code&gt;passDecision: "ask"&lt;/code&gt;) so the host's native &lt;code&gt;Always Allow&lt;/code&gt; state keeps working untouched.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Claude Code&lt;/strong&gt;: Unflagged calls return &lt;code&gt;{}&lt;/code&gt; (deferring cleanly to Claude Code's own permission flow), and only flagged commands or self-tamper attempts return &lt;code&gt;hookSpecificOutput.permissionDecision: "ask" | "deny"&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The installer also merges &lt;code&gt;~/.claude/settings.json&lt;/code&gt; and &lt;code&gt;~/.cursor/hooks.json&lt;/code&gt; idempotently instead of overwriting them, so existing hooks like &lt;code&gt;cc-safety-net&lt;/code&gt; keep running untouched, and &lt;code&gt;uninstall --host &amp;lt;host&amp;gt;&lt;/code&gt; strips only SafeLatch's entries.&lt;/p&gt;




&lt;h2&gt;
  
  
  Pitfall 2: Snapshotting shell edits means tracking files that didn't exist — and Windows 8.3 short paths
&lt;/h2&gt;

&lt;p&gt;Consider a compound shell command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;sed -i &lt;span class="s1"&gt;'s/verifyToken/bypassAuth/g'&lt;/span&gt; src/auth.ts &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;echo&lt;/span&gt; leak &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; debug.tmp
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Backing up &lt;code&gt;src/auth.ts&lt;/code&gt; alone isn't enough. If &lt;code&gt;debug.tmp&lt;/code&gt; did not exist beforehand, restoring without an &lt;code&gt;existed: false&lt;/code&gt; marker leaves shell-created junk behind.&lt;/p&gt;

&lt;p&gt;Before &lt;code&gt;Bash&lt;/code&gt;, &lt;code&gt;run_command&lt;/code&gt;, or &lt;code&gt;beforeShellExecution&lt;/code&gt; executes, SafeLatch parses POSIX, &lt;code&gt;cmd&lt;/code&gt;, and PowerShell AST segments (including &lt;code&gt;cd&lt;/code&gt; location tracking, GNU/BSD &lt;code&gt;sed -i.bak&lt;/code&gt;, &lt;code&gt;perl -i&lt;/code&gt;, &lt;code&gt;tee&lt;/code&gt;, &lt;code&gt;truncate&lt;/code&gt;, PowerShell &lt;code&gt;Set-Content&lt;/code&gt;/&lt;code&gt;sc&lt;/code&gt;/&lt;code&gt;Remove-Item&lt;/code&gt;/&lt;code&gt;ri&lt;/code&gt;, and Base64 &lt;code&gt;-EncodedCommand&lt;/code&gt;) and captures deduplicated SHA-256 blobs under local quota limits (5 MB/file, 50 MB/snapshot, 1 GB total, 7-day TTL).&lt;/p&gt;

&lt;p&gt;Two deliberate boundaries here:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;safelatch restore&lt;/code&gt; is CLI-only.&lt;/strong&gt; SafeLatch exposes 4 read-only MCP tools (&lt;code&gt;safelatch_audit&lt;/code&gt;, &lt;code&gt;safelatch_snapshots&lt;/code&gt;, &lt;code&gt;safelatch_diff&lt;/code&gt;, &lt;code&gt;safelatch_check&lt;/code&gt;), while &lt;code&gt;restore&lt;/code&gt; requires &lt;code&gt;--dry-run&lt;/code&gt; inspection and manual &lt;code&gt;--yes&lt;/code&gt; in a terminal so a runaway agent cannot self-trigger rollbacks.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Windows 8.3 short-path mismatch (&lt;code&gt;RUNNER~1&lt;/code&gt;).&lt;/strong&gt; Our &lt;code&gt;windows-latest&lt;/code&gt; CI caught a real bug in &lt;code&gt;v0.3.0&lt;/code&gt;: Node's &lt;code&gt;fs.realpathSync&lt;/code&gt; keeps Windows 8.3 short names like &lt;code&gt;C:\Users\RUNNER~1\...&lt;/code&gt;, while &lt;code&gt;fs.realpathSync.native&lt;/code&gt; expands them to &lt;code&gt;C:\Users\runneradmin\...&lt;/code&gt;. Mixing the two caused false &lt;code&gt;G106&lt;/code&gt; out-of-workspace alerts on Windows usernames longer than 8 characters or containing spaces. Unifying containment and snapshot keys onto &lt;code&gt;fs.realpathSync.native&lt;/code&gt; fixed it in &lt;code&gt;v0.3.1&lt;/code&gt;.&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  Pitfall 3: Auditing MCP configs without flagging normal &lt;code&gt;https://&lt;/code&gt; servers
&lt;/h2&gt;

&lt;p&gt;Many static scanners penalize any remote URL, burying real risks under false positives on legitimate Sentry/GitHub/Notion MCP endpoints.&lt;/p&gt;

&lt;p&gt;SafeLatch's offline auditor (&lt;code&gt;A001&lt;/code&gt;–&lt;code&gt;A009&lt;/code&gt;) takes a stricter signal-to-noise stance:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Standard &lt;code&gt;https://&lt;/code&gt; remote MCP endpoints get 0 score penalty&lt;/strong&gt;, while still appearing in a &lt;strong&gt;Capabilities &amp;amp; Network X-Ray&lt;/strong&gt; table (with URL credentials and query strings redacted).&lt;/li&gt;
&lt;li&gt;Penalties focus on plaintext &lt;code&gt;http://&lt;/code&gt;/&lt;code&gt;ws://&lt;/code&gt;, raw IPs, ephemeral tunnels (&lt;code&gt;ngrok&lt;/code&gt;, &lt;code&gt;trycloudflare.com&lt;/code&gt;), unpinned &lt;code&gt;npx -y&lt;/code&gt;/&lt;code&gt;@latest&lt;/code&gt;/&lt;code&gt;uvx&lt;/code&gt; runners, hidden zero-width/bidi Unicode in skills/rules, hardcoded &lt;code&gt;"decision": "allow"&lt;/code&gt; hooks, and wrapper indirections (&lt;code&gt;scripts/hook.mjs&lt;/code&gt; -&amp;gt; &lt;code&gt;dist/hook.mjs&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;On our reproducible 36-target synthetic multi-host benchmark (&lt;code&gt;npm run bench:audit&lt;/code&gt;, documented in &lt;code&gt;docs/benchmarks.md&lt;/code&gt;), SafeLatch matched &lt;strong&gt;24/24&lt;/strong&gt; expected findings with &lt;strong&gt;0/12&lt;/strong&gt; benign false positives and &lt;strong&gt;0/4&lt;/strong&gt; false positives on standard HTTPS endpoints (&lt;code&gt;p50 32.73 ms&lt;/code&gt; / &lt;code&gt;p95 71.58 ms&lt;/code&gt; in-process on Windows Node 24).&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Try the 10-second read-only audit (no hooks installed)
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npx -y safelatch@0.3.1 audit --workspace .
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This scans local Antigravity (&lt;code&gt;~/.gemini/config&lt;/code&gt;, &lt;code&gt;.agents/&lt;/code&gt;), Claude Code (&lt;code&gt;~/.claude&lt;/code&gt;, &lt;code&gt;~/.claude.json&lt;/code&gt;, &lt;code&gt;.mcp.json&lt;/code&gt;), and Cursor (&lt;code&gt;.cursor/&lt;/code&gt;, &lt;code&gt;.cursorrules&lt;/code&gt;) config files without touching editor extension caches or making network requests. It also supports &lt;code&gt;--sarif&lt;/code&gt; (SARIF 2.1.0) and a composite GitHub Action (&lt;code&gt;safelatch-dev/safelatch@v0.3.1&lt;/code&gt;).&lt;/p&gt;

&lt;p&gt;If you also want shell-aware pre-write snapshots and cross-shell runtime protection:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npx -y safelatch@0.3.1 install --host claude-code
npx -y safelatch@0.3.1 install --host cursor
npx -y safelatch@0.3.1 install              &lt;span class="c"&gt;# Antigravity&lt;/span&gt;
&lt;span class="c"&gt;# Or all three hosts together:&lt;/span&gt;
npx -y safelatch@0.3.1 install --host all
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Non-goals &amp;amp; current limits
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Not a kernel/container sandbox (complements OS sandboxing rather than replacing it).&lt;/li&gt;
&lt;li&gt;Static shell AST extraction won't predict dynamic file paths computed at runtime inside arbitrary &lt;code&gt;python -c&lt;/code&gt; or &lt;code&gt;node -e&lt;/code&gt; one-liners.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;GitHub: &lt;a href="https://github.com/safelatch-dev/safelatch" rel="noopener noreferrer"&gt;https://github.com/safelatch-dev/safelatch&lt;/a&gt;&lt;br&gt;&lt;br&gt;
npm: &lt;a href="https://www.npmjs.com/package/safelatch" rel="noopener noreferrer"&gt;https://www.npmjs.com/package/safelatch&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you run &lt;code&gt;audit&lt;/code&gt; on your own &lt;code&gt;.mcp.json&lt;/code&gt; or &lt;code&gt;.claude&lt;/code&gt; setup and hit a false positive or an unhandled shell mutation pattern, feel free to open an issue!&lt;/p&gt;

</description>
      <category>ai</category>
      <category>security</category>
      <category>opensource</category>
      <category>mcp</category>
    </item>
    <item>
      <title>Undo `sed -i` Edits from AI Agents + 3 Hook Pitfalls Building SafeLatch</title>
      <dc:creator>joejibewater</dc:creator>
      <pubDate>Sat, 05 Dec 2026 13:20:00 +0000</pubDate>
      <link>https://dev.to/joejibewater/undo-sed-i-edits-from-ai-agents-3-hook-pitfalls-building-safelatch-cai</link>
      <guid>https://dev.to/joejibewater/undo-sed-i-edits-from-ai-agents-3-hook-pitfalls-building-safelatch-cai</guid>
      <description>&lt;p&gt;If you use Claude Code, Cursor, or Google Antigravity heavily, you have probably hit two blind spots that standard workflows don't cover:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Editor rewind misses shell mutations.&lt;/strong&gt;
Structured file tools (&lt;code&gt;Edit&lt;/code&gt;, &lt;code&gt;Write&lt;/code&gt;, &lt;code&gt;edit_file&lt;/code&gt;) are easy for editors to undo, and command blockers like &lt;code&gt;cc-safety-net&lt;/code&gt; are great at stopping &lt;code&gt;rm -rf /&lt;/code&gt;. Yet if an agent runs a normal shell command — &lt;code&gt;sed -i&lt;/code&gt;, &lt;code&gt;echo ... &amp;gt; config.json&lt;/code&gt;, &lt;code&gt;tee&lt;/code&gt;, &lt;code&gt;truncate&lt;/code&gt;, &lt;code&gt;mv&lt;/code&gt;, or PowerShell &lt;code&gt;Set-Content&lt;/code&gt; — and corrupts or deletes a file, structured undo misses it and blockers can't restore what was already overwritten.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Community MCP configs and plugin hooks are opaque before you run them.&lt;/strong&gt;
A &lt;code&gt;plugin.json&lt;/code&gt; or &lt;code&gt;.mcp.json&lt;/code&gt; rarely tells you upfront what wrapper scripts it chains into, whether it invokes unpinned &lt;code&gt;npx -y @latest&lt;/code&gt; runners, or whether a Markdown skill hides zero-width/bidi Unicode overrides.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;I built &lt;strong&gt;SafeLatch&lt;/strong&gt; (&lt;a href="https://github.com/safelatch-dev/safelatch" rel="noopener noreferrer"&gt;github.com/safelatch-dev/safelatch&lt;/a&gt;, MIT, zero runtime dependencies, zero network calls, zero &lt;code&gt;child_process&lt;/code&gt; imports) to fill those gaps across Antigravity, Claude Code, and Cursor.&lt;/p&gt;

&lt;p&gt;Here are three real engineering pitfalls from building and testing &lt;code&gt;v0.3.1&lt;/code&gt; — plus how to try the read-only audit in 10 seconds.&lt;/p&gt;




&lt;h2&gt;
  
  
  Pitfall 1: Returning &lt;code&gt;{}&lt;/code&gt; from a &lt;code&gt;PreToolUse&lt;/code&gt; hook isn't always "allow"
&lt;/h2&gt;

&lt;p&gt;When writing the first Antigravity &lt;code&gt;PreToolUse&lt;/code&gt; adapter, I assumed returning an empty JSON object &lt;code&gt;{}&lt;/code&gt; meant "no objection, pass through."&lt;/p&gt;

&lt;p&gt;In practice, Antigravity treats &lt;code&gt;{}&lt;/code&gt; as a hard &lt;code&gt;deny&lt;/code&gt; (&lt;code&gt;tool call denied by pre-tool hook&lt;/code&gt;), blocking every tool call. Returning &lt;code&gt;{"decision": "allow"}&lt;/code&gt; has the opposite problem: it silently bypasses the user's native confirmation prompt and &lt;code&gt;Always Allow&lt;/code&gt; flow.&lt;/p&gt;

&lt;p&gt;Different hosts expect opposite defaults:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Antigravity&lt;/strong&gt;: Unflagged calls explicitly emit &lt;code&gt;{"decision": "ask"}&lt;/code&gt; (&lt;code&gt;passDecision: "ask"&lt;/code&gt;) so the host's native &lt;code&gt;Always Allow&lt;/code&gt; state keeps working untouched.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Claude Code&lt;/strong&gt;: Unflagged calls return &lt;code&gt;{}&lt;/code&gt; (deferring cleanly to Claude Code's own permission flow), and only flagged commands or self-tamper attempts return &lt;code&gt;hookSpecificOutput.permissionDecision: "ask" | "deny"&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The installer also merges &lt;code&gt;~/.claude/settings.json&lt;/code&gt; and &lt;code&gt;~/.cursor/hooks.json&lt;/code&gt; idempotently instead of overwriting them, so existing hooks like &lt;code&gt;cc-safety-net&lt;/code&gt; keep running untouched, and &lt;code&gt;uninstall --host &amp;lt;host&amp;gt;&lt;/code&gt; strips only SafeLatch's entries.&lt;/p&gt;




&lt;h2&gt;
  
  
  Pitfall 2: Snapshotting shell edits means tracking files that didn't exist — and Windows 8.3 short paths
&lt;/h2&gt;

&lt;p&gt;Consider a compound shell command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;sed -i &lt;span class="s1"&gt;'s/verifyToken/bypassAuth/g'&lt;/span&gt; src/auth.ts &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;echo&lt;/span&gt; leak &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; debug.tmp
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Backing up &lt;code&gt;src/auth.ts&lt;/code&gt; alone isn't enough. If &lt;code&gt;debug.tmp&lt;/code&gt; did not exist beforehand, restoring without an &lt;code&gt;existed: false&lt;/code&gt; marker leaves shell-created junk behind.&lt;/p&gt;

&lt;p&gt;Before &lt;code&gt;Bash&lt;/code&gt;, &lt;code&gt;run_command&lt;/code&gt;, or &lt;code&gt;beforeShellExecution&lt;/code&gt; executes, SafeLatch parses POSIX, &lt;code&gt;cmd&lt;/code&gt;, and PowerShell AST segments (including &lt;code&gt;cd&lt;/code&gt; location tracking, GNU/BSD &lt;code&gt;sed -i.bak&lt;/code&gt;, &lt;code&gt;perl -i&lt;/code&gt;, &lt;code&gt;tee&lt;/code&gt;, &lt;code&gt;truncate&lt;/code&gt;, PowerShell &lt;code&gt;Set-Content&lt;/code&gt;/&lt;code&gt;sc&lt;/code&gt;/&lt;code&gt;Remove-Item&lt;/code&gt;/&lt;code&gt;ri&lt;/code&gt;, and Base64 &lt;code&gt;-EncodedCommand&lt;/code&gt;) and captures deduplicated SHA-256 blobs under local quota limits (5 MB/file, 50 MB/snapshot, 1 GB total, 7-day TTL).&lt;/p&gt;

&lt;p&gt;Two deliberate boundaries here:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;safelatch restore&lt;/code&gt; is CLI-only.&lt;/strong&gt; SafeLatch exposes 4 read-only MCP tools (&lt;code&gt;safelatch_audit&lt;/code&gt;, &lt;code&gt;safelatch_snapshots&lt;/code&gt;, &lt;code&gt;safelatch_diff&lt;/code&gt;, &lt;code&gt;safelatch_check&lt;/code&gt;), while &lt;code&gt;restore&lt;/code&gt; requires &lt;code&gt;--dry-run&lt;/code&gt; inspection and manual &lt;code&gt;--yes&lt;/code&gt; in a terminal so a runaway agent cannot self-trigger rollbacks.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Windows 8.3 short-path mismatch (&lt;code&gt;RUNNER~1&lt;/code&gt;).&lt;/strong&gt; Our &lt;code&gt;windows-latest&lt;/code&gt; CI caught a real bug in &lt;code&gt;v0.3.0&lt;/code&gt;: Node's &lt;code&gt;fs.realpathSync&lt;/code&gt; keeps Windows 8.3 short names like &lt;code&gt;C:\Users\RUNNER~1\...&lt;/code&gt;, while &lt;code&gt;fs.realpathSync.native&lt;/code&gt; expands them to &lt;code&gt;C:\Users\runneradmin\...&lt;/code&gt;. Mixing the two caused false &lt;code&gt;G106&lt;/code&gt; out-of-workspace alerts on Windows usernames longer than 8 characters or containing spaces. Unifying containment and snapshot keys onto &lt;code&gt;fs.realpathSync.native&lt;/code&gt; fixed it in &lt;code&gt;v0.3.1&lt;/code&gt;.&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  Pitfall 3: Auditing MCP configs without flagging normal &lt;code&gt;https://&lt;/code&gt; servers
&lt;/h2&gt;

&lt;p&gt;Many static scanners penalize any remote URL, burying real risks under false positives on legitimate Sentry/GitHub/Notion MCP endpoints.&lt;/p&gt;

&lt;p&gt;SafeLatch's offline auditor (&lt;code&gt;A001&lt;/code&gt;–&lt;code&gt;A009&lt;/code&gt;) takes a stricter signal-to-noise stance:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Standard &lt;code&gt;https://&lt;/code&gt; remote MCP endpoints get 0 score penalty&lt;/strong&gt;, while still appearing in a &lt;strong&gt;Capabilities &amp;amp; Network X-Ray&lt;/strong&gt; table (with URL credentials and query strings redacted).&lt;/li&gt;
&lt;li&gt;Penalties focus on plaintext &lt;code&gt;http://&lt;/code&gt;/&lt;code&gt;ws://&lt;/code&gt;, raw IPs, ephemeral tunnels (&lt;code&gt;ngrok&lt;/code&gt;, &lt;code&gt;trycloudflare.com&lt;/code&gt;), unpinned &lt;code&gt;npx -y&lt;/code&gt;/&lt;code&gt;@latest&lt;/code&gt;/&lt;code&gt;uvx&lt;/code&gt; runners, hidden zero-width/bidi Unicode in skills/rules, hardcoded &lt;code&gt;"decision": "allow"&lt;/code&gt; hooks, and wrapper indirections (&lt;code&gt;scripts/hook.mjs&lt;/code&gt; -&amp;gt; &lt;code&gt;dist/hook.mjs&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;On our reproducible 36-target synthetic multi-host benchmark (&lt;code&gt;npm run bench:audit&lt;/code&gt;, documented in &lt;code&gt;docs/benchmarks.md&lt;/code&gt;), SafeLatch matched &lt;strong&gt;24/24&lt;/strong&gt; expected findings with &lt;strong&gt;0/12&lt;/strong&gt; benign false positives and &lt;strong&gt;0/4&lt;/strong&gt; false positives on standard HTTPS endpoints (&lt;code&gt;p50 32.73 ms&lt;/code&gt; / &lt;code&gt;p95 71.58 ms&lt;/code&gt; in-process on Windows Node 24).&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Try the 10-second read-only audit (no hooks installed)
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npx -y safelatch@0.3.1 audit --workspace .
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This scans local Antigravity (&lt;code&gt;~/.gemini/config&lt;/code&gt;, &lt;code&gt;.agents/&lt;/code&gt;), Claude Code (&lt;code&gt;~/.claude&lt;/code&gt;, &lt;code&gt;~/.claude.json&lt;/code&gt;, &lt;code&gt;.mcp.json&lt;/code&gt;), and Cursor (&lt;code&gt;.cursor/&lt;/code&gt;, &lt;code&gt;.cursorrules&lt;/code&gt;) config files without touching editor extension caches or making network requests. It also supports &lt;code&gt;--sarif&lt;/code&gt; (SARIF 2.1.0) and a composite GitHub Action (&lt;code&gt;safelatch-dev/safelatch@v0.3.1&lt;/code&gt;).&lt;/p&gt;

&lt;p&gt;If you also want shell-aware pre-write snapshots and cross-shell runtime protection:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npx -y safelatch@0.3.1 install --host claude-code
npx -y safelatch@0.3.1 install --host cursor
npx -y safelatch@0.3.1 install              &lt;span class="c"&gt;# Antigravity&lt;/span&gt;
&lt;span class="c"&gt;# Or all three hosts together:&lt;/span&gt;
npx -y safelatch@0.3.1 install --host all
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Non-goals &amp;amp; current limits
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Not a kernel/container sandbox (complements OS sandboxing rather than replacing it).&lt;/li&gt;
&lt;li&gt;Static shell AST extraction won't predict dynamic file paths computed at runtime inside arbitrary &lt;code&gt;python -c&lt;/code&gt; or &lt;code&gt;node -e&lt;/code&gt; one-liners.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;GitHub: &lt;a href="https://github.com/safelatch-dev/safelatch" rel="noopener noreferrer"&gt;https://github.com/safelatch-dev/safelatch&lt;/a&gt;&lt;br&gt;&lt;br&gt;
npm: &lt;a href="https://www.npmjs.com/package/safelatch" rel="noopener noreferrer"&gt;https://www.npmjs.com/package/safelatch&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you run &lt;code&gt;audit&lt;/code&gt; on your own &lt;code&gt;.mcp.json&lt;/code&gt; or &lt;code&gt;.claude&lt;/code&gt; setup and hit a false positive or an unhandled shell mutation pattern, feel free to open an issue!&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fuy2kikbf0irufiew10yq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fuy2kikbf0irufiew10yq.png" alt=" " width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>agents</category>
      <category>ai</category>
      <category>security</category>
      <category>tools</category>
    </item>
  </channel>
</rss>
