@adamancyzhang/claude-orchestrator 0.3.2 → 0.4.0
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 +198 -280
- package/dist/cli/commands.d.ts +0 -10
- package/dist/cli/commands.js +1 -184
- package/dist/cli/commands.js.map +1 -1
- package/dist/config.d.ts +22 -0
- package/dist/config.js +23 -0
- package/dist/config.js.map +1 -1
- package/dist/executor/template.js +21 -3
- package/dist/executor/template.js.map +1 -1
- package/dist/index.js +9 -34
- package/dist/index.js.map +1 -1
- package/dist/leader/chain-router.d.ts +5 -1
- package/dist/leader/chain-router.js +90 -2
- package/dist/leader/chain-router.js.map +1 -1
- 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 +7 -0
- package/dist/leader/index.js +5 -2
- package/dist/leader/index.js.map +1 -1
- package/dist/leader/merge-validator.d.ts +24 -0
- package/dist/leader/merge-validator.js +112 -0
- package/dist/leader/merge-validator.js.map +1 -0
- package/dist/leader/state.d.ts +17 -0
- package/dist/leader/state.js +48 -2
- package/dist/leader/state.js.map +1 -1
- package/dist/leader/tui.d.ts +2 -0
- package/dist/leader/tui.js +140 -16
- package/dist/leader/tui.js.map +1 -1
- package/dist/leader/watcher.js +12 -0
- package/dist/leader/watcher.js.map +1 -1
- package/dist/models/schemas.d.ts +15 -0
- package/dist/models/schemas.js +6 -1
- package/dist/models/schemas.js.map +1 -1
- package/dist/orchestrator/run.d.ts +6 -0
- package/dist/orchestrator/run.js +181 -0
- package/dist/orchestrator/run.js.map +1 -0
- package/dist/skills/CLAUDE.md +1 -1
- package/dist/skills/claude-orchestrator/SKILL.md +75 -217
- package/dist/templates/agents/worker-accept.md +48 -0
- package/dist/templates/agents/worker-build.md +38 -0
- package/dist/templates/agents/worker-decompose.md +40 -0
- package/dist/templates/agents/worker-evaluate.md +49 -0
- package/dist/templates/agents/worker-plan.md +36 -0
- package/dist/templates/agents/worker-review.md +42 -0
- package/dist/templates/agents/worker-verify.md +44 -0
- package/dist/templates/claude-memory/personal-claude-accepter.md +17 -0
- package/dist/templates/claude-memory/personal-claude-builder.md +24 -0
- package/dist/templates/claude-memory/personal-claude-planner.md +22 -0
- package/dist/templates/claude-memory/personal-claude-reviewer.md +25 -0
- package/dist/templates/claude-memory/personal-claude-verifier.md +24 -0
- package/dist/templates/claude-memory/team-claude.md +61 -0
- package/dist/utils/logger.d.ts +1 -0
- package/dist/utils/logger.js +3 -0
- package/dist/utils/logger.js.map +1 -1
- package/dist/worker/child-runner.d.ts +12 -0
- package/dist/worker/child-runner.js +99 -0
- package/dist/worker/child-runner.js.map +1 -0
- package/dist/worker/child.d.ts +2 -0
- package/dist/worker/child.js +8 -0
- package/dist/worker/child.js.map +1 -0
- package/dist/worker/commit-checker.d.ts +20 -0
- package/dist/worker/commit-checker.js +87 -0
- package/dist/worker/commit-checker.js.map +1 -0
- package/dist/worker/watcher.d.ts +5 -1
- package/dist/worker/watcher.js +41 -4
- package/dist/worker/watcher.js.map +1 -1
- package/dist/worker/worktree-initializer.d.ts +10 -0
- package/dist/worker/worktree-initializer.js +235 -0
- package/dist/worker/worktree-initializer.js.map +1 -0
- package/package.json +2 -2
- package/dist/templates/worker-accept.md +0 -46
- package/dist/templates/worker-build.md +0 -45
- package/dist/templates/worker-decompose.md +0 -67
- package/dist/templates/worker-evaluate.md +0 -41
- package/dist/templates/worker-plan.md +0 -43
- package/dist/templates/worker-review.md +0 -46
- package/dist/templates/worker-verify.md +0 -47
package/README.md
CHANGED
|
@@ -18,29 +18,22 @@
|
|
|
18
18
|
|
|
19
19
|
## What is this?
|
|
20
20
|
|
|
21
|
-
**Claude Orchestrator**
|
|
21
|
+
**Claude Orchestrator** runs multiple Claude Code instances as an AI team. Each Worker gets an isolated git worktree with humanized names (Tom, Jerry, Lucy...), auto-processes assigned tasks via `claude -p`, self-evaluates output, and sends structured decisions back to the Leader. The Leader runs a read-only TUI and mechanically routes tasks through the Plan → Build → Verify → Review → Accept responsibility chain.
|
|
22
22
|
|
|
23
|
-
|
|
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.
|
|
23
|
+
Under the hood, ZooKeeper handles coordination: ephemeral nodes for heartbeat, sequential nodes for FIFO task ordering, and watches for real-time notification. Zero external database — all state lives in ZooKeeper.
|
|
26
24
|
|
|
27
25
|
```
|
|
28
|
-
|
|
29
|
-
│
|
|
30
|
-
│
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
│ │ │
|
|
40
|
-
└──────────────┼──────────────┘
|
|
41
|
-
│
|
|
42
|
-
claude-orchestrator CLI
|
|
43
|
-
(send-message, push-task, …)
|
|
26
|
+
┌──────────────────────────────────────────────────────┐
|
|
27
|
+
│ ZooKeeper │
|
|
28
|
+
│ /leader /instances /tasks /messages │
|
|
29
|
+
└────────┬────────────────┬────────────────┬────────────┘
|
|
30
|
+
│ │ │
|
|
31
|
+
┌────┴────┐ ┌────┴────┐ ┌────┴────┐
|
|
32
|
+
│ Leader │ │ Worker │ │ Worker │
|
|
33
|
+
│ (TUI) │ │(worktree)│ │(worktree)│
|
|
34
|
+
│ Tom │ │ Jerry │ │ Lucy │
|
|
35
|
+
│planner │ │ builder │ │verifier │
|
|
36
|
+
└─────────┘ └─────────┘ └─────────┘
|
|
44
37
|
```
|
|
45
38
|
|
|
46
39
|
---
|
|
@@ -59,191 +52,175 @@ npm install -g @adamancyzhang/claude-orchestrator
|
|
|
59
52
|
docker-compose up -d
|
|
60
53
|
```
|
|
61
54
|
|
|
62
|
-
### 3.
|
|
55
|
+
### 3. Launch Everything
|
|
63
56
|
|
|
64
57
|
```bash
|
|
65
|
-
|
|
66
|
-
claude-orchestrator setup --leader --name Tom
|
|
67
|
-
|
|
68
|
-
# For each Worker (the doers):
|
|
69
|
-
claude-orchestrator setup --name Jerry --role builder
|
|
58
|
+
claude-orchestrator run --worker 5
|
|
70
59
|
```
|
|
71
60
|
|
|
72
|
-
|
|
61
|
+
One command. It:
|
|
62
|
+
- Creates isolated git worktrees for each Worker (`.claude-orchestrator/worktree/{name}/`)
|
|
63
|
+
- Assigns humanized names (Tom, Jerry, Lucy, Thomas, Jack...) and roles (planner, builder, verifier, reviewer, accepter)
|
|
64
|
+
- Copies agent templates and skills into each worktree
|
|
65
|
+
- Starts the Leader TUI
|
|
66
|
+
- Forks Worker child processes (each in its own worktree)
|
|
73
67
|
|
|
74
|
-
### 4.
|
|
68
|
+
### 4. Use It
|
|
75
69
|
|
|
76
|
-
|
|
77
|
-
claude-orchestrator leader --name Tom
|
|
78
|
-
# → TUI launches: team panel, task board, event log, footer
|
|
79
|
-
```
|
|
80
|
-
|
|
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.
|
|
82
|
-
|
|
83
|
-
### 5. Register a Worker
|
|
84
|
-
|
|
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
|
-
|
|
92
|
-
### 6. Go
|
|
93
|
-
|
|
94
|
-
Now the Leader TUI shows Jerry online. You can push tasks, send messages, and manage the full lifecycle — all from any terminal.
|
|
70
|
+
Type a requirement in the TUI input line and press Enter. The Leader forwards it to a Planner Worker, which decomposes it into a responsibility chain. Each Worker processes its link, self-evaluates, and the Leader routes the next link.
|
|
95
71
|
|
|
96
72
|
```bash
|
|
73
|
+
# CLI commands (from any terminal)
|
|
97
74
|
claude-orchestrator push-task --title "Implement login endpoint" --priority 0
|
|
98
75
|
claude-orchestrator send-message --to-name Jerry --content "Starting on the auth module?"
|
|
99
|
-
claude-orchestrator
|
|
76
|
+
claude-orchestrator list-tasks --status pending
|
|
100
77
|
```
|
|
101
78
|
|
|
102
79
|
---
|
|
103
80
|
|
|
104
|
-
##
|
|
81
|
+
## Architecture
|
|
105
82
|
|
|
106
|
-
### Leader-Worker Model
|
|
83
|
+
### Leader-Worker Model (v0.4)
|
|
107
84
|
|
|
108
85
|
| Component | What it does | ZK magic |
|
|
109
86
|
|-----------|-------------|----------|
|
|
110
|
-
| **Leader** | Read-only TUI, mechanical message/task
|
|
111
|
-
| **Worker** |
|
|
112
|
-
| **Task Queue** | Push → Claim →
|
|
113
|
-
| **Message Router** |
|
|
114
|
-
|
|
87
|
+
| **Leader** | Read-only TUI, mechanical message/task routing, merge validation, orphan recovery. No AI calls. | `/leader` EPHEMERAL — exactly one Leader |
|
|
88
|
+
| **Worker** | Isolated git worktree, ZK watch loop, auto-processes messages via `claude -p`, self-evaluates output, auto-commits changes | EPHEMERAL nodes → auto-cleanup on disconnect |
|
|
89
|
+
| **Task Queue** | Push → Claim → Complete (or Block/Fail/Retry). Role-link priority sorting. | Sequential nodes for FIFO, ephemeral claims for atomic locks |
|
|
90
|
+
| **Message Router** | Point-to-point messaging via ZK watches | Persistent-sequential nodes, push notification |
|
|
91
|
+
|
|
92
|
+
### Worktree Isolation
|
|
93
|
+
|
|
94
|
+
Each Worker runs in its own `git worktree` under `.claude-orchestrator/worktree/{name}/`. This gives every Worker:
|
|
95
|
+
- **Independent working directory** — no file conflicts
|
|
96
|
+
- **Dedicated git branch** — `claude-orchestrator/{name}-workspace`
|
|
97
|
+
- **Personal CLAUDE.md** — role-specific rules at `.claude-orchestrator/docs/{name}/CLAUDE.md`
|
|
98
|
+
- **Daily directory memory** — `.claude-orchestrator/docs/{name}/YYYY-MM-DD/CLAUDE.md` preserves session context across restarts
|
|
115
99
|
|
|
116
|
-
### CLI-Native —
|
|
100
|
+
### CLI-Native — Zero MCP Server
|
|
117
101
|
|
|
118
|
-
|
|
102
|
+
Leader and Workers each connect directly to ZooKeeper. The Leader is a pure router: forwards requirements, creates tasks from ChainDef JSON, mechanically executes EvalDecision JSON. All AI intelligence runs exclusively on Workers via `claude -p`. No HTTP, no SSE, no MCP protocol.
|
|
119
103
|
|
|
120
|
-
###
|
|
104
|
+
### Responsibility Chain
|
|
121
105
|
|
|
122
|
-
|
|
106
|
+
```
|
|
107
|
+
Plan → Build → Verify → Review → Accept
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
Each link is a dedicated role. One Worker produces, the next Worker verifies — forming a **closed-loop responsibility chain**. Every output is written to `.claude-orchestrator/docs/{name}/YYYY-MM-DD/` and the next link reads from there. Built-in self-evaluation after every link ensures quality at each step.
|
|
111
|
+
|
|
112
|
+
---
|
|
113
|
+
|
|
114
|
+
## CLI Commands
|
|
115
|
+
|
|
116
|
+
| Command | Description |
|
|
123
117
|
|---------|-------------|
|
|
124
|
-
| `
|
|
125
|
-
| `setup` | Initialize environment: templates, skills, config |
|
|
126
|
-
| `register` | Join the swarm. With `--work-dir`: persistent message watcher |
|
|
118
|
+
| `run --worker <n>` | Start full orchestration: Leader TUI + N Workers with worktree isolation |
|
|
127
119
|
| `unregister` | Explicitly unregister an instance |
|
|
128
120
|
| `push-task` | Create a task (optionally assign to someone) |
|
|
129
121
|
| `claim-task` | Grab the next task — atomic, no two instances can claim the same one |
|
|
130
122
|
| `complete-task` | Mark a task done with results |
|
|
131
|
-
| `
|
|
123
|
+
| `list-tasks` | List tasks by status |
|
|
132
124
|
| `task-block` | Mark a claimed task as blocked (with reason) |
|
|
133
125
|
| `task-fail` | Mark a claimed task as failed (with reason) |
|
|
134
|
-
| `task-retry` | Re-queue a failed task
|
|
135
|
-
| `send-message` |
|
|
126
|
+
| `task-retry` | Re-queue a failed task (retry_count + 1, max 3) |
|
|
127
|
+
| `send-message` | Send a message to a specific instance |
|
|
136
128
|
| `poll-message` | Check your inbox |
|
|
137
129
|
| `delete-message` | Delete a message from your inbox |
|
|
138
130
|
| `config` | Show current configuration |
|
|
139
131
|
|
|
140
|
-
All CLI commands return JSON. Every command supports `--zookeeper` / `-z` (or `ZK_HOSTS` env var) for pointing at a remote ZooKeeper.
|
|
141
|
-
|
|
142
132
|
---
|
|
143
133
|
|
|
144
|
-
##
|
|
134
|
+
## Directory Memory (CLAUDE.md)
|
|
145
135
|
|
|
146
|
-
|
|
136
|
+
Claude Orchestrator uses a three-layer **CLAUDE.md** system as directory memory:
|
|
147
137
|
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
138
|
+
| Layer | Location | Content |
|
|
139
|
+
|-------|----------|---------|
|
|
140
|
+
| **Team** | Worktree root `CLAUDE.md` | Team roles, directory structure, responsibility chain, git rules |
|
|
141
|
+
| **Personal** | `.claude-orchestrator/docs/{name}/CLAUDE.md` | Role-specific process, output standards, communication rules, prohibited behaviors |
|
|
142
|
+
| **Daily** | `.claude-orchestrator/docs/{name}/YYYY-MM-DD/CLAUDE.md` | Session context, task progress, decisions, blockers |
|
|
153
143
|
|
|
154
|
-
|
|
155
|
-
```bash
|
|
156
|
-
claude-orchestrator register
|
|
157
|
-
```
|
|
158
|
-
```
|
|
159
|
-
TUI updates:
|
|
160
|
-
[TEAM] Jerry joined (builder)
|
|
161
|
-
[EVENT] 9:15:03 PM Jerry joined (builder)
|
|
162
|
-
```
|
|
144
|
+
Layers 1 and 2 are seeded from templates during worktree creation. Layer 3 is created and maintained by Workers themselves during task execution — guided by prompt templates that instruct Claude to manage its own daily memory.
|
|
163
145
|
|
|
164
|
-
|
|
165
|
-
```bash
|
|
166
|
-
claude-orchestrator push-task --title "Implement POST /api/auth/login" \
|
|
167
|
-
--description "Email+password login, return JWT." --priority 0
|
|
168
|
-
```
|
|
146
|
+
---
|
|
169
147
|
|
|
170
|
-
|
|
171
|
-
```bash
|
|
172
|
-
claude-orchestrator claim-task
|
|
173
|
-
# → { "id": "task-0000000000", "status": "claimed", ... }
|
|
174
|
-
```
|
|
148
|
+
## Template Structure
|
|
175
149
|
|
|
176
|
-
**Jerry gets blocked:**
|
|
177
|
-
```bash
|
|
178
|
-
claude-orchestrator task-block --task-id task-0000000000 --reason "Waiting for API key"
|
|
179
150
|
```
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
151
|
+
templates/
|
|
152
|
+
├── agents/ ← Worker prompt templates
|
|
153
|
+
│ ├── worker-decompose.md # Requirement → chain decomposition
|
|
154
|
+
│ ├── worker-plan.md # Planner: blueprint design
|
|
155
|
+
│ ├── worker-build.md # Builder: traceable implementation
|
|
156
|
+
│ ├── worker-verify.md # Verifier: cross-check Plan vs Build
|
|
157
|
+
│ ├── worker-review.md # Reviewer: chain-level quality gate
|
|
158
|
+
│ ├── worker-accept.md # Accepter: final Go/No-Go decision
|
|
159
|
+
│ └── worker-evaluate.md # Self-evaluation after each link
|
|
160
|
+
└── claude-memory/ ← Directory memory templates
|
|
161
|
+
├── team-claude.md # Workspace-level CLAUDE.md
|
|
162
|
+
├── personal-claude-planner.md # Planner role rules
|
|
163
|
+
├── personal-claude-builder.md # Builder role rules
|
|
164
|
+
├── personal-claude-verifier.md # Verifier role rules
|
|
165
|
+
├── personal-claude-reviewer.md # Reviewer role rules
|
|
166
|
+
└── personal-claude-accepter.md # Accepter role rules
|
|
184
167
|
```
|
|
185
168
|
|
|
186
|
-
|
|
187
|
-
```bash
|
|
188
|
-
claude-orchestrator complete-task --task-id task-0000000000 --result "PR #42 — login endpoint with tests"
|
|
189
|
-
```
|
|
169
|
+
Worker templates are lean — they provide task context and key instructions, then guide Workers to read the corresponding skill file (`.claude/skills/{skill}/SKILL.md`) for detailed process. This keeps prompts focused and prevents LLM attention dispersion.
|
|
190
170
|
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
171
|
+
---
|
|
172
|
+
|
|
173
|
+
## Skills
|
|
174
|
+
|
|
175
|
+
| Skill | Role | Description |
|
|
176
|
+
|-------|------|-------------|
|
|
177
|
+
| `task-planning` | Planner | Analyze requirements, define blueprints, break down tasks |
|
|
178
|
+
| `task-execution` | Builder | Claim tasks, implement against blueprints, commit with traceability |
|
|
179
|
+
| `task-verification` | Verifier | Independently verify Builder output against Plan criteria |
|
|
180
|
+
| `task-review` | Reviewer | Review full chain (Plan→Build→Verify) for design consistency |
|
|
181
|
+
| `task-acceptance` | Accepter | Validate final deliverable against business criteria, sign Go/No-Go |
|
|
182
|
+
| `task-traceability` | Foundation | Trace → Execute → Map → Evidence → Record — all roles |
|
|
197
183
|
|
|
198
184
|
---
|
|
199
185
|
|
|
200
|
-
## ZooKeeper
|
|
186
|
+
## ZooKeeper Node Tree
|
|
201
187
|
|
|
202
188
|
```
|
|
203
189
|
/claude-orchestrator
|
|
204
190
|
├── leader [EPHEMERAL] Leader metadata
|
|
205
|
-
├── instances/
|
|
206
|
-
│ ├── a1b2c3d4... [EPHEMERAL] Tom (leader)
|
|
207
|
-
│ ├── f6e5d4c3... [EPHEMERAL] Jerry (developer)
|
|
208
|
-
│ └── e7f8a9b0... [EPHEMERAL] Bob (tester)
|
|
191
|
+
├── instances/{id} [EPHEMERAL] Instance metadata
|
|
209
192
|
├── tasks/
|
|
210
|
-
│ ├── pending/
|
|
211
|
-
│
|
|
212
|
-
│
|
|
213
|
-
|
|
214
|
-
│ │ └── f6e5d4c3-task-0000000000 [EPHEMERAL] ← atomic lock!
|
|
215
|
-
│ └── completed/
|
|
216
|
-
│ └── task-0000000000 [PERSISTENT]
|
|
217
|
-
├── messages/
|
|
218
|
-
│ ├── a1b2c3d4.../
|
|
219
|
-
│ │ └── msg-0000000000 [PERSISTENT_SEQUENTIAL]
|
|
220
|
-
│ └── f6e5d4c3.../
|
|
221
|
-
│ └── msg-0000000000 [PERSISTENT_SEQUENTIAL]
|
|
222
|
-
└── context/
|
|
223
|
-
└── jwt_strategy [PERSISTENT]
|
|
193
|
+
│ ├── pending/task-NNNNN [PERSISTENT_SEQUENTIAL]
|
|
194
|
+
│ ├── claimed/{insId}-task-NNNNN [EPHEMERAL] ← atomic lock
|
|
195
|
+
│ └── completed/task-NNNNN [PERSISTENT]
|
|
196
|
+
└── messages/{instanceId}/msg-NNNNN [PERSISTENT_SEQUENTIAL]
|
|
224
197
|
```
|
|
225
198
|
|
|
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
199
|
---
|
|
229
200
|
|
|
230
|
-
##
|
|
201
|
+
## Why ZooKeeper?
|
|
231
202
|
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
203
|
+
| Concern | ZooKeeper answer |
|
|
204
|
+
|---------|-----------------|
|
|
205
|
+
| Instance lifecycle | Ephemeral nodes → auto-cleanup on crash |
|
|
206
|
+
| Task ordering | Sequential nodes → guaranteed FIFO |
|
|
207
|
+
| Claim atomicity | `create(path, ephemeral=true)` is atomic — only one winner |
|
|
208
|
+
| Leader election | `/leader` EPHEMERAL → exactly one Leader |
|
|
209
|
+
| Change notification | Built-in watches → push, not poll |
|
|
210
|
+
| Dependencies | One dependency (ZK). No database, no HTTP server. |
|
|
211
|
+
|
|
212
|
+
---
|
|
238
213
|
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
|
242
|
-
|
|
243
|
-
| `
|
|
244
|
-
| `
|
|
245
|
-
| `
|
|
246
|
-
| `
|
|
214
|
+
## Roles
|
|
215
|
+
|
|
216
|
+
| Role | Value | Typical behavior |
|
|
217
|
+
|------|-------|-----------------|
|
|
218
|
+
| Leader | `leader` | Runs TUI, mechanical routing, merge validation, orphan recovery |
|
|
219
|
+
| Planner | `planner` | Decomposes requirements, defines blueprints |
|
|
220
|
+
| Builder | `builder` | Implements per blueprint, produces traceability evidence |
|
|
221
|
+
| Verifier | `verifier` | Cross-checks Builder output against Plan |
|
|
222
|
+
| Reviewer | `reviewer` | Quality gate for design consistency across full chain |
|
|
223
|
+
| Accepter | `accepter` | Final Go/No-Go validation against business criteria |
|
|
247
224
|
|
|
248
225
|
---
|
|
249
226
|
|
|
@@ -253,7 +230,7 @@ claimed → pending (Worker disconnect, Leader recovers orphan)
|
|
|
253
230
|
|
|
254
231
|
- Node.js 18+
|
|
255
232
|
- Docker (for ZooKeeper)
|
|
256
|
-
- Claude Code CLI (for
|
|
233
|
+
- Claude Code CLI (for Worker message processing)
|
|
257
234
|
|
|
258
235
|
### From Source
|
|
259
236
|
|
|
@@ -261,166 +238,107 @@ claimed → pending (Worker disconnect, Leader recovers orphan)
|
|
|
261
238
|
git clone https://github.com/adamancyzhang/claude-orchestrator-server.git
|
|
262
239
|
cd claude-orchestrator-server
|
|
263
240
|
|
|
264
|
-
# Install dependencies
|
|
265
241
|
npm install
|
|
266
|
-
|
|
267
|
-
# Start ZooKeeper
|
|
268
242
|
docker-compose up -d
|
|
269
|
-
|
|
270
|
-
# Build TypeScript
|
|
271
243
|
npm run build
|
|
272
244
|
|
|
273
|
-
# Start
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
# Or use the CLI directly
|
|
277
|
-
claude-orchestrator config
|
|
245
|
+
# Start with 3 Workers
|
|
246
|
+
node dist/index.js run --worker 3
|
|
278
247
|
```
|
|
279
248
|
|
|
280
249
|
### Run Tests
|
|
281
250
|
|
|
282
251
|
```bash
|
|
283
|
-
npm test
|
|
252
|
+
npm test # All unit tests (110+)
|
|
253
|
+
npm run test:watch # Watch mode
|
|
254
|
+
npx vitest run tests/unit/worker-prompt-rendering.test.ts # Prompt rendering verification
|
|
284
255
|
```
|
|
285
256
|
|
|
286
257
|
---
|
|
287
258
|
|
|
288
|
-
## Skills for Claude Code
|
|
289
|
-
|
|
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/`.
|
|
291
|
-
|
|
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 |
|
|
302
|
-
|
|
303
|
-
---
|
|
304
|
-
|
|
305
|
-
## Why ZooKeeper?
|
|
306
|
-
|
|
307
|
-
| Concern | ZooKeeper answer |
|
|
308
|
-
|---------|-----------------|
|
|
309
|
-
| Instance lifecycle | Ephemeral nodes → auto-cleanup. No heartbeat polling needed. |
|
|
310
|
-
| Task ordering | Sequential nodes → guaranteed FIFO. No race conditions. |
|
|
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. |
|
|
313
|
-
| Change notification | Built-in watches → push, not poll. |
|
|
314
|
-
| Dependencies | One dependency (ZK). No external database, no HTTP server. |
|
|
315
|
-
|
|
316
|
-
Zero external database. All state lives in ZooKeeper.
|
|
317
|
-
|
|
318
|
-
---
|
|
319
|
-
|
|
320
|
-
## Roles
|
|
321
|
-
|
|
322
|
-
| Role | Value | Typical behavior |
|
|
323
|
-
|------|-------|-----------------|
|
|
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 |
|
|
330
|
-
|
|
331
|
-
---
|
|
332
|
-
|
|
333
|
-
## Configuration Reference
|
|
334
|
-
|
|
335
|
-
| Config | Where | Default |
|
|
336
|
-
|--------|-------|---------|
|
|
337
|
-
| ZK hosts | `-z, --zookeeper` flag or `ZK_HOSTS` env | `127.0.0.1:2181` |
|
|
338
|
-
| Instance ID | `-i, --instance-id` flag or `.claude-orchestrator/config.json` (project) / `~/.claude-orchestrator/config.json` (global) | auto-saved after `register` |
|
|
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` |
|
|
341
|
-
|
|
342
|
-
---
|
|
343
|
-
|
|
344
259
|
## Project Structure
|
|
345
260
|
|
|
346
261
|
```
|
|
347
262
|
├── src/
|
|
348
|
-
│ ├── index.ts
|
|
349
|
-
│ ├── config.ts
|
|
350
|
-
│ ├──
|
|
351
|
-
│ │ └──
|
|
352
|
-
│ ├── leader/
|
|
353
|
-
│ │ ├── index.ts
|
|
354
|
-
│ │ ├── tui.ts
|
|
355
|
-
│ │ ├── event-bus.ts
|
|
356
|
-
│ │ ├── state.ts
|
|
357
|
-
│ │ ├── monitor.ts
|
|
358
|
-
│ │ ├── orchestrator.ts
|
|
359
|
-
│ │ ├── recovery.ts
|
|
360
|
-
│ │ ├── watcher.ts
|
|
361
|
-
│ │
|
|
362
|
-
│
|
|
363
|
-
│
|
|
364
|
-
│ │
|
|
365
|
-
│ ├──
|
|
366
|
-
│ │ ├──
|
|
367
|
-
│ │
|
|
368
|
-
│ ├──
|
|
369
|
-
│ │
|
|
370
|
-
│
|
|
371
|
-
│ │ ├──
|
|
372
|
-
│ │
|
|
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)
|
|
263
|
+
│ ├── index.ts # CLI entry point (commander)
|
|
264
|
+
│ ├── config.ts # Configuration layering (global + project)
|
|
265
|
+
│ ├── orchestrator/
|
|
266
|
+
│ │ └── run.ts # Unified run orchestrator (5-phase startup)
|
|
267
|
+
│ ├── leader/ # Leader node
|
|
268
|
+
│ │ ├── index.ts # Startup / shutdown orchestration
|
|
269
|
+
│ │ ├── tui.ts # ANSI TUI with Worker Messages panel
|
|
270
|
+
│ │ ├── event-bus.ts # Typed EventEmitter (15 events)
|
|
271
|
+
│ │ ├── state.ts # Centralized LeaderState
|
|
272
|
+
│ │ ├── monitor.ts # WorkerMonitor — join/leave detection
|
|
273
|
+
│ │ ├── orchestrator.ts # TaskOrchestrator — lifecycle tracking
|
|
274
|
+
│ │ ├── recovery.ts # TaskRecovery — orphan recovery (max 3 retries)
|
|
275
|
+
│ │ ├── watcher.ts # LeaderWatcher — message processing
|
|
276
|
+
│ │ ├── chain-router.ts # ChainRouter — mechanical routing (no AI)
|
|
277
|
+
│ │ └── merge-validator.ts # Cross-verify + merge worker branches
|
|
278
|
+
│ ├── worker/ # Worker node
|
|
279
|
+
│ │ ├── worktree-initializer.ts# Name generation, worktree creation, role assignment
|
|
280
|
+
│ │ ├── child.ts # Child process entry point
|
|
281
|
+
│ │ ├── child-runner.ts # Child process core (chdir → ZK → Watcher)
|
|
282
|
+
│ │ ├── watcher.ts # WorkerWatcher — ZK watch loop + orchestration
|
|
283
|
+
│ │ ├── evaluator.ts # SelfEvaluator — built-in self-evaluation (max 3 retries)
|
|
284
|
+
│ │ └── commit-checker.ts # Auto-commit after task completion
|
|
285
|
+
│ ├── executor/ # Template execution engine
|
|
286
|
+
│ │ ├── template.ts # TemplateEngine — loading + identity card + rendering
|
|
287
|
+
│ │ └── runner.ts # ClaudeRunner — CLI execution wrapper
|
|
376
288
|
│ ├── zk/
|
|
377
|
-
│ │ ├── client.ts
|
|
378
|
-
│ │
|
|
379
|
-
│ │ └── watcher.ts # ZK watch manager
|
|
289
|
+
│ │ ├── client.ts # ZooKeeper connection management
|
|
290
|
+
│ │ └── paths.ts # ZK path constants
|
|
380
291
|
│ ├── modules/
|
|
381
|
-
│ │ ├── registry.ts
|
|
382
|
-
│ │ ├── task-queue.ts
|
|
383
|
-
│ │
|
|
384
|
-
│ │ └── context-store.ts # Shared key-value store
|
|
292
|
+
│ │ ├── registry.ts # Instance registry
|
|
293
|
+
│ │ ├── task-queue.ts # Task queue (push/claim/complete/block/fail/retry)
|
|
294
|
+
│ │ └── message-router.ts # Message routing + template rendering
|
|
385
295
|
│ ├── models/
|
|
386
|
-
│ │ └── schemas.ts
|
|
296
|
+
│ │ └── schemas.ts # Zod schemas (Instance, Task, Message, ChainDef, EvalDecision)
|
|
387
297
|
│ └── utils/
|
|
388
|
-
│ ├── exec.ts
|
|
389
|
-
│
|
|
390
|
-
|
|
391
|
-
├──
|
|
392
|
-
│ └── claude-
|
|
393
|
-
├──
|
|
394
|
-
│ ├──
|
|
395
|
-
│ ├──
|
|
396
|
-
│ ├──
|
|
397
|
-
│ ├──
|
|
398
|
-
│
|
|
399
|
-
├──
|
|
400
|
-
│ ├──
|
|
401
|
-
│
|
|
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
|
|
298
|
+
│ ├── exec.ts # Shell execution (execWithTee)
|
|
299
|
+
│ └── logger.ts # Tagged logger (+ --debug mode)
|
|
300
|
+
├── templates/ # Prompt and memory templates (v0.4)
|
|
301
|
+
│ ├── agents/ # 7 Worker prompt templates
|
|
302
|
+
│ └── claude-memory/ # 6 CLAUDE.md directory memory templates
|
|
303
|
+
├── skills/ # Claude Code skills (8 total)
|
|
304
|
+
│ ├── task-traceability/ # Foundation layer
|
|
305
|
+
│ ├── task-planning/ # Planner skill
|
|
306
|
+
│ ├── task-execution/ # Builder skill
|
|
307
|
+
│ ├── task-verification/ # Verifier skill
|
|
308
|
+
│ ├── task-review/ # Reviewer skill
|
|
309
|
+
│ ├── task-acceptance/ # Accepter skill
|
|
310
|
+
│ ├── claude-orchestrator/ # CLI reference
|
|
311
|
+
│ └── claude-code-developer/ # Claude Code developer reference
|
|
408
312
|
├── docs/
|
|
409
|
-
│ ├── v0.
|
|
410
|
-
│ ├── v0.
|
|
411
|
-
│
|
|
412
|
-
│
|
|
413
|
-
│ └──
|
|
313
|
+
│ ├── v0.4/
|
|
314
|
+
│ │ ├── design.md # v0.4 full design document
|
|
315
|
+
│ │ ├── CLAUDE.md # v0.4 changelog summary
|
|
316
|
+
│ │ └── worker-init/
|
|
317
|
+
│ │ └── design.md # Worker initialization + directory memory design
|
|
318
|
+
│ └── v0.3/ # Archived v0.3 docs
|
|
414
319
|
├── tests/
|
|
415
|
-
│ ├── unit/
|
|
416
|
-
│ └──
|
|
417
|
-
|
|
418
|
-
├──
|
|
419
|
-
|
|
320
|
+
│ ├── unit/ # 11 test files, 110+ tests
|
|
321
|
+
│ │ └── worker-prompt-rendering.test.ts # Prompt variable substitution verification
|
|
322
|
+
│ └── integration/ # Leader-Worker integration tests
|
|
323
|
+
├── examples-workspace/ # Reference implementation of multi-agent patterns
|
|
324
|
+
├── docker-compose.yml # ZooKeeper
|
|
325
|
+
├── package.json
|
|
326
|
+
└── tsconfig.json
|
|
420
327
|
```
|
|
421
328
|
|
|
422
329
|
---
|
|
423
330
|
|
|
331
|
+
## Configuration Reference
|
|
332
|
+
|
|
333
|
+
| Config | Where | Default |
|
|
334
|
+
|--------|-------|---------|
|
|
335
|
+
| ZK hosts | `-z, --zookeeper` flag or `ZK_HOSTS` env | `127.0.0.1:2181` |
|
|
336
|
+
| Instance ID | Auto-generated per Worker | saved to `.claude-orchestrator/config.json` |
|
|
337
|
+
| Claude command | `config.json` → `commands.claude-cli` | `claude --dangerously-skip-permissions --permission-mode dontAsk` |
|
|
338
|
+
| Cache directory | `config.json` → `cache_dir` | `~/.claude-orchestrator/sessions` |
|
|
339
|
+
|
|
340
|
+
---
|
|
341
|
+
|
|
424
342
|
## License
|
|
425
343
|
|
|
426
344
|
MIT — use it, fork it, ship it.
|
package/dist/cli/commands.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
export declare function cmdRegister(zkHosts: string, debug?: boolean): Promise<void>;
|
|
2
1
|
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>;
|
|
3
2
|
export declare function cmdClaimTask(zkHosts: string, cliInstanceId: string | undefined): Promise<void>;
|
|
4
3
|
export declare function cmdCompleteTask(zkHosts: string, cliInstanceId: string | undefined, taskId: string, result: string): Promise<void>;
|
|
@@ -7,15 +6,6 @@ export declare function cmdSendMessage(zkHosts: string, cliInstanceId: string |
|
|
|
7
6
|
export declare function cmdPollMessage(zkHosts: string, cliInstanceId: string | undefined): Promise<void>;
|
|
8
7
|
export declare function cmdDeleteMessage(zkHosts: string, cliInstanceId: string | undefined, messageId: string): Promise<void>;
|
|
9
8
|
export declare function cmdUnregister(zkHosts: string, cliInstanceId: string | undefined): Promise<void>;
|
|
10
|
-
export declare function cmdSetup(options: {
|
|
11
|
-
leader: boolean;
|
|
12
|
-
name?: string;
|
|
13
|
-
role?: string;
|
|
14
|
-
cacheDir?: string;
|
|
15
|
-
command?: string;
|
|
16
|
-
global: boolean;
|
|
17
|
-
instanceId?: string;
|
|
18
|
-
}): Promise<void>;
|
|
19
9
|
export declare function cmdTaskBlock(zkHosts: string, cliInstanceId: string | undefined, taskId: string, reason: string): Promise<void>;
|
|
20
10
|
export declare function cmdTaskFail(zkHosts: string, cliInstanceId: string | undefined, taskId: string, reason: string): Promise<void>;
|
|
21
11
|
export declare function cmdTaskRetry(zkHosts: string, _cliInstanceId: string | undefined, taskId: string): Promise<void>;
|