npm install @petriflow/rules

Claude Code

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

Vercel AI SDK

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(),
})

OpenClaw

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" }
)

pi-mono

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" }
)