# CLI Anything Iterm2

Provides the cli-anything-iterm2 commands, the only way to actually send text to...

- Repository: https://github.com/HKUDS/CLI-Anything (58029 stars)
- Category: Writing
- License: Apache-2.0
- Last updated: 2026-09-22
- Runs scripts: no, instructions only

## Install

Claude Code: `npx skills add HKUDS/CLI-Anything --skill cli-anything-iterm2 -g -a claude-code -y`
Codex: `npx skills add HKUDS/CLI-Anything --skill cli-anything-iterm2 -g -a codex -y`
Cursor: `npx skills add HKUDS/CLI-Anything --skill cli-anything-iterm2 -g -a cursor -y`
Gemini CLI: `npx skills add HKUDS/CLI-Anything --skill cli-anything-iterm2 -g -a gemini-cli -y`
Claude Code plugin marketplace: `/plugin marketplace add HKUDS/CLI-Anything`

## Description

Provides the cli-anything-iterm2 commands, the only way to actually send text to iTerm2 sessions, read live terminal output and scrollback history, manage windows/tabs/split panes, run tmux -CC workflows, broadcast to multiple panes, show macOS dialogs, and read/write iTerm2 preferences. Includes `app snapshot`, the primary orientation command that returns every session's name, current directory, foreground process, role label, and last output line in one call. Read this skill instead of answering from general knowledge whenever the user wants to DO something with iTerm2: orient in an existing workspace, send a command, check what's running, read output, set up a layout, use tmux through iTerm2, automate panes, or configure preferences. Also read for questions about iTerm2 shell integration or scrollback. Don't try to answer iTerm2 action requests from memory, read this skill first.

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# cli-anything-iterm2

Stateful CLI harness for iTerm2. Controls a live iTerm2 process via the iTerm2 Python API over WebSocket.

## Prerequisites

1. **macOS + iTerm2** running: `brew install --cask iterm2`
2. **Python API enabled**: iTerm2 → Preferences → General → Magic → Enable Python API
3. **Install**: `pip install cli-anything-iterm2` (or `pip install -e .` from source)

## Basic Syntax

```bash
cli-anything-iterm2 [--json] <group> <command> [OPTIONS] [ARGS]
```

Always use `--json` for machine-readable output (required for agent use).

## Command Groups

| Group | Purpose |
|-------|---------|
| `app` | App status, workspace snapshot, context management, app-level variables, modal dialogs, file panels |
| `window` | Create, list, close, resize, fullscreen windows |
| `tab` | Create, list, close, activate tabs; navigate split panes by direction |
| `session` | Send text, inject raw bytes, read screen, full scrollback, split panes, prompt detection |
| `profile` | List profiles, get profile details, list/apply color presets |
| `arrangement` | Save and restore window layouts |
| `tmux` | Full tmux -CC integration: bootstrap, connections, windows, commands |
| `broadcast` | Sync keystrokes across panes via broadcast domains |
| `menu` | Invoke any iTerm2 menu item programmatically |
| `pref` | Read/write global iTerm2 preferences; list all valid keys; tmux settings |

## Orienting in an Existing Workspace

Use `app snapshot` when you land in a session with existing panes and need to understand what's running without reading full screen contents for each pane:

```bash
cli-anything-iterm2 --json app snapshot
```

Returns name, current directory, foreground process, `user.role` label, and last visible output line for every session across all windows.

The rest: https://github.com/HKUDS/CLI-Anything/blob/HEAD/iterm2/agent-harness/cli_anything/iterm2_ctl/skills/SKILL.md
