# CLI Reference

The `agentteam` CLI manages the local daemon, service lifecycle, channels, agents, skills, diagnostics, documentation, and upgrades.

Many list/get commands support:

```text
--format, -f: table | json | jsonc | yaml | toml
```

## `agentteam connect`

Connect this machine to a AgentTeam server using a browser-issued one-time token.

```bash
agentteam connect --token <token> --server-url <url>
agentteam connect 'agentteam://connect?token=...&origin=https%3A%2F%2Fagentteam.example.com'
```

After exchanging the token, this command saves the AgentTeam channel settings and starts the daemon when needed.

## `agentteam onboard`

Interactive setup.

```bash
agentteam onboard
agentteam onboard --runtime
```

`--runtime` skips the full wizard and prints runtime detection status plus remediation guidance. It does not install or upgrade external runtimes.

## `agentteam daemon`

Start the daemon in the foreground, or save AgentTeam machine settings before startup.

```bash
agentteam daemon
agentteam daemon --server-url <url> --api-key <machineApiKey>
agentteam daemon --host 0.0.0.0 --port 9090
agentteam daemon --headless
```

`--headless` is exposed on macOS and Windows. Linux daemon runs headless.

## `agentteam agent`

Inspect agents synced from remote AgentTeam servers. Create, update, and delete agents from the corresponding AgentTeam server.

```bash
agentteam agent list
agentteam agent get <id>
```

`agent list` and `agent get` support `--format/-f table|json|jsonc|yaml|toml`. The `agent list` table output includes `ID`, `NAME`, `STATUS`, `RUNTIME`, `MODEL`, and `SOURCE`; structured formats expose the same live-or-registration state as `status`. When the daemon is running, `status` reflects its local session snapshot; without the daemon, it falls back to registration state.

## `agentteam channel`

Manage messaging channels.

```bash
agentteam channel list
agentteam channel get <id>
agentteam channel add [name] --agentteam.server-url <url> --agentteam.api-key <key>
agentteam channel update <id> --agent <agent-id>
agentteam channel delete <id>
agentteam channel rm <id>
agentteam channel enable <id>
agentteam channel disable <id>
```

## `agentteam skill`

Manage reusable skill documents.

```bash
agentteam skill list
agentteam skill get <id>
agentteam skill import <file-or-url>
agentteam skill import ./skill.md --id skill-id --name "Skill Name"
agentteam skill import ./skills.zip --force
agentteam skill delete <id>
agentteam skill rm <id>
```

Supported import sources include markdown files, archives, remote URLs, and GitHub/GitLab repository URLs.

## `agentteam service`

Install and manage the system service.

```bash
agentteam service install
agentteam service uninstall
agentteam service restart
agentteam service reinstall
```

On Linux and Windows:

```bash
agentteam service start
agentteam service stop
```

On Linux, `install`, `uninstall`, `start`, `stop`, `restart`, `reinstall`, and `status` support `--user` for the current user's systemd manager.

## `agentteam status`

Show installed or running service status.

```bash
agentteam status
agentteam status --user
agentteam status -f json
agentteam status --format yaml
```

On Linux, plain `agentteam status` checks both system and user services and shows installed services as active, failed, or inactive.

The status output contains process and local API facts only. It does not mint a
browser URL or expose the short-lived credential used internally when a CLI
command talks to the running daemon.

## `agentteam journal` / `agentteam j`

Read service logs.

```bash
agentteam journal
agentteam journal --tail 50
agentteam journal --head 20
agentteam journal -f
agentteam j -f --tail 20
```

Without flags, `agentteam journal` prints the resolved log path. The default log file is `~/Library/Logs/agentteam/agentteam.log` on macOS, `${TMPDIR:-/tmp}/agentteam/log/agentteam.log` on Linux, and `%LOCALAPPDATA%\agentteam\Logs\agentteam.log` on Windows. Set `log.dir` or `log.file` in `config.yaml` to override it.

The Desktop dashboard **AgentTeam logs** entry shows the latest 500 daemon log lines
and lets you copy the visible log text.

## `agentteam doctor`

Run diagnostics.

```bash
agentteam doctor
agentteam doctor --fix-runtime
```

## `agentteam upgrade`

Check and apply updates.

```bash
agentteam upgrade
agentteam upgrade --check
```

`agentteam upgrade` starts a background upgrade helper when auto-upgrade is available.

## `agentteam --version`

Print version information.

```bash
agentteam --version
agentteam --version -f json
```

## `agentteam doc`

Generate CLI documentation.

```bash
agentteam doc
agentteam doc --man
agentteam doc --man --install
agentteam doc --skill
```

`--man` and `--skill` are mutually exclusive.
