---
name: commandagi
description: Work in CommandAGI for the user. Connect to its hosted MCP server, then design parts and circuit boards, run simulations, build and host websites, send mail, texts and letters, start agent threads, and drive real machines (CNC mills, printers, robot arms, cameras) inside standing grants. Every document is a code file in the user's Drive. Use when the user names CommandAGI, a `cloud://home/…` address or a `.3d.tsx`, `.sch.tsx`, `.pcb.tsx` or `world.tsx` file, or asks you to make something real that needs more than this repository.
metadata:
  homepage: https://commandagi.com
  docs: https://commandagi.com/agents.md
---

# CommandAGI

CommandAGI is one place where people and agents make things: documents, designs, websites, simulations, and jobs on
real machines. You work in it through its tools. What you make is plain files in the user's Drive, and each file opens
in an editor in the user's browser.

This skill is the short path. The long page for agents is https://commandagi.com/agents.md, and the index of the docs
is https://commandagi.com/llms.txt. Fetch them when you need a detail that is not here.

## 1. Connect

Use the hosted MCP server. It needs no install and no key: the user signs in once in their browser.

Claude Code:

```sh
claude mcp add --transport http commandagi https://api.commandagi.com/mcp
```

Then the user runs `/mcp`, selects `commandagi` and signs in.

Codex:

```sh
codex mcp add commandagi --url https://api.commandagi.com/mcp
```

Codex opens the sign-in page. If it does not, run `codex mcp login commandagi`.

Any other MCP client: add a Streamable HTTP server at `https://api.commandagi.com/mcp`. The client signs in with OAuth,
or sends `Authorization: Bearer <key>` with an API key.

A server added during a session starts with the next session. If the `commandagi` tools are not in your tool list
after you add the server, tell the user to restart you, and stop there.

Check the connection first: call `whoami`. It answers the account you act for.

## 2. Find a tool

The server lists the tools you need on every turn. The editors' operations (a sketch, an extrude, a board's routing)
are found by search:

1. `search_tools` with a few words ("add sketch", "route board", "send letter").
2. `describe_tool` with the name, for its whole schema.
3. Call the tool by that name.

Do not guess a tool's name or arguments. Search, then read the schema.

Tools you use often:

| to | call |
| --- | --- |
| see who you are and what you may spend | `whoami`, `get_credits` |
| list, read and write files | `list_drive`, `read_drive_file`, `write_drive_file` |
| run a snippet in a sandbox | `run_code` |
| start an agent on a goal and follow it | `create_thread`, `send_message`, `get_thread`, `thread_events` |
| host a folder as a website | `create_site`, `deploy_site` |
| reach a computer the user paired | `list_hosts`, `host_call` |

## 3. Documents are code

Every document is one code file. An editor opens it, and each edit a person makes in the editor is written back into
the code. You write the same file. One declarative file is cheaper and more exact than one call per operation, so
prefer writing the file to driving an editor step by step.

| file | what it is |
| --- | --- |
| `<name>.3d.tsx` | a 3D design: parts, assemblies, a scene a simulator steps |
| `<name>.sch.tsx` and `<name>.pcb.tsx` | a circuit: its schematic, and the board that names it |
| `<name>.page.tsx`, `<name>.sheet.tsx`, `<name>.deck.tsx` | a page, a workbook, a slide deck |
| `<name>.dashboard.tsx` | a dashboard: panes and the files they show |
| `<name>.task.tsx`, `<name>.project.tsx` | a task and a project |
| `devices/<id>/definition.tsx` | one kind of machine, as a set of channels |
| `worlds/<id>/world.tsx` | real machines placed as units in a space |

A file's address is `cloud://home/<account>/<path>`. `whoami` gives the account. A world looks like this:

```tsx
export default () => (
  <world name="Shop floor">
    <space origin_mm={[0, 0, 0]} size_mm={[6000, 4000, 3000]} />
    <unit uid="mill-1" name="Mill" device="../../devices/cnc-3018/definition.tsx" position={[1200, 800, 0]} rotation={0} />
  </world>
);
```

Before you write a kind of file for the first time, read one that exists: `list_drive` the shipped examples at
`cloud://home/user-commandagi/examples/` and `cloud://home/user-commandagi/global/`, and `read_drive_file` the nearest
one. The formats are at https://commandagi.com/docs/foundations/files-and-formats.

When you have written a file, give the user its link, alone on a line, so they open it in the editor:

```
https://commandagi.com/?open=/file?path=cloud://home/<account>/<path>
```

A reference inside a file is a path relative to that file's folder, or a whole address. Do not invent ids.

## 4. The command line and the SDKs

Use these when the user wants a script, a build step or a terminal, not a conversation.

```sh
npm install -g @commandagi/host   # the `commandagi` command and this computer's host
npm i commandagi                  # the TypeScript SDK
pip install commandagi            # the Python SDK
cargo add commandagi              # the Rust SDK
```

All four read the API key from the environment variable `COMMANDAGI_API_KEY`. `commandagi help` lists every command;
`commandagi call <tool> --json '{…}'` calls any tool by name.

```ts
import { CommandAGI } from "commandagi";

const cagi = new CommandAGI(); // reads COMMANDAGI_API_KEY
console.log(await cagi.call("whoami"));
```

```rust
use commandagi::client::CommandAGI;

let cagi = CommandAGI::from_env()?; // reads COMMANDAGI_API_KEY
let thread = cagi.threads().create("Design a bracket for a NEMA 17 motor")?;
cagi.threads().send(&thread.id, "Make it 3 mm thick.")?;
```

## 5. Keys

- The hosted MCP server needs no key when the client signs in.
- The command line and the SDKs need `COMMANDAGI_API_KEY`. The user makes one in the workbench: the account menu,
  **API keys**. Ask them to put it in a file git ignores (`.env`), as `COMMANDAGI_API_KEY=…`. Do not ask them to
  paste it into the chat.
- When `commandagi help` lists `keys`, make a narrower key yourself, with no browser:
  `commandagi keys create --for me --scope <scopes> --into .env:COMMANDAGI_API_KEY`. It writes the key into the file
  and prints only its id.
- Never print a key, never put it in a command's arguments, a log, a commit or a document. Check that the file is
  ignored before you write to it.

## 6. Real machines

A design (`.3d.tsx`) and a world's twin are simulated: run them freely. A world names real machines, and these rules
hold for every action on one:

- You act only inside a **standing grant**: a recorded act that names you, the world or unit, and the limits. Call
  `list_my_grants` first. If no grant covers the action, say which grant is missing. Do not look for a way around it.
- **Stopping is always allowed.** `stop`, pause, feed hold, torque off and emergency stop are open to anyone who holds
  any grant on the unit. When something looks wrong, stop first.
- Every action is recorded before it is sent, with who sent it.
- **An acknowledgement is not a state.** `ok` means the machine received the command. Read the state the machine
  reports before you go on.
- **Unknown stays unknown.** A lost link is `state: unknown`. Do not assume the last command finished.
- **Nothing retries by itself.** If you decide to send a physical command again, that is a new command and a new
  decision. Say why.
- A simulated result is never evidence that the real machine did something.

Simulate first. Move to the real unit when the simulated run does what the user asked.

## 7. How to work

1. Say back, in one line, what the user wants made.
2. `whoami`, then find the tools (`search_tools`).
3. Read a nearby example file, then write the file.
4. Check it with the tool that fits (a design's check, a board's rule check, a site's deploy log) and fix what it
   reports.
5. Give the user the link to open it.

Things that cost money (a posted letter, a phone number, a part order, a paid model) are quoted by their own tools
before they are bought. Quote first, tell the user the price, then buy.
