PetriFlow is a standalone gate that sits between your agent and its tools. Thin adaptors connect it to whatever framework you already use.
Hook into Claude Code's tool pipeline. Gate bash, file operations, and MCP tools.
import { configure } from "@petriflow/claude-code"
const config = configure(".")
// merge into .claude/settings.json
// hooks: SessionStart, PreToolUse,
// PostToolUse, PostToolUseFailure Wrap tool definitions with gate logic. Works with generateText, streamText, and any model provider.
import { createPetriflowGate } from "@petriflow/vercel-ai"
const gate = createPetriflowGate([safetyNet])
await generateText({
tools: gate.wrapTools({ bash, write }),
system: gate.systemPrompt(),
}) Replace policy checks with structural rules. Drop-in safety upgrade for OpenClaw agents.
import { createPetriGatePlugin }
from "@petriflow/openclaw"
// drop-in plugin for OpenClaw agents
const plugin = createPetriGatePlugin(
[observeBeforeSend()],
{ mode: "enforce" }
) Native extension for pi-mono. Full access to skill nets and tool mapping.
import { composeGates }
from "@petriflow/pi-extension"
// native extension with full net access
const gates = composeGates(
[testBeforeDeploy()],
{ mode: "enforce" }
)