multi-agents-cli 1.0.35 → 1.0.37
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 +85 -96
- package/init.js +7 -7
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
# Multi Agents
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A structured workflow tool that orchestrates multiple Claude Code agents working in parallel - each isolated in its own git worktree, owning a specific scope of the codebase.
|
|
4
|
+
|
|
5
|
+
Instead of one agent doing everything in a single bloated session, each agent stays focused, token-efficient, and conflict-free. Shared state files keep them coordinated without manual intervention.
|
|
6
|
+
|
|
7
|
+
**The result:** faster builds, lower token spend, and a clean git history - without sacrificing reliability or context.
|
|
4
8
|
|
|
5
9
|
---
|
|
6
10
|
|
|
@@ -31,29 +35,39 @@ npm run agent
|
|
|
31
35
|
|
|
32
36
|
---
|
|
33
37
|
|
|
38
|
+
## Commands
|
|
39
|
+
|
|
40
|
+
| Command | Purpose |
|
|
41
|
+
|---------|---------|
|
|
42
|
+
| `npm run init` | Re-run initialization or restart a process |
|
|
43
|
+
| `npm run agent` | Start a new task with an agent |
|
|
44
|
+
| `npm run complete` | Agent finished - merge and move on |
|
|
45
|
+
|
|
46
|
+
All three commands self-relocate to the repo root via `git rev-parse --git-common-dir`. Run them from the worktree terminal, the repo root, or anywhere inside the git tree.
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
34
50
|
## Workflow
|
|
35
51
|
|
|
36
|
-
### 1.
|
|
52
|
+
### 1. Start a task
|
|
37
53
|
|
|
38
54
|
```bash
|
|
39
55
|
npm run agent
|
|
40
56
|
```
|
|
41
57
|
|
|
42
|
-
Select scope
|
|
43
|
-
workspace opens in your IDE automatically.
|
|
58
|
+
Select scope (client/backend/shared) then agent then describe the task.
|
|
59
|
+
The workspace opens in your IDE automatically.
|
|
44
60
|
|
|
45
61
|
The agent reads `TASK.md` and executes autonomously.
|
|
46
62
|
|
|
47
63
|
### 2. Agent completes the task
|
|
48
64
|
|
|
49
65
|
The agent commits its work and runs `npm run complete` autonomously.
|
|
50
|
-
This merges the branch into main, updates `BUILD_STATE.md`, and clears
|
|
51
|
-
the tracking slot.
|
|
66
|
+
This merges the branch into main, updates `BUILD_STATE.md`, and clears the tracking slot.
|
|
52
67
|
|
|
53
68
|
### 3. Repeat
|
|
54
69
|
|
|
55
|
-
`npm run complete` chains back to `npm run agent`. Pick the next agent
|
|
56
|
-
and continue building.
|
|
70
|
+
`npm run complete` chains back to `npm run agent`. Pick the next agent and continue building.
|
|
57
71
|
|
|
58
72
|
---
|
|
59
73
|
|
|
@@ -62,31 +76,24 @@ and continue building.
|
|
|
62
76
|
Choose during `multi-agents init`:
|
|
63
77
|
|
|
64
78
|
**Multi-Agent Driven Orchestration** *(recommended)*
|
|
65
|
-
Every task
|
|
66
|
-
|
|
67
|
-
`npm run complete`. Faster builds and lower token spend than a single long session.
|
|
68
|
-
⚠ If you commit directly to main yourself, you bypass the framework and break
|
|
69
|
-
task tracking for any active agent branches.
|
|
79
|
+
Every task starts with `npm run agent`. Each agent works in its own git worktree - an isolated branch and folder that merges back into main via `npm run complete`. Faster builds and lower token spend than a single long session.
|
|
80
|
+
If you commit directly to main yourself, you bypass the framework and break task tracking for any active agent branches.
|
|
70
81
|
|
|
71
82
|
**Shared Orchestration**
|
|
72
|
-
You and agents co-build
|
|
73
|
-
|
|
74
|
-
boundaries before work begins.
|
|
75
|
-
⚠ If you and an agent touch the same file, expect merge conflicts.
|
|
83
|
+
You and agents co-build - each owning a defined part of the codebase. Agent tasks run in git worktrees; your work happens directly in the project. Define boundaries before work begins.
|
|
84
|
+
If you and an agent touch the same file, expect merge conflicts.
|
|
76
85
|
|
|
77
86
|
---
|
|
78
87
|
|
|
79
88
|
## Supported Frameworks
|
|
80
89
|
|
|
81
90
|
### Client
|
|
82
|
-
Next.js
|
|
91
|
+
Next.js - Angular - Vue/Nuxt - SvelteKit - Vite+React - Remix
|
|
83
92
|
|
|
84
93
|
### Backend (separate)
|
|
85
|
-
Express
|
|
94
|
+
Express - NestJS - Fastify - FastAPI - Django
|
|
86
95
|
|
|
87
|
-
Each framework has a dedicated scaffold instruction file in
|
|
88
|
-
`client/frameworks/` and `backend/frameworks/` — agents read these
|
|
89
|
-
before scaffolding to ensure files land in the correct location.
|
|
96
|
+
Each framework has a dedicated scaffold instruction file in `.frameworks/client/` and `.frameworks/backend/` - agents read these before scaffolding to ensure files land in the correct location.
|
|
90
97
|
|
|
91
98
|
---
|
|
92
99
|
|
|
@@ -96,24 +103,24 @@ before scaffolding to ensure files land in the correct location.
|
|
|
96
103
|
|
|
97
104
|
| Agent | Default task | Requires |
|
|
98
105
|
|-------|-------------|---------|
|
|
99
|
-
| `UI` | Scaffolds full project structure |
|
|
100
|
-
| `LOGIC` | State management, API integration, hooks | UI
|
|
101
|
-
| `FORMS` | Form components, validation, submission | UI
|
|
102
|
-
| `ROUTING` | Page routing, navigation, URL structure | UI
|
|
103
|
-
| `TESTING` | Unit and integration tests | UI
|
|
104
|
-
| `ACCESSIBILITY` | a11y compliance, keyboard navigation | UI
|
|
106
|
+
| `UI` | Scaffolds full project structure | - |
|
|
107
|
+
| `LOGIC` | State management, API integration, hooks | UI done |
|
|
108
|
+
| `FORMS` | Form components, validation, submission | UI done |
|
|
109
|
+
| `ROUTING` | Page routing, navigation, URL structure | UI done |
|
|
110
|
+
| `TESTING` | Unit and integration tests | UI done |
|
|
111
|
+
| `ACCESSIBILITY` | a11y compliance, keyboard navigation | UI done |
|
|
105
112
|
|
|
106
113
|
### Backend (separate only)
|
|
107
114
|
|
|
108
115
|
| Agent | Default task | Requires |
|
|
109
116
|
|-------|-------------|---------|
|
|
110
|
-
| `API` | REST/GraphQL endpoints
|
|
111
|
-
| `LOGIC` | Business logic, services, data processing | API
|
|
112
|
-
| `AUTH` | Authentication, authorization, sessions | API
|
|
113
|
-
| `DB` | Database schemas, migrations, queries |
|
|
114
|
-
| `EVENTS` | Event queues, pub/sub, webhooks | API
|
|
115
|
-
| `JOBS` | Background jobs, scheduled tasks | API
|
|
116
|
-
| `TESTING` | API and integration tests | API
|
|
117
|
+
| `API` | REST/GraphQL endpoints - start here | - |
|
|
118
|
+
| `LOGIC` | Business logic, services, data processing | API done |
|
|
119
|
+
| `AUTH` | Authentication, authorization, sessions | API done |
|
|
120
|
+
| `DB` | Database schemas, migrations, queries | - |
|
|
121
|
+
| `EVENTS` | Event queues, pub/sub, webhooks | API done |
|
|
122
|
+
| `JOBS` | Background jobs, scheduled tasks | API done |
|
|
123
|
+
| `TESTING` | API and integration tests | API done |
|
|
117
124
|
|
|
118
125
|
### Shared
|
|
119
126
|
|
|
@@ -121,8 +128,7 @@ before scaffolding to ensure files land in the correct location.
|
|
|
121
128
|
|-------|-------------|
|
|
122
129
|
| `SECURITY` | Shared auth utilities, encryption, validation |
|
|
123
130
|
|
|
124
|
-
|
|
125
|
-
> the correct next agent dynamically based on what's already completed.
|
|
131
|
+
Start with UI (client) or API (backend). The launcher recommends the correct next agent dynamically based on what is already completed.
|
|
126
132
|
|
|
127
133
|
---
|
|
128
134
|
|
|
@@ -136,20 +142,18 @@ npm install
|
|
|
136
142
|
npm run dev
|
|
137
143
|
```
|
|
138
144
|
|
|
139
|
-
For deployment
|
|
140
|
-
`client/` — not the repo root.
|
|
145
|
+
For deployment set the root directory to `client/` - not the repo root.
|
|
141
146
|
|
|
142
147
|
---
|
|
143
148
|
|
|
144
149
|
## Remote Setup
|
|
145
150
|
|
|
146
|
-
`multi-agents init` does
|
|
147
|
-
session handles remote setup automatically:
|
|
151
|
+
`multi-agents init` does not configure a GitHub remote. The first agent session handles remote setup automatically:
|
|
148
152
|
|
|
149
153
|
1. Checks SSH, gh CLI, and HTTPS credentials in order
|
|
150
|
-
2. If a remote repo exists
|
|
154
|
+
2. If a remote repo exists - evaluates its state (orphaned branches, completion status, age)
|
|
151
155
|
3. Auto-clears old sessions or surfaces a decision when unfinished work is detected
|
|
152
|
-
4. If no remote
|
|
156
|
+
4. If no remote - opens your browser to `github.com/new` with the repo name pre-filled
|
|
153
157
|
|
|
154
158
|
No manual `git remote add` needed.
|
|
155
159
|
|
|
@@ -159,16 +163,15 @@ No manual `git remote add` needed.
|
|
|
159
163
|
|
|
160
164
|
| File | Purpose |
|
|
161
165
|
|------|---------|
|
|
162
|
-
| `CLAUDE.md` | Global coordination rules
|
|
163
|
-
| `BUILD_STATE.md` | Living project state
|
|
164
|
-
| `CONTRACTS.md` | Shared types and interfaces
|
|
165
|
-
| `TASK.md` | Per-task instructions
|
|
166
|
+
| `CLAUDE.md` | Global coordination rules - every agent reads this first |
|
|
167
|
+
| `BUILD_STATE.md` | Living project state - what is built, what is next |
|
|
168
|
+
| `CONTRACTS.md` | Shared types and interfaces - single source of truth |
|
|
169
|
+
| `TASK.md` | Per-task instructions - lives in the agent worktree |
|
|
166
170
|
| `.scaffold/.config.json` | Project config written at init time |
|
|
167
|
-
| `.scaffold/.tracking.json` | Active agent state
|
|
168
|
-
| `.scaffold/.paths.json` | Expected and actual framework paths
|
|
171
|
+
| `.scaffold/.tracking.json` | Active agent state - managed by workflow scripts |
|
|
172
|
+
| `.scaffold/.paths.json` | Expected and actual framework paths - updated by agents after scaffolding |
|
|
169
173
|
|
|
170
|
-
|
|
171
|
-
> updates to it. Editing it in a worktree causes merge conflicts.
|
|
174
|
+
Never edit `BUILD_STATE.md` directly. `npm run complete` owns all updates to it. Editing it in a worktree causes merge conflicts.
|
|
172
175
|
|
|
173
176
|
---
|
|
174
177
|
|
|
@@ -177,19 +180,18 @@ No manual `git remote add` needed.
|
|
|
177
180
|
Context loads in this order for every agent:
|
|
178
181
|
|
|
179
182
|
```
|
|
180
|
-
Root CLAUDE.md
|
|
181
|
-
|
|
182
|
-
client/CLAUDE.md
|
|
183
|
-
|
|
184
|
-
client/
|
|
185
|
-
|
|
186
|
-
agents/UI.md
|
|
187
|
-
|
|
188
|
-
TASK.md
|
|
183
|
+
Root CLAUDE.md <- global rules, protocols, tracking schema
|
|
184
|
+
|
|
|
185
|
+
client/CLAUDE.md <- stack config, framework scaffold instructions
|
|
186
|
+
|
|
|
187
|
+
.frameworks/client/{fw}.md <- exact scaffold commands and path conventions
|
|
188
|
+
|
|
|
189
|
+
.agents/client/UI.md <- agent-specific behavior and constraints
|
|
190
|
+
|
|
|
191
|
+
TASK.md <- the specific task to execute
|
|
189
192
|
```
|
|
190
193
|
|
|
191
|
-
Each layer narrows scope. Agents never need to be told what framework
|
|
192
|
-
or language to use — it's resolved from config automatically.
|
|
194
|
+
Each layer narrows scope. Agents never need to be told what framework or language to use - it is resolved from config automatically.
|
|
193
195
|
|
|
194
196
|
---
|
|
195
197
|
|
|
@@ -197,11 +199,11 @@ or language to use — it's resolved from config automatically.
|
|
|
197
199
|
|
|
198
200
|
The launcher enforces structural rules before any worktree is created:
|
|
199
201
|
|
|
200
|
-
- **Skeleton guard**
|
|
201
|
-
- **Prerequisite check**
|
|
202
|
-
- **Active agent gate**
|
|
203
|
-
- **MISSING gate**
|
|
204
|
-
- **Coexistence check**
|
|
202
|
+
- **Skeleton guard** - LOGIC/FORMS/ROUTING/TESTING require UI completed first
|
|
203
|
+
- **Prerequisite check** - surfaces unmet dependencies, lets you proceed or repick
|
|
204
|
+
- **Active agent gate** - if the same agent is already running, offers Continue / Complete / Abandon / Pick again
|
|
205
|
+
- **MISSING gate** - if a worktree was deleted without completing, mandatory Recover or Reset decision
|
|
206
|
+
- **Coexistence check** - if recovering, surfaces file conflicts and divergence before restoring
|
|
205
207
|
|
|
206
208
|
---
|
|
207
209
|
|
|
@@ -223,7 +225,7 @@ The launcher enforces structural rules before any worktree is created:
|
|
|
223
225
|
}
|
|
224
226
|
```
|
|
225
227
|
|
|
226
|
-
**Status values:** `null` (never launched)
|
|
228
|
+
**Status values:** `null` (never launched) - `ACTIVE` (running) - `MISSING` (worktree deleted without completing)
|
|
227
229
|
|
|
228
230
|
Managed entirely by `agent.js` and `complete.js`. Never edit manually.
|
|
229
231
|
|
|
@@ -245,46 +247,33 @@ Managed entirely by `agent.js` and `complete.js`. Never edit manually.
|
|
|
245
247
|
}
|
|
246
248
|
```
|
|
247
249
|
|
|
248
|
-
**Status values:** `pending` (not yet scaffolded)
|
|
250
|
+
**Status values:** `pending` (not yet scaffolded) - `verified` (agent confirmed path) - `diverged` (actual path differs from expected)
|
|
249
251
|
|
|
250
252
|
Written at init time. Updated by agents after scaffolding their framework.
|
|
251
253
|
|
|
252
254
|
---
|
|
253
255
|
|
|
254
|
-
## Running Commands From Anywhere
|
|
255
|
-
|
|
256
|
-
`npm run agent` and `npm run complete` self-relocate to the repo root
|
|
257
|
-
via `git rev-parse --git-common-dir`. Run them from the worktree terminal,
|
|
258
|
-
the repo root, or anywhere inside the git tree — they always work.
|
|
259
|
-
|
|
260
|
-
---
|
|
261
|
-
|
|
262
256
|
## Architecture
|
|
263
257
|
|
|
264
258
|
```
|
|
265
259
|
my-project/
|
|
266
|
-
├──
|
|
267
|
-
│ ├──
|
|
268
|
-
│
|
|
269
|
-
|
|
270
|
-
|
|
260
|
+
├── .agents/ <- agent instruction files
|
|
261
|
+
│ ├── client/ <- UI.md, LOGIC.md, FORMS.md ...
|
|
262
|
+
│ ├── backend/ <- API.md, DB.md, AUTH.md ...
|
|
263
|
+
│ └── shared/ <- SECURITY.md
|
|
264
|
+
├── .frameworks/ <- framework scaffold instructions
|
|
265
|
+
│ ├── client/ <- nextjs.md, angular.md ...
|
|
266
|
+
│ └── backend/ <- express.md, fastapi.md ...
|
|
267
|
+
├── .workflow/ <- workflow scripts (agent.js, complete.js, guards.js)
|
|
268
|
+
├── .scaffold/ <- runtime state (config, tracking, paths, lock)
|
|
269
|
+
├── client/ <- built by client agents
|
|
270
|
+
├── backend/ <- built by backend agents (if separate)
|
|
271
271
|
├── shared/
|
|
272
|
-
├── worktrees/
|
|
273
|
-
│ └── client-my-project-ui-1780403456467/
|
|
272
|
+
├── worktrees/ <- local only, gitignored
|
|
274
273
|
├── CLAUDE.md
|
|
275
274
|
├── BUILD_STATE.md
|
|
276
|
-
|
|
277
|
-
├── .scaffold/
|
|
278
|
-
│ ├── .config.json
|
|
279
|
-
│ ├── .tracking.json
|
|
280
|
-
│ ├── .paths.json
|
|
281
|
-
│ └── .initialized
|
|
282
|
-
└── .workflow/
|
|
283
|
-
├── agent.js
|
|
284
|
-
├── complete.js
|
|
285
|
-
└── guards.js
|
|
275
|
+
└── CONTRACTS.md
|
|
286
276
|
```
|
|
287
277
|
|
|
288
278
|
Each agent works in its own `worktrees/` folder on a dedicated branch.
|
|
289
|
-
On completion, its work merges into `main`. The final `main` branch is
|
|
290
|
-
a complete, runnable application.
|
|
279
|
+
On completion, its work merges into `main`. The final `main` branch is a complete, runnable application.
|
package/init.js
CHANGED
|
@@ -683,8 +683,8 @@ const main = async () => {
|
|
|
683
683
|
}
|
|
684
684
|
|
|
685
685
|
if (active.length === 0) {
|
|
686
|
-
console.log(yellow('\n No active processes found.\n'));
|
|
687
|
-
return
|
|
686
|
+
console.log(yellow('\n No active processes found. Nothing to restart.\n'));
|
|
687
|
+
return 'empty';
|
|
688
688
|
}
|
|
689
689
|
|
|
690
690
|
separator();
|
|
@@ -702,7 +702,7 @@ const main = async () => {
|
|
|
702
702
|
],
|
|
703
703
|
}, { onCancel: () => process.exit(0) });
|
|
704
704
|
|
|
705
|
-
if (!pickRes.value || pickRes.value === '__back__') return
|
|
705
|
+
if (!pickRes.value || pickRes.value === '__back__') return 'back';
|
|
706
706
|
const idx = active.findIndex(a => a.agent === pickRes.value);
|
|
707
707
|
if (idx < 0) return false;
|
|
708
708
|
const { scope, agent, data } = active[idx];
|
|
@@ -748,7 +748,7 @@ const main = async () => {
|
|
|
748
748
|
|
|
749
749
|
if (confirmRes.value !== 'y') {
|
|
750
750
|
console.log(dim('\n Cancelled.\n'));
|
|
751
|
-
return
|
|
751
|
+
return 'back';
|
|
752
752
|
}
|
|
753
753
|
|
|
754
754
|
// Perform wipe
|
|
@@ -765,7 +765,7 @@ const main = async () => {
|
|
|
765
765
|
|
|
766
766
|
fs.writeFileSync(trackingPath, JSON.stringify(tracking, null, 2), 'utf8');
|
|
767
767
|
console.log(`\n ${green('✓')} Restart complete.\n`);
|
|
768
|
-
return
|
|
768
|
+
return 'done';
|
|
769
769
|
};
|
|
770
770
|
|
|
771
771
|
if (prompts && process.stdin.isTTY) {
|
|
@@ -791,8 +791,8 @@ const main = async () => {
|
|
|
791
791
|
child.on('exit', (code) => process.exit(code));
|
|
792
792
|
return;
|
|
793
793
|
} else if (res.value === '2') {
|
|
794
|
-
const
|
|
795
|
-
if (
|
|
794
|
+
const restartResult = await showRestartProcess();
|
|
795
|
+
if (restartResult === 'back') continue; // Back — show menu again
|
|
796
796
|
lockLoop = false;
|
|
797
797
|
return;
|
|
798
798
|
} else {
|
package/package.json
CHANGED