# Line9 for coding agents (CLI)

Have Claude Code, Codex or another coding agent draw diagrams with Line9, and render your own from a terminal.

## What it does

The Line9 CLI, `line9`, is a command-line tool for macOS, Linux and Windows. With it:

- Coding agents such as Claude Code and Codex draw diagrams with Line9. Each diagram opens in a browser tab, and the tab updates when the agent changes the diagram.
- You can open your own Mermaid files in Line9, or save them as SVG.
- With [Line9 Pro](/docs/getting-started#line9-pro), you can publish flowcharts from the terminal.

## Install the CLI

On macOS or Linux:

```sh
curl -fsSL https://line9.ai/install.sh | sh
```

With Homebrew:

```sh
brew install line9-ai/line9/line9
```

On Windows, in PowerShell:

```powershell
irm https://line9.ai/install.ps1 | iex
```

With Node.js, run it without installing:

```sh
npx line9@latest
```

Put `npx line9@latest` in place of `line9` to run any command this way.

To download it yourself, see [the CLI page](/cli).

To check it's installed, run `line9 doctor`.

## Set up your coding agent

Run this once:

```sh
line9 bootstrap
```

It tells Claude Code and Codex that Line9 is installed, and adds the Line9 flowchart skill, which shows them how to write diagrams that Line9 lays out well. It sets up whichever of the two you have. For another agent, ask it to run `line9 robot`.

To set up only the folder your terminal is in, run `line9 bootstrap --project`.

## Ask your agent for a diagram

Ask in your own words:

- Draw a flowchart of how a support ticket is escalated.
- Draw a diagram of how the services in this repository call each other.

The agent writes the diagram as a Mermaid file and runs `line9 render` to open it in your browser. Ask for changes, and the same tab shows each new version.

## Render your own Mermaid files

To open a Mermaid file in a browser tab:

```sh
line9 render diagrams/expense-approval.mmd
```

Run it again after you change the file, and the tab updates.

To save a flowchart as an SVG file instead:

```sh
line9 render diagrams/expense-approval.mmd --out expense-approval.svg
```

To choose the theme, add `--theme linen` or `--theme blueprint`.

## Publish from the terminal

With Line9 Pro, sign in once, then publish a flowchart:

```sh
line9 login
line9 publish diagrams/expense-approval.mmd
```

`line9 publish` prints the diagram's address. Run it again on the same file to publish a new version at the same address. See [Publish a diagram](/docs/publish) for who can see it.

## Next

- [CLI commands](/docs/cli-commands): every command, and what it does.
- [Line9 in chat apps (MCP)](/docs/mcp): use Line9 in ChatGPT and Claude.
