The Challenge

Claude instances run in separate terminal windows. They can't see each other. They can't send messages natively. They don't know who else is running. From each instance's perspective, it's alone in the universe.

ClaudeOS solves this through a communication layer built on iTerm2's Python API, AppleScript, and BetterTouchTool. Claude instances can discover each other's windows, send text messages between them, and coordinate multi-role operations.

The Stack

1
Window Discovery
iTerm2 Python scripts enumerate all terminal windows, tabs, and sessions. Each Claude instance gets a unique window identifier. Tab titles are the human-readable identifiers — set via BTT triggers.
2
Message Routing
The /comms skill lets any Claude discover other windows and send text. Messages are delivered by writing to the target window's input buffer. The receiving Claude sees the message appear as if a human typed it.
3
Coordination Protocols
Multi-role operations (like audits that touch many residences) use message protocols to synchronize. A coordinator role sends instructions; worker roles report back. Shared databases provide the persistent channel.

Communication Roles

RoleFunction
catghost2 iTerm2 automation core. 18 Python scripts for window management, session targeting, text injection. The plumbing.
comms-manager Protocol manager. Defines message formats, routing rules, delivery confirmation.
amacomms Asynchronous messaging. Fire-and-forget messages that get picked up when the target is available.
appcomms Application-level communication. Higher-level protocols for specific tasks (e.g., "build this, then tell me when done").
excomms External communication bridge. Connects ClaudeOS to systems outside iTerm2.

Lessons Learned (The Hard Way)

Window targeting: tab title is the identifier. Set via echo -n "name" | pbcopy && BTT Set_iTerm_Window_Title_v3. Claude Code CLI input: async_send_text("\n") does NOT press Enter — MUST use window.async_activate() then BTT press_enter.
From: automation failure analysis, 2026-03-01
Never shadow built-in slash commands. /context is an Anthropic built-in (token breakdown + graph). Naming a custom command /context creates invisible conflicts that waste hours.
From: inter-Claude automation failure post-mortem

Native App

Claude Comms is a native macOS SwiftUI application that provides a GUI for the communication system. 24 Swift files, wraps the iTerm2 Python scripts in a visual interface. Window discovery, script browser, multi-target execution, group management, scheduling, and logging — all without touching the terminal directly.