agents-task-assigning 0.1.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 +311 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1672 -0
- package/dist/index.js.map +1 -0
- package/package.json +45 -0
package/README.md
ADDED
|
@@ -0,0 +1,311 @@
|
|
|
1
|
+
# agents-task-assigning
|
|
2
|
+
|
|
3
|
+
MCP Server for multi-agent task assignment and coordination. Enables multiple Claude Code agents to work in parallel on the same project — each in its own git worktree, with DAG-based dependency tracking and file conflict prevention.
|
|
4
|
+
|
|
5
|
+
## How It Works
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
Coordinator (main branch)
|
|
9
|
+
│
|
|
10
|
+
├─ create_tasks ──► SQLite DB (.tasks/tasks.db)
|
|
11
|
+
│ │
|
|
12
|
+
│ ┌───────────────────┼───────────────────┐
|
|
13
|
+
│ ▼ ▼ ▼
|
|
14
|
+
│ Agent #1 Agent #2 Agent #3
|
|
15
|
+
│ claim → start claim → start claim → start
|
|
16
|
+
│ .worktrees/task-1 .worktrees/task-2 .worktrees/task-3
|
|
17
|
+
│ task/task-1-* task/task-2-* task/task-3-*
|
|
18
|
+
│ │ │ │
|
|
19
|
+
│ ▼ ▼ ▼
|
|
20
|
+
│ complete complete complete
|
|
21
|
+
│ │ │ │
|
|
22
|
+
└────┴───── merge ◄──────┴───────────────────┘
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
1. **Coordinator** splits work into a task group with dependencies and file ownership
|
|
26
|
+
2. **Agents** in separate sessions claim, start, and work on tasks — each in an isolated git worktree
|
|
27
|
+
3. **Coordinator** merges completed branches back, with automatic conflict detection
|
|
28
|
+
|
|
29
|
+
## Quick Start
|
|
30
|
+
|
|
31
|
+
Add to your project's `.mcp.json`:
|
|
32
|
+
|
|
33
|
+
```json
|
|
34
|
+
{
|
|
35
|
+
"mcpServers": {
|
|
36
|
+
"task-assigner": {
|
|
37
|
+
"command": "npx",
|
|
38
|
+
"args": ["-y", "agents-task-assigning"]
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Or install globally:
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
npm install -g agents-task-assigning
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## MCP Tools
|
|
51
|
+
|
|
52
|
+
### Task Management
|
|
53
|
+
|
|
54
|
+
#### `create_tasks`
|
|
55
|
+
|
|
56
|
+
Create a task group with dependencies and file ownership rules.
|
|
57
|
+
|
|
58
|
+
```json
|
|
59
|
+
{
|
|
60
|
+
"group_title": "Blog System",
|
|
61
|
+
"group_description": "Build a full blog with auth",
|
|
62
|
+
"tasks": [
|
|
63
|
+
{
|
|
64
|
+
"title": "DB Schema",
|
|
65
|
+
"description": "Create database schema and migrations",
|
|
66
|
+
"priority": "high",
|
|
67
|
+
"file_patterns": [
|
|
68
|
+
{ "pattern": "src/db/**", "ownership_type": "exclusive" }
|
|
69
|
+
]
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
"title": "Auth System",
|
|
73
|
+
"description": "JWT-based authentication",
|
|
74
|
+
"file_patterns": [
|
|
75
|
+
{ "pattern": "src/auth/**", "ownership_type": "exclusive" }
|
|
76
|
+
]
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
"title": "CRUD API",
|
|
80
|
+
"description": "Blog post CRUD endpoints",
|
|
81
|
+
"depends_on": [1, 2],
|
|
82
|
+
"file_patterns": [
|
|
83
|
+
{ "pattern": "src/api/**", "ownership_type": "exclusive" }
|
|
84
|
+
]
|
|
85
|
+
}
|
|
86
|
+
]
|
|
87
|
+
}
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
- `depends_on` uses 1-based sequence numbers
|
|
91
|
+
- Tasks with unmet dependencies start in `blocked` status
|
|
92
|
+
- File pattern overlaps with `exclusive` ownership generate warnings
|
|
93
|
+
- DAG is validated for cycles on creation
|
|
94
|
+
|
|
95
|
+
#### `list_tasks`
|
|
96
|
+
|
|
97
|
+
List tasks with optional filters. Returns computed `can_start` status and summary counts.
|
|
98
|
+
|
|
99
|
+
```json
|
|
100
|
+
{
|
|
101
|
+
"group_id": "...",
|
|
102
|
+
"status": ["pending", "in_progress"]
|
|
103
|
+
}
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
#### `get_task`
|
|
107
|
+
|
|
108
|
+
Get full task details including dependencies, file ownership, and progress logs.
|
|
109
|
+
|
|
110
|
+
```json
|
|
111
|
+
{
|
|
112
|
+
"task_id": "..."
|
|
113
|
+
}
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
### Agent Workflow
|
|
117
|
+
|
|
118
|
+
#### `claim_task`
|
|
119
|
+
|
|
120
|
+
Claim a pending task. Validates dependencies are met and no file ownership conflicts exist.
|
|
121
|
+
|
|
122
|
+
```json
|
|
123
|
+
{
|
|
124
|
+
"task_id": "...",
|
|
125
|
+
"agent_id": "agent-frontend"
|
|
126
|
+
}
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
#### `start_task`
|
|
130
|
+
|
|
131
|
+
Create a git worktree and branch, then start working. Returns the worktree path and task context.
|
|
132
|
+
|
|
133
|
+
```json
|
|
134
|
+
{
|
|
135
|
+
"task_id": "..."
|
|
136
|
+
}
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
Creates:
|
|
140
|
+
|
|
141
|
+
- Branch: `task/task-{seq}-{slug}` (e.g. `task/task-1-db-schema`)
|
|
142
|
+
- Worktree: `.worktrees/task-{seq}-{slug}`
|
|
143
|
+
|
|
144
|
+
#### `update_progress`
|
|
145
|
+
|
|
146
|
+
Report progress. Checks for file conflicts with other in-progress tasks and recommends rebase when main has new commits.
|
|
147
|
+
|
|
148
|
+
```json
|
|
149
|
+
{
|
|
150
|
+
"task_id": "...",
|
|
151
|
+
"progress": 75,
|
|
152
|
+
"note": "Schema complete, seeding data",
|
|
153
|
+
"files_changed": ["src/db/schema.ts", "src/db/seed.ts"]
|
|
154
|
+
}
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
#### `complete_task`
|
|
158
|
+
|
|
159
|
+
Mark task as done (moves to `in_review`). Automatically unlocks downstream tasks whose dependencies are now met.
|
|
160
|
+
|
|
161
|
+
```json
|
|
162
|
+
{
|
|
163
|
+
"task_id": "...",
|
|
164
|
+
"summary": "Schema and migrations complete",
|
|
165
|
+
"files_changed": ["src/db/schema.ts", "src/db/migrations/001.sql"]
|
|
166
|
+
}
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
### Integration
|
|
170
|
+
|
|
171
|
+
#### `merge_task`
|
|
172
|
+
|
|
173
|
+
Merge a completed task's branch into main. Supports `merge` and `squash` strategies. On success, cleans up the worktree and branch automatically.
|
|
174
|
+
|
|
175
|
+
```json
|
|
176
|
+
{
|
|
177
|
+
"task_id": "...",
|
|
178
|
+
"strategy": "squash"
|
|
179
|
+
}
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
If conflicts occur, returns the conflicted files with resolution suggestions.
|
|
183
|
+
|
|
184
|
+
#### `cleanup_task`
|
|
185
|
+
|
|
186
|
+
Remove a task's worktree and branch, mark it as failed. Use for abandoned or broken tasks.
|
|
187
|
+
|
|
188
|
+
```json
|
|
189
|
+
{
|
|
190
|
+
"task_id": "...",
|
|
191
|
+
"reason": "Approach changed, splitting into smaller tasks"
|
|
192
|
+
}
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
## Task State Machine
|
|
196
|
+
|
|
197
|
+
```
|
|
198
|
+
pending ──► assigned ──► in_progress ──► in_review ──► completed
|
|
199
|
+
│ │ │
|
|
200
|
+
▼ ▼ ▼
|
|
201
|
+
failed failed failed
|
|
202
|
+
▲
|
|
203
|
+
blocked ───────────────────────┘
|
|
204
|
+
(auto-unblocks when deps complete)
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
## File Ownership
|
|
208
|
+
|
|
209
|
+
Prevents merge conflicts before they happen:
|
|
210
|
+
|
|
211
|
+
- **`exclusive`** — Only one task can modify files matching this pattern. Other tasks attempting to claim overlapping patterns will be rejected.
|
|
212
|
+
- **`shared`** — Multiple tasks can modify these files, but warnings are generated during progress updates if conflicts are detected.
|
|
213
|
+
|
|
214
|
+
Patterns use prefix matching (e.g. `src/db/**` matches `src/db/schema.ts`).
|
|
215
|
+
|
|
216
|
+
## Configuration
|
|
217
|
+
|
|
218
|
+
### Database Location
|
|
219
|
+
|
|
220
|
+
Default: `.tasks/tasks.db` in the current working directory.
|
|
221
|
+
|
|
222
|
+
Override with environment variable:
|
|
223
|
+
|
|
224
|
+
```json
|
|
225
|
+
{
|
|
226
|
+
"mcpServers": {
|
|
227
|
+
"task-assigner": {
|
|
228
|
+
"command": "npx",
|
|
229
|
+
"args": ["-y", "agents-task-assigning"],
|
|
230
|
+
"env": {
|
|
231
|
+
"TASK_DB_PATH": "/path/to/custom/tasks.db"
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
### Git
|
|
239
|
+
|
|
240
|
+
The server auto-detects the git repository root. Worktrees are created under `.worktrees/` in the repo root. Add to your `.gitignore`:
|
|
241
|
+
|
|
242
|
+
```
|
|
243
|
+
.tasks/
|
|
244
|
+
.worktrees/
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
## Example Workflow
|
|
248
|
+
|
|
249
|
+
### Session 1 — Coordinator
|
|
250
|
+
|
|
251
|
+
```
|
|
252
|
+
You: Split this into parallel tasks: build a blog with auth, DB, and API
|
|
253
|
+
|
|
254
|
+
Claude uses create_tasks → creates 3 tasks, task 3 depends on 1 and 2
|
|
255
|
+
|
|
256
|
+
You: What's the status?
|
|
257
|
+
|
|
258
|
+
Claude uses list_tasks → shows task 1 and 2 ready, task 3 blocked
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
### Session 2 — Agent A
|
|
262
|
+
|
|
263
|
+
```
|
|
264
|
+
Agent: I'll work on the DB Schema task
|
|
265
|
+
|
|
266
|
+
Claude uses claim_task → assigned
|
|
267
|
+
Claude uses start_task → worktree at .worktrees/task-1-db-schema
|
|
268
|
+
|
|
269
|
+
(works in worktree, commits code)
|
|
270
|
+
|
|
271
|
+
Claude uses update_progress → 80%, no conflicts
|
|
272
|
+
Claude uses complete_task → moved to in_review, task 3 still blocked (needs task 2)
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
### Session 3 — Agent B
|
|
276
|
+
|
|
277
|
+
```
|
|
278
|
+
Agent: I'll take the Auth System task
|
|
279
|
+
|
|
280
|
+
Claude uses claim_task → assigned
|
|
281
|
+
Claude uses start_task → worktree at .worktrees/task-2-auth-system
|
|
282
|
+
|
|
283
|
+
(works in worktree, commits code)
|
|
284
|
+
|
|
285
|
+
Claude uses complete_task → moved to in_review, task 3 now unlocked!
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
### Back to Session 1 — Coordinator
|
|
289
|
+
|
|
290
|
+
```
|
|
291
|
+
You: Merge the completed tasks
|
|
292
|
+
|
|
293
|
+
Claude uses merge_task for task 1 → clean merge, worktree cleaned up
|
|
294
|
+
Claude uses merge_task for task 2 → clean merge, worktree cleaned up
|
|
295
|
+
|
|
296
|
+
You: Start task 3
|
|
297
|
+
|
|
298
|
+
(Agent C can now claim and start the CRUD API task)
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
## Development
|
|
302
|
+
|
|
303
|
+
```bash
|
|
304
|
+
pnpm install
|
|
305
|
+
pnpm test # run tests (78 tests)
|
|
306
|
+
pnpm build # build to dist/
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
## License
|
|
310
|
+
|
|
311
|
+
MIT
|
package/dist/index.d.ts
ADDED