iterm2-automation

iterm2-automation is a skill for Claude Code, Codex from lyhcode/agent-skills. It costs 109 tokens per session (1,582 once invoked), scanned B, original, MIT.

A guide to automating iTerm2, the macOS terminal app, with output triggers, Python scripts, and terminal control codes.

In plain words
What is it for?
Use it to highlight errors, notify you when builds finish, respond to password prompts through a password manager, or write iTerm2 automation scripts.
Why use it?
It removes repetitive manual terminal actions by reacting to matching output or running scripted controls.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it to highlight errors, notify you when builds finish, respond to password prompts through a password manager, or write iTerm2 automation scripts.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/lyhcode/agent-skills/iterm2-automation
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add lyhcode/agent-skills --skill iterm2-automation
Clone the repo
git clone --depth 1 https://github.com/lyhcode/agent-skills

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for iterm2-automation

README.md
[![agentmods](https://agentmods.dev/badge/skills/lyhcode/agent-skills/iterm2-automation/github.svg)](https://agentmods.dev/skills/lyhcode/agent-skills/iterm2-automation)
Your own site
<a href="https://agentmods.dev/skills/lyhcode/agent-skills/iterm2-automation"><img src="https://agentmods.dev/badge/skills/lyhcode/agent-skills/iterm2-automation/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for iterm2-automation

Your own site · 80×15
<a href="https://agentmods.dev/skills/lyhcode/agent-skills/iterm2-automation"><img src="https://agentmods.dev/badge/skills/lyhcode/agent-skills/iterm2-automation.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 109 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,582 The whole file, excluding the scripts and references it only reads on demand.
Security scan B 2 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00109 $0.01582
Opus 5.5 $0.00044 $0.00633
Sonnet 5.5 $0.00022 $0.00316
Haiku 4.5 $0.00011 $0.00158

Measured 3mo ago against content hash b634f28e6985, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade B, and why

iterm2-automation scanned grade B with 2 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Asks for rootmediumPrivilege escalation

A mod that escalates privileges can change anything on the machine, not only the project.

**Auto-fill sudo password prompt:**

Runs shell commandslowCapability

Expected in a hook, worth knowing in a rule or an instructions file.

result = subprocess.run(
skills/iterm2-automation/SKILL.md · 209 lines

How it starts

The opening of the file, as written. The whole thing — 209 lines — stays where its author put it; the contents beside it link to each section on GitHub.

iTerm2 Automation & Scripting

Help the user automate iTerm2 with triggers, Python API scripts, and escape codes.

User's Environment

  • iTerm2 3.6.8 on macOS, using zsh
  • Python scripts directory: ~/Library/Application Support/iTerm2/Scripts/
  • No existing Python scripts

Triggers

Triggers are regex-based rules that fire actions when matching text appears in terminal output. They're the simplest form of automation — no coding required.

Configuration Path

Settings > Profiles > Advanced > Triggers > Edit

Each trigger has:

  • Regex — ICU regular expression (matched line-by-line)
  • Action — What to do when matched
  • Parameter — Action-specific value
  • Instant — Fire immediately without waiting for newline (useful for password prompts)

Common Trigger Patterns

Highlight errors in red:

  • Regex: (?i)\b(error|fail|fatal|exception)\b
  • Action: Highlight Text
  • Parameter: Red text color

Notification on build completion:

  • Regex: (BUILD SUCCESSFUL|Build complete|✓ Done)
  • Action: Post Notification
  • Parameter: "Build finished"

Auto-fill sudo password prompt:

  • Regex: ^\[sudo\] password
  • Action: Open Password Manager
  • Instant: checked

Mark deployment events:

  • Regex: Deployed to (production|staging)
  • Action: Set Mark + Post Notification

Highlight IP addresses:

  • Regex: \b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b
  • Action: Make Hyperlink

For the full list of all 26 trigger actions, read references/trigger-actions.md.

Trigger Tips

  • Triggers process the last 3 wrapped lines by default (adjustable in Advanced Settings)
  • Use capture groups \1, \2 in parameters to reference matched text
  • "Stop Processing Triggers" action prevents subsequent triggers from firing — useful for priority ordering
  • Triggers are profile-specific; use dynamic profiles to share triggers across contexts

Python API

iTerm2's Python API enables deeper automation than triggers. Scripts can create windows, monitor sessions, build custom status bar components, and respond to events.

Read the full file on GitHub · 209 lines

Files

What ships with it

3 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 3mo ago First seen · 209 lines · 109 tokens per session scan B b634f28e6985

Subscribe to this mod's changes

iterm2-automation is a skill published in the GitHub repository lyhcode/agent-skills (2 stars, last pushed 7mo ago), licensed MIT. It adds 109 tokens to every session and 1,582 once invoked, about $0.0004 per session on Opus 5.5. A static security scan graded it B with 2 findings (asks for root, runs shell commands). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

iterm2-automation compared with skills from other repositories

iterm2-automation next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
iterm2-automationlyhcode/agent-skillsSkill27mo agoMITB109Claude Code, Codex
local-ai-agentsmicrosoft/ai-agents-for-beginnersSkill82ktodayMITA200Claude Code, Codex
imagegenopenai/codexSkill137ktodayApache-2.0A113Codex
playwright-climicrosoft/playwrightSkill102ktodayApache-2.0A19Claude Code
browser-automationopenclaw/openclawSkill396ktodayMITA36Claude Code
free-llm-apismnfst/awesome-free-llm-apisSkill15kyesterdayCC0-1.0A113Claude Code, Codex
systematic-debuggingobra/superpowersSkill331k5d agoMITA21Claude Code