cli-anything-iterm2
Stateful CLI harness for iTerm2. Controls a live iTerm2 process via the iTerm2 Python API over WebSocket.
Prerequisites
- macOS + iTerm2 running:
brew install --cask iterm2 - Python API enabled: iTerm2 → Preferences → General → Magic → Enable Python API
- Install:
pip install cli-anything-iterm2(orpip install -e .from source)
Basic Syntax
Always use --json for machine-readable output (required for agent use).
Command Groups
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:
Returns name, current directory, foreground process, user.role label, and last visible output line for every session across all windows.
Naming convention — label panes when setting up a workspace so you can find them later:
app snapshot will surface these roles alongside process and path, giving you a full picture in one call.
Typical Agent Workflow
Reference Files
Read only what the task requires — each file is a single narrow concern (~10–30 lines):
REPL Mode
Run without arguments for an interactive REPL that maintains context between commands:


