@logicseek/hello-cc 0.1.0 → 0.1.1

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.
package/README.md CHANGED
@@ -6,100 +6,77 @@
6
6
 
7
7
  <p align="center">
8
8
  <a href="https://github.com/Dullne/hello-cc"><img src="https://img.shields.io/github/stars/Dullne/hello-cc?style=flat-square&color=40c4aa" alt="GitHub stars"></a>
9
+ <a href="https://www.npmjs.com/package/@logicseek/hello-cc"><img src="https://img.shields.io/npm/v/@logicseek/hello-cc?style=flat-square&color=40c4aa" alt="npm version"></a>
9
10
  <a href="https://nodejs.org"><img src="https://img.shields.io/badge/node-%3E%3D24.0.0-brightgreen?style=flat-square" alt="node >=24"></a>
10
11
  <a href="./LICENSE"><img src="https://img.shields.io/badge/license-Apache%202.0-blue?style=flat-square" alt="license Apache 2.0"></a>
11
12
  </p>
12
13
 
13
14
  <p align="center"><b>English</b> | <a href="README.zh-CN.md">中文</a></p>
14
15
 
15
- `hello-cc` connects Claude Code, Codex, and other coding CLI sessions into a
16
- project-local peer mesh. The command is `hcc`.
17
-
18
- The default model is a flat peer mesh, not a fixed main/worker topology. Every
19
- terminal session is a named peer that can see open tasks, receive directed
20
- messages, hold locks, hand off progress, and be observed or operated from the
21
- web console.
22
-
23
- ```text
24
- <project>/.hello-cc/mesh.db
25
- ```
16
+ `hello-cc` is a local control plane for Claude Code, Codex, and other coding
17
+ CLI sessions. It gives every terminal in one project a shared task board,
18
+ mailbox, lock table, and browser console while keeping the real local terminal
19
+ as the source of interaction.
20
+
21
+ It is built for developers who run multiple AI coding agents in the same repo
22
+ and need them to coordinate instead of guessing what the other sessions are
23
+ doing.
24
+
25
+ ## Highlights
26
+
27
+ - **Shared project memory**: peers, tasks, messages, locks, handoffs, and
28
+ events are stored in `<project>/.hello-cc/mesh.db`.
29
+ - **Real terminal control**: Web attaches to the same local tmux pane as your
30
+ terminal, not a separate browser-only shell.
31
+ - **Claude/Codex awareness**: hooks inject live `hcc` state before model turns,
32
+ so agents can answer from current project state.
33
+ - **Conflict avoidance**: advisory locks and handoffs make multi-agent editing
34
+ explicit.
35
+ - **Resume-friendly identity**: resumed Claude/Codex sessions map back to
36
+ stable peers when provider session ids are available.
37
+ - **One console, many projects**: one local Web runtime can switch between
38
+ registered project roots.
26
39
 
27
40
  ## Install
28
41
 
29
- **Node 24+ is required** because hello-cc uses built-in `node:sqlite`.
30
-
31
- Install the CLI globally from npm:
42
+ Node.js 24 or newer is required.
32
43
 
33
44
  ```bash
34
45
  npm install -g @logicseek/hello-cc
35
46
  ```
36
47
 
37
- Or run it without a global install:
48
+ Update an existing global install:
38
49
 
39
50
  ```bash
40
- npx @logicseek/hello-cc web
51
+ npm install -g @logicseek/hello-cc@latest
41
52
  ```
42
53
 
43
- For local development, run the CLI directly from the checkout:
54
+ Or run it without a global install:
44
55
 
45
56
  ```bash
46
- node ./bin/hcc.mjs web
57
+ npx @logicseek/hello-cc web
47
58
  ```
48
59
 
49
- After a global install, both `hcc` and `hello-cc` are available. The examples
50
- below use `hcc`.
51
-
52
- ## Default Entry
60
+ ## Quick Start
53
61
 
54
- Run one command in the project directory:
62
+ Run this inside the project you want agents to share:
55
63
 
