Static verification lands in OpenCode as a safety-first plugin
In a Show HN post, a developer describes a plugin that injects static security checks into OpenCode, aiming to curb unsafe tool calls in AI workflows. Drawing on formal verification ideas from the Guardians of the Agents lineage, the project translates theory into a practical safety instrument for developers who orchestrate AI tooling.
The author notes that the work builds on Erik Meijer's formalization concepts and Nada Amin's Guardians repository, then moves toward a concrete implementation that can be used in day-to-day coding. The goal is to bring static security verification to OpenCode, so that potentially risky tool interactions are caught before they can cause harm in a live environment.
How it works
- Interception: The plugin hooks into OpenCode's TypeScript plugin system using the tool.execute.before phase to intercept candidate tool calls (bash, read, edit, write) prior to their execution.
- Sidecar verification: Intercepted tool parameters are passed to a local Python daemon running guardians.verify(), enabling a formal verification step alongside the development workflow.
- Decision and enforcement: Based on the verification outcome, the system can allow, warn, or block the tool call, thereby preventing unsafe actions from taking effect.
Static verification acts as a gatekeeper by inspecting tool parameters before execution, stopping unsafe calls in their tracks.
The approach emphasizes decoupled safety, where a lightweight, sidecar verification process sits next to OpenCode and performs rigorous checks without requiring invasive changes to every tool or library in use. This separation of concerns mirrors the Guardian philosophy that formal verification can provide robust guarantees about how AI agents interact with tools and data.
From a practical standpoint, the plugin is designed to be minimally invasive: intercept, verify, and decide. It leverages the existing TypeScript plugin interface to capture tool calls and hands off critical parameters to a Python daemon running the verification logic. The result is a streamlined workflow where unsafe calls can be halted early, reducing the risk of unintended side effects in AI-driven automation.
Why this matters for AI safety
As AI systems increasingly coordinate tool usage, the potential surface for unsafe actions expands—from shell access to file edits and beyond. A static verifier embedded in the development toolchain provides a first-line defense that can catch violations before they become runtime incidents. By translating formal verification concepts into a usable plugin, this work exemplifies a practical bridge between theoretical safety properties and day-to-day tooling.
- Pre-execution checks: The primary safety gain comes from blocking dangerous calls before they run, avoiding side effects.
- Layered defense: This static check adds another layer of protection alongside runtime safeguards and code reviews.
- Policy clarity: By codifying safety checks, teams can evolve and communicate what constitutes an unsafe action and update the verification rules accordingly.
Overall, the project demonstrates how Guardians-inspired verification can be concretely embedded into modern developer workflows. While nascent, it offers a blueprint for safer AI-tool orchestration that can be extended to other platforms and toolchains, reinforcing the notion that formal verification can have immediate, practical payoff in everyday AI development.