# Agents

An agent drives a twin through `twin mcp`, the same commands as tools. The Claude Code plugin in the repository is the first client: it starts the server and adds two skills.

## The MCP server

`twin mcp` speaks MCP on standard input and output. Its tools are the commands:
`twin_list`, `twin_attach`, `twin_create`, `twin_up`, `twin_down`, `twin_screenshot`,
`twin_click`, `twin_type`, `twin_key`, `twin_scroll`, `twin_drag`, `twin_wait`, `twin_exec`,
`twin_put`, `twin_get`, `twin_style`. Their arguments are the flags, by the same names.

`twin_screenshot` returns the picture itself, so the model sees it at once, and its size, so a
click lands where the model saw the thing. `twin_up` takes `wait` to return once the twin answers
commands.

Any client that runs an MCP server over standard input can use it:

```json
{ "mcpServers": { "twin": { "command": "twin", "args": ["mcp"] } } }
```

## The Claude Code plugin

```sh
claude plugin marketplace add localixai/localix-twin
claude plugin install localix-twin@localix-twin
```

The plugin is a client and holds no logic. Its launcher finds `twin` in `$TWIN_BIN`, then on the
`PATH`, then in the repository's `target/release`. It brings two skills:

- **drive-a-twin**: look first, act in the screenshot's pixels, wait for the screen to settle,
  look again; open apps with `open -a` through the shell rather than by search; commands go
  through `twin_exec`, not typed into a terminal on the screen.
- **style-a-twin**: show the plan, check it with the person, then apply it.

The same plugin is an Agent Plugins core package (`plugin/plugin.json`, `plugin/mcp.json`), so
other hosts that load that format can take it.

## In a real session

The plugin was run in Claude Code on a twin: take a screenshot, open TextEdit, type a line, check
it, read the macOS version. Opus finished in 24 turns and 34 s, Sonnet in 28 turns and 35 s.
