# Claude Code

`kosa8 agent run claude` starts Claude Code in a microVM of its own on your computer, from the built-in `claude` kit. It sees one folder at `/work`, reaches only the hosts the kit lists, and holds a placeholder instead of your Anthropic credential. `kosa8 prompt` runs the same kit headless for one task.

**How this page was checked**

Against the built-in kit in kosa8's source (`pkg/kit/kit.go`) and the `kosa8 agent run` and `kosa8 prompt` commands, November 2026.

## Run it

```
$ curl -fsSL https://kosa8.com/install | sh
$ kosa8 daemon start
$ export ANTHROPIC_API_KEY=sk-ant-…          # or CLAUDE_CODE_OAUTH_TOKEN from `claude setup-token`
$ kosa8 agent run --dry-run claude          # print the plan, start nothing
$ cd ~/code/api && kosa8 agent run claude
```

Options for kosa8 go before the kit's name; anything after it is passed to Claude Code. The sandbox is removed when Claude Code exits, and your folder keeps what it changed.

## One task, headless

```
$ kosa8 prompt "add a test for parseConfig and make it pass"
$ git diff | kosa8 prompt --no-network -a claude -
$ kosa8 prompt --dry-run "upgrade the lodash dependency"
```

`claude` is the default agent (or `$KOSA8_AGENT`). The task is the rest of the command line, or standard input when it is `-`. The exit status is Claude Code's.

## What the kit sets

| Field | Value |
|---|---|
| Image | `node:22-slim` (Debian: Claude Code's Bash tool needs bash) |
| Package | `@anthropic-ai/claude-code` 2.1.296, checked against a pinned digest |
| Workspace | the current directory, or `-w DIR`, at `/work` |
| Network | `registry.npmjs.org`, `statsig.anthropic.com`; `api.anthropic.com` through the broker |
| Credentials | `CLAUDE_CODE_OAUTH_TOKEN` first, else `ANTHROPIC_API_KEY`; the sandbox gets `ANTHROPIC_BASE_URL` (the broker) and a placeholder |
| Headless command | `claude -p TASK --permission-mode bypassPermissions`, with `IS_SANDBOX=1` |
| Hook | kosa8's hook on every tool call, checked before it runs |
| Skills folder | `$HOME/.claude/skills` |
| Size | 4 vCPUs, 4096 MB |

## Flags

| Flag | What it does |
|---|---|
| `-w, --workspace DIR` | The host folder the agent may see (default: the current directory) |
| `--no-network` | Deny all network access, overriding the kit |
| `--keep` | Keep the sandbox after the agent exits |
| `--name` | The sandbox's name |
| `--dry-run` | Show what would run without creating the sandbox |
| `--skill NAME` | Give the agent an imported skill (`kosa8 skill add`); repeatable |

To change anything else, `kosa8 agent init claude` writes the kit to `~/.kosa8/kits/claude.yaml`; a kit there overrides the built-in of the same name. See [Writing a kit](https://docs.kosa8.com/guides/kits/).

## Held calls, the log, and stopping

```
$ kosa8 mcp asks                # calls waiting for a person, e.g. a force push
$ kosa8 mcp approve ID
$ kosa8 audit ls
$ kosa8 audit verify
$ kosa8 sandbox pause --all     # freeze every running sandbox
```

See [Run an AI assistant](https://docs.kosa8.com/guides/agents/), [Rules for tool calls](https://docs.kosa8.com/guides/tool-rules/) and [The audit log](https://docs.kosa8.com/guides/audit/).

## What it does not cover

- The shared folder: Claude Code can change anything in it, including `.git` and `.env`. Commit first.

- What it sends to the hosts it can reach, including your code to the model.

- The placeholder is a capability: anything in the sandbox can spend the key through the broker. Set a limit at your provider.

- kosa8 does not detect or stop prompt injection; it limits what an injected instruction can reach.

To run Claude Code on kosa8 Cloud instead, see [Claude Code in a kosa8 Cloud sandbox](https://kosa8.com/guides/run-claude-code-in-cloud-sandbox/), or connect a local Claude Code to the [cloud MCP server](https://docs.kosa8.com/guides/cloud-mcp/). The overview with FAQs is on kosa8.com: [Run Claude Code in a microVM sandbox](https://kosa8.com/docs/integrations/claude-code/).

---
Source: https://docs.kosa8.com/guides/claude-code/
