---
title: "Claude Code Integration"
seo:
  description: "isolate sets up Claude Code inside guest VMs and gives you a single command to launch it."
---
<!--
Derived from trailofbits/coop.
Modified by chr33s: ported/adapted for the Swift implementation.
SPDX-License-Identifier: Apache-2.0
-->


isolate sets up Claude Code inside guest VMs and gives you a single command to launch it. This guide covers the `iso claude` command, the configuration that controls what gets injected into the guest, and the bootstrap sequence that runs when a VM starts.

## Launching Claude Code

```bash
iso claude [instance-name] [-- extra-args...]
```

This SSHes into the guest and runs the `claude` CLI. The guest's managed `~/.claude/settings.json` (written during VM startup) sets `defaultMode: bypassPermissions` and `skipDangerousModePermissionPrompt: true`, so Claude operates without confirmation prompts. The VM is the isolation boundary; permission prompts inside it are redundant.

To restore permission prompts for a single session, pass `--ask`. isolate then launches `claude` with `--permission-mode default`, overriding the guest default:

```bash
iso claude --ask
```

Trailing arguments go straight through to the `claude` CLI:

```bash
iso claude -- --model sonnet --verbose
```

## Managing background agents

```bash
iso claude-agents [instance-name] [-- extra-args...]
# or the short alias:
iso ca
```

This runs `claude agents` in the guest, which opens the agent view — an interactive TUI for monitoring background agent sessions. Background sessions are managed by Claude Code (not by isolate), so closing the TUI and reconnecting later with `iso ca` keeps you in sync with whatever is still running.

The agent view itself has no sign-in prompt, but it forwards a `/login` command to a new Claude Code session. If you haven't signed Claude in with `iso claude` (and aren't forwarding an `ANTHROPIC_API_KEY`), run `/login` at the start of your `iso ca` session to start the sign-in flow.

If the remote TUI appears stuck or stops responding, use OpenSSH's local escape: type Enter, then `~.` to disconnect. isolate forces the interactive SSH escape character to `~`, so the escape path is available even if your user SSH config changes or disables `EscapeChar`. If your terminal remains in raw/no-echo mode after the disconnect, run:

```bash
stty sane
```

This is separate from SSH startup failures that exit with code 255. isolate already restores the terminal after those failures; the escape sequence is for sessions where SSH is still connected and forwarding keystrokes to the remote TUI.

`claude agents` accepts `--cwd <path>` (filter sessions by working directory) and `--setting-sources <sources>`; pass them after `--`:

```bash
iso ca -- --cwd /workspace
```

Closing the TUI does not stop background sessions; reopening `iso ca` reattaches to whatever Claude Code's daemon is still running.

## Configuration

Claude-related settings live under the `claude` object in `~/.iso/config.jsonc`, except `github` which is a top-level field:

```jsonc
{
  "github": "auto",
  "claude": {
    "api_key": "cmd:security find-generic-password -s anthropic -w",
    "env_forward": ["MYORG_KEY"],
    "config_dir": "~/.claude",
    "marketplaces": [
      "https://github.com/anthropics/claude-plugins-official",
      "/path/to/local/marketplace"
    ],
    "plugins": ["rust-analyzer-lsp@claude-plugins-official"],
    "mcp_servers": {
      "sentry": { "type": "http", "url": "https://mcp.sentry.dev/mcp" }
    }
  }
}
```

Every field is optional. An empty `claude` object (or omitting it entirely) skips all bootstrap steps.

### API key forwarding

