> This page is for v0.

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.nvidia.com/nemoclaw/llms.txt.

# Create Custom Policy Presets

> Author and apply a scoped network policy preset for an endpoint that NemoClaw does not include.

Create a custom preset when a sandbox needs an operator-reviewed endpoint that no maintained NemoClaw preset covers. Custom presets add scoped access to one sandbox without changing the baseline policy.

> **Warning**
>
> Custom preset hosts bypass NemoClaw's review process and can widen sandbox egress. Review every
> host before applying a custom preset, especially when the file originates outside your team.

## Author a Preset

Create a preset-format YAML file:

```yaml
preset:
  name: my-service-api
  description: "Reviewed external service"
network_policies:
  my-service-api:
    name: my-service-api
    endpoints:
      - host: api.example.com
        port: 443
        protocol: rest
        enforcement: enforce
        rules:
          - allow: { method: GET, path: "/**" }
    binaries:
      - { path: /path/to/requesting-binary }
```

Replace `/path/to/requesting-binary` with the exact executable path reported for the blocked request in `openshell term`.

For Deep Agents Code, OpenShell commonly reports `/usr/local/bin/dcode` or
`/opt/venv/bin/python3*`. Authorize only the process that needs the reviewed endpoint.

The top-level `preset.name` must be a lowercase RFC 1123 label with letters, digits, and hyphens.
It must not collide with a maintained preset name such as `slack` or `pypi`.
Rename `preset.name` if NemoClaw reports a collision.
Custom preset `network_policies` entries must not use `npm_yarn` or `personal_open_internet`.
NemoClaw reserves those keys for maintained presets and rejects the file before preview or application.

Each endpoint must name a specific host or a scoped subdomain wildcard such as `*.example.com`. NemoClaw rejects catch-all destinations, including `*`, `0.0.0.0`, `0.0.0.0/0`, `::`, and `::/0`. Rule matchers must match the endpoint protocol.

| Protocol  | Rule fields                                                           |
| --------- | --------------------------------------------------------------------- |
| REST      | `method` and `path`; `method` accepts standard HTTP methods or `*`    |
| WebSocket | `method` and `path`; `method` accepts `GET`, `WEBSOCKET_TEXT`, or `*` |
| JSON-RPC  | `method` only                                                         |
| MCP       | `method` with optional `tool` or `params.name`                        |

The same protocol-specific matcher shape applies to `deny_rules`.

User-authored presets must not declare `allowed_ips` for ordinary endpoints. NemoClaw rejects that field in files passed through `--from-file` or `--from-dir` because it can widen the private ranges that OpenShell checks during SSRF protection. Use hostnames, ports, protocols, methods, paths, and binary restrictions instead. The only exception is the `host.openshell.internal` bridge endpoint for explicit sandbox-to-host service access.

## Admit a Private Host

Use explicit private-host trust when a custom preset targets an operator-controlled endpoint on RFC1918, carrier-grade network address translation (CGNAT), or IPv6 unique local address space. This flow applies to REST, WebSocket, JSON-RPC, and MCP endpoint protocols.

> **Warning**
>
> The `--trusted-private-host` option and `NEMOCLAW_TRUSTED_PRIVATE_HOSTS` grant the custom preset
> access to each matching exact private host. Review the preset, resolved addresses, requesting
> binaries, methods, and paths before you apply it.

Pass the endpoint host with `--from-file` or `--from-dir`:

```bash
nemo-deepagents my-assistant policy add \
  --from-file ./presets/my-internal-api.yaml \
  --trusted-private-host api.corp.example \
  --dry-run
```

The option is invalid for a built-in preset because maintained presets own their reviewed destinations. NemoClaw validates every custom-preset endpoint, even when you provide no private-host declaration. It rejects untrusted private, loopback, link-local, metadata, unspecified, multicast, documentation, translation, benchmarking, and other reserved destinations. It also rejects unused, unrelated, wildcard, suffix, CIDR, URL-shaped, duplicate, or malformed `--trusted-private-host` declarations.

As an alternative, set `NEMOCLAW_TRUSTED_PRIVATE_HOSTS` to a comma-separated list of exact hosts for the current command. NemoClaw combines the environment list with any `--trusted-private-host` options. It normalizes and deduplicates environment entries and ignores entries unrelated to the custom preset batch.

After schema validation, NemoClaw resolves each declared endpoint and inserts every validated address as an exact `allowed_ips` value in memory. An exact trusted host can return both public and supported private addresses. NemoClaw pins every canonical answer. If any answer is a disallowed private, reserved, or special-purpose address, validation rejects the preset instead of discarding that answer. The dry-run output shows the generated pins for review. NemoClaw applies the transformed preset directly to the current OpenShell policy instead of the unpinned source file. Rebuild carries those live pins forward as part of the complete OpenShell policy without depending on ambient DNS. Reapply the source preset with explicit trust only when you intend to refresh the trusted host's address pins or change its endpoint policy.

To change the live address set, apply the source preset again with explicit trust. NemoClaw performs a new preflight and shows the changed pins before it applies them. Do not add `allowed_ips` to the source YAML.

## Apply a Single File

Preview the file before you apply it:

```bash
nemo-deepagents my-assistant policy add --from-file ./presets/my-service-api.yaml --dry-run
nemo-deepagents my-assistant policy add --from-file ./presets/my-service-api.yaml --yes
```

NemoClaw namespaces the preset keys in the current OpenShell policy. You can remove the preset later by name without keeping the original file while that live policy remains available.

## Apply Every File in a Directory

Apply preset files in lexicographic order:

```bash
nemo-deepagents my-assistant policy add --from-dir ./presets/ --yes
```

Processing stops at the first failure. NemoClaw does not remove presets that it already applied. Fix the failing file and run the command again to continue.

## Add a Preset to the Source Catalog

Save a maintained local preset under `nemoclaw-blueprint/policies/presets/`. The filename without `.yaml` must match `preset.name`. The preset catalog reads `preset.name`, while `policy add <name>` loads `presets/<name>.yaml`. A mismatch can list a preset that the named command cannot load.

Apply the catalog preset by name:

```bash
nemo-deepagents my-assistant policy add my-service-api
```

Run the same command after editing the file. NemoClaw compares the preset with the live policy and applies changed content.

## Remove a Custom Preset

Remove the preset by its name:

```bash
nemo-deepagents my-assistant policy remove my-service-api --yes
```

Run `nemo-deepagents <name> policy list` to see every maintained and custom preset present in the current OpenShell policy.

## Related Topics

* [Apply Policy Presets](apply-policy-presets) explains preset persistence and reapplication.
* [Network Policies](../../reference/network-policies) describes the policy schema.