> ## Documentation Index
> Fetch the complete documentation index at: https://docs.befailproof.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Prevent your first failure with a policy

> Author a policy version, deploy it in observe mode, and then enforce it.

Use a policy only after you can describe the unsafe action and the legitimate actions that must remain allowed.

<Tabs>
  <Tab title="Dashboard">
    <Steps>
      <Step title="Author the policy">
        Go to **Admin → policy editor**. Start with the demo policy, review or edit its source, then select **publish version**. Publishing creates the immutable version that you can deploy to machines.

        <img src="https://mintcdn.com/exosphere/WgPwQzedeDNwJBTy/images/dashboard/policy-editor.png?fit=max&auto=format&n=WgPwQzedeDNwJBTy&q=85&s=7c01c862f4ec601d0535a6969eb619ce" alt="The Policy editor compose view with a demo policy ready to publish as an immutable version." width="2938" height="1608" data-path="images/dashboard/policy-editor.png" />
      </Step>

      <Step title="Deploy it to a machine">
        Go to **Admin → enforcement**, expand the target machine, and select **edit this machine**. Add the published demo policy, pin its version, choose **observe**, and apply the deployment.

        <img src="https://mintcdn.com/exosphere/WgPwQzedeDNwJBTy/images/dashboard/enforcement-editor.png?fit=max&auto=format&n=WgPwQzedeDNwJBTy&q=85&s=264a3a1f53c025dae05c8498156aa49a" alt="The machine deployment editor with a published policy version selected in observe mode before applying the deployment." width="2936" height="1508" data-path="images/dashboard/enforcement-editor.png" />
      </Step>

      <Step title="Verify the policy">
        Run a new agent session on that machine, then open **Observe → policy**. Select the machine and confirm that the demo policy appears in the policy mapping and decision timeline. Observe mode records what the policy would do without blocking the action.

        <img src="https://mintcdn.com/exosphere/WgPwQzedeDNwJBTy/images/dashboard/policy-observe.png?fit=max&auto=format&n=WgPwQzedeDNwJBTy&q=85&s=13535ad27c8bddac6589f9d1560916cb" alt="The Policy page showing decision totals, enforcement activity over time, and local and Cloud-managed policy mappings." width="2372" height="1548" data-path="images/dashboard/policy-observe.png" />
      </Step>
    </Steps>
  </Tab>

  <Tab title="CLI">
    Cloud policy authoring and fleet deployment are administrative workflows. Use the local CLI to validate the same policy before publishing it:

    ```bash theme={null}
    failproofai policies --install --custom ./payment-retry.policies.ts \
      --cli claude --scope project
    failproofai config --status
    ```

    Use `fp` to inspect Cloud-visible policy decisions:

    ```bash theme={null}
    fp events --event-type hook_completed --env production --since 24h
    fp sessions --env production --since 24h
    ```

    The Cloud CLI does not expose root-only enforcement deployment routes. Publish versions from **Admin → policy editor** and deploy them from **Admin → enforcement**.
  </Tab>
</Tabs>