By default (`proxy.mode: "required"`, from the `provider-only` baseline) no
Anthropic credential reaches the guest: Claude Code calls the
[credential proxy](/docs/credential-proxy), which injects the credential stored by
`iso proxy setup`. A remote-model VM with agents and no provider proxy fails at
`iso up`/`iso start`. See [`proxy.mode`](/docs/configuration/security#proxymode).

Raw forwarding applies only when `proxy.mode` is `"auto"` with no Anthropic
proxy configured, or `"off"`, and `egress` is not `"none"` (for example with
the `networked` preset). isolate then forwards `ANTHROPIC_API_KEY` to the guest
via SSH `SendEnv` on every session: `iso claude`, `iso shell`, and `iso exec`
alike. The key is never written to disk inside the guest.

Resolution order:

1. `claude.api_key` in the configuration (a literal or a `cmd:` reference run on the host)
2. `ANTHROPIC_API_KEY` environment variable on the host

If neither is set, the guest starts without an API key. You can authenticate interactively the first time you run `claude` inside the VM.

### GitHub auth

The `github` field controls how isolate obtains a `GITHUB_TOKEN` for the guest. This token enables private repo cloning and `gh` CLI usage inside the VM.

| Value    | Behavior |
|----------|----------|
| `"auto"` | Check the `GITHUB_TOKEN` env var first. If unset, run `gh auth token` on the host to extract a token from the GitHub CLI. |
| `"env"`  | Require `GITHUB_TOKEN` in the host environment. Warns if missing. |
| `"off"`  | Skip GitHub token forwarding entirely. This is the default when `github` is unset. |
| `"pat"`  | Use a per-repo fine-grained PAT from `github.pat`. GitHub enforces the permissions and repositories selected for that token. Run `iso github setup-pat --repo owner/name` to add an entry; see [configuration.md](/docs/configuration/github#fine-grained-pat-github-pat) for the full reference. |

A [VM PAT assignment](/docs/configuration/github#assign-an-existing-pat-to-a-vm) selects an existing entry independently of workspace detection.

When a token is available, isolate runs `gh auth setup-git` in the guest during bootstrap. This configures the git credential helper so `git clone` works against private repositories without further setup.

### Config directory

`config_dir` selects a host directory to overlay into the guest's `~/.claude/`
on every agent bootstrap (`iso up` or `iso start`, without `--no-agents`).
Nothing is imported by default: name the directory (`"~/.claude"` to import
your host settings) to opt in. Omitting `config_dir` or setting it to `false`
disables the import; `null` is rejected. The root is read once into a confined
snapshot; a link that leaves it, or a special file, stops the import. Paths
support `~` expansion. Turning imports off later does not remove files an
earlier import copied into a retained guest disk.

```jsonc
{ "claude": { "config_dir": "~/claude-customizations" } }
```

The copied entries are `CLAUDE.md`, `keybindings.json`, `rules/`, `commands/`, `skills/`, `agents/`, `output-styles/`, `themes/`, and `workflows/`.
Directories are copied recursively in full, including nested skill references,
scripts, executable assets, hidden supporting files, and skills-directory plugin
bundles. The copy is a confined snapshot: a symlink is materialized only when it
resolves inside the `config_dir` root (a link outside it stops the import),
special files are refused, and an import is capped at 10,000 entries and
256 MiB. Directory names do **not** guarantee that
recursive content is free of credentials; select a source containing only content
you intend to put in the VM. Absolute host paths inside content are not rewritten.

Current Claude Code loading contracts (verified with 2.1.259):

| Content | Native behavior |
| --- | --- |
| `CLAUDE.md`, `rules/`, `commands/` | Personal instructions, rules and commands. |
| `skills/<name>/SKILL.md` | Personal skills with supporting files in the same bundle; see [skills](https://code.claude.com/docs/en/skills). |
| `skills/<directory>/.claude-plugin/plugin.json` | Immediate, non-hidden directories load as `<manifest-name>@skills-dir` without installation. Names are matched exactly in preferences; directory names and skill frontmatter do not determine plugin IDs. Hidden and reserved `synced` directories are not discovered. See [skills-directory plugins](https://code.claude.com/docs/en/plugins-reference#skills-directory-plugins). |
| `agents/` | Personal [subagents](https://code.claude.com/docs/en/sub-agents). |
| `output-styles/` | Personal [output styles](https://code.claude.com/docs/en/output-styles), selected by `outputStyle`. |
| `themes/` | Personal theme JSON files with `base` and `overrides`, available in `/theme`; selection from host `.claude.json` is not imported. See [themes](https://code.claude.com/docs/en/terminal-config). |
| `workflows/` | Personal `.js` workflows with a literal `export const meta` name/description, discovered as commands; see [workflows](https://code.claude.com/docs/en/workflows). Availability depends on Claude's workflow feature support. |
| `keybindings.json` | Native [keybindings](https://code.claude.com/docs/en/keybindings), read from the user config directory. |

Top-level `hooks/`, `monitors/`, and `routines/` are excluded. Merely copying a
hook script does not register it. Hooks and monitors **inside plugin bundles**
are copied with their registration files; Claude's own loading restrictions still
apply (plugin monitors are interactive-only). Host settings, credentials, sessions,
marketplaces, and `plugins/` installation/cache state are not copied wholesale.
Claude's separate synced-skills ownership registry, `skills/manifest.json`, is
also unsupported: import stops before transferring content when it is present.
Use a custom source with the personal bundles you want and without sync state.
Unreadable manifests or invalid plugin names likewise stop import rather than
risk dropping a disable preference. Invalid directory encoding is unsupported.

#### Companion preferences and refresh

From host `settings.json`, isolate selects only:

- `disableAllHooks` (boolean): applies to all guest Claude hooks, including hooks
  within copied skills/plugins and pre-existing guest hooks.
- `outputStyle` (string): selects the guest output style by name. Claude resolves
  the name; a style supplied by an excluded marketplace installation is not
  installed by this import.
- Boolean `enabledPlugins` entries whose exact IDs belong to copied,
  discoverable skills-directory plugins, including IDs recorded from previous
  copies retained by the overlay. Absent entries leave guest choices or
  Claude's manifest/default enablement in effect; isolate never synthesizes `true`.

Explicit imported values override the corresponding guest user preferences.
Unrelated guest settings and plugin entries survive. Isolate's managed permissions,
authentication handling, and model/proxy routing retain their existing precedence;
none can be supplied through this narrow host-settings merge. Claude's own
project/managed settings precedence still applies above user settings.

On each successful active-source refresh, removed host overrides restore the
previous guest values, or remove the key if none existed before import. A guest
edit that differs from the last imported value is retained when the host override
is removed. Removing an explicit disable therefore can enable that extension
again, according to the restored guest preference or Claude's default.
An absent host `settings.json` is an empty preference set; malformed settings or
invalid relevant preference types stop bootstrap before any Claude invocation.

Isolate retains a narrow `~/.claude/iso-import.json` snapshot for recovery, and
`_isoImportedPreferences` ownership metadata in guest `settings.json` for atomic
restoration of previous values. Imported preferences are applied before transferring staged extensions and before onboarding,
marketplace/plugin installation, or MCP registration, including after the existing
corrupt-settings fallback. The fallback still loses unrelated corrupt guest state,
but reapplies imported disables and style selection. An invalid import snapshot
stops bootstrap rather than treating disabled extensions as enabled.

Files follow an overlay lifecycle: restart overwrites files still present on the
host, but host deletions do not delete previous guest copies. `config_dir = false`
stops copying and retains both previous copies and the last preference snapshot.
A named directory must exist at config validation time. If a source disappears after validation, copying
is skipped and the snapshot retained. To remove retained content, remove it in the
guest or recreate the VM. Deletion synchronization and broader symlink/copier
hardening are outside this import contract.

### Environment variable forwarding

`env_forward` lists additional environment variable names to forward from the host to the guest via SSH `SendEnv`. These are forwarded on every SSH session, not just during bootstrap.

`ANTHROPIC_API_KEY` and `GITHUB_TOKEN` are handled through their own mechanisms (described above) and do not need to appear here. Provider credential variables (`ANTHROPIC_API_KEY`, `ANTHROPIC_AUTH_TOKEN`, `CLAUDE_CODE_OAUTH_TOKEN`, `OPENAI_API_KEY`) are an error here under the default `proxy.mode: "required"`.

```jsonc
{ "claude": { "env_forward": ["MYORG_KEY", "MYORG_REGION"] } }
```

Each variable must be set in the host environment at the time of the SSH session. Unset variables are silently skipped.

### Plugin marketplaces

`marketplaces` lists plugin marketplace sources. Each entry is either a remote URL (typically a GitHub repository) or an absolute path to a local directory.

```jsonc
{
  "claude": {
    "marketplaces": [
      "https://github.com/anthropics/claude-plugins-official",
      "/Users/me/dev/my-marketplace"
    ]
  }
}
```

Remote URLs are passed directly to `claude plugin marketplace add --scope user` inside the guest.

Local directories are first copied into the guest at `~/.iso/marketplaces/<dirname>/` via SCP, then registered using the guest-side path. This is useful when developing a marketplace and testing plugins without publishing them to a remote source.

### Plugin installation

`plugins` lists plugins to install from the registered marketplaces. Each entry is passed to `claude plugin install <name> -s user` inside the guest.

```jsonc
{
  "claude": {
    "plugins": [
      "rust-analyzer-lsp@claude-plugins-official",
      "devcontainer-setup@trailofbits"
    ]
  }
}
```

Plugins are installed after marketplaces are registered. If a plugin references a marketplace that hasn't been added, installation fails.

### MCP server registration

`mcp_servers` maps server names to their definitions. Each server is registered via `claude mcp add-json -s user <name>` inside the guest, with the JSON definition passed on stdin so resolved header values never appear in a process argument list.

Three server types are supported: stdio, HTTP and SSE (`"type": "sse"`, a remote server using server-sent events, configured like HTTP). See the [configuration reference](/docs/configuration/agents#mcp-servers) for every field.

**stdio**: a local command that communicates over stdin/stdout:

```jsonc
{
  "claude": {
    "mcp_servers": {
      "my-tool": { "command": "/usr/local/bin/my-tool", "args": ["--verbose"] }
    }
  }
}
```

**HTTP**: a remote server accessed by URL:

```jsonc
{
  "claude": {
    "mcp_servers": {
      "sentry": { "type": "http", "url": "https://mcp.sentry.dev/mcp" }
    }
  }
}
```

Server definitions can include an `env` map for environment variable name mappings passed through to the MCP server configuration.

## Bootstrap sequence

When `iso up` creates/restarts a project VM or `iso start` restarts a stopped VM (without `--no-agents`), isolate executes the following steps after the VM boots and SSH becomes available:

1. **GitHub auth**: If a `GITHUB_TOKEN` is available, run `gh auth setup-git` in the guest.
2. **User content preparation**: Stage the [allowlisted customizations](#config-directory) from `config_dir` and refresh their narrow companion-preference snapshot.
3. **Managed permissions**: Merge isolate's managed permission keys (`permissions.defaultMode: bypassPermissions` and `permissions.skipDangerousModePermissionPrompt: true`) into the guest's `~/.claude/settings.json`, preserving unrelated keys and applying the imported companion preferences described above. The setting must live in user scope — Claude Code ignores `skipDangerousModePermissionPrompt` from project settings. Other keys Claude Code stores in this file (notably `enabledPlugins` and `extraKnownMarketplaces`) are preserved except for the explicitly imported plugin IDs, so unrelated plugin and marketplace state survives a stop/start cycle. Isolate also owns the `env` block for local-model routing (see [Local model support](#local-model-support)): it is set when the VM is in local-model mode and removed in remote mode, so any hand-authored `env` entries in this file are not preserved. A file that cannot be parsed is replaced with managed defaults, then the imported companion preferences are reapplied before invoking Claude.
   After settings are written, transfer the staged content into guest `~/.claude/`, then seed onboarding when required.
4. **Marketplaces**: Register each `claude.marketplaces` source (local directories are copied to the guest first). On first boot, isolate skips any marketplace the image's template record lists as baked in; the Apple backend records none, so every configured marketplace is registered. Profile `marketplaces` are not applied.
5. **Plugins**: Install each `claude.plugins` entry from the registered marketplaces, with the same template-record delta as marketplaces (empty on the Apple backend). Profile `plugins` are not applied.
6. **MCP servers**: Register each MCP server definition.

On restart (`iso start` of a stopped instance), isolate refreshes GitHub auth (step 1), config directory contents (step 2), and the managed `~/.claude/settings.json` (step 3). Marketplaces, plugins, and MCP servers persist on the guest disk and are not re-installed.

### Skipping bootstrap

To create or restart a VM without any Claude Code configuration:

```bash
iso up . --no-agents
iso start --no-agents
```

This skips the entire bootstrap sequence. The VM boots normally but gets no API key, no GitHub token, no plugins, and no MCP servers. You can still run `iso claude` afterward; that session forwards any `env_forward` variables via SSH, and `ANTHROPIC_API_KEY` only where raw forwarding applies (see [API key forwarding](#api-key-forwarding)). Plugins and MCP servers won't be available unless you configure them manually inside the guest.

## Updating Claude Code

Claude Code auto-updates in the background by default — it checks for a newer version on startup and periodically, and applies the update on the next launch. isolate does not disable this. With open egress (`network.transport: "vmnet"` and `egress: "open"`, as the `networked` preset sets), Claude Code keeps itself current with no action from you. A default VM (brokered transport, `egress: "none"`) has no outbound network, so the background updater cannot reach the update server.

To force an update immediately rather than waiting for the background updater:

```bash
iso agent update --claude
```

This runs `claude update` synchronously inside the guest as the guest user. It is a convenience for when you want the newest version right now; for the recurring stale-agent problem, Codex is the one that needs attention (see [Updating Codex](/docs/codex-integration#updating-codex)). See [`agent update`](/docs/commands/agents#agent-update).

## Local model support

A VM can route Claude Code at a host-side local model server (Ollama / LM Studio
/ vLLM / llama.cpp) instead of Anthropic's cloud. The endpoint must serve the
Anthropic Messages API. Switch a VM with [`iso model set local <vm>`](/docs/commands/sessions#model)
and back with `iso model set remote <vm>`; configure the endpoint under
[`claude.local_model`](/docs/configuration/agents#local-model-routing) or interactively
at the `iso model set local …` prompt.

The selection is per VM and independent of Codex — Claude can run on a local
model while Codex stays on cloud, or the reverse. The endpoint Claude resolves
is the `claude.local_model` config object if present, otherwise an endpoint
saved interactively for the instance, otherwise none (it stays on cloud).
Config takes precedence over the saved endpoint.

In local mode isolate writes an `env` block into the managed
`~/.claude/settings.json` (see step 3 of the [bootstrap sequence](#bootstrap-sequence))
pointing `ANTHROPIC_BASE_URL` at the guest-visible endpoint, pinning every model
tier to the configured model, and supplying `ANTHROPIC_AUTH_TOKEN`. isolate owns
this `env` block: it is set in local mode and removed in remote mode, so
hand-authored `env` entries are not preserved. Two cache-stability keys
(`CLAUDE_CODE_ATTRIBUTION_HEADER=0`, `CLAUDE_CODE_DISABLE_GIT_INSTRUCTIONS=1`)
are set in local mode. They stop Claude Code from mutating the system prompt
per request, which keeps a local inference server's prompt cache warm.

Switching takes effect without a VM restart: isolate rewrites `settings.json` live
over SSH on a running VM (or saves the selection to apply on the next start). A
running `claude` reads its config at launch, so relaunch it (`iso claude <vm>`)
to pick up the change.
