# Use VAIL from Claude Code

> Connect Claude Code to VAIL, then scan, probe, and harden an agent from the repository you have open. This also covers Claude on the web and Cowork. The page for people is https://agents.projectvail.com/docs/guides/claude-code; all guides: https://agents.projectvail.com/docs/guides.md

## Before you start

- A VAIL account. Sign up at [agents.projectvail.com](https://agents.projectvail.com); VAIL approves each new organization before its scans run. Accounts, approval, and tokens are explained in [auth.md](https://agents.projectvail.com/auth.md).
- The repository of the agent you want to test, open in Claude Code.
- A sandboxed copy of that agent, if you will probe it. Probes try to make it break its rules, and its tool calls are real.

## Install the plugin

1. Run these in Claude Code. The plugin connects VAIL's MCP server and brings the `agent-assurance` and `agent-improvement` skills.

   ```
   /plugin marketplace add projectvail/vail-agent-assurance
   /plugin install vail-agent-assurance@vail-agent-assurance
   ```

2. Run `/mcp`, select `vail`, and sign in to VAIL in the browser window that opens. Or sign in from a terminal:

   ```sh
   claude mcp login plugin:vail-agent-assurance:vail
   ```

3. Approve access for your organization. No token passes through Claude Code, and you can revoke the connection under [Access tokens](https://agents.projectvail.com/settings/tokens).

## Claude on the web and Cowork

VAIL is listed in the Anthropic Directory as a plugin and connector for claude.ai and Cowork. Add it there, and sign in to VAIL when prompted.

## Without the plugin

1. Connect the MCP server directly, then sign in:

   ```sh
   claude mcp add --scope user --transport http vail https://agents.projectvail.com/mcp
   claude mcp login vail
   ```

2. Optional: add the VAIL skills, which explain the workflow in more detail. VAIL's MCP server describes its own tools, so they are not required.

   ```sh
   mkdir -p ~/.claude/skills/agent-assurance ~/.claude/skills/agent-improvement
   curl -fsSL https://raw.githubusercontent.com/projectvail/vail-agent-assurance/main/plugins/vail-agent-assurance/skills/agent-assurance/SKILL.md -o ~/.claude/skills/agent-assurance/SKILL.md
   curl -fsSL https://raw.githubusercontent.com/projectvail/vail-agent-assurance/main/plugins/vail-agent-assurance/skills/agent-improvement/SKILL.md -o ~/.claude/skills/agent-improvement/SKILL.md
   ```

## For CI or headless machines

For headless machines and CI, where no browser can open. Create a token under [Access tokens](https://agents.projectvail.com/settings/tokens). It acts as you, so keep it in your shell profile as `VAIL_TOKEN`, never in chat or a committed file. With `VAIL_TOKEN` set, run this. The shell expands the token, so Claude Code saves it in its configuration.

```sh
claude mcp add --scope user --transport http vail https://agents.projectvail.com/mcp \
  --header "Authorization: Bearer $VAIL_TOKEN"
```

## Check the connection

Ask Claude Code:

```
Which VAIL organization am I connected to?
```

It calls `get_identity`, which names your organization and whether it may scan yet. Until VAIL approves a new organization, it can create agents and upload source, but scans and probe generation wait.

## Onboard your agent

Open the agent's repository in Claude Code, and ask:

```
Use VAIL to onboard the AI agent in this repository: create it in VAIL, upload its source, scan it for behaviors, and generate probes. Then summarize the vulnerability and control behaviors it found.
```

It creates the agent in VAIL, shows you the files it will upload, uploads them with its own shell tools, scans the agent, and generates probes. Scans take several minutes. You approve probes and schedule them against the running agent in the [web app](https://agents.projectvail.com/agents).

## Test and fix the agent locally

The `agent-improvement` skill tests the agent's risks against a copy running on your machine, graded the way VAIL grades them, then fixes what the tests show and runs them again. It works for LangGraph, Hermes, and OpenClaw agents. Ask:

```
Use the agent-improvement skill to test this agent's VAIL behaviors against a local copy, and fix what fails.
```

You choose which risks to address and approve every change. The skill installs VAIL's grading package in a virtual environment of its own, and keeps results in `.vail/` in the agent's repository. Keep that directory out of version control, since it holds the agent's replies.

## Troubleshooting

- The `vail` tools are missing: run `/mcp` and check that `vail` is connected. If it asks you to sign in, do so.
- Calls stop authenticating: sign in again with `/mcp`. With a personal token, check that it has not expired or been revoked.
- A tool returns `organization_not_approved`: your organization is still pending. Uploads work; scans and probe generation start once VAIL approves it. Questions: contact@projectvail.com.
