# The deckclip command line

> Read, write, paste and ask AI from the terminal with deckclip.

`deckclip` is a command-line tool that controls Deck from the terminal and from scripts.

## Install and enable

`deckclip` comes with Deck. When Deck starts, it links `deckclip` into `/usr/local/bin`, or into `~/.local/bin` if that is not possible. Open a new terminal window after the first launch.

Then turn it on in Deck:

1. Open **Settings › Deck CLI**.
2. Turn on **Enable Deck CLI** ("Allow the deckclip command-line tool to communicate with Deck").

The setting is off by default, and Deck must be running. The page also shows quick-start commands.

## Quick start

```sh
deckclip version
deckclip health
echo "hello" | deckclip write
deckclip read
```

`deckclip health` checks that the command line can reach Deck. Run `deckclip -h`, or `deckclip <command> --help`, for the built-in help. Running `deckclip` alone in a terminal opens the interactive chat.

## Commands

| Command | What it does |
|---|---|
| `deckclip health` | Checks the connection to Deck. |
| `deckclip write [TEXT]` | Adds text to your history. Reads standard input when `TEXT` is omitted. |
| `deckclip read` | Prints the latest item's text. |
| `deckclip paste <1-9>` | Pastes item 1 to 9 of the panel. |
| `deckclip panel toggle` | Shows or hides the panel. |
| `deckclip ai run <PROMPT>` | Runs an AI prompt. |
| `deckclip ai search <QUERY>` | Searches your history with AI. |
| `deckclip ai transform <PROMPT>` | Transforms text with AI or a script plugin. |
| `deckclip chat` | Starts an interactive AI chat in the terminal. |
| `deckclip login` | Sets up the AI provider in the terminal. |
| `deckclip mcp` | Sets up MCP clients. See [MCP](https://deckclip.app/docs/automation/mcp). |
| `deckclip completion <shell>` | Prints a shell completion script. |
| `deckclip version` | Prints the version. |

### write

```sh
deckclip write [TEXT] [--tag <name>] [--tag-id <id>] [--raw]
```

- `--tag` and `--tag-id` give the item a tag, by name or by ID.
- `--raw` skips smart rules. Without it, rules apply as for any copied item.
- Writing fails while recording is paused.

```sh
echo "meeting notes" | deckclip write --tag work
```

### paste

```sh
deckclip paste <1-9> [--plain] [--target <bundle-id>]
```

`--plain` pastes as plain text. `--target` names the app to paste into by its bundle ID.

```sh
deckclip paste 2 --plain --target com.apple.TextEdit
```

### ai run

```sh
deckclip ai run <PROMPT> [--text <text>] [--save] [--tag-id <id>]
```

The input text comes from `--text` or standard input. `--save` stores the result in your history, and `--tag-id` tags it.

```sh
deckclip ai run "Summarize this" --text "Long text…" --save
```

### ai search

```sh
deckclip ai search <QUERY> [--mode <mode>] [--limit <n>]
```

`--mode` is `auto` (default), `exact`, `fuzzy`, `regex`, `mixed` or `semantic`. `--limit` defaults to 10 and is capped at 50.

```sh
deckclip ai search "invoice number" --mode regex --limit 5
```

### ai transform

```sh
deckclip ai transform <PROMPT> [--text <text>] [--plugin <plugin-id>]
```

Text comes from `--text` or standard input. With `--plugin`, a script plugin does the work. See [Smart rules and script plugins](https://deckclip.app/docs/automation/smart-rules).

```sh
cat draft.txt | deckclip ai transform "Translate to English"
```

### mcp

```sh
deckclip mcp
deckclip mcp setup [--client <client>] [--write] [--path <file>] [--command <cmd>]
deckclip mcp tools
deckclip mcp doctor
deckclip mcp cleanup [--idle-hours <hours>] [--dry-run]
```

See [MCP](https://deckclip.app/docs/automation/mcp).

## JSON output

Add `--json` to any command to get output for scripts.

```sh
deckclip read --json
```

```json
{"ok":true,"data":{"text":"hello"}}
```

Messages look like `{"ok":true,"message":"…"}`. Errors go to standard error as `{"ok":false,"error":"…"}`, and the exit code is 1.

## Security

`deckclip` talks to Deck over a local socket that only your user account can reach. Deck accepts connections only from the genuine `deckclip` program. When security mode is on, reading your history from the command line asks you to authenticate first.

AI commands use the provider you set up in Deck. See [AI assistant](https://deckclip.app/docs/automation/ai-assistant).

- Previous: [Siri and Shortcuts](https://deckclip.app/docs/automation/shortcuts.md)
- Next: [MCP](https://deckclip.app/docs/automation/mcp.md)

---

- HTML: https://deckclip.app/docs/automation/cli
- 中文: https://deckclip.app/zh-cn/docs/automation/cli.md

© 2026 Yuze Pan