56
64
  ```bash
57
65
  cd /path/to/project
58
66
  hcc web
59
67
  ```
60
68
 
61
- `hcc web` is the default entrypoint. It automatically:
69
+ Then open the printed local URL. `hcc web` initializes the project bus, installs
70
+ Claude/Codex hooks and shims, starts or reuses the Web console, and returns the
71
+ terminal to you.
62
72
 
63
- 1. Initializes `.hello-cc/mesh.db` in the current directory
64
- 2. Writes bounded guidance blocks: `.hello-cc/HCC.md`, `CLAUDE.md`, `AGENTS.md`
65
- 3. Installs or refreshes Claude Code hooks: `~/.claude/settings.json`
66
- 4. Installs or refreshes Codex hooks: `~/.codex/hooks.json`
67
- 5. Installs `~/.hcc-shims/claude` and `~/.hcc-shims/codex`
68
- 6. Adds `~/.hcc-shims` to the shell PATH
69
- 7. Ensures `tmux` is available, with best-effort automatic install and a clear
70
- install command if that fails
71
- 8. Starts or reuses the global web console, registers the current project,
72
- prints URL/PID/runtime/log, then returns the terminal to you
73
-
74
- Example output:
75
-
76
- ```text
77
- hello-cc web started in background
78
- pid: 12345
79
- project: /path/to/project
80
- database: /path/to/project/.hello-cc/mesh.db
81
- runtime: /path/to/project/.hello-cc/runtime.json
82
- log: /path/to/project/.hello-cc/web.log
83
- open: http://<machine-ip>:8787/?project=%2Fpath%2Fto%2Fproject
84
- local: http://127.0.0.1:8787/?project=%2Fpath%2Fto%2Fproject
85
- shims: installed claude, codex
86
- PATH updated in ~/.bashrc; open a new terminal or source it
87
- stop: hcc down
88
- ```
89
-
90
- `hcc web` uses a single global web runtime. Running `hcc web` again from
91
- another project directory does not open another port; it registers that project
92
- with the same web console. The frontend Project selector switches between
93
- registered roots. Each project still keeps its own `.hello-cc/mesh.db`, so
94
- tasks, messages, locks, and peers stay isolated.
95
-
96
- After the first shim install, open a new terminal or run:
73
+ After the first shim install, open a new terminal or reload your shell:
97
74
 
98
75
  ```bash
99
76
  source ~/.bashrc
100
77
  ```
101
78
 
102
- Then direct project-local commands are wrapped automatically:
79
+ Start normal agent sessions from the project:
103
80
 
104
81
  ```bash
105
82
  claude
@@ -108,285 +85,37 @@ claude --resume <session-id>
108
85
  codex resume <session-id>
109
86
  ```
110
87
 
111
- The wrappers create or reuse **local persistent tmux terminals**:
112
-
113
- - The local terminal attaches to the same tmux session and remains usable.
114
- - The web console controls the same tmux pane, not a temporary browser-only
115
- terminal.
116
- - `hcc down` stops only the web runtime. It does not kill tmux sessions.
117
- - Running `hcc web` again reattaches live recorded tmux panes.
118
-
119
- For local coordination without Web or shims, use the lower-level command:
120
-
121
- ```bash
122
- hcc up
123
- ```
124
-
125
- Most users should start with `hcc web`.
126
-
127
- ## Project Boundary
128
-
129
- By default, the project boundary is the **current working directory**. If the
130
- current directory has no `.hello-cc/mesh.db`, hello-cc creates one on first use:
131
-
132
- ```text
133
- /repo-a/.hello-cc/mesh.db
134
- /repo-a/subdir/.hello-cc/mesh.db
135
- ```
136
-
137
- Those are two different projects by default. Sessions communicate naturally
138
- when they start from the same project path.
88
+ Those sessions become tmux-backed peers that can be seen and controlled from
89
+ Web while remaining usable from the local terminal.
139
90
 
140
- To share one bus across paths or worktrees, opt in explicitly:
141
-
142
- ```bash
143
- hcc --root /path/to/project web
144
- export HCC_ROOT=/path/to/project
145
- export HCC_DB=/path/to/project/.hello-cc/mesh.db
146
- ```
147
-
148
- hello-cc does not automatically inherit a parent directory's bus. That avoids
149
- subdirectory sessions joining a broader project by accident.
150
-
151
- ## Communication Model
152
-
153
- hello-cc is not point-to-point CLI messaging and does not require MCP. The core
154
- is a project-local SQLite WAL bus:
155
-
156
- ```text
157
- Claude/Codex/plain shell
158
- -> hooks / hcc commands / web runtime
159
- -> .hello-cc/mesh.db
160
- -> peers / tasks / messages / locks / handoffs / events
161
- -> tmux-backed terminal control
162
- ```
163
-
164
- Tasks and messages have different read semantics:
165
-
166
- - **Tasks** are project facts. Every peer sees tasks until they become `done`
167
- or `abandoned`. A task does not disappear because one terminal read it.
168
- - **Messages** are addressed mailbox items. `hcc msg inbox` defaults to unread
169
- messages for the current peer, and `hcc msg ack` records per-peer read state.
170
- - `ask` and `broadcast` write durable messages. With `--inject`, they also send
171
- live input to runtime-attached terminals.
172
- - Locks use SQLite transactions and TTLs. They are coordination locks, not a
173
- filesystem sandbox.
174
-
175
- ## How Claude/Codex Knows Other Sessions
176
-
177
- The primary path is hook injection, not `CLAUDE.md`.
178
-
179
- `hcc web` installs Claude Code and Codex hooks. On session start, user prompt
180
- submit, tool events, and idle events, hooks inject the current hello-cc snapshot
181
- into the model context:
182
-
183
- - current peer identity
184
- - active peer list
185
- - open tasks
186
- - unread messages for the current peer
187
- - active locks
188
- - suggested commands such as `hcc status`, `hcc peers`, `hcc task list`,
189
- `hcc msg inbox`, and `hcc lock list`
190
-
191
- So when an attached Claude/Codex session is asked what other sessions are doing,
192
- it should answer from the latest hello-cc state instead of generic isolation
193
- knowledge.
194
-
195
- If a session still says it cannot know, likely causes are:
196
-
197
- - `hcc web` has not been run in the project directory
198
- - the terminal has not loaded `~/.hcc-shims` into PATH
199
- - Codex hooks are not enabled or the installed hook has not been trusted in
200
- Codex's hook review flow
201
- - the CLI was started in a different project directory
202
- - the session was an already-open raw terminal before hello-cc was installed
203
- - the provider CLI version did not fire the expected hook
204
-
205
- To verify Claude Code hook injection directly, run a one-shot debug call from
206
- the same project:
207
-
208
- ```bash
209
- claude -p 'Do you see hello-cc open tasks?' --debug hooks --debug-file /tmp/hcc-claude-hooks.log
210
- ```
211
-
212
- The debug log should contain `Hook UserPromptSubmit ... provided
213
- additionalContext` and the `hello-cc coordination` block. If that is present but
214
- the model still answers from generic isolation knowledge, restart/resume the
215
- session through the shim and ask again; hello-cc injects a stronger instruction
216
- on every new user prompt.
217
-
218
- ## Web Console
219
-
220
- Start local and LAN-visible control:
221
-
222
- ```bash
223
- hcc web
224
- ```
225
-
226
- Use a token only when you want one:
227
-
228
- ```bash
229
- HCC_WEB_TOKEN='choose-a-long-token' hcc web --host 0.0.0.0 --port 8787
230
- ```
231
-
232
- Open from another machine on the same network:
233
-
234
- ```text
235
- http://<machine-ip>:8787/
236
- ```
237
-
238
- The web console can:
239
-
240
- - switch between multiple registered project roots on one port
241
- - register another project path from the browser and switch to it without
242
- starting another web server
243
- - show project state: peers, tasks, messages, locks, handoffs, events
244
- - operate local terminals: start Claude/Codex/shell, send keyboard input, view
245
- output, detach runtime control
246
- - start a new session by choosing only its kind; the browser form generates the
247
- next project-local alias, uses the selected Project root as the working
248
- directory, and runs the default command for that kind
249
-
250
- Browser-controlled sessions are local tmux terminals:
251
-
252
- - sessions started by the web form: tmux-backed
253
- - sessions started by `hcc peer start`: tmux-backed
254
- - direct `claude` / `codex` sessions started through shims: tmux-backed
255
- - existing tmux panes attached with `hcc peer attach`: tmux-backed
256
-
257
- Already-open raw terminals cannot be captured or controlled unconditionally
258
- unless they started under tmux, screen, or a hello-cc shim. They can still
259
- participate in tasks, messages, and locks through hooks and `hcc` commands.
260
-
261
- ## Common Commands
262
-
263
- ```text
264
- # Default entry
265
- hcc web [--host HOST] [--port N] [--token TEXT] [--local] [--no-discover] [--no-guidance]
266
- hcc down
267
-
268
- # Local coordination without Web
269
- hcc up [--no-discover] [--no-guidance]
270
-
271
- # Peers and status
272
- hcc peers
273
- hcc status [--peer ID]
274
- hcc scan [--register]
275
- hcc prompt --peer ID [--kind codex|claude|shell|other] [--role ROLE]
276
- hcc join --peer ID [--kind codex|claude|shell|other] [--role ROLE]
277
- hcc env --peer ID
278
- hcc heartbeat [--peer ID] [--renew-locks --ttl 900]
279
- hcc run --peer ID --kind codex|claude|shell --role ROLE -- COMMAND [ARGS...]
280
-
281
- # Browser-controllable terminals
282
- hcc peer list
283
- hcc peer start PEER [--kind K] [--role R] [--cwd DIR] [--restart-env] -- COMMAND [ARGS...]
284
- hcc peer start PEER --kind codex --resume SESSION_ID [--restart-env]
285
- hcc peer start PEER --kind codex --last
286
- hcc peer start PEER --kind claude --resume SESSION_ID [--restart-env]
287
- hcc peer start PEER --kind claude --continue
288
- hcc peer attach PEER [--pane PANE] [--kind K] [--role R] [--cwd DIR]
289
- hcc peer stop PEER
290
- hcc inject PEER TEXT [--no-enter]
291
-
292
- # Messages
293
- hcc msg send [--from ID] [--to ID|all] --body TEXT [--task N] [--kind note|task|handoff]
294
- hcc msg inbox [--peer ID] [--wait SEC] [--all] [--limit N]
295
- hcc msg ack [--peer ID] --id N
296
- hcc ask PEER MESSAGE [--from ID] [--task N] [--inject]
297
- hcc broadcast MESSAGE [--from ID] [--task N] [--inject]
298
-
299
- # Tasks
300
- hcc task create --title TEXT [--body TEXT] [--from ID] [--to ID] [--priority N]
301
- hcc task list [--status S] [--peer ID] [--all]
302
- hcc task claim [--peer ID] --id N
303
- hcc task next [--peer ID]
304
- hcc task update [--peer ID] --id N --status running|review|blocked|done|abandoned [--summary TEXT] [--body TEXT] [--to ID]
305
- hcc task done [--peer ID] --id N --summary TEXT
306
-
307
- # Locks and handoffs
308
- hcc lock acquire [--peer ID] --resource PATH [--task N] [--ttl SEC] [--reason TEXT]
309
- hcc lock renew [--peer ID] --resource PATH [--ttl SEC]
310
- hcc lock release [--peer ID] --resource PATH [--force]
311
- hcc lock list [--all]
312
- hcc handoff create [--from ID] --summary TEXT [--task N] [--to ID] [--changed-files JSON_OR_CSV] [--tests TEXT] [--risks TEXT]
313
- hcc handoff list [--task N] [--limit N]
314
- hcc event tail [--limit N]
315
- hcc gc [--older-than DAYS] [--yes]
316
- ```
317
-
318
- ## Stable Peer Identity
319
-
320
- hello-cc tries to keep peer IDs stable across resumed sessions:
321
-
322
- | Launch pattern | Peer ID |
323
- |---|---|
324
- | `claude --resume abc12345...` | `claude-abc12345` |
325
- | `claude --session-id abc12345...` | `claude-abc12345` |
326
- | `claude --continue` | terminal-derived ID first, then hooks record real session metadata |
327
- | `claude --fork-session --resume abc12345...` | terminal-derived ID first, then hooks record new session metadata |
328
- | `codex resume abc12345...` | `codex-abc12345` |
329
- | `codex resume --last` | terminal-derived ID first, then discovery records real session metadata |
330
- | plain shell | `shell-<terminal>` |
331
- | manual `HCC_PEER=xxx` | uses `xxx` |
332
-
333
- Known resume IDs keep the same peer ID after restart. Launch modes that do not
334
- expose the real provider session ID before startup use a terminal-derived ID
335
- first, then record provider metadata after hooks or discovery run.
336
-
337
- ## Typical Workflow
338
-
339
- Create a task:
340
-
341
- ```bash
342
- hcc task create --title "Refactor router diagnostics" \
343
- --body "Keep changes scoped." --priority 20
344
- ```
345
-
346
- Claim and lock:
91
+ ## Basic Workflow
347
92
 
