Skip to main content

Launch multiple Claude Code instances (terminal, headless, or subagents) that communicate together in real time via hooks.

Project description

hcom — Claude Hook Comms

PyPI - Version PyPI - License Python Version DeepWiki

Launch multiple Claude Code instances (terminal, headless, or subagents) that communicate together in real time via hooks.

Demo

Start

Run without installing

uvx hcom 2

Run with installing

pip install hcom

hcom                      # UI

claude 'run hcom start'   # toggle hcom for any claude code

What it does

Adds hooks that enable instant messaging between claude code instances. Launch multiple terminals/headless/subagents that remain active, waiting to respond. Normal claude remains unaffected by hcom, but can opt-in (hcom start) or opt-out (hcom stop) at runtime. Safely remove hooks with hcom reset. Works on Mac, Linux, Windows, Android.

Commands

Command Description
hcom TUI dashboard
hcom <n> Launch n instances
hcom start Enable participation
hcom stop Disable participation

Features

communicate with task tool subagents

claude 'use 3x task tool with task: say hi in hcom chat'
# Each subagent gets unique identity and can communicate with siblings
# Parent resumes with full conversation history

persistent headless instances

hcom 1 claude -p    # launch with default 30min timeout
hcom                # See what it's doing from dashboard
hcom stop           # Let it die earlier than timeout

.claude/agents in interactive claude window

HCOM_AGENT=code-writer hcom 1
HCOM_AGENT=reviewer hcom 1

@-mention: groups and direct

HCOM_TAG=cooltag hcom 2
hcom send '@cooltag hi, you both are cool'
hcom send '@john you are cooler'

toggle inside claude code

claude              # Normal Claude Code
'run hcom start'    # Opt-in to receive messages
'run hcom stop'     # Opt-out, continue as normal claude code

async push notifications from anywhere

# Any process can message claude instances with custom identity
hcom send --from background-worker 'i finished, now you go do stuff'

All commands
Usage: hcom                           # TUI dashboard
       [ENV_VARS] hcom <COUNT> [claude <ARGS>...]
       hcom watch [--type TYPE] [--instance NAME] [--last N] [--wait SEC]
       hcom list [--json] [--verbose]
       hcom send "message"
       hcom stop [alias|all]
       hcom start [alias]
       hcom reset [logs|hooks|config]

Launch Examples:
  hcom 3             open 3 terminals with claude connected to hcom
  hcom 3 claude -p                                       + headless
  HCOM_TAG=api hcom 3 claude -p               + @-mention group tag
  claude 'run hcom start'        claude code with prompt also works

Commands:
  watch               Query recent events (JSON per line)
    --type TYPE       Filter by event type (message, status)
    --instance ALIAS  Filter by instance
    --last N          Limit to last N events (default: 20)
    --wait SEC        Block until a matching event arrives

  list                Show instance status/metadata
    --json            Emit JSON (one instance per line)
    --verbose         Include additional metadata

  send "msg"          Send message to all instances
  send "@alias msg"   Send to specific instance/group
    --from <name>     Custom external identity

  stop                Stop current instance (from inside Claude)
  stop <alias>        Stop specific instance
  stop all            Stop all instances

  start               Start current instance (from inside Claude)
  start <alias>       Start specific instance

  reset               Stop all + archive logs + remove hooks + clear config
  reset logs          Clear + archive conversation
  reset hooks         Safely remove hcom hooks from claude settings.json
  reset config        Clear + archive config.env

Environment Variables:
  HCOM_TAG=name               Group tag (creates name-* instances)
  HCOM_AGENT=type             Agent from .claude/agents/ (comma-separated for multiple)
  HCOM_TERMINAL=mode          Terminal: new|here|print|"custom {script}"
  HCOM_HINTS=text             Text appended to all messages received by instance
  HCOM_TIMEOUT=secs           Time until disconnected from hcom chat (default: 1800s / 30m)
  HCOM_SUBAGENT_TIMEOUT=secs  Subagent idle timeout (default: 30s)
  HCOM_CLAUDE_ARGS=args       Claude CLI defaults (e.g., '-p --model opus "hello!"')

  ANTHROPIC_MODEL=opus # Any env var passed through to Claude Code

  Persist Env Vars in `~/.hcom/config.env`

