# CLI agent

A CLI agent is an AI agent you run from the terminal, such as Claude Code or the Codex CLI. What it does with your files and how it differs from a chat window.

**Definition:** A CLI agent is an AI agent you start from the command line in a folder, where it reads and edits the files and runs commands for you, instead of answering in a chat window you copy from.

## Examples

- [Claude Code](/glossary/claude-code), from Anthropic.
- The [Codex CLI](/glossary/codex-cli), from OpenAI.
- Cursor Agent, which Cursor's CLI runs in any terminal.
- Gemini CLI, from Google, and OpenCode, which describe themselves as agents for the terminal.

## How it changes the work

A CLI agent works where your files are. Ask it to tighten an intro, split a long draft into three or rename every heading in a folder, and it does it in the files, so you read the result in your draft instead of pasting it in. Most read a standing instruction file at the start, such as [CLAUDE.md](/glossary/claude-md) for Claude Code or [AGENTS.md](/glossary/agents-md) for Codex and others.

Because it edits files directly, it can also change more than you meant. Keep a way back: a [checkpoint](/glossary/checkpoint) or a Git commit before it starts.

## In Flywrite

If an agent runs in your Mac's terminal, it runs in Flywrite's terminal, under the page you're writing. Flywrite has launchers for Claude Code, Codex and Cursor Agent. Claude Code sees the open file, line and selection automatically, and Cursor Agent does after its one-time setup; for any agent, select text and press ⌘⇧L to send it to the terminal ([how it works](/guides/send-selection-to-cli-agent)). Flywrite saves a checkpoint of the whole project when Claude Code starts in its terminal, and when Cursor Agent starts after its one-time setup. Codex and other CLI agents don't trigger it, so press ⌘⇧C before you start them. More in [The terminal](/docs/the-terminal).

## Questions

### Do I need to know the terminal to use a CLI agent?

Very little. You install it with one command, start it with another, such as claude or codex, and from then on you ask in plain words.

### How is a CLI agent different from a chatbot?

A chatbot answers in a window and you copy the result into your file. A CLI agent edits the file itself, so the change is already in your draft, and you need a way to undo it.

## Sources

1. [Claude Code: Overview](https://code.claude.com/docs/en/overview), checked 2026-11-10
2. [OpenAI Codex docs: Codex CLI](https://learn.chatgpt.com/docs/codex/cli), checked 2026-11-10
3. [Cursor CLI](https://cursor.com/docs/cli/overview), checked 2026-11-17
4. [Gemini CLI docs](https://geminicli.com/docs/), checked 2026-11-17
5. [OpenCode docs](https://opencode.ai/docs/), checked 2026-11-17
6. [Flywrite docs: The terminal](/docs/the-terminal), checked 2026-11-17

---

This is the Markdown copy of https://flywrite.app/glossary/cli-agent.