348
93
  ```bash
94
+ hcc task create --title "Review router changes" --priority 20
349
95
  hcc task next
350
- hcc lock acquire --resource vllm/router --ttl 900 --reason "implement diagnostics"
351
- ```
352
-
353
- Message or inject:
354
-
355
- ```bash
356
- hcc msg send --to claude-a --body "Implementation is ready for review."
357
- hcc ask claude-a "Please review the current implementation." --inject
358
- hcc broadcast "Pause edits under vllm/router until this task finishes." --inject
96
+ hcc lock acquire --resource src/router --ttl 900 --reason "edit router"
97
+ hcc status
98
+ hcc handoff create --summary "Router change ready for review" --tests "npm test"
99
+ hcc task done --id 1 --summary "Done"
359
100
  ```
360
101
 
361
- Finish with a handoff:
362
-
363
- ```bash
364
- hcc handoff create --to claude-a \
365
- --summary "Implemented router diagnostics changes." \
366
- --tests "pytest tests/router" \
367
- --risks "Full benchmark not run"
102
+ Ask an agent what is happening in the project:
368
103
 
369
- hcc task done --id 1 --summary "Done and handed off."
370
- hcc lock release --resource vllm/router
104
+ ```text
105
+ What are the other hello-cc sessions doing?
371
106
  ```
372
107
 
373
- ## Stack
108
+ Attached Claude/Codex sessions should answer from live `hcc` state rather than
109
+ generic session-isolation assumptions.
374
110
 
375
- ```text
376
- Node.js >= 24
377
- node:sqlite + SQLite WAL
378
- Node HTTP server
379
- ws WebSocket
380
- xterm.js
381
- tmux create/capture/send
382
- Claude Code hooks
383
- Codex hooks
384
- shell shim wrappers
385
- ```
111
+ ## Documentation
386
112
 
387
- A2A and MCP are not required for the core. A2A is better suited to remote agent
388
- interoperability, and MCP can be added later as a tool layer. Local multi-CLI
389
- coordination uses hooks + SQLite + tmux.
113
+ - [User Guide](docs/guide.md): setup, Web console, commands, workflows, and
114
+ environment behavior.
115
+ - [Design Notes](docs/design.md): product boundaries and coordination model.
116
+ - [Implementation Notes](docs/implementation.md): architecture and internal
117
+ protocol.
118
+ - [中文用户指南](docs/guide.zh-CN.md)
390
119
 
391
120
  ## Testing
392
121
 
@@ -394,69 +123,9 @@ coordination uses hooks + SQLite + tmux.
394
123
  npm test
395
124
  ```
