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

# Coding agents

> Claude Code, Codex, and OpenCode come pre-installed on every machine, already configured to work with boxd.

Every boxd machine ships with three coding agents: **Claude Code** (`claude`), **Codex** (`codex`), and **OpenCode** (`opencode`). Type the command from any directory and go. Forks and fresh machines have them too, since the agents are part of the image.

<video autoPlay muted loop playsInline src="/videos/claude-in-boxd-2.mp4" />

Claude Code starts already logged in on a fresh machine.

## Already configured for boxd

Each machine carries an instructions file that every agent reads through its own convention: `~/.claude/CLAUDE.md` for Claude Code, `~/.codex/AGENTS.md` for Codex, and `~/.config/opencode/AGENTS.md` for OpenCode. It tells the agent about the environment: the in-machine `boxd` CLI, the default proxy, and how to create sibling machines, manage proxies, and clean up. You skip the part where you explain the platform, because the agent already knows it.

A repo-level `CLAUDE.md` or `AGENTS.md` merges on top, so your project conventions come for free as well.

The in-machine `boxd` CLI is pre-authenticated, so any of the three agents can create machines, exec into them, and expose ports without a token or key setup. See [Machine to machine](/guides/vm-to-vm.md).

## Logins

* **Claude Code and Codex.** Sign in once per organization, on any machine. boxd serves the login to every private machine you have in that org, new machines and forks included. The credential is stored encrypted, and you can disconnect it from the console.
* **OpenCode.** Run the `opencode` login once on each machine. The login persists on that machine's disk, and a new machine asks again.

Prefer an API key over a subscription? Set `ANTHROPIC_API_KEY` (or the equivalent for the other agents) as an [env var or secret](/guides/env-secrets.md) and the same binaries use it.

> [!WARNING]
>
> Sharing a machine removes your agent logins from it, and no personal login is served to a shared machine, so a teammate can never read your tokens. See [Machine sharing](/guides/share-a-vm.md).

## Use them

Interactive:

```bash
boxd connect myapp
cd my-project
claude        # or codex, or opencode
```

Non-interactive, delegated from your laptop:

```bash
boxd machine exec myapp -- claude -p 'Add a /health endpoint' --dangerously-skip-permissions
boxd machine exec myapp -- codex exec 'Add a /health endpoint'
boxd machine exec myapp -- opencode run 'Add a /health endpoint'
```

Sessions live on the machine's persistent disk, so you can delegate a job and take over interactively later:

```bash
boxd connect myapp
claude --resume <session-id>
```

## An agent that is always available

The machine keeps running when you disconnect, so an agent session that lives on the machine outlives your laptop. Three pieces make it permanent: `tmux` keeps the terminal session alive on the machine, Claude Code runs inside it, and remote control connects the session to your Claude account so you can drive it from anywhere.

```bash
boxd connect myapp
tmux new -s agent
claude
```

Inside Claude Code, turn on remote control:

```text
/remote-control
```

<video autoPlay muted loop playsInline src="/videos/always-on-agent-2.mp4" />

A tmux session keeps the agent on the machine, and remote control makes it reachable from anywhere.

Now close the terminal whenever you like. The session keeps running on the machine, and you can check progress or reply from the Claude mobile app, the desktop app, or [claude.ai](https://claude.ai). Reattaching from a shell is `boxd connect myapp` followed by `tmux attach -t agent`.

> [!WARNING]
>
> The idle timers watch network traffic in either direction, not CPU. A session that works with no traffic looks idle and the machine hibernates mid-job. For an agent that must keep going unattended, disable hibernation: `boxd machine config set myapp auto-hibernate.timeout 0`. See [Suspend, resume, and hibernate](/guides/suspend-resume.md).

## Many agents at once

One agent on one machine is the starting point. To fan a problem out across many agents in parallel, each on its own machine with a lead agent merging the results, see [Agent swarm intelligence](/use-cases/agent-swarm-intelligence.md).

## FAQ

> [accordion] Do sessions survive a reboot?
>
> Yes. Session state lives on the persistent disk. Resume after a reboot with `claude --resume <session-id>`, and the same holds for the other agents' session storage.

> [accordion] Where do the Claude Code and Codex logins live?
>
> With boxd, encrypted, one per organization you sign in from. boxd serves them to your private machines in that org. Disconnect them from the console at any time. An OpenCode login lives on the disk of the machine you ran it on.

> [accordion] Can the agents run Docker, systemd, anything?
>
> Yes. A boxd machine has its own kernel, so anything you'd do on a Linux server, the agent can do here. See [Run Docker](/guides/run-docker.md).

> [accordion] Which instructions file wins when a repo has its own?
>
> The repo-level `CLAUDE.md` or `AGENTS.md` merges on top of the boxd-provided one, so the agent keeps the platform context and adds your conventions.
