nodrail

Docs overview

Write your first APF rule, connect it to Claude Code or add a policy check to your own tool runner. Teams using Nodrail Cloud can connect agents to a shared approval queue.

Try APF locally · Integrate your own harness · Connect to Cloud

Start locally

Install the open-source engine with Node.js 22 or later. No account is needed.

npm i -g @nodrail/policy-engine

With pnpm, run pnpm setup once first, then pnpm add --global @nodrail/policy-engine.

Try APF locally walks you through a two-rule rules.yaml: check what it allows and denies, test it in CI and enforce it in Claude Code. The same file imports into Nodrail Cloud when your team needs it.

Add a playbook to a repository

nodrail is Nodrail's one command line. It adds ready-made policies to a repository, such as letting an agent open a draft pull request only after QA and review passed. nodrail policy runs the same commands as nodrail-policy.

npm i -g @nodrail/cli
nodrail add @nodrail/open-reviewed-pr

Playbooks (preview) walks you through giving the module its values, reviewing the permission changes, locking them and exporting one APF file for your agents.

Connect an agent to Cloud

  1. Create a workspace, or sign in.
  2. Open Agents → Connect an agent and choose the integration. Copy its Nodrail credential when shown and store it in your environment's secret settings.
  3. Follow the matching setup instructions. For Codex, enable the installed hooks before testing; installation alone does not activate them.
  4. Try a harmless covered call with no matching rule. Review the request in Approvals: Allow once allows it once, and Always allow… also adds a rule for exactly that request after you confirm it. Write broader rules for recurring work in Policies, or import the rules.yaml you tested locally.
  5. Test an explicit denial and verify the underlying tool did not run. Check your integration's failure behavior before relying on it.

A TypeScript connection starts with:

npm install @nodrail/client

Set NODRAIL_CREDENTIAL in your runtime's secret settings. For an existing compatible tools collection:

import { guard } from "@nodrail/client";

const governedTools = guard(tools);
// Pass governedTools to your existing agent instead of tools.

This fragment assumes tools already exists. Do not put the credential in browser code or a public repository. The SDK is a Cloud connection; it is not the offline policy engine.

Choose an integration · SDK reference and examples

All documentation

Get started

  • Try APF locally: install the engine, write rules, test them and connect Claude Code.

Policies

Integrations

Nodrail Cloud

Reference

The client remains a developer preview before 1.0. Pin package versions in applications and check compatibility when upgrading. Local policy tests verify decisions; integration tests must also prove that blocked calls never invoke the underlying tool.