WezTerm Terminal Control
Interact with existing WezTerm panes via the CLI. WezTerm must be running and on PATH.
Workflow
Always read before acting. Always read after acting.
- List panes to find the right target
- Read pane contents to confirm state
- Send command
- Read again to verify output
List Panes
wezterm cli list --format json
Returns pane_id, tab_id, window_id, title, and current working directory. Run this first unless a pane ID is already known.
Pane selection priority:
- Working directory matches the target repo
- Title references the current project
- Interactive shell prompt is visible
Read a Pane
wezterm cli get-text --pane-id <PANE_ID>
Use to inspect output, check for running processes, confirm command completion, or locate errors.
Send a Command
wezterm cli send-text --pane-id <PANE_ID> --no-paste "<COMMAND>\r"
\r executes the command. Omitting it inserts text without running it.
Create a New Pane
wezterm cli split-pane --right # horizontal split
wezterm cli split-pane --bottom # vertical split
Returns the new pane ID. Prefer reusing existing panes.
Focus a Pane
wezterm cli activate-pane --pane-id <PANE_ID>
Monitoring Long-Running Commands
Poll until completion is observed in output — do not assume success.
wezterm cli send-text --pane-id <PANE_ID> --no-paste "npm test\r"
sleep 2
wezterm cli get-text --pane-id <PANE_ID>
# repeat until done
Caution
Inspect state before running destructive commands:
rm -rf | git clean -fdx | git reset --hard
docker system prune | terraform destroy | kubectl delete | drop database
Never assume these are safe. Read first.