hcom 0.1.8__tar.gz → 0.2.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of hcom might be problematic. Click here for more details.

@@ -3,6 +3,7 @@ include pyproject.toml
3
3
  recursive-include src/hcom *.py
4
4
  global-exclude __pycache__
5
5
  global-exclude *.py[co]
6
+ prune test
6
7
  prune tests
7
8
  prune docs
8
9
  prune old
hcom-0.2.1/PKG-INFO ADDED
@@ -0,0 +1,423 @@
1
+ Metadata-Version: 2.4
2
+ Name: hcom
3
+ Version: 0.2.1
4
+ Summary: CLI tool for launching multiple Claude Code terminals with interactive subagents, headless persistence, and real-time communication via hooks
5
+ Author: aannoo
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/aannoo/claude-hook-comms
8
+ Project-URL: Repository, https://github.com/aannoo/claude-hook-comms
9
+ Project-URL: Issues, https://github.com/aannoo/claude-hook-comms/issues
10
+ Project-URL: Documentation, https://github.com/aannoo/claude-hook-comms#readme
11
+ Keywords: claude,claude-code,hooks,agents,cli,multi-agent,orchestration,terminal
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Environment :: Console
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: Operating System :: OS Independent
16
+ Classifier: Operating System :: MacOS
17
+ Classifier: Operating System :: Microsoft :: Windows
18
+ Classifier: Operating System :: POSIX :: Linux
19
+ Classifier: Programming Language :: Python :: 3
20
+ Classifier: Programming Language :: Python :: 3 :: Only
21
+ Classifier: Topic :: Communications :: Chat
22
+ Classifier: Topic :: Software Development
23
+ Classifier: Topic :: System :: Monitoring
24
+ Classifier: Topic :: Terminals
25
+ Requires-Python: >=3.7
26
+ Description-Content-Type: text/markdown
27
+
28
+ # hcom - Claude Hook Comms
29
+
30
+ [![PyPI - Version](https://img.shields.io/pypi/v/hcom)](https://pypi.org/project/hcom/)
31
+ [![PyPI - License](https://img.shields.io/pypi/l/hcom)](https://opensource.org/license/MIT) [![Python Version](https://img.shields.io/badge/python-3.7+-blue.svg)](https://python.org)
32
+
33
+ CLI tool for launching multiple Claude Code terminals with interactive [subagents](https://docs.anthropic.com/en/docs/claude-code/sub-agents), headless persistence, and real-time communication via [hooks](https://docs.anthropic.com/en/docs/claude-code/hooks). Works on Mac, Linux, and Windows with zero dependencies.
34
+
35
+ ![Claude Hook Comms Example](https://raw.githubusercontent.com/aannoo/claude-hook-comms/main/screenshot.jpg)
36
+
37
+ ## 🥦 Usage
38
+
39
+ **Run without installing** ([uv](https://docs.astral.sh/uv/#installation))
40
+ ```bash
41
+ uvx hcom open 2
42
+ ```
43
+
44
+ **Install** (optional)
45
+ ```bash
46
+ pip install hcom
47
+ hcom open 2
48
+ ```
49
+
50
+ | Commands | |
51
+ |---------|-------------|
52
+ | `hcom open [n]` | Launch `n` instances or named agents |
53
+ | `hcom watch` | Live dashboard / messaging |
54
+ | `hcom clear` | New conversation log |
55
+ | `hcom cleanup` | Safely remove hcom hooks, preserving your project settings |
56
+
57
+
58
+ ## 🦆 What It Does
59
+
60
+ `hcom open` adds hooks to the `.claude/settings.local.json` file in the current folder and launches terminals with claude code that remain active, waiting to respond to messages in the shared chat.
61
+
62
+ **Subagents in their own terminal**
63
+ ```bash
64
+ # Launch subagents from your .claude/agents
65
+ hcom open planner code-writer reviewer
66
+ ```
67
+
68
+ **Persistent headless instances**
69
+ ```bash
70
+ # Launch one headless instance (default 30min timeout)
71
+ hcom open -p
72
+ ```
73
+
74
+ **Groups and direct messages**
75
+ ```bash
76
+ hcom open --prefix cool # Creates cool-hovoa7
77
+ hcom open --prefix cool # Creates cool-homab8
78
+ hcom send '@cool hi, you are cool'
79
+ hcom send '@homab8 hi, you are cooler'
80
+ ```
81
+
82
+ ---
83
+
84
+
85
+ <details>
86
+ <summary><strong>🦷 Features</strong></summary>
87
+
88
+ - **Multi-Terminal Launch** - Launch Claude Code subagents in new terminals
89
+ - **Background Mode** - Run headless instances without terminal windows
90
+ - **Interactive subagents** - Run subagents in their own terminal window
91
+ - **Live Dashboard** - Real-time monitoring and messaging
92
+ - **Multi-Agent Communication** - Instances talk to each other via shared chat
93
+ - **@Mention Targeting** - Send messages to specific instances or teams
94
+ - **Session Persistence** - Resume previous conversations automatically
95
+ - **Zero Dependencies** - Pure Python stdlib, works everywhere
96
+
97
+ </details>
98
+
99
+ <details>
100
+ <summary><strong>🥨 All Commands</strong></summary>
101
+
102
+
103
+ | Command | Description |
104
+ |---------|-------------|
105
+ | `hcom open [n]` | Launch n Claude instances (or named agents) |
106
+ | `hcom open -p` | Launch headless process |
107
+ | `hcom open --prefix <p> [n]` | Launch with `<p>` prefix (e.g., api-hova7) |
108
+ | `hcom open --claude-args "..."` | Pass flags to Claude Code |
109
+ | `hcom watch` | Conversation/status dashboard |
110
+ | `hcom clear` | Clear and archive conversation |
111
+ | `hcom cleanup` | Safely Remove HCOM hooks from current directory while preserving your settings (`--all` for all directories) |
112
+ | `hcom kill [name]` | Kill specific instance (--all for all running instances) |
113
+
114
+ ### Automation Commands
115
+ | Command | Description |
116
+ |---------|-------------|
117
+ | `hcom send 'message'` | Send message to all instances |
118
+ | `hcom send '@alias msg'` | Send to specific instances alias or prefix |
119
+ | `hcom watch --logs` | View message log history (non-interactive) |
120
+ | `hcom watch --status` | Show instance status as JSON (non-interactive) |
121
+ | `hcom watch --wait [timeout]` | Wait and notify for new messages |
122
+
123
+ </details>
124
+
125
+
126
+
127
+ <details>
128
+ <summary><strong>🗿 Examples</strong></summary>
129
+
130
+ ```bash
131
+ # Instances can be privately @mentioned by alias or prefix
132
+ hcom open --prefix cool # Creates cool-hovoa7
133
+ hcom open --prefix cool # Creates cool-hovob8
134
+ hcom open --prefix notcool # creates notcool-hovoc9
135
+
136
+ # Send a targeted message in dashboard
137
+ @notcool i think you smell good
138
+ @cool that other guy is smelly
139
+ @hovoa7 im lying about the smelly thing
140
+
141
+ # Launch 3 headless instances that die after 60 seconds of inactivity
142
+ HCOM_WAIT_TIMEOUT="60" hcom open 3 -p
143
+ # Manually kill all instance
144
+ hcom kill --all
145
+
146
+ # Launch multiple of the same subagent
147
+ hcom open reviewer reviewer reviewer
148
+
149
+ # Launch agent with specific prompt
150
+ HCOM_INITIAL_PROMPT='write tests' hcom open test-writer
151
+
152
+ # Resume instance (hcom chat will continue)
153
+ hcom open --claude-args "--resume session_id"
154
+
155
+ # Text appended to all messages recieved by instance
156
+ HCOM_INSTANCE_HINTS="remember where you came from" hcom open
157
+
158
+ # Pass multiple Claude flags
159
+ hcom open orchestrator --claude-args "--model sonnet --resume session_id"
160
+ ```
161
+
162
+ </details>
163
+
164
+ <details>
165
+ <summary><strong>🦖 Configuration</strong></summary>
166
+
167
+ ### Configuration
168
+
169
+ Settings can be changed two ways:
170
+
171
+ #### Method 1: Environment variable (temporary, per-command/instance)
172
+
173
+
174
+ ```bash
175
+ HCOM_INSTANCE_HINTS="always update chat with progress" hcom open nice-subagent-but-not-great-with-updates
176
+ ```
177
+
178
+ #### Method 2: Config file (persistent, affects all instances)
179
+
180
+ ### Config File Location
181
+
182
+ `~/.hcom/config.json`
183
+
184
+ | Setting | Default | Environment Variable | Description |
185
+ |---------|---------|---------------------|-------------|
186
+ | `wait_timeout` | 1800 | `HCOM_WAIT_TIMEOUT` | How long instances wait for messages (seconds) |
187
+ | `max_message_size` | 1048576 | `HCOM_MAX_MESSAGE_SIZE` | Maximum message length (1MB) |
188
+ | `max_messages_per_delivery` | 50 | `HCOM_MAX_MESSAGES_PER_DELIVERY` | Messages delivered per batch |
189
+ | `sender_name` | "bigboss" | `HCOM_SENDER_NAME` | Your name in chat |
190
+ | `sender_emoji` | "🐳" | `HCOM_SENDER_EMOJI` | Your emoji icon |
191
+ | `initial_prompt` | "Say hi in chat" | `HCOM_INITIAL_PROMPT` | What new instances are told to do |
192
+ | `first_use_text` | "Essential, concise messages only" | `HCOM_FIRST_USE_TEXT` | Welcome message for instances |
193
+ | `terminal_mode` | "new_window" | `HCOM_TERMINAL_MODE` | How to launch terminals ("new_window", "same_terminal", "show_commands") |
194
+ | `terminal_command` | null | `HCOM_TERMINAL_COMMAND` | Custom terminal command (see Terminal Options) |
195
+ | `cli_hints` | "" | `HCOM_CLI_HINTS` | Extra text added to CLI outputs |
196
+ | `instance_hints` | "" | `HCOM_INSTANCE_HINTS` | Extra text added to instance messages |
197
+ | `auto_watch` | true | `HCOM_AUTO_WATCH` | Auto-launch watch dashboard after open |
198
+ | `env_overrides` | {} | - | Additional environment variables for Claude Code |
199
+
200
+ ### Examples
201
+
202
+ ```bash
203
+ # Change your name for one command
204
+ HCOM_SENDER_NAME="coolguy" hcom send "LGTM!"
205
+
206
+ # Make instances timeout after 60 seconds instead of 30 minutes
207
+ HCOM_WAIT_TIMEOUT=60 hcom open 3
208
+
209
+ # Custom welcome message
210
+ HCOM_FIRST_USE_TEXT="Debug session for issue #123" hcom open 2
211
+
212
+ # Bigger delivery batches
213
+ HCOM_MAX_MESSAGES_PER_DELIVERY=100 hcom watch --logs
214
+ ```
215
+
216
+ **Windows PowerShell**:
217
+ ```powershell
218
+ # Set environment variables in PowerShell
219
+ $env:HCOM_TERMINAL_MODE="same_terminal"; hcom open agent-name
220
+ $env:HCOM_WAIT_TIMEOUT="60"; hcom open 3
221
+ $env:HCOM_INITIAL_PROMPT="go home buddy!"; hcom open
222
+ ```
223
+
224
+ ### Status Indicators
225
+ - ◉ **thinking** (cyan) - Processing input
226
+ - ▷ **responding** (green) - Generating text response
227
+ - ▶ **executing** (green) - Running tools
228
+ - ◉ **waiting** (blue) - Waiting for messages
229
+ - ■ **blocked** (yellow) - Permission blocked
230
+ - ○ **inactive** (red) - Timed out/dead
231
+ - **(bg)** suffix - Instance running in background headless mode
232
+
233
+ </details>
234
+
235
+ <details>
236
+ <summary><strong>🎲 How It Works</strong></summary>
237
+
238
+ ### Hooks!
239
+
240
+ hcom adds hooks to your project directory's `.claude/settings.local.json`:
241
+
242
+ 1. **Sending**: Claude agents use `echo "HCOM_SEND:message"` internally (you use `hcom send` from terminal or dashboard)
243
+ 2. **Receiving**: Other Claudes get notified via Stop hook
244
+ 3. **Waiting**: Stop hook keeps Claude in a waiting state for new messages
245
+
246
+ - **Identity**: Each instance gets a unique name based on session ID (e.g., "hovoa7")
247
+ - **Persistence**: Names persist across `--resume` maintaining conversation context
248
+ - **Status Detection**: Notification hook tracks permission requests and activity
249
+ - **Agents**: When you run `hcom open researcher`, it loads an interactive Claude session with a system prompt from `.claude/agents/researcher.md` (local) or `~/.claude/agents/researcher.md` (global). Specified `model:` and `tools:` are carried over.
250
+
251
+ ### Architecture
252
+ - **Single conversation** - All instances share one global conversation
253
+ - **Opt-in participation** - Only Claude Code instances launched with `hcom open` join the chat
254
+ - **@-mention filtering** - Target messages to specific instances or teams
255
+
256
+ ### File Structure
257
+ ```
258
+ ~/.hcom/
259
+ ├── hcom.log # Conversation log
260
+ ├── instances/ # Instance tracking
261
+ ├── logs/ # Background process logs
262
+ ├── config.json # Configuration
263
+ └── archive/ # Archived sessions
264
+
265
+ your-project/
266
+ └── .claude/
267
+ └── settings.local.json # hcom hooks
268
+ ```
269
+
270
+ </details>
271
+
272
+
273
+ <details>
274
+ <summary><strong>🥔 Terminal Options</strong></summary>
275
+
276
+ ### Terminal Mode
277
+
278
+ Configure terminal behavior in `~/.hcom/config.json`:
279
+ - `"terminal_mode": "new_window"` - Opens new terminal window(s) (default)
280
+ - `"terminal_mode": "same_terminal"` - Opens in current terminal
281
+ - `"terminal_mode": "show_commands"` - Prints commands without executing
282
+
283
+ ### Default Terminals
284
+
285
+ - **macOS**: Terminal.app
286
+ - **Linux**: gnome-terminal, konsole, or xterm
287
+ - **Windows & WSL**: Windows Terminal / Git Bash
288
+
289
+ ### Running in Current Terminal temporarily
290
+ ```bash
291
+ # For single instances
292
+ HCOM_TERMINAL_MODE=same_terminal hcom open
293
+ ```
294
+
295
+ ### Custom Terminal Examples
296
+
297
+ Configure `terminal_command` in `~/.hcom/config.json` (permanent) or environment variables (temporary).
298
+
299
+ #### How to use this
300
+
301
+ The `{script}` placeholder is replaced by HCOM with the path to a temporary bash script that launches Claude Code.
302
+
303
+ Your custom command just needs to:
304
+ 1. Accept `{script}` as a placeholder that will be replaced with a script path
305
+ 2. Execute that script with bash
306
+
307
+ Example template: `your_terminal_command --execute "bash {script}"`
308
+
309
+ ### iTerm2
310
+ ```json
311
+ "terminal_command": "osascript -e 'tell app \"iTerm\" to tell (create window with default profile) to tell current session to write text \"{script}\"'"
312
+ ```
313
+
314
+ ### WezTerm
315
+ Windows:
316
+ ```json
317
+ "terminal_command": "wezterm start -- bash {script}"
318
+ ```
319
+ Or open tabs from within WezTerm:
320
+ ```json
321
+ "terminal_command": "wezterm cli spawn -- bash {script}"
322
+ ```
323
+ macOS/Linux:
324
+ ```json
325
+ "terminal_command": "wezterm start -- bash {script}"
326
+ ```
327
+
328
+ ### Wave Terminal
329
+ Windows. From within Wave Terminal:
330
+ ```json
331
+ "terminal_command": "wsh run -- bash {script}"
332
+ ```
333
+
334
+ ### Alacritty
335
+ macOS:
336
+ ```json
337
+ "terminal_command": "open -n -a Alacritty.app --args -e bash {script}"
338
+ ```
339
+ Linux:
340
+ ```json
341
+ "terminal_command": "alacritty -e bash {script}"
342
+ ```
343
+
344
+ ### Kitty
345
+ macOS:
346
+ ```json
347
+ "terminal_command": "open -n -a kitty.app --args bash {script}"
348
+ ```
349
+ Linux:
350
+ ```json
351
+ "terminal_command": "kitty bash {script}"
352
+ ```
353
+
354
+ ### Termux (Android)
355
+ ```json
356
+ "terminal_command": "am startservice --user 0 -n com.termux/com.termux.app.RunCommandService -a com.termux.RUN_COMMAND --es com.termux.RUN_COMMAND_PATH {script} --ez com.termux.RUN_COMMAND_BACKGROUND false"
357
+ ```
358
+ Note: Requires `allow-external-apps=true` in `~/.termux/termux.properties`
359
+
360
+ ### tmux
361
+ ```json
362
+ "terminal_command": "tmux new-window -n hcom {script}"
363
+ ```
364
+ Then from a terminal:
365
+ ```bash
366
+ # Run hcom open directly in new session
367
+ tmux new-session 'hcom open 3'
368
+ ```
369
+ Or once off:
370
+ ```bash
371
+ # Start tmux with split panes and 3 claude instances in hcom chat
372
+ HCOM_TERMINAL_COMMAND="tmux split-window -h {script}" hcom open 3
373
+ ```
374
+
375
+
376
+ </details>
377
+
378
+
379
+ <details>
380
+ <summary><strong>🦆 Remove</strong></summary>
381
+
382
+
383
+ ### Archive Conversation / Start New
384
+ ```bash
385
+ hcom clear
386
+ ```
387
+
388
+ ### Kill Running Instances
389
+ ```bash
390
+ # Kill specific instance
391
+ hcom kill hovoa7
392
+
393
+ # Kill all instances
394
+ hcom kill --all
395
+ ```
396
+
397
+ ### Remove HCOM hooks from current directory
398
+ ```bash
399
+ hcom cleanup
400
+ ```
401
+
402
+ ### Remove HCOM hooks from all directories
403
+ ```bash
404
+ hcom cleanup --all
405
+ ```
406
+
407
+ ### Remove hcom Completely
408
+ 1. Remove hcom: `rm /usr/local/bin/hcom` (or wherever you installed hcom)
409
+ 2. Remove all data: `rm -rf ~/.hcom`
410
+
411
+ </details>
412
+
413
+ ## 🦐 Requirements
414
+
415
+ - Python 3.7+
416
+ - [Claude Code](https://claude.ai/code)
417
+
418
+
419
+ ## 🌮 License
420
+
421
+ - MIT License
422
+
423
+ ---