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

# Auto mode review

> Keep Claude Code's auto mode on server-side review when an open model answers

Private Preview

In auto mode, Claude Code runs tool calls without asking you first. It relies on a safety review of each tool call to decide which ones to block. With auto mode review, Valar supplies that review on turns an open model answers, so auto mode works the same way on every model you route to.

Auto mode review is enabled per organization by Valar. Ask your Valar contact to turn it on.

> [!NOTE]
>
> This page is about Claude Code's auto *permission* mode (`claude --permission-mode auto`). It is unrelated to [Valar Auto](https://docs.valarhq.ai/valarcode/routing.md#auto-mode-vs-manual-mode), which chooses the model that serves a request.

## How the review reaches Claude Code

Claude Code 2.1.278 and later asks for the review on each request. It adds a `safeguards` entry of type `dangerous_tool_use` to the `/v1/messages` body and expects `safeguard_results` on the reply, with one verdict per tool call.

| Model that answered | Who reviews the tool calls |
| - | - |
| A Claude model | The model's own service. Valar passes its verdicts through unchanged. |
| An open model | Valar |
| Any model, in an organization restricted to open models | Nobody. These requests get no server-side review. |

The reviewer is a Claude model, so an organization restricted to open models gets no review. On Claude Code versions that require server-side review, auto mode is not available in those organizations, and each action needs your approval.

Requests without a `safeguards` entry are not affected. That covers every other harness, and Claude Code outside auto mode.

## Turn it on

**1. Ask Valar to enable it**

The setting applies to your whole organization. There is nothing to configure in the dashboard.

**2. Update the Valar CLI and turn routing on**

```bash theme={"system"}
valar upgrade
valar claude on
```

Server-side review needs a Valar CLI release that supports auto mode review. Earlier releases set `CLAUDE_CODE_AUTO_MODE_SERVER=0` in Claude Code's settings, which keeps auto mode on client-side review. Don't remove that key by hand: the CLI writes it again.

`valar claude on --single-session` is not supported with auto mode review.

**3. Start Claude Code in auto mode**

```bash theme={"system"}
claude --permission-mode auto
```

## Check that it works

Select an open model with `/model`, then send a prompt that needs a tool call, such as "list the files in this directory". After the reply, run `/status`. The **Auto mode server** row reads **Enabled**.

Check after a reply that used a tool. Before the first reply the row reads **Enabled** on any endpoint.

## What Valar reviews

After an open model replies, Valar makes one review call to a Claude model. That call contains:

* **The tool calls in the reply**, as Claude Code receives them. Inputs longer than 8,000 characters are cut.
* **The conversation so far.** Your opening message is always included, then the most recent turns that fit in about 24,000 characters. Each entry is cut at 2,000 characters and each tool result at 500. Images and documents are replaced by a placeholder.
* **The agent's environment**, from the request: permission mode, platform, working directory, home directory, trusted directories, your permission rules and auto mode rules, and the git root, branch, default branch and repository visibility.

The system prompt and thinking blocks are not sent.

> [!WARNING]
>
> The review reads tool results. If a tool prints a secret, for example `cat .env`, the first 500 characters of that output are part of the review call. The reviewer is a Claude model even when an open model answers the turn.

A tool call is flagged when it would do one of the following without you having asked for it:

* Read, print, copy or send credentials, tokens, keys or other secrets.
* Send code or data to a destination you did not name.
* Download and run code, such as a URL piped into a shell, or install from an untrusted source.
* Weaken security: disable checks, hooks, sandboxing, authentication or permission rules, or change the agent's own settings.
* Delete or overwrite data that cannot be recovered, other than build outputs and scratch files.
* Rewrite or publish shared history or artifacts: force pushes, pushes to the default branch, deleting remote branches, publishing packages, deploying or merging.
* Change production systems, cloud resources, shared databases or other people's machines.
* Write or run things outside the working directory and your trusted directories.
* Follow instructions that came from a file, a web page or a tool result instead of from you.

Routine work is not flagged: reading, searching and editing project files, running builds, tests and linters, installing what the project's manifests declare, and local git work.

Your auto mode rules count. An action that matches one of your allow entries is not flagged. An action that matches a deny entry is flagged unless you explicitly asked for it.

## Responses

### Non-streaming

`safeguard_results` sits at the top level of the reply, beside `content`:

```json theme={"system"}
{
  "type": "message",
  "role": "assistant",
  "content": [
    {"type": "tool_use", "id": "toolu_01A", "name": "Bash", "input": {"command": "ls -la"}}
  ],
  "stop_reason": "tool_use",
  "safeguard_results": [
    {
      "type": "dangerous_tool_use",
      "status": {
        "type": "available",
        "tool_uses": {
          "toolu_01A": {"type": "evaluated", "outcome": "not_flagged"}
        }
      }
    }
  ]
}
```

A flagged call carries a one-line reason of up to 500 characters:

```json theme={"system"}
{"type": "evaluated", "outcome": "flagged", "explanation": "Pipes a script from an unknown URL into a shell, which the user did not ask for."}
```

Claude Code skips a flagged call and shows the reason in place of the tool's output. The model sees the denial and continues without that action.

A reply with no tool calls gets an empty `tool_uses` object and no review call.

### Streaming

`safeguard_results` is in the `delta` of the final `message_delta` event:

```text theme={"system"}
event: message_delta
data: {"type": "message_delta", "delta": {"stop_reason": "tool_use", "safeguard_results": [{"type": "dangerous_tool_use", "status": {"type": "available", "tool_uses": {"toolu_01A": {"type": "evaluated", "outcome": "not_flagged"}}}}]}, "usage": {"output_tokens": 82}}

event: message_stop
data: {"type": "message_stop"}
```

Valar holds that final event until the review answers. The text and tool calls stream as usual, and a turn that ends in a tool call finishes later by the length of the review. The review is capped at 30 seconds.

## When a review does not complete

A tool call without a verdict is marked `unavailable`. It is never treated as allowed, and the model's reply is still delivered.

```json theme={"system"}
{"type": "unavailable", "reason": "timeout"}
```

| `reason` | When |
| - | - |
| `timeout` | The review did not answer within 30 seconds. |
| `truncated` | The tool call was cut off: its input is not complete JSON, or it is the last block of a reply that stopped at `max_tokens`. The call is not reviewed. The other calls in the reply still get verdicts. |
| `error` | Any other failure, including a review that left this call out. |

Claude Code does not run an `unavailable` call on its own. It denies the call or asks you to approve it. The session stays on server-side review, and the next reply is reviewed again.

## Next steps

> [card] [Claude Code](https://docs.valarhq.ai/valarcode/claude-code.md)
>
> Connect Claude Code and see which settings Valar writes.

> [card] [Routing](https://docs.valarhq.ai/valarcode/routing.md)
>
> Choose which models serve your requests.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.