@adamancyzhang/claude-orchestrator 0.3.0 → 0.3.2
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 +203 -201
- package/dist/cli/commands.d.ts +6 -17
- package/dist/cli/commands.js +133 -172
- package/dist/cli/commands.js.map +1 -1
- package/dist/config.d.ts +28 -14
- package/dist/config.js +51 -20
- package/dist/config.js.map +1 -1
- package/dist/executor/runner.d.ts +19 -0
- package/dist/executor/runner.js +59 -0
- package/dist/executor/runner.js.map +1 -0
- package/dist/executor/template.d.ts +12 -0
- package/dist/executor/template.js +42 -0
- package/dist/executor/template.js.map +1 -0
- package/dist/hooks/engine.d.ts +22 -0
- package/dist/hooks/engine.js +50 -0
- package/dist/hooks/engine.js.map +1 -0
- package/dist/index.js +115 -250
- package/dist/index.js.map +1 -1
- package/dist/leader/chain-router.d.ts +22 -0
- package/dist/leader/chain-router.js +163 -0
- package/dist/leader/chain-router.js.map +1 -0
- package/dist/leader/event-bus.d.ts +1 -1
- package/dist/leader/event-bus.js +1 -1
- package/dist/leader/event-bus.js.map +1 -1
- package/dist/leader/index.d.ts +1 -2
- package/dist/leader/index.js +35 -13
- package/dist/leader/index.js.map +1 -1
- package/dist/leader/recovery.d.ts +2 -0
- package/dist/leader/recovery.js +37 -22
- package/dist/leader/recovery.js.map +1 -1
- package/dist/leader/state.d.ts +2 -1
- package/dist/leader/state.js +48 -2
- package/dist/leader/state.js.map +1 -1
- package/dist/leader/tui.d.ts +8 -0
- package/dist/leader/tui.js +74 -9
- package/dist/leader/tui.js.map +1 -1
- package/dist/leader/watcher.d.ts +4 -3
- package/dist/leader/watcher.js +8 -13
- package/dist/leader/watcher.js.map +1 -1
- package/dist/models/schemas.d.ts +307 -87
- package/dist/models/schemas.js +51 -43
- package/dist/models/schemas.js.map +1 -1
- package/dist/modules/message-router.d.ts +1 -3
- package/dist/modules/message-router.js +3 -26
- package/dist/modules/message-router.js.map +1 -1
- package/dist/modules/registry.js +3 -3
- package/dist/modules/registry.js.map +1 -1
- package/dist/modules/task-queue.d.ts +1 -1
- package/dist/modules/task-queue.js +28 -2
- package/dist/modules/task-queue.js.map +1 -1
- package/dist/skills/CLAUDE.md +155 -0
- package/dist/skills/claude-code-developer/SKILL.md +325 -0
- package/dist/skills/claude-orchestrator/SKILL.md +244 -0
- package/dist/skills/task-acceptance/SKILL.md +201 -0
- package/dist/skills/task-execution/SKILL.md +142 -0
- package/dist/skills/task-planning/SKILL.md +188 -0
- package/dist/skills/task-review/SKILL.md +220 -0
- package/dist/skills/task-traceability/SKILL.md +154 -0
- package/dist/skills/task-verification/SKILL.md +194 -0
- package/dist/templates/worker-accept.md +46 -0
- package/dist/templates/worker-build.md +45 -0
- package/dist/templates/worker-decompose.md +67 -0
- package/dist/templates/worker-evaluate.md +41 -0
- package/dist/templates/worker-plan.md +43 -0
- package/dist/templates/worker-review.md +46 -0
- package/dist/templates/worker-verify.md +47 -0
- package/dist/utils/exec.d.ts +5 -0
- package/dist/utils/exec.js +27 -0
- package/dist/utils/exec.js.map +1 -1
- package/dist/utils/logger.d.ts +10 -0
- package/dist/utils/logger.js +22 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/worker/evaluator.d.ts +13 -0
- package/dist/worker/evaluator.js +112 -0
- package/dist/worker/evaluator.js.map +1 -0
- package/dist/worker/watcher.d.ts +13 -4
- package/dist/worker/watcher.js +108 -24
- package/dist/worker/watcher.js.map +1 -1
- package/dist/zk/client.d.ts +0 -5
- package/dist/zk/client.js +0 -27
- package/dist/zk/client.js.map +1 -1
- package/dist/zk/paths.d.ts +8 -10
- package/dist/zk/paths.js +1 -6
- package/dist/zk/paths.js.map +1 -1
- package/dist/zk/watcher.d.ts +0 -2
- package/dist/zk/watcher.js +0 -3
- package/dist/zk/watcher.js.map +1 -1
- package/package.json +2 -2
- package/dist/modules/context-store.d.ts +0 -10
- package/dist/modules/context-store.js +0 -25
- package/dist/modules/context-store.js.map +0 -1
- package/dist/templates/leader.md +0 -10
- package/dist/templates/worker.md +0 -8
package/README.md
CHANGED
|
@@ -22,30 +22,25 @@
|
|
|
22
22
|
|
|
23
23
|
Behind the scenes, ZooKeeper acts as the coordination backbone: ephemeral nodes for instance heartbeat, sequential nodes for FIFO task ordering, and watches for real-time change notification.
|
|
24
24
|
|
|
25
|
+
v0.3.1 delivers a **Leader-Worker CLI-native architecture**: no MCP server, no HTTP. The Leader runs a read-only TUI and acts as a pure message/task router — it never calls `claude -p`. Workers connect directly to ZooKeeper, process messages via `claude -p`, self-evaluate their output, and send structured decisions back to the Leader. All AI intelligence lives in Workers; the Leader only handles mechanical forwarding, task distribution, and recovery. Built-in Claude Code skills (task-planning, task-execution, task-verification, task-review, task-acceptance, task-traceability) enforce a standardized responsibility chain for every task.
|
|
26
|
+
|
|
25
27
|
```
|
|
26
|
-
|
|
27
|
-
│
|
|
28
|
-
│
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
│
|
|
34
|
-
│
|
|
35
|
-
│
|
|
36
|
-
|
|
37
|
-
│
|
|
38
|
-
|
|
39
|
-
│
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
└──────────────────────────────────────────────────────────┘
|
|
43
|
-
▲ ▲ ▲
|
|
44
|
-
│ │ │
|
|
45
|
-
┌────┴────┐ ┌────┴────┐ ┌────┴────┐
|
|
46
|
-
│ Tom │ │ Jerry │ │ Bob │
|
|
47
|
-
│Architect│ │Developer│ │ Tester │
|
|
48
|
-
└─────────┘ └─────────┘ └─────────┘
|
|
28
|
+
┌─────────────────────────────────────────────────┐
|
|
29
|
+
│ ZooKeeper │
|
|
30
|
+
│ /leader /instances /tasks /messages /context│
|
|
31
|
+
└──────┬──────────────┬──────────────┬────────────┘
|
|
32
|
+
│ │ │
|
|
33
|
+
┌────┴────┐ ┌────┴────┐ ┌────┴────┐
|
|
34
|
+
│ Leader │ │ Worker │ │ Worker │
|
|
35
|
+
│ (TUI) │ │ (CLI) │ │ (CLI) │
|
|
36
|
+
│ Tom │ │ Jerry │ │ Bob │
|
|
37
|
+
│architect│ │developer│ │ tester │
|
|
38
|
+
└─────────┘ └─────────┘ └─────────┘
|
|
39
|
+
│ │ │
|
|
40
|
+
└──────────────┼──────────────┘
|
|
41
|
+
│
|
|
42
|
+
claude-orchestrator CLI
|
|
43
|
+
(send-message, push-task, …)
|
|
49
44
|
```
|
|
50
45
|
|
|
51
46
|
---
|
|
@@ -64,129 +59,83 @@ npm install -g @adamancyzhang/claude-orchestrator
|
|
|
64
59
|
docker-compose up -d
|
|
65
60
|
```
|
|
66
61
|
|
|
67
|
-
### 3.
|
|
62
|
+
### 3. Initialize your environment
|
|
68
63
|
|
|
69
64
|
```bash
|
|
70
|
-
|
|
71
|
-
|
|
65
|
+
# For the Leader (the team coordinator):
|
|
66
|
+
claude-orchestrator setup --leader --name Tom
|
|
67
|
+
|
|
68
|
+
# For each Worker (the doers):
|
|
69
|
+
claude-orchestrator setup --name Jerry --role builder
|
|
72
70
|
```
|
|
73
71
|
|
|
74
|
-
|
|
72
|
+
This creates `.claude-orchestrator/agents/` with message templates, `.claude/skills/` with responsibility-chain skills, and writes project + global config.
|
|
75
73
|
|
|
76
|
-
|
|
74
|
+
### 4. Start the Leader
|
|
77
75
|
|
|
78
76
|
```bash
|
|
79
|
-
claude-orchestrator
|
|
77
|
+
claude-orchestrator leader --name Tom
|
|
78
|
+
# → TUI launches: team panel, task board, event log, footer
|
|
80
79
|
```
|
|
81
80
|
|
|
82
|
-
|
|
81
|
+
The Leader TUI is read-only — it shows who's online, what tasks are pending/in-progress, and a scrolling event log. All actions are triggered by CLI commands or Worker registrations.
|
|
83
82
|
|
|
84
|
-
|
|
85
|
-
- `--global` — write to `~/.claude/mcp.json` instead of local `.claude/mcp.json`
|
|
86
|
-
- `--port`, `--host` — if your server runs on a different address
|
|
87
|
-
- `--name`, `--role` — set instance identity headers
|
|
88
|
-
- `--with-hook` — add SessionStart + SessionEnd hooks for automatic lifecycle
|
|
83
|
+
### 5. Register a Worker
|
|
89
84
|
|
|
90
|
-
|
|
85
|
+
```bash
|
|
86
|
+
# Reads name/role from .claude-orchestrator/config.json (set during setup).
|
|
87
|
+
# Starts Worker Watcher — listens for messages and auto-processes via claude -p:
|
|
88
|
+
claude-orchestrator register
|
|
89
|
+
# Press Ctrl+C to stop and unregister
|
|
90
|
+
```
|
|
91
91
|
|
|
92
|
-
|
|
92
|
+
### 6. Go
|
|
93
93
|
|
|
94
|
-
Now
|
|
94
|
+
Now the Leader TUI shows Jerry online. You can push tasks, send messages, and manage the full lifecycle — all from any terminal.
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
claude-orchestrator push-task --title "Implement login endpoint" --priority 0
|
|
98
|
+
claude-orchestrator send-message --to-name Jerry --content "Starting on the auth module?"
|
|
99
|
+
claude-orchestrator poll-task
|
|
100
|
+
```
|
|
95
101
|
|
|
96
102
|
---
|
|
97
103
|
|
|
98
104
|
## How It Works
|
|
99
105
|
|
|
100
|
-
###
|
|
106
|
+
### Leader-Worker Model
|
|
101
107
|
|
|
102
|
-
|
|
|
103
|
-
|
|
104
|
-
| **
|
|
105
|
-
| **
|
|
106
|
-
| **
|
|
108
|
+
| Component | What it does | ZK magic |
|
|
109
|
+
|-----------|-------------|----------|
|
|
110
|
+
| **Leader** | Read-only TUI, mechanical message/task router, recovers orphaned tasks. No AI calls. | `/leader` EPHEMERAL — only one Leader at a time |
|
|
111
|
+
| **Worker** | Persistent ZK connection, auto-processes messages via `claude -p`, self-evaluates output | Ephemeral nodes → auto-cleanup on disconnect |
|
|
112
|
+
| **Task Queue** | Push → Claim → In Progress → Complete (or Block/Fail/Retry) | Sequential nodes for FIFO, ephemeral claims for atomic locks |
|
|
113
|
+
| **Message Router** | P2P messages, broadcast, help requests, templates | Persistent-sequential nodes, ZK watches for push |
|
|
107
114
|
| **Context Store** | Shared key-value storage, watch for changes | Persistent nodes, cross-instance visibility |
|
|
108
115
|
|
|
109
|
-
###
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
|
116
|
-
|
|
117
|
-
|
|
|
118
|
-
|
|
|
119
|
-
|
|
|
120
|
-
|
|
|
121
|
-
|
|
|
122
|
-
|
|
|
123
|
-
|
|
|
124
|
-
|
|
|
125
|
-
|
|
|
126
|
-
|
|
|
127
|
-
|
|
|
128
|
-
|
|
|
129
|
-
|
|
|
130
|
-
|
|
|
131
|
-
|
|
|
132
|
-
| 18 | `server_status` | Health check |
|
|
133
|
-
|
|
134
|
-
### Or Use the CLI Directly
|
|
135
|
-
|
|
136
|
-
If you prefer the terminal over Claude Code:
|
|
137
|
-
|
|
138
|
-
```bash
|
|
139
|
-
# Register
|
|
140
|
-
claude-orchestrator register --name Alice --role developer
|
|
141
|
-
|
|
142
|
-
# See who's around
|
|
143
|
-
claude-orchestrator list-instances
|
|
144
|
-
|
|
145
|
-
# Push a task
|
|
146
|
-
claude-orchestrator push-task --title "Add rate limiting" --priority 0
|
|
147
|
-
|
|
148
|
-
# Claim the next task
|
|
149
|
-
claude-orchestrator claim-task
|
|
150
|
-
|
|
151
|
-
# Send a message
|
|
152
|
-
claude-orchestrator send-message --to <instance-id> --content "How's PR #42 going?"
|
|
153
|
-
|
|
154
|
-
# Check inbox
|
|
155
|
-
claude-orchestrator poll-messages
|
|
156
|
-
|
|
157
|
-
# Wait for messages (blocks until received or timeout)
|
|
158
|
-
claude-orchestrator wait-for-message --timeout 60
|
|
159
|
-
|
|
160
|
-
# Dismiss a message
|
|
161
|
-
claude-orchestrator dismiss-message --message-id msg-0000000000
|
|
162
|
-
|
|
163
|
-
# Share context
|
|
164
|
-
claude-orchestrator set-context --key "api_version" --value "v2.1"
|
|
165
|
-
|
|
166
|
-
# Read shared context
|
|
167
|
-
claude-orchestrator get-context --key "api_version"
|
|
168
|
-
|
|
169
|
-
# List context keys
|
|
170
|
-
claude-orchestrator list-context-keys
|
|
171
|
-
|
|
172
|
-
# Delete context
|
|
173
|
-
claude-orchestrator delete-context --key "api_version"
|
|
174
|
-
|
|
175
|
-
# Watch context for changes
|
|
176
|
-
claude-orchestrator watch-context --key "jwt_strategy"
|
|
177
|
-
|
|
178
|
-
# Watch for new tasks
|
|
179
|
-
claude-orchestrator watch-tasks
|
|
180
|
-
|
|
181
|
-
# Unregister
|
|
182
|
-
claude-orchestrator unregister
|
|
183
|
-
|
|
184
|
-
# Show config
|
|
185
|
-
claude-orchestrator config
|
|
186
|
-
|
|
187
|
-
# Health check
|
|
188
|
-
claude-orchestrator status
|
|
189
|
-
```
|
|
116
|
+
### CLI-Native — No MCP Server
|
|
117
|
+
|
|
118
|
+
v0.3.x removes the centralized MCP Server entirely. Leader and Workers each connect directly to ZooKeeper. The Leader is a pure router: it forwards requirements to Planner Workers, creates tasks from structured definitions, and mechanically executes EvalDecision JSON from Workers. AI intelligence (task decomposition, self-evaluation) runs exclusively on Workers via `claude -p`. This eliminates 3 layers of indirection (MCP protocol, SSE, HTTP) and makes every node self-contained.
|
|
119
|
+
|
|
120
|
+
### CLI Commands (15)
|
|
121
|
+
|
|
122
|
+
| Command | What it does |
|
|
123
|
+
|---------|-------------|
|
|
124
|
+
| `leader` | Start Leader node with read-only TUI |
|
|
125
|
+
| `setup` | Initialize environment: templates, skills, config |
|
|
126
|
+
| `register` | Join the swarm. With `--work-dir`: persistent message watcher |
|
|
127
|
+
| `unregister` | Explicitly unregister an instance |
|
|
128
|
+
| `push-task` | Create a task (optionally assign to someone) |
|
|
129
|
+
| `claim-task` | Grab the next task — atomic, no two instances can claim the same one |
|
|
130
|
+
| `complete-task` | Mark a task done with results |
|
|
131
|
+
| `poll-task` | Check your claimed tasks |
|
|
132
|
+
| `task-block` | Mark a claimed task as blocked (with reason) |
|
|
133
|
+
| `task-fail` | Mark a claimed task as failed (with reason) |
|
|
134
|
+
| `task-retry` | Re-queue a failed task for retry (retry_count + 1, max 3) |
|
|
135
|
+
| `send-message` | DM another instance by name |
|
|
136
|
+
| `poll-message` | Check your inbox |
|
|
137
|
+
| `delete-message` | Delete a message from your inbox |
|
|
138
|
+
| `config` | Show current configuration |
|
|
190
139
|
|
|
191
140
|
All CLI commands return JSON. Every command supports `--zookeeper` / `-z` (or `ZK_HOSTS` env var) for pointing at a remote ZooKeeper.
|
|
192
141
|
|
|
@@ -194,74 +143,69 @@ All CLI commands return JSON. Every command supports `--zookeeper` / `-z` (or `Z
|
|
|
194
143
|
|
|
195
144
|
## Example Session
|
|
196
145
|
|
|
197
|
-
Here's a real flow with
|
|
146
|
+
Here's a real flow with a Leader (Tom) and two Workers (Jerry, Bob):
|
|
198
147
|
|
|
199
|
-
**Tom
|
|
200
|
-
```json
|
|
201
|
-
{ "id": "a1b2c3d4...", "name": "Tom", "role": "architect", "status": "idle" }
|
|
148
|
+
**Tom starts the Leader:**
|
|
202
149
|
```
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
```json
|
|
206
|
-
{ "id": "f6e5d4c3...", "name": "Jerry", "role": "developer", "status": "idle" }
|
|
150
|
+
claude-orchestrator leader --name Tom
|
|
151
|
+
→ TUI shows: [TEAM] Tom (leader), [PENDING] empty, [EVENT LOG] Leader started
|
|
207
152
|
```
|
|
208
153
|
|
|
209
|
-
**
|
|
210
|
-
```
|
|
211
|
-
|
|
212
|
-
[architect] Tom (a1b2c3d4...) status=idle
|
|
213
|
-
[developer] Jerry (f6e5d4c3...) status=idle
|
|
154
|
+
**Jerry registers as a Worker:**
|
|
155
|
+
```bash
|
|
156
|
+
claude-orchestrator register
|
|
214
157
|
```
|
|
215
|
-
|
|
216
|
-
**Tom assigns work:**
|
|
217
158
|
```
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
priority: HIGH (0)
|
|
222
|
-
assignee: f6e5d4c3... (Jerry)
|
|
159
|
+
TUI updates:
|
|
160
|
+
[TEAM] Jerry joined (builder)
|
|
161
|
+
[EVENT] 9:15:03 PM Jerry joined (builder)
|
|
223
162
|
```
|
|
224
163
|
|
|
225
|
-
**
|
|
226
|
-
```
|
|
227
|
-
|
|
228
|
-
|
|
164
|
+
**Tom assigns work (from another terminal):**
|
|
165
|
+
```bash
|
|
166
|
+
claude-orchestrator push-task --title "Implement POST /api/auth/login" \
|
|
167
|
+
--description "Email+password login, return JWT." --priority 0
|
|
229
168
|
```
|
|
230
169
|
|
|
231
|
-
**Jerry
|
|
232
|
-
```
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
context: "Express + jsonwebtoken, ~100K DAU"
|
|
170
|
+
**Jerry claims it:**
|
|
171
|
+
```bash
|
|
172
|
+
claude-orchestrator claim-task
|
|
173
|
+
# → { "id": "task-0000000000", "status": "claimed", ... }
|
|
236
174
|
```
|
|
237
175
|
|
|
238
|
-
**
|
|
239
|
-
```
|
|
240
|
-
|
|
241
|
-
send_message to=Jerry: "15min access, 7d refresh. Use Redis blacklist for logout."
|
|
176
|
+
**Jerry gets blocked:**
|
|
177
|
+
```bash
|
|
178
|
+
claude-orchestrator task-block --task-id task-0000000000 --reason "Waiting for API key"
|
|
242
179
|
```
|
|
243
180
|
|
|
244
|
-
**Tom
|
|
245
|
-
```
|
|
246
|
-
|
|
181
|
+
**Tom sees the block in the TUI and sends the key:**
|
|
182
|
+
```bash
|
|
183
|
+
claude-orchestrator send-message --to-name Jerry --content "API key is in 1Password: auth/third-party/google-oauth"
|
|
247
184
|
```
|
|
248
185
|
|
|
249
186
|
**Jerry finishes:**
|
|
250
|
-
```
|
|
251
|
-
|
|
187
|
+
```bash
|
|
188
|
+
claude-orchestrator complete-task --task-id task-0000000000 --result "PR #42 — login endpoint with tests"
|
|
252
189
|
```
|
|
253
190
|
|
|
254
|
-
|
|
191
|
+
**Bob fails a task (test env down):**
|
|
192
|
+
```bash
|
|
193
|
+
claude-orchestrator task-fail --task-id task-0000000001 --reason "Test environment unavailable"
|
|
194
|
+
claude-orchestrator task-retry --task-id task-0000000001
|
|
195
|
+
# → Re-queued as task-0000000002 with retry_count: 1
|
|
196
|
+
```
|
|
255
197
|
|
|
256
198
|
---
|
|
257
199
|
|
|
258
|
-
## ZooKeeper Schema
|
|
200
|
+
## ZooKeeper Schema (v0.3.0)
|
|
259
201
|
|
|
260
202
|
```
|
|
261
203
|
/claude-orchestrator
|
|
204
|
+
├── leader [EPHEMERAL] Leader metadata
|
|
262
205
|
├── instances/
|
|
263
|
-
│ ├── a1b2c3d4...
|
|
264
|
-
│
|
|
206
|
+
│ ├── a1b2c3d4... [EPHEMERAL] Tom (leader)
|
|
207
|
+
│ ├── f6e5d4c3... [EPHEMERAL] Jerry (developer)
|
|
208
|
+
│ └── e7f8a9b0... [EPHEMERAL] Bob (tester)
|
|
265
209
|
├── tasks/
|
|
266
210
|
│ ├── pending/
|
|
267
211
|
│ │ ├── task-0000000000 [PERSISTENT_SEQUENTIAL]
|
|
@@ -279,7 +223,27 @@ No polling required for task claiming — the atomic claim mechanism means Jerry
|
|
|
279
223
|
└── jwt_strategy [PERSISTENT]
|
|
280
224
|
```
|
|
281
225
|
|
|
282
|
-
**Key insight:** Ephemeral nodes mean crashed instances auto-unregister. Ephemeral claim nodes mean abandoned tasks auto-release.
|
|
226
|
+
**Key insight:** Ephemeral nodes mean crashed instances auto-unregister. Ephemeral claim nodes mean abandoned tasks auto-release. The Leader monitors `/instances` and recovers orphaned tasks when a Worker disconnects (max 3 retries, then archived as failed).
|
|
227
|
+
|
|
228
|
+
---
|
|
229
|
+
|
|
230
|
+
## Task State Machine (v0.3.0)
|
|
231
|
+
|
|
232
|
+
```
|
|
233
|
+
pending → claimed → in_progress → completed
|
|
234
|
+
→ blocked → pending (retry)
|
|
235
|
+
→ failed → pending (retry, max 3)
|
|
236
|
+
claimed → pending (Worker disconnect, Leader recovers orphan)
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
| State | Meaning | Trigger |
|
|
240
|
+
|-------|---------|---------|
|
|
241
|
+
| `pending` | Waiting for claim | `push_task` |
|
|
242
|
+
| `claimed` | Claimed, not started | `claim_task` |
|
|
243
|
+
| `in_progress` | Working | `heartbeat(current_task=...)` |
|
|
244
|
+
| `completed` | Done | `complete_task` |
|
|
245
|
+
| `blocked` | Blocked, waiting unblock | `task-block` |
|
|
246
|
+
| `failed` | Failed, can retry | `task-fail` |
|
|
283
247
|
|
|
284
248
|
---
|
|
285
249
|
|
|
@@ -289,7 +253,7 @@ No polling required for task claiming — the atomic claim mechanism means Jerry
|
|
|
289
253
|
|
|
290
254
|
- Node.js 18+
|
|
291
255
|
- Docker (for ZooKeeper)
|
|
292
|
-
- Claude Code (for
|
|
256
|
+
- Claude Code CLI (for `register --work-dir` message processing)
|
|
293
257
|
|
|
294
258
|
### From Source
|
|
295
259
|
|
|
@@ -306,11 +270,11 @@ docker-compose up -d
|
|
|
306
270
|
# Build TypeScript
|
|
307
271
|
npm run build
|
|
308
272
|
|
|
309
|
-
# Start the
|
|
310
|
-
claude-orchestrator
|
|
273
|
+
# Start the Leader
|
|
274
|
+
claude-orchestrator leader
|
|
311
275
|
|
|
312
276
|
# Or use the CLI directly
|
|
313
|
-
claude-orchestrator
|
|
277
|
+
claude-orchestrator config
|
|
314
278
|
```
|
|
315
279
|
|
|
316
280
|
### Run Tests
|
|
@@ -323,18 +287,18 @@ npm test
|
|
|
323
287
|
|
|
324
288
|
## Skills for Claude Code
|
|
325
289
|
|
|
326
|
-
The repo includes Claude Code skills that
|
|
290
|
+
The repo includes Claude Code skills that enforce a standardized **responsibility chain**: Plan → Build → Verify → Review → Accept. Each link has a dedicated skill, grounded on the `task-traceability` foundation layer. The `setup` command installs all skills into `.claude/skills/`.
|
|
327
291
|
|
|
328
|
-
| Skill | What it does |
|
|
329
|
-
|
|
330
|
-
| `
|
|
331
|
-
| `
|
|
332
|
-
| `
|
|
333
|
-
| `
|
|
334
|
-
| `
|
|
335
|
-
| `
|
|
336
|
-
| `orchestrator
|
|
337
|
-
| `
|
|
292
|
+
| Skill | Role | What it does |
|
|
293
|
+
|-------|------|-------------|
|
|
294
|
+
| `task-planning` | Planner | Analyze requirements, define blueprints, break down tasks, push to queue |
|
|
295
|
+
| `task-execution` | Builder | Claim tasks, implement against blueprints, commit code with traceability |
|
|
296
|
+
| `task-verification` | Verifier | Independently verify Builder output against Plan criteria |
|
|
297
|
+
| `task-review` | Reviewer | Review full chain (Plan→Build→Verify) for design consistency |
|
|
298
|
+
| `task-acceptance` | Accepter | Validate final deliverable against business criteria, sign Go/No-Go |
|
|
299
|
+
| `task-traceability` | Foundation | Trace → Execute → Map → Evidence → Record — all roles |
|
|
300
|
+
| `claude-orchestrator` | Infrastructure | Full CLI reference — all 15 commands with examples |
|
|
301
|
+
| `claude-code-developer` | Infrastructure | Hooks, settings, MCP, CLI reference for extending Claude Code |
|
|
338
302
|
|
|
339
303
|
---
|
|
340
304
|
|
|
@@ -345,8 +309,9 @@ The repo includes Claude Code skills that make the orchestrator even easier to u
|
|
|
345
309
|
| Instance lifecycle | Ephemeral nodes → auto-cleanup. No heartbeat polling needed. |
|
|
346
310
|
| Task ordering | Sequential nodes → guaranteed FIFO. No race conditions. |
|
|
347
311
|
| Claim atomicity | `create(path, ephemeral=true)` is atomic at the ZK level. Only one winner. |
|
|
312
|
+
| Leader election | `/leader` EPHEMERAL → exactly one Leader. Auto-released on crash. |
|
|
348
313
|
| Change notification | Built-in watches → push, not poll. |
|
|
349
|
-
| Dependencies | One dependency (ZK). No external database
|
|
314
|
+
| Dependencies | One dependency (ZK). No external database, no HTTP server. |
|
|
350
315
|
|
|
351
316
|
Zero external database. All state lives in ZooKeeper.
|
|
352
317
|
|
|
@@ -356,10 +321,12 @@ Zero external database. All state lives in ZooKeeper.
|
|
|
356
321
|
|
|
357
322
|
| Role | Value | Typical behavior |
|
|
358
323
|
|------|-------|-----------------|
|
|
359
|
-
|
|
|
360
|
-
|
|
|
361
|
-
|
|
|
362
|
-
|
|
|
324
|
+
| Leader | `leader` | Runs TUI, mechanical message/task routing, recovers orphaned tasks |
|
|
325
|
+
| Planner | `planner` | Decomposes requirements into task chains, defines blueprints |
|
|
326
|
+
| Builder | `builder` | Claims build tasks, writes code, submits PRs |
|
|
327
|
+
| Verifier | `verifier` | Claims verify tasks, checks Builder output against Plan |
|
|
328
|
+
| Reviewer | `reviewer` | Claims review tasks, quality gate for design consistency |
|
|
329
|
+
| Accepter | `accepter` | Claims accept tasks, final Go/No-Go validation |
|
|
363
330
|
|
|
364
331
|
---
|
|
365
332
|
|
|
@@ -369,8 +336,8 @@ Zero external database. All state lives in ZooKeeper.
|
|
|
369
336
|
|--------|-------|---------|
|
|
370
337
|
| ZK hosts | `-z, --zookeeper` flag or `ZK_HOSTS` env | `127.0.0.1:2181` |
|
|
371
338
|
| Instance ID | `-i, --instance-id` flag or `.claude-orchestrator/config.json` (project) / `~/.claude-orchestrator/config.json` (global) | auto-saved after `register` |
|
|
372
|
-
|
|
|
373
|
-
|
|
|
339
|
+
| Claude command | `--command` flag or `config.json` → `command` | `claude --dangerously-skip-permissions -v` |
|
|
340
|
+
| Cache directory | `--cache-dir` flag or `config.json` → `cache_dir` | `~/.claude-orchestrator/sessions` |
|
|
374
341
|
|
|
375
342
|
---
|
|
376
343
|
|
|
@@ -378,37 +345,72 @@ Zero external database. All state lives in ZooKeeper.
|
|
|
378
345
|
|
|
379
346
|
```
|
|
380
347
|
├── src/
|
|
381
|
-
│ ├── index.ts # CLI entry point (commander)
|
|
382
|
-
│ ├── server.ts # MCP server — 18 tools, 5 resources, 2 prompts
|
|
348
|
+
│ ├── index.ts # CLI entry point (commander, 15 commands)
|
|
383
349
|
│ ├── config.ts # Configuration handling
|
|
384
350
|
│ ├── cli/
|
|
385
351
|
│ │ └── commands.ts # CLI subcommand implementations
|
|
352
|
+
│ ├── leader/ # Leader node (v0.3.1)
|
|
353
|
+
│ │ ├── index.ts # startup / shutdown orchestration
|
|
354
|
+
│ │ ├── tui.ts # ANSI-based read-only TUI
|
|
355
|
+
│ │ ├── event-bus.ts # typed EventEmitter (13 events)
|
|
356
|
+
│ │ ├── state.ts # centralized LeaderState
|
|
357
|
+
│ │ ├── monitor.ts # WorkerMonitor — join/leave detection
|
|
358
|
+
│ │ ├── orchestrator.ts # TaskOrchestrator — lifecycle tracking
|
|
359
|
+
│ │ ├── recovery.ts # TaskRecovery — orphan recovery (max 3 retries)
|
|
360
|
+
│ │ ├── watcher.ts # LeaderWatcher — message processing
|
|
361
|
+
│ │ └── chain-router.ts # ChainRouter — mechanical routing (no AI)
|
|
362
|
+
│ ├── worker/ # Worker node (v0.3.1)
|
|
363
|
+
│ │ ├── watcher.ts # WorkerWatcher — ZK watch loop + orchestration
|
|
364
|
+
│ │ └── evaluator.ts # SelfEvaluator — built-in self-evaluation
|
|
365
|
+
│ ├── executor/ # Template execution engine
|
|
366
|
+
│ │ ├── template.ts # TemplateEngine — loading + rendering
|
|
367
|
+
│ │ └── runner.ts # ClaudeRunner — CLI execution wrapper
|
|
368
|
+
│ ├── templates/ # Built-in agent templates
|
|
369
|
+
│ │ ├── worker-decompose.md # Planner decompose prompt
|
|
370
|
+
│ │ ├── worker-evaluate.md # Worker self-evaluation prompt
|
|
371
|
+
│ │ ├── worker-plan.md # Planner template (task-traceability + task-acceptance)
|
|
372
|
+
│ │ ├── worker-build.md # Builder template (task-traceability)
|
|
373
|
+
│ │ ├── worker-verify.md # Verifier template (task-traceability)
|
|
374
|
+
│ │ ├── worker-review.md # Reviewer template (task-traceability)
|
|
375
|
+
│ │ └── worker-accept.md # Accepter template (task-traceability + task-acceptance)
|
|
386
376
|
│ ├── zk/
|
|
387
377
|
│ │ ├── client.ts # ZooKeeper connection management
|
|
388
378
|
│ │ ├── paths.ts # ZK path constants
|
|
389
379
|
│ │ └── watcher.ts # ZK watch manager
|
|
390
380
|
│ ├── modules/
|
|
391
381
|
│ │ ├── registry.ts # Instance registry
|
|
392
|
-
│ │ ├── task-queue.ts # Task queue
|
|
393
|
-
│ │ ├── message-router.ts # Message routing + long-poll
|
|
382
|
+
│ │ ├── task-queue.ts # Task queue (6-state: push/claim/block/fail/retry)
|
|
383
|
+
│ │ ├── message-router.ts # Message routing + template rendering + long-poll
|
|
394
384
|
│ │ └── context-store.ts # Shared key-value store
|
|
395
385
|
│ ├── models/
|
|
396
386
|
│ │ └── schemas.ts # Zod schemas and inferred types
|
|
397
387
|
│ └── utils/
|
|
398
|
-
│
|
|
388
|
+
│ ├── exec.ts # Shell execution (execWithTee)
|
|
389
|
+
│ ├── output.ts # CLI output formatting
|
|
390
|
+
│ └── logger.ts # Tagged logger for contextual output
|
|
399
391
|
├── bin/
|
|
400
392
|
│ └── claude-orchestrator # npm CLI entry (Node.js)
|
|
401
393
|
├── scripts/
|
|
402
394
|
│ ├── start-zk.sh # Docker ZK launcher
|
|
403
|
-
│ ├── start-
|
|
395
|
+
│ ├── start-leader.sh # Leader launcher
|
|
396
|
+
│ ├── start-worker.sh # Worker launcher
|
|
404
397
|
│ ├── stop-all.sh # Tear down
|
|
405
398
|
│ └── publish.sh # npm publish pipeline
|
|
406
|
-
├── skills/ # Claude Code skills
|
|
399
|
+
├── skills/ # Claude Code skills (8 skills, responsibility chain)
|
|
400
|
+
│ ├── task-planning/ # Planner skill
|
|
401
|
+
│ ├── task-execution/ # Builder skill
|
|
402
|
+
│ ├── task-verification/ # Verifier skill
|
|
403
|
+
│ ├── task-review/ # Reviewer skill
|
|
404
|
+
│ ├── task-acceptance/ # Accepter skill
|
|
405
|
+
│ ├── task-traceability/ # Foundation layer skill
|
|
406
|
+
│ ├── claude-orchestrator/ # CLI reference skill
|
|
407
|
+
│ └── claude-code-developer/ # Claude Code extension skill
|
|
407
408
|
├── docs/
|
|
408
409
|
│ ├── v0.1.0/ # Archived Python v0.1.0 docs
|
|
409
|
-
│
|
|
410
|
-
│
|
|
411
|
-
│
|
|
410
|
+
│ ├── v0.2.0/ # Archived MCP-based v0.2.x docs
|
|
411
|
+
│ └── v0.3.0/ # Current v0.3.0 docs
|
|
412
|
+
│ ├── prd/ # Full spec + architecture + ZK schema
|
|
413
|
+
│ └── migration-guide.md # v0.2.0 → v0.3.0 migration
|
|
412
414
|
├── tests/
|
|
413
415
|
│ ├── unit/
|
|
414
416
|
│ └── integration/
|
|
@@ -426,5 +428,5 @@ MIT — use it, fork it, ship it.
|
|
|
426
428
|
---
|
|
427
429
|
|
|
428
430
|
<p align="center">
|
|
429
|
-
<sub>Built with TypeScript
|
|
431
|
+
<sub>Built with TypeScript and ZooKeeper. Orchestrate responsibly.</sub>
|
|
430
432
|
</p>
|
package/dist/cli/commands.d.ts
CHANGED
|
@@ -1,22 +1,11 @@
|
|
|
1
|
-
export declare function
|
|
2
|
-
export declare function
|
|
3
|
-
export declare function cmdHeartbeat(zkHosts: string, cliInstanceId: string | undefined, currentTask?: string): Promise<void>;
|
|
4
|
-
export declare function cmdListInstances(zkHosts: string): Promise<void>;
|
|
5
|
-
export declare function cmdPushTask(zkHosts: string, cliInstanceId: string | undefined, title: string, description: string, priority: number, assignee?: string): Promise<void>;
|
|
1
|
+
export declare function cmdRegister(zkHosts: string, debug?: boolean): Promise<void>;
|
|
2
|
+
export declare function cmdPushTask(zkHosts: string, cliInstanceId: string | undefined, title: string, description: string, priority: number, assignee?: string, link?: string, chainId?: string, dependsOn?: string[], blockedBy?: string[]): Promise<void>;
|
|
6
3
|
export declare function cmdClaimTask(zkHosts: string, cliInstanceId: string | undefined): Promise<void>;
|
|
7
4
|
export declare function cmdCompleteTask(zkHosts: string, cliInstanceId: string | undefined, taskId: string, result: string): Promise<void>;
|
|
8
|
-
export declare function
|
|
9
|
-
export declare function cmdSendMessage(zkHosts: string, cliInstanceId: string | undefined, content: string
|
|
10
|
-
export declare function
|
|
11
|
-
export declare function
|
|
12
|
-
export declare function cmdDismissMessage(zkHosts: string, cliInstanceId: string | undefined, messageId: string): Promise<void>;
|
|
13
|
-
export declare function cmdRequestHelp(zkHosts: string, cliInstanceId: string | undefined, question: string, ctx?: string): Promise<void>;
|
|
14
|
-
export declare function cmdSetContext(zkHosts: string, cliInstanceId: string | undefined, key: string, value: string): Promise<void>;
|
|
15
|
-
export declare function cmdGetContext(zkHosts: string, key: string): Promise<void>;
|
|
16
|
-
export declare function cmdDeleteContext(zkHosts: string, key: string): Promise<void>;
|
|
17
|
-
export declare function cmdListContextKeys(zkHosts: string): Promise<void>;
|
|
18
|
-
export declare function cmdWatchContext(zkHosts: string, key: string): Promise<void>;
|
|
19
|
-
export declare function cmdWatchTasks(zkHosts: string): Promise<void>;
|
|
5
|
+
export declare function cmdPollTask(zkHosts: string, statusFilter?: string): Promise<void>;
|
|
6
|
+
export declare function cmdSendMessage(zkHosts: string, cliInstanceId: string | undefined, content: string): Promise<void>;
|
|
7
|
+
export declare function cmdPollMessage(zkHosts: string, cliInstanceId: string | undefined): Promise<void>;
|
|
8
|
+
export declare function cmdDeleteMessage(zkHosts: string, cliInstanceId: string | undefined, messageId: string): Promise<void>;
|
|
20
9
|
export declare function cmdUnregister(zkHosts: string, cliInstanceId: string | undefined): Promise<void>;
|
|
21
10
|
export declare function cmdSetup(options: {
|
|
22
11
|
leader: boolean;
|