Requirements

  • Python 3.10+
  • Claude Code

Terminal Options

Default Terminals

  • macOS: Terminal.app
  • Linux: gnome-terminal, konsole, or xterm
  • Windows (native) & WSL: Windows Terminal / Git Bash
  • Android: Termux

Terminal Mode

  • HCOM_TERMINAL=new - New terminal windows (default)
  • HCOM_TERMINAL=here - Current terminal window
  • HCOM_TERMINAL="open -a iTerm {script}" - Custom terminal

Custom Terminal

Your custom command just needs to:

  1. Accept {script} as a placeholder that will be replaced with a script path
  2. Execute that script with bash

Custom Terminal Examples

ttab (new tab instead of new window in Terminal.app)
HCOM_TERMINAL="ttab {script}"
wttab (new tab in Windows Terminal)
HCOM_TERMINAL="wttab {script}"
More
# Wave Terminal Mac/Linux/Windows. From within Wave Terminal:
HCOM_TERMINAL="wsh run -- bash {script}"

# Alacritty macOS:
HCOM_TERMINAL="open -n -a Alacritty.app --args -e bash {script}"

# Alacritty Linux:
HCOM_TERMINAL="alacritty -e bash {script}"

# Kitty macOS:
HCOM_TERMINAL="open -n -a kitty.app --args {script}"

# Kitty Linux
HCOM_TERMINAL="kitty {script}"

# tmux with split panes and 3 claude instances in hcom chat
HCOM_TERMINAL="tmux split-window -h {script}" hcom 3

# WezTerm Linux/Windows
HCOM_TERMINAL="wezterm start -- bash {script}"

# Tabs from within WezTerm
HCOM_TERMINAL="wezterm cli spawn -- bash {script}"

# WezTerm macOS:
HCOM_TERMINAL="open -n -a WezTerm.app --args start -- bash {script}"

# Tabs from within WezTerm macOS
HCOM_TERMINAL="/Applications/WezTerm.app/Contents/MacOS/wezterm cli spawn -- bash {script}"

Android (Termux)

#1. Install:
    Termux from F-Droid (not Google Play)
#2. Setup:
   pkg install python nodejs
   npm install -g @anthropic-ai/claude-cli
   pip install hcom
#3. Enable:
   echo "allow-external-apps=true" >> ~/.termux/termux.properties
   termux-reload-settings
#4. Enable: 
    "Display over other apps" permission for visible terminals
#5. Run: 
    `hcom 2`

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hcom-0.6.3.tar.gz (117.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

hcom-0.6.3-py3-none-any.whl (128.2 kB view details)

Uploaded Python 3

File details

Details for the file hcom-0.6.3.tar.gz.

File metadata

  • Download URL: hcom-0.6.3.tar.gz
  • Upload date:
  • Size: 117.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for hcom-0.6.3.tar.gz
Algorithm Hash digest
SHA256 d8f9253b4ec23ce99e84456e0e7a2f6c2a8f27ed8d24428a717ce11c53cf64f9
MD5 5a1291628d306c8ceb7f0bf2c2e96f77
BLAKE2b-256 3d9c31ce0ae2d8197b6633315f0e743d39b0bc5cb79ecf949c7bb48934ed78ad

See more details on using hashes here.

File details

Details for the file hcom-0.6.3-py3-none-any.whl.

File metadata

  • Download URL: hcom-0.6.3-py3-none-any.whl
  • Upload date:
  • Size: 128.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for hcom-0.6.3-py3-none-any.whl
Algorithm Hash digest
SHA256 ed298611750c827173cf8cb373c8ab66a7b2f9d147b17d5d42f76ed64fa736a2
MD5 3721142ca41a0463cc09fd116323936b
BLAKE2b-256 82e8846534c9a33775bd809b8778415979954e2e68a026eb70611e0b2dae2784

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page