# Docs overview

> Choose a local APF quickstart, connect the Claude Code hook, integrate a custom harness or set up a Cloud workspace.

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](https://nodrail.com/docs/quickstart) · [Integrate your own harness](https://nodrail.com/docs/library#connect-a-custom-harness) · [Connect to Cloud](#cloud)

## Start locally {#local}

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

```sh
npm i -g @nodrail/policy-engine
```

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

[Try APF locally](https://nodrail.com/docs/quickstart) 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 {#playbooks}

`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`.

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

[Playbooks (preview)](https://nodrail.com/docs/playbooks) 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 {#cloud}

1. [Create a workspace](https://app.nodrail.com/signup), or [sign in](https://app.nodrail.com/login).
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:

```sh
npm install @nodrail/client
```

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

```ts
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](https://nodrail.com/integrations) · [SDK reference and examples](https://nodrail.com/docs/sdk)

## All documentation {#reference}

**Get started**

- [Try APF locally](https://nodrail.com/docs/quickstart): install the engine, write rules, test them and connect Claude Code.

**Policies**

- [Agent Policy Format (APF)](https://nodrail.com/docs/apf): YAML rules, outcomes, precedence and tests.
- [Playbooks (preview)](https://nodrail.com/docs/playbooks): add ready-made policies to a repository, lock them and export one file.
- [Rules reference](https://nodrail.com/docs/rules): fields, lists, macros and overrides.
- [Commands and tools](https://nodrail.com/docs/commands-and-tools): action mapping and command semantics.
- [Runs, gates and budgets (preview)](https://nodrail.com/docs/runs): rules about what already happened in a piece of work, and the receipts agents end with.

**Integrations**

- [Integrate your own harness](https://nodrail.com/docs/library): use the engine in your own tool runner.
- [Claude Code and Codex](https://nodrail.com/docs/agent-plugins): the Cloud plugins, what they check and how they fail.
- [TypeScript SDK](https://nodrail.com/docs/sdk): guard the tools you pass to your agent.

**Nodrail Cloud**

- [Using Nodrail Cloud](https://nodrail.com/docs/cloud): Overview, Approvals, Policies, Activity and Insights.
- [Runtime API](https://nodrail.com/docs/runtime-api): ask Cloud for a decision over HTTPS from any language.
- [Personal API (preview)](https://nodrail.com/docs/api): your workspace from scripts, with a personal access token.

**Reference**

- [CLI reference (nodrail)](https://nodrail.com/docs/cli): project, policy and Cloud commands.
- [CLI reference (nodrail-policy)](https://nodrail.com/docs/nodrail-policy): validation, evaluation, testing and execution gates.
- [Security model](https://nodrail.com/docs/security-model): data flows, enforcement and bypass boundaries.

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.
