Inspect currently running Linux terminal emulators, try emulator-specific dumps or screenshot-plus-OCR fallbacks to recover visible session contents including tabs when possible, then either close empty single-tab windows or attach them to tmux sessions tracked in a Markdown file. Use when Codex needs to coordinate many terminal windows, harvest their visible state, clean up idle scratch terminals, keep tmux layout associations, or publish the skill repository with gh.
Use the bundled helper instead of hand-rolling terminal inspection. The helper is intentionally best-effort because tab enumeration and screen scraping differ by emulator and by display server.
Inventory running terminal windows:
python3 scripts/manyterminals.py inspect
Emit machine-readable inspection output:
python3 scripts/manyterminals.py inspect --json
Persist an inspection snapshot:
python3 scripts/manyterminals.py inspect --json --output state/last-inspection.json
Show the current tmux assignment plan:
python3 scripts/manyterminals.py plan --state-file state/tmux-sessions.md
Create detached tmux sessions from the Markdown plan and attach them into empty single-tab terminals when possible:
python3 scripts/manyterminals.py ensure-tmux --state-file state/tmux-sessions.md
Preview which empty single-tab terminals would be closed:
python3 scripts/manyterminals.py close-empty --dry-run
Close empty single-tab terminals that are not tmux-backed:
python3 scripts/manyterminals.py close-empty
Create an org-owned GitHub repository with gh, set origin, and push the current branch:
python3 scripts/manyterminals.py publish --org YOUR_ORG --repo manyterminals --private
inspect first. Prefer --json when another tool will consume the output.capture_method and capture_status fields before trusting content. tmux, kitty, and wezterm methods are higher signal than OCR.ensure-tmux only when the target terminals should be empty. The helper only injects commands into windows that look empty after capture.close-empty when the goal is cleanup rather than tmux reuse. It targets single-tab terminals with no detected tmux session, prefers prompt-only captures when screen/text recovery succeeds, and falls back to descendant-process heuristics when Wayland capture metadata is unavailable.publish after local verification. It shells out to gh, so GitHub auth and org permissions must already exist.tesseract and a screenshot tool such as ImageMagick import, gnome-screenshot, or grim.xdotool and wmctrl are optional but improve window discovery and command injection.