WezTerm Terminal Control
Interact with existing WezTerm panes via the CLI. WezTerm must be running and on PATH.
Preconditions — check before anything else
This skill applies ONLY when a WezTerm GUI instance is already running.
- Verify:
wezterm cli list --format json— fails or returns nothing if WezTerm isn't running. - If WezTerm is not running, STOP. Do not launch it, do not use
wezterm start. Ordinary commands belong in your own bash tool. - Never reach for this skill just because you need to run a command, read terminal output, or watch a process.
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.