{"slug": "show-hn-i-built-a-static-verifier-for-opencode-to-stop-unsafe-ai-tool-calls", "title": "Show HN: I built a static verifier for OpenCode to stop unsafe AI tool calls", "summary": "A developer built a static security verification plugin for OpenCode that intercepts AI tool calls and runs formal verification via a Python daemon using the Guardians repository, blocking unsafe operations like path traversal and secret leakage in approximately 1.5 milliseconds before execution. The plugin, available on GitHub, integrates Erik Meijer's and Nada Amin's formal verification approach for AI workflows.", "body_md": "Erik Meijer wrote the paper \"Guardians of the Agents\" on formal verification for AI workflows, and Nada Amin implemented it in the Guardians repository. I built this plugin to bring static security verification to OpenCode.\n\nHow It Works: 1. Interception: Uses OpenCode's TypeScript plugin system (\"tool.execute.before\") to intercept candidate tool calls (bash, read, edit, write) before they run. 2. Sidecar Verification: Passes tool parameters to a local Python daemon running guardians.verify(). 3. Formal Verification (~1.5ms): Evaluates Z3 path containment (blocking path traversal like ../../../../etc/passwd), secret taint tracking (preventing .env data from flowing to output files or shell commands), and security automata (enforcing read-before-edit rules). 4. Pre-Execution Abort: If a violation is flagged, the plugin throws an exception to block execution before any side effects happen on disk, forcing the agent to self-correct.\n\nThe repository links metareflection/guardians directly as a Git submodule (guardians-core), keeping the core verifier untouched and synced with upstream updates.\n\nRepo & Setup Instructions: [https://github.com/albertjoseph0/opencode-plugin-guardians](https://github.com/albertjoseph0/opencode-plugin-guardians)\n\nI would love to hear your thoughts or feedback!\n\nComments URL: [https://news.ycombinator.com/item?id=49064655](https://news.ycombinator.com/item?id=49064655)\n\nPoints: 1\n\n# Comments: 0", "url": "https://wpnews.pro/news/show-hn-i-built-a-static-verifier-for-opencode-to-stop-unsafe-ai-tool-calls", "canonical_source": "https://github.com/albertjoseph0/opencode-plugin-guardians", "published_at": "2026-07-27 02:45:22+00:00", "updated_at": "2026-07-27 03:22:40.749025+00:00", "lang": "en", "topics": ["ai-safety", "ai-tools", "developer-tools"], "entities": ["OpenCode", "Guardians", "Erik Meijer", "Nada Amin", "Z3"], "alternates": {"html": "https://wpnews.pro/news/show-hn-i-built-a-static-verifier-for-opencode-to-stop-unsafe-ai-tool-calls", "markdown": "https://wpnews.pro/news/show-hn-i-built-a-static-verifier-for-opencode-to-stop-unsafe-ai-tool-calls.md", "text": "https://wpnews.pro/news/show-hn-i-built-a-static-verifier-for-opencode-to-stop-unsafe-ai-tool-calls.txt", "jsonld": "https://wpnews.pro/news/show-hn-i-built-a-static-verifier-for-opencode-to-stop-unsafe-ai-tool-calls.jsonld"}}