396
125
 
397
- The regression creates a temporary project, temporary `HOME`, fake
398
- `claude`/`codex` binaries, a temporary runtime port, and temporary tmux
399
- sessions. It covers `hcc web` bootstrap, single-port multi-project
400
- registration, hooks/shims, SQLite coordination, tmux-backed `peer start`
401
- creation and restore, shim-launched tmux peers, tmux attach, WebSocket terminal
402
- streaming, terminal injection, runtime shutdown, package dry-run, and old-name
403
- scanning.
126
+ The regression suite uses temporary projects, fake Claude/Codex binaries,
127
+ temporary tmux sessions, and a temporary Web runtime to test the main flows.
404
128
 
405
- ## Architecture
129
+ ## License
406
130
 
407
- ```text
408
- hcc CLI
409
- ├── lib/discover.mjs Claude/Codex session discovery
410
- ├── lib/setup.mjs hooks, shims, PATH installation
411
- ├── bin/hcc.mjs CLI, SQLite, web runtime, tmux control
412
- └── .hello-cc/
413
- ├── mesh.db coordination state
414
- ├── HCC.md project guidance rules
415
- ├── runtime.json web runtime discovery file
416
- └── web.log web runtime log
417
- ```
418
-
419
- ## Environment Variables
420
-
421
- | Variable | Purpose |
422
- |---|---|
423
- | `HCC_PEER` | default peer identity |
424
- | `HCC_ROOT` | override project root |
425
- | `HCC_DB` | override database path |
426
- | `HCC_WEB_TOKEN` | optional token for web access |
427
- | `HCC_RUNTIME_URL` | direct runtime URL |
428
- | `HCC_NO_AUTO_INSTALL_TMUX=1` | disable tmux auto-install, mainly for tests |
429
-
430
- The `claude` / `codex` shims and `hcc peer start` create tmux-backed sessions
431
- from the environment of the **local terminal that launched them**, not from the
432
- older environment of the background web runtime. This lets you open a new
433
- terminal, export provider variables such as `ANTHROPIC_*` or
434
- `CLAUDE_CODE_*`, then run `claude` / `codex`.
435
-
436
- An already-running CLI process cannot have its environment changed in place by
437
- the operating system. The `claude` / `codex` shims call `hcc peer start` with
438
- `--restart-env`, so hello-cc records a launch environment fingerprint for the
439
- same resume/session peer. If you start that peer again from a new terminal and
440
- the environment changed, hello-cc automatically restarts the tmux session with
441
- the new environment when there are no attached tmux clients or Web clients. If
442
- the session is actively attached, hello-cc asks you to detach/close Web clients
443
- or run `hcc peer stop <peer>` before starting it again.
444
-
445
- When you call `hcc peer start` directly, add `--restart-env` if you want the
446
- same restart-on-environment-change behavior.
447
-
448
- The shims only manage interactive terminal sessions. Metadata and maintenance
449
- commands pass through to the real provider CLI, including `claude --help`,
450
- `claude --version`, `claude --print`, `claude --bare`, `claude --safe-mode`,
451
- `codex --help`, `codex --version`, and non-interactive Codex subcommands such as
452
- `codex exec`, `codex review`, `codex doctor`, and `codex mcp`. Interactive
453
- `claude`, `claude --resume ...`, `codex`, `codex resume ...`, and `codex fork
454
- ...` are tmux-backed and visible in the Web console.
455
-
456
- ---
457
-
458
- <p align="center">
459
- <a href="https://star-history.com/#Dullne/hello-cc&Date">
460
- <img src="https://api.star-history.com/svg?repos=Dullne/hello-cc&type=Date" width="600" alt="Star History Chart">
461
- </a>
462
- </p>
131
+ [Apache-2.0](LICENSE)