nightshift-mcp 1.1.1 → 2.0.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 +979 -971
- package/dist/agent-spawner.js +85 -85
- package/dist/chat-manager.js +8 -8
- package/dist/cli.js +32 -32
- package/dist/daemon-manager.js +69 -69
- package/dist/daemon.d.ts +21 -0
- package/dist/daemon.d.ts.map +1 -1
- package/dist/daemon.js +247 -47
- package/dist/daemon.js.map +1 -1
- package/dist/database.d.ts +139 -0
- package/dist/database.d.ts.map +1 -0
- package/dist/database.js +503 -0
- package/dist/database.js.map +1 -0
- package/dist/index.js +121 -121
- package/dist/orchestrator.js +67 -67
- package/dist/ralph-manager.js +11 -11
- package/dist/ralph-manager.js.map +1 -1
- package/dist/tools/agents.js +84 -84
- package/dist/tools/utility.js +64 -64
- package/dist/types.d.ts +2 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +56 -54
package/README.md
CHANGED
|
@@ -1,971 +1,979 @@
|
|
|
1
|
-
# NightShift MCP
|
|
2
|
-
|
|
3
|
-
**The responsible kind of multi-agent chaos.**
|
|
4
|
-
|
|
5
|
-
Explicit delegation, review, and handoffs between AI models.
|
|
6
|
-
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
An MCP (Model Context Protocol) server for agent teams and multi-agent orchestration across different AI models. Coordinate Claude, Codex, Gemini, Goose, and local Ollama models as an agentic team — with structured delegation, shared task management, and autonomous workflows. Works with any MCP-compatible client.
|
|
10
|
-
|
|
11
|
-
## Features
|
|
12
|
-
|
|
13
|
-
- **Multi-agent chat**: Structured inter-agent messaging with agent name, timestamp, type, and content
|
|
14
|
-
- **Failover handling**: Seamless handoffs when an agent hits limits or context windows fill up
|
|
15
|
-
- **PRD-driven task management**: Work through user stories in prd.json with dependencies (`dependsOn`) and tags for smart routing
|
|
16
|
-
- **Progress tracking**: Shared learnings via progress.txt
|
|
17
|
-
- **Selective context retrieval**: Topic-based context store lets agents query relevant context instead of prompt-stuffing
|
|
18
|
-
- **Execution tracing**: Structured trace of agent spawns, completions, and failures with parent-child tree visualization
|
|
19
|
-
- **Agent spawning & orchestration**: Spawn Claude, Codex, Gemini, Goose, or local Ollama models as subprocesses with full lifecycle tracking
|
|
20
|
-
- **Agent availability checks**: Pre-flight validation before spawning — never fails silently on missing agents
|
|
21
|
-
- **Local model support**: Use Goose + Ollama for free, private, offline agent work with local models
|
|
22
|
-
- **Autonomous orchestration**: Single `orchestrate` tool runs a claim→implement→complete loop until all stories pass
|
|
23
|
-
- **Agent status tracking**: Monitor spawned agents by PID, check exit codes, and tail output in real-time
|
|
24
|
-
- **Smart retry**: Automatically suggests or uses a different agent when one fails
|
|
25
|
-
- **Workflow management**: Phases, strategic decisions, and agent assignments
|
|
26
|
-
- **Watch/polling**: Monitor for new messages with cursor-based polling
|
|
27
|
-
- **Auto-archiving**: Archive old messages to keep the chat file manageable
|
|
28
|
-
- **Cross-platform**: Works on Windows, Linux, and macOS
|
|
29
|
-
- **Heterogeneous agent teams**: Mix different AI models — use each for what it's best at
|
|
30
|
-
- **Universal compatibility**: Works with any MCP-supporting tool (49 tools across 10 categories)
|
|
31
|
-
- **Flexible savepoints**: Git-based checkpoints when available, JSON state snapshots when not
|
|
32
|
-
- **
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
- **
|
|
38
|
-
- **
|
|
39
|
-
- **
|
|
40
|
-
- **
|
|
41
|
-
- **
|
|
42
|
-
- **
|
|
43
|
-
- **
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
**
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
- `
|
|
139
|
-
- `
|
|
140
|
-
- `
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
- `
|
|
144
|
-
- `
|
|
145
|
-
- `
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
**
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
```
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
```
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
Files
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
```
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
###
|
|
262
|
-
|
|
263
|
-
```bash
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
```
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
"
|
|
299
|
-
"
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
"
|
|
303
|
-
"
|
|
304
|
-
"
|
|
305
|
-
"
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
"
|
|
309
|
-
"
|
|
310
|
-
"
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
|
327
|
-
|
|
328
|
-
| **`
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
|
333
|
-
|
|
334
|
-
|
|
|
335
|
-
|
|
|
336
|
-
| `
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
#### `
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
#### `
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
- `
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
- `
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
#### `
|
|
403
|
-
Add a
|
|
404
|
-
|
|
405
|
-
**Parameters:**
|
|
406
|
-
- `
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
**
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
│
|
|
491
|
-
|
|
492
|
-
│
|
|
493
|
-
│
|
|
494
|
-
│
|
|
495
|
-
│
|
|
496
|
-
│
|
|
497
|
-
│
|
|
498
|
-
│ │ │
|
|
499
|
-
│
|
|
500
|
-
│
|
|
501
|
-
│
|
|
502
|
-
│
|
|
503
|
-
│
|
|
504
|
-
│
|
|
505
|
-
│
|
|
506
|
-
│
|
|
507
|
-
│
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
"
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
#### `
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
- `
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
#
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
#### `
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
#### `
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
**Parameters:**
|
|
645
|
-
- `
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
#### `
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
-
|
|
676
|
-
|
|
677
|
-
**
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
- `
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
**
|
|
795
|
-
```
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
```
|
|
799
|
-
|
|
800
|
-
**
|
|
801
|
-
```
|
|
802
|
-
delegate_story(agent: "codex"
|
|
803
|
-
delegate_story(agent: "
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
#
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
```
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
#
|
|
827
|
-
nightshift-daemon
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
│
|
|
868
|
-
|
|
869
|
-
│
|
|
870
|
-
│
|
|
871
|
-
│ │
|
|
872
|
-
│ │ •
|
|
873
|
-
│ │ •
|
|
874
|
-
│
|
|
875
|
-
│
|
|
876
|
-
│
|
|
877
|
-
│
|
|
878
|
-
│
|
|
879
|
-
│ │
|
|
880
|
-
│ │ •
|
|
881
|
-
│ │ •
|
|
882
|
-
│ │ •
|
|
883
|
-
│
|
|
884
|
-
│
|
|
885
|
-
│
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
```
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
```
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
1
|
+
# NightShift MCP
|
|
2
|
+
|
|
3
|
+
**The responsible kind of multi-agent chaos.**
|
|
4
|
+
|
|
5
|
+
Explicit delegation, review, and handoffs between AI models.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
An MCP (Model Context Protocol) server for agent teams and multi-agent orchestration across different AI models. Coordinate Claude, Codex, Gemini, Goose, and local Ollama models as an agentic team — with structured delegation, shared task management, and autonomous workflows. Works with any MCP-compatible client.
|
|
10
|
+
|
|
11
|
+
## Features
|
|
12
|
+
|
|
13
|
+
- **Multi-agent chat**: Structured inter-agent messaging with agent name, timestamp, type, and content
|
|
14
|
+
- **Failover handling**: Seamless handoffs when an agent hits limits or context windows fill up
|
|
15
|
+
- **PRD-driven task management**: Work through user stories in prd.json with dependencies (`dependsOn`) and tags for smart routing
|
|
16
|
+
- **Progress tracking**: Shared learnings via progress.txt
|
|
17
|
+
- **Selective context retrieval**: Topic-based context store lets agents query relevant context instead of prompt-stuffing
|
|
18
|
+
- **Execution tracing**: Structured trace of agent spawns, completions, and failures with parent-child tree visualization
|
|
19
|
+
- **Agent spawning & orchestration**: Spawn Claude, Codex, Gemini, Goose, or local Ollama models as subprocesses with full lifecycle tracking
|
|
20
|
+
- **Agent availability checks**: Pre-flight validation before spawning — never fails silently on missing agents
|
|
21
|
+
- **Local model support**: Use Goose + Ollama for free, private, offline agent work with local models
|
|
22
|
+
- **Autonomous orchestration**: Single `orchestrate` tool runs a claim→implement→complete loop until all stories pass
|
|
23
|
+
- **Agent status tracking**: Monitor spawned agents by PID, check exit codes, and tail output in real-time
|
|
24
|
+
- **Smart retry**: Automatically suggests or uses a different agent when one fails
|
|
25
|
+
- **Workflow management**: Phases, strategic decisions, and agent assignments
|
|
26
|
+
- **Watch/polling**: Monitor for new messages with cursor-based polling
|
|
27
|
+
- **Auto-archiving**: Archive old messages to keep the chat file manageable
|
|
28
|
+
- **Cross-platform**: Works on Windows, Linux, and macOS with platform-safe process management
|
|
29
|
+
- **Heterogeneous agent teams**: Mix different AI models — use each for what it's best at
|
|
30
|
+
- **Universal compatibility**: Works with any MCP-supporting tool (49 tools across 10 categories)
|
|
31
|
+
- **Flexible savepoints**: Git-based checkpoints when available, JSON state snapshots when not
|
|
32
|
+
- **SQLite-backed storage**: ACID transactions, indexed queries, zero external services required
|
|
33
|
+
- **Autoresearch**: Built-in agent performance analytics — success rates, duration, scope leak tracking
|
|
34
|
+
|
|
35
|
+
## What's New in 2.0.0
|
|
36
|
+
|
|
37
|
+
- **SQLite data layer**: ACID transactions replace scattered JSON/text files. All state stored in `.robot-chat/nightshift.db` with WAL mode for concurrent access. Migration path to PostgreSQL.
|
|
38
|
+
- **Circuit breaker**: Proper CLOSED/OPEN/HALF\_OPEN state machine tracks per-agent health. Auto-disables failing agents after configurable threshold, re-enables after cooldown. Persisted across daemon restarts.
|
|
39
|
+
- **Immutable audit trail**: Append-only `audit_log` table records every agent spawn, completion, failure, circuit break, and stuck-agent kill. Feeds directly into autoresearch.
|
|
40
|
+
- **Run records**: Structured execution history for every agent run — duration, exit status, files changed, scope leak detection, verification results.
|
|
41
|
+
- **Budget tracking**: Per-agent cost tracking with enable/disable toggle. Daily and monthly limits with configurable warning thresholds. Ready for OpenRouter integration.
|
|
42
|
+
- **Autoresearch queries**: Built-in analytics — agent success rates, average duration, scope leak rates. Data accumulates automatically for future intelligent agent routing.
|
|
43
|
+
- **Dependency security**: MCP SDK upgraded to 1.28.0, all production dependency vulnerabilities resolved.
|
|
44
|
+
|
|
45
|
+
### Previous releases
|
|
46
|
+
|
|
47
|
+
**1.1.0**: Local model support (Ollama/Goose), agent availability checks, PRD dependencies (`dependsOn`), PRD tags for routing, optional savepoints, persistent agent tracking, benchmark suite.
|
|
48
|
+
|
|
49
|
+
**1.0.10**: NightShift CLI (`nightshift` command), daemon manager fixes for Windows, goose agent support.
|
|
50
|
+
|
|
51
|
+
## Installation
|
|
52
|
+
|
|
53
|
+
**Via npm (recommended):**
|
|
54
|
+
```bash
|
|
55
|
+
npm install -g nightshift-mcp
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
**Updating:**
|
|
59
|
+
```bash
|
|
60
|
+
npm update -g nightshift-mcp
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
**Or build from source:**
|
|
64
|
+
```bash
|
|
65
|
+
git clone <repo-url>
|
|
66
|
+
cd nightshift-mcp
|
|
67
|
+
npm install
|
|
68
|
+
npm run build
|
|
69
|
+
npm link # makes 'nightshift-mcp' available globally
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## Configuration
|
|
73
|
+
|
|
74
|
+
### Claude Code (`~/.claude.json`)
|
|
75
|
+
|
|
76
|
+
```json
|
|
77
|
+
{
|
|
78
|
+
"mcpServers": {
|
|
79
|
+
"nightshift": {
|
|
80
|
+
"command": "nightshift-mcp",
|
|
81
|
+
"args": []
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### Codex (`~/.codex/config.toml`)
|
|
88
|
+
|
|
89
|
+
```toml
|
|
90
|
+
[mcp_servers.nightshift]
|
|
91
|
+
command = "nightshift-mcp"
|
|
92
|
+
args = []
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
The server automatically uses the current working directory for the `.robot-chat/` folder. You can override this with the `ROBOT_CHAT_PROJECT_PATH` environment variable if needed.
|
|
96
|
+
|
|
97
|
+
## Usage
|
|
98
|
+
|
|
99
|
+
For agents to communicate, they must be running in the **same project directory**. The chat file is created at `<project>/.robot-chat/chat.txt` based on where each CLI is started.
|
|
100
|
+
|
|
101
|
+
**Example - two agents working on the same project:**
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
# Terminal 1
|
|
105
|
+
cd ~/myproject
|
|
106
|
+
claude
|
|
107
|
+
|
|
108
|
+
# Terminal 2
|
|
109
|
+
cd ~/myproject
|
|
110
|
+
codex
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
Both agents now share the same chat file and can coordinate via the nightshift tools.
|
|
114
|
+
|
|
115
|
+
**Note:** If agents are started in different directories, they will have separate chat files and won't be able to communicate.
|
|
116
|
+
|
|
117
|
+
## Tools
|
|
118
|
+
|
|
119
|
+
### `read_robot_chat`
|
|
120
|
+
|
|
121
|
+
Read recent messages from the chat file.
|
|
122
|
+
|
|
123
|
+
**Parameters:**
|
|
124
|
+
- `limit` (optional): Maximum messages to return (default: 20)
|
|
125
|
+
- `agent` (optional): Filter by agent name
|
|
126
|
+
- `type` (optional): Filter by message type
|
|
127
|
+
|
|
128
|
+
**Example:**
|
|
129
|
+
```
|
|
130
|
+
Read the last 10 messages from Claude
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### `write_robot_chat`
|
|
134
|
+
|
|
135
|
+
Write a message to the chat file.
|
|
136
|
+
|
|
137
|
+
**Parameters:**
|
|
138
|
+
- `agent` (required): Your agent name (e.g., "Claude", "Codex")
|
|
139
|
+
- `type` (required): Message type
|
|
140
|
+
- `content` (required): Message content
|
|
141
|
+
|
|
142
|
+
**Message Types:**
|
|
143
|
+
- `FAILOVER_NEEDED` - Request another agent to take over
|
|
144
|
+
- `FAILOVER_CLAIMED` - Acknowledge taking over a task
|
|
145
|
+
- `TASK_COMPLETE` - Mark a task as finished
|
|
146
|
+
- `STATUS_UPDATE` - Share progress update
|
|
147
|
+
- `HANDOFF` - Pass work to a specific agent
|
|
148
|
+
- `INFO` - General information
|
|
149
|
+
- `ERROR` - Error report
|
|
150
|
+
- `QUESTION` - Ask other agents a question
|
|
151
|
+
- `ANSWER` - Answer a question
|
|
152
|
+
|
|
153
|
+
**Example:**
|
|
154
|
+
```
|
|
155
|
+
Post a STATUS_UPDATE from Claude about completing the login form
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
### `check_failovers`
|
|
159
|
+
|
|
160
|
+
Find unclaimed FAILOVER_NEEDED messages.
|
|
161
|
+
|
|
162
|
+
**Example:**
|
|
163
|
+
```
|
|
164
|
+
Check if any agent needs help with their task
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
### `claim_failover`
|
|
168
|
+
|
|
169
|
+
Claim a failover request from another agent.
|
|
170
|
+
|
|
171
|
+
**Parameters:**
|
|
172
|
+
- `agent` (required): Your agent name
|
|
173
|
+
- `originalAgent` (required): Agent who requested failover
|
|
174
|
+
- `task` (optional): Task description
|
|
175
|
+
|
|
176
|
+
**Example:**
|
|
177
|
+
```
|
|
178
|
+
Claim the failover from Codex and continue working on the authentication feature
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
### `get_chat_path`
|
|
182
|
+
|
|
183
|
+
Get the full path to the chat file.
|
|
184
|
+
|
|
185
|
+
### `list_agents`
|
|
186
|
+
|
|
187
|
+
List all agents who have posted to the chat, with their activity stats.
|
|
188
|
+
|
|
189
|
+
**Returns:**
|
|
190
|
+
- Agent name
|
|
191
|
+
- Last seen timestamp
|
|
192
|
+
- Last message type
|
|
193
|
+
- Total message count
|
|
194
|
+
|
|
195
|
+
**Example:**
|
|
196
|
+
```
|
|
197
|
+
Show me which agents have been active in the chat
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
### `watch_chat`
|
|
201
|
+
|
|
202
|
+
Poll for new messages since a cursor position. Useful for monitoring the chat for updates.
|
|
203
|
+
|
|
204
|
+
**Parameters:**
|
|
205
|
+
- `cursor` (optional): Line number from previous watch call. Omit to get current cursor.
|
|
206
|
+
|
|
207
|
+
**Returns:**
|
|
208
|
+
- `cursor`: Updated cursor for next call
|
|
209
|
+
- `messageCount`: Number of new messages
|
|
210
|
+
- `messages`: Array of new messages
|
|
211
|
+
|
|
212
|
+
**Example workflow:**
|
|
213
|
+
```
|
|
214
|
+
1. Call watch_chat without cursor to get initial position
|
|
215
|
+
2. Store the returned cursor value
|
|
216
|
+
3. Call watch_chat with that cursor to get new messages
|
|
217
|
+
4. Update your cursor with the returned value
|
|
218
|
+
5. Repeat step 3-4 to poll for updates
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
### `archive_chat`
|
|
222
|
+
|
|
223
|
+
Archive old messages to a date-stamped file, keeping recent messages in main chat.
|
|
224
|
+
|
|
225
|
+
**Parameters:**
|
|
226
|
+
- `keepRecent` (optional): Number of messages to keep (default: 50)
|
|
227
|
+
|
|
228
|
+
**Example:**
|
|
229
|
+
```
|
|
230
|
+
Archive old messages, keeping the last 20
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
## Chat File Format
|
|
234
|
+
|
|
235
|
+
Messages are stored in a human-readable format:
|
|
236
|
+
|
|
237
|
+
```
|
|
238
|
+
# Robot Chat - Multi-Agent Communication
|
|
239
|
+
# Format: [AgentName @ HH:MM] MESSAGE_TYPE
|
|
240
|
+
# ========================================
|
|
241
|
+
|
|
242
|
+
[Claude @ 14:32] STATUS_UPDATE
|
|
243
|
+
Working on implementing the login form.
|
|
244
|
+
Files modified: src/components/LoginForm.tsx
|
|
245
|
+
|
|
246
|
+
[Codex @ 14:45] FAILOVER_NEEDED
|
|
247
|
+
Status: Hit rate limit
|
|
248
|
+
Current Task: Implementing user authentication
|
|
249
|
+
Progress: 60% - login form done, need logout and session handling
|
|
250
|
+
Files Modified: src/auth/login.tsx, src/api/auth.ts
|
|
251
|
+
|
|
252
|
+
Requesting another agent continue this work.
|
|
253
|
+
|
|
254
|
+
[Claude @ 14:47] FAILOVER_CLAIMED
|
|
255
|
+
Claiming failover from Codex.
|
|
256
|
+
Continuing task: Implementing user authentication
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
## Testing
|
|
260
|
+
|
|
261
|
+
### With MCP Inspector
|
|
262
|
+
|
|
263
|
+
```bash
|
|
264
|
+
npx @modelcontextprotocol/inspector node /path/to/nightshift-mcp/dist/index.js /tmp/test-project
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
### Manual Testing
|
|
268
|
+
|
|
269
|
+
```bash
|
|
270
|
+
# Set project path and run
|
|
271
|
+
ROBOT_CHAT_PROJECT_PATH=/tmp/test-project node dist/index.js
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
## Development
|
|
275
|
+
|
|
276
|
+
```bash
|
|
277
|
+
# Watch mode for development
|
|
278
|
+
npm run dev
|
|
279
|
+
|
|
280
|
+
# Build
|
|
281
|
+
npm run build
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
## Ralph-Style Task Management
|
|
285
|
+
|
|
286
|
+
NightShift includes Ralph-compatible PRD and progress management, enabling structured autonomous development.
|
|
287
|
+
|
|
288
|
+
### Setup
|
|
289
|
+
|
|
290
|
+
1. Create a `prd.json` in your project root:
|
|
291
|
+
|
|
292
|
+
```json
|
|
293
|
+
{
|
|
294
|
+
"project": "MyApp",
|
|
295
|
+
"description": "Feature description",
|
|
296
|
+
"userStories": [
|
|
297
|
+
{
|
|
298
|
+
"id": "US-001",
|
|
299
|
+
"title": "Set up project structure",
|
|
300
|
+
"description": "Initialize the project with routing and base components",
|
|
301
|
+
"acceptanceCriteria": ["Add routes", "Create base components", "Typecheck passes"],
|
|
302
|
+
"priority": 1,
|
|
303
|
+
"passes": false,
|
|
304
|
+
"notes": "",
|
|
305
|
+
"tags": ["infrastructure"]
|
|
306
|
+
},
|
|
307
|
+
{
|
|
308
|
+
"id": "US-002",
|
|
309
|
+
"title": "Add database field",
|
|
310
|
+
"description": "As a developer, I need to store the new field",
|
|
311
|
+
"acceptanceCriteria": ["Add column to table", "Run migration", "Typecheck passes"],
|
|
312
|
+
"priority": 2,
|
|
313
|
+
"passes": false,
|
|
314
|
+
"notes": "",
|
|
315
|
+
"dependsOn": ["US-001"],
|
|
316
|
+
"tags": ["code", "infrastructure"]
|
|
317
|
+
}
|
|
318
|
+
]
|
|
319
|
+
}
|
|
320
|
+
```
|
|
321
|
+
|
|
322
|
+
### PRD Schema
|
|
323
|
+
|
|
324
|
+
| Field | Type | Required | Default | Description |
|
|
325
|
+
|-------|------|----------|---------|-------------|
|
|
326
|
+
| `project` | string | no | — | Project name |
|
|
327
|
+
| `description` | string | no | "" | Project description |
|
|
328
|
+
| **`userStories`** | array | **yes** | — | Array of user story objects |
|
|
329
|
+
|
|
330
|
+
**User Story fields:**
|
|
331
|
+
|
|
332
|
+
| Field | Type | Required | Default | Description |
|
|
333
|
+
|-------|------|----------|---------|-------------|
|
|
334
|
+
| **`id`** | string | **yes** | — | Unique ID (e.g., "US-001") |
|
|
335
|
+
| **`title`** | string | **yes** | — | Short title |
|
|
336
|
+
| `description` | string | no | "" | Detailed description |
|
|
337
|
+
| `acceptanceCriteria` | string[] | no | [] | Criteria for completion |
|
|
338
|
+
| `priority` | number | no | 999 | Lower = higher priority |
|
|
339
|
+
| `passes` | boolean | no | false | Whether the story is complete |
|
|
340
|
+
| `notes` | string | no | "" | Implementation notes |
|
|
341
|
+
| `dependsOn` | string[] | no | — | Story IDs that must complete first |
|
|
342
|
+
| `tags` | string[] | no | — | Labels for routing (e.g., `["code", "security"]`) |
|
|
343
|
+
|
|
344
|
+
**Tags and routing:** When the orchestrator uses `adaptive` strategy, tags influence which agent gets assigned:
|
|
345
|
+
- `research`, `planning`, `documentation` → prefers gemini/claude
|
|
346
|
+
- `code`, `implementation`, `feature` → prefers codex/claude
|
|
347
|
+
- `security`, `architecture`, `infrastructure` → prefers claude
|
|
348
|
+
|
|
349
|
+
### PRD Validation
|
|
350
|
+
|
|
351
|
+
NightShift validates your `prd.json` with Zod schemas and provides helpful error messages when common mistakes are detected:
|
|
352
|
+
|
|
353
|
+
- Using `stories` instead of `userStories` → suggests the correct field name
|
|
354
|
+
- Using `acceptance_criteria` instead of `acceptanceCriteria` → suggests the correct field name
|
|
355
|
+
- Missing required fields (`id`, `title`) → identifies which story has the issue
|
|
356
|
+
- Optional fields default gracefully (`passes` → false, `notes` → "", `acceptanceCriteria` → [])
|
|
357
|
+
|
|
358
|
+
Use `nightshift_setup(showExamples: true)` for the full schema reference and examples.
|
|
359
|
+
|
|
360
|
+
2. Agents use these tools to work through stories:
|
|
361
|
+
|
|
362
|
+
### PRD Tools
|
|
363
|
+
|
|
364
|
+
#### `read_prd`
|
|
365
|
+
Read the full PRD with completion summary.
|
|
366
|
+
|
|
367
|
+
#### `get_next_story`
|
|
368
|
+
Get the highest priority incomplete story.
|
|
369
|
+
|
|
370
|
+
#### `get_incomplete_stories`
|
|
371
|
+
List all remaining work.
|
|
372
|
+
|
|
373
|
+
#### `claim_story`
|
|
374
|
+
Claim a story and notify other agents via chat.
|
|
375
|
+
|
|
376
|
+
**Parameters:**
|
|
377
|
+
- `agent` (required): Your agent name
|
|
378
|
+
- `storyId` (optional): Specific story to claim
|
|
379
|
+
|
|
380
|
+
#### `complete_story`
|
|
381
|
+
Mark story complete, log progress, and notify via chat.
|
|
382
|
+
|
|
383
|
+
**Parameters:**
|
|
384
|
+
- `agent` (required): Your agent name
|
|
385
|
+
- `storyId` (required): Story ID
|
|
386
|
+
- `summary` (required): What was implemented
|
|
387
|
+
- `filesModified` (optional): List of changed files
|
|
388
|
+
- `learnings` (optional): Gotchas/patterns for future iterations
|
|
389
|
+
|
|
390
|
+
#### `mark_story_complete`
|
|
391
|
+
Just mark a story as complete without chat notification.
|
|
392
|
+
|
|
393
|
+
**Parameters:**
|
|
394
|
+
- `storyId` (required): Story ID
|
|
395
|
+
- `notes` (optional): Implementation notes
|
|
396
|
+
|
|
397
|
+
### Progress Tools
|
|
398
|
+
|
|
399
|
+
#### `read_progress`
|
|
400
|
+
Read progress.txt containing learnings from all iterations.
|
|
401
|
+
|
|
402
|
+
#### `append_progress`
|
|
403
|
+
Add a timestamped progress entry.
|
|
404
|
+
|
|
405
|
+
**Parameters:**
|
|
406
|
+
- `content` (required): What was done, files changed, learnings
|
|
407
|
+
|
|
408
|
+
#### `add_codebase_pattern`
|
|
409
|
+
Add a reusable pattern to the Codebase Patterns section.
|
|
410
|
+
|
|
411
|
+
**Parameters:**
|
|
412
|
+
- `pattern` (required): The pattern (e.g., "Use sql<number> for aggregations")
|
|
413
|
+
|
|
414
|
+
### Context Store
|
|
415
|
+
|
|
416
|
+
NightShift includes a selective context retrieval system that replaces prompt-stuffing with topic-based queries. Instead of truncating progress.txt to fit the context window, agents can store and retrieve relevant context on demand.
|
|
417
|
+
|
|
418
|
+
Context entries are stored as individual JSON files in `.robot-chat/context/` for concurrent-safe multi-agent access.
|
|
419
|
+
|
|
420
|
+
#### `store_context`
|
|
421
|
+
Store a context entry for other agents to query later.
|
|
422
|
+
|
|
423
|
+
**Parameters:**
|
|
424
|
+
- `topic` (required): Topic/category (e.g., "authentication", "database-schema")
|
|
425
|
+
- `content` (required): The context to store (learnings, decisions, findings)
|
|
426
|
+
- `agent` (required): Your agent name
|
|
427
|
+
- `tags` (optional): Tags for better searchability (e.g., ["auth", "jwt"])
|
|
428
|
+
|
|
429
|
+
**Example:**
|
|
430
|
+
```
|
|
431
|
+
store_context(topic: "authentication", content: "Using JWT with RS256. Refresh tokens stored in httpOnly cookies.", agent: "Claude", tags: ["jwt", "cookies"])
|
|
432
|
+
```
|
|
433
|
+
|
|
434
|
+
#### `query_context`
|
|
435
|
+
Search stored context entries by topic.
|
|
436
|
+
|
|
437
|
+
**Parameters:**
|
|
438
|
+
- `topic` (required): Search term (case-insensitive match on topic and tags)
|
|
439
|
+
- `limit` (optional): Max entries to return (default: 10)
|
|
440
|
+
|
|
441
|
+
**Example:**
|
|
442
|
+
```
|
|
443
|
+
query_context(topic: "auth")
|
|
444
|
+
# Returns all entries matching "auth" in topic or tags, sorted by recency
|
|
445
|
+
```
|
|
446
|
+
|
|
447
|
+
#### `list_context`
|
|
448
|
+
List all topics in the context store with entry counts.
|
|
449
|
+
|
|
450
|
+
**How delegation uses context:**
|
|
451
|
+
|
|
452
|
+
When `delegate_story` or `delegate_research` spawns an agent, it queries the context store for entries relevant to the task and includes them in the prompt — instead of blindly truncating progress.txt. Agents are also instructed to use `store_context` to save their learnings, creating a self-enriching context loop.
|
|
453
|
+
|
|
454
|
+
### Execution Tracing
|
|
455
|
+
|
|
456
|
+
NightShift automatically traces all agent spawns, completions, and failures into a structured execution log at `.robot-chat/trace.json`. Each trace event has parent-child relationships that can be reconstructed as a tree for debugging multi-agent runs.
|
|
457
|
+
|
|
458
|
+
#### `get_trace`
|
|
459
|
+
View the execution trace as a flat list or tree.
|
|
460
|
+
|
|
461
|
+
**Parameters:**
|
|
462
|
+
- `tree` (optional): Return as tree with parent-child relationships (default: false)
|
|
463
|
+
- `taskId` (optional): Filter by story/task ID
|
|
464
|
+
|
|
465
|
+
**Example:**
|
|
466
|
+
```
|
|
467
|
+
get_trace(tree: true)
|
|
468
|
+
# Returns tree showing: orchestrator → spawned claude (US-001) → completed
|
|
469
|
+
# orchestrator → spawned codex (US-002) → failed → retried with gemini → completed
|
|
470
|
+
```
|
|
471
|
+
|
|
472
|
+
#### `clear_trace`
|
|
473
|
+
Reset the trace for a fresh orchestration run.
|
|
474
|
+
|
|
475
|
+
**What gets traced automatically:**
|
|
476
|
+
- `spawn_agent` and `spawn_agent_background` calls
|
|
477
|
+
- `delegate_story` and `delegate_research` delegations
|
|
478
|
+
- `orchestrate` decisions (inline mode)
|
|
479
|
+
- Agent completions with exit codes
|
|
480
|
+
- Agent failures with error details
|
|
481
|
+
|
|
482
|
+
Each trace event includes metadata: agent type, story ID, prompt length, exit code, and timing.
|
|
483
|
+
|
|
484
|
+
### Autonomous Workflow
|
|
485
|
+
|
|
486
|
+
With multiple agents working together:
|
|
487
|
+
|
|
488
|
+
```
|
|
489
|
+
┌──────────────────────────────────────────────────────────────────┐
|
|
490
|
+
│ NightShift Workflow │
|
|
491
|
+
├──────────────────────────────────────────────────────────────────┤
|
|
492
|
+
│ │
|
|
493
|
+
│ ┌────────┐ ┌────────┐ ┌────────┐ ┌────────┐ ┌────────┐ │
|
|
494
|
+
│ │ Claude │ │ Codex │ │ Gemini │ │ Vibe │ │ Goose │ │
|
|
495
|
+
│ └───┬────┘ └───┬────┘ └───┬────┘ └───┬────┘ └───┬────┘ │
|
|
496
|
+
│ │ │ │ │ │ │
|
|
497
|
+
│ └───────────┴─────┬─────┴───────────┴───────────┘ │
|
|
498
|
+
│ │ │
|
|
499
|
+
│ ▼ │
|
|
500
|
+
│ ┌──────────────────┐ │
|
|
501
|
+
│ │ .robot-chat/ │ ◄── Agent coordination │
|
|
502
|
+
│ │ chat.txt │ │
|
|
503
|
+
│ └──────────────────┘ │
|
|
504
|
+
│ │ │
|
|
505
|
+
│ ┌──────────┬────────┼────────┬──────────┐ │
|
|
506
|
+
│ │ │ │ │ │ │
|
|
507
|
+
│ ▼ ▼ ▼ ▼ ▼ │
|
|
508
|
+
│ ┌────────┐ ┌────────┐ ┌────┐ ┌──────────┐ ┌──────────┐ │
|
|
509
|
+
│ │prd.json│ │progress│ │Code│ │nightshift│ │ audit │ │
|
|
510
|
+
│ │(tasks) │ │ .txt │ │ │ │ .db │ │ trail │ │
|
|
511
|
+
│ │ │ │ │ │ │ │ (SQLite) │ │(immutable│ │
|
|
512
|
+
│ └────────┘ └────────┘ └────┘ └──────────┘ └──────────┘ │
|
|
513
|
+
│ │
|
|
514
|
+
└──────────────────────────────────────────────────────────────────┘
|
|
515
|
+
```
|
|
516
|
+
|
|
517
|
+
Each agent:
|
|
518
|
+
1. Checks for failovers (helps stuck agents first)
|
|
519
|
+
2. Reads progress.txt for codebase patterns
|
|
520
|
+
3. Claims the next story via chat
|
|
521
|
+
4. Implements the story
|
|
522
|
+
5. Runs quality checks
|
|
523
|
+
6. Commits changes
|
|
524
|
+
7. Marks complete and logs learnings
|
|
525
|
+
8. Repeats until all stories pass
|
|
526
|
+
|
|
527
|
+
When an agent hits limits, it posts `FAILOVER_NEEDED` and another agent claims the work.
|
|
528
|
+
|
|
529
|
+
### Completion Signal
|
|
530
|
+
|
|
531
|
+
When all stories in prd.json have `passes: true` AND all bugs in bugs.json have `fixed: true`, the tools:
|
|
532
|
+
|
|
533
|
+
1. Post a `READY_TO_TEST` message to the chat
|
|
534
|
+
2. Return `<promise>COMPLETE</promise>`
|
|
535
|
+
|
|
536
|
+
This signals to humans that work is ready for review.
|
|
537
|
+
|
|
538
|
+
## Bug Tracking
|
|
539
|
+
|
|
540
|
+
When testing reveals issues, add a `bugs.json` file:
|
|
541
|
+
|
|
542
|
+
```json
|
|
543
|
+
{
|
|
544
|
+
"project": "MyApp",
|
|
545
|
+
"bugs": [
|
|
546
|
+
{
|
|
547
|
+
"id": "BUG-001",
|
|
548
|
+
"title": "Login fails on mobile",
|
|
549
|
+
"description": "Login button unresponsive on iOS Safari",
|
|
550
|
+
"stepsToReproduce": [
|
|
551
|
+
"Open app on iOS Safari",
|
|
552
|
+
"Enter credentials",
|
|
553
|
+
"Tap login button",
|
|
554
|
+
"Nothing happens"
|
|
555
|
+
],
|
|
556
|
+
"priority": 1,
|
|
557
|
+
"fixed": false
|
|
558
|
+
}
|
|
559
|
+
]
|
|
560
|
+
}
|
|
561
|
+
```
|
|
562
|
+
|
|
563
|
+
### Bug Tools
|
|
564
|
+
|
|
565
|
+
#### `read_bugs`
|
|
566
|
+
Read bugs.json with completion summary.
|
|
567
|
+
|
|
568
|
+
#### `get_next_bug`
|
|
569
|
+
Get highest priority unfixed bug.
|
|
570
|
+
|
|
571
|
+
#### `claim_bug`
|
|
572
|
+
Claim a bug and notify via chat.
|
|
573
|
+
|
|
574
|
+
**Parameters:**
|
|
575
|
+
- `agent` (required): Your agent name
|
|
576
|
+
- `bugId` (optional): Specific bug to claim
|
|
577
|
+
|
|
578
|
+
#### `mark_bug_fixed`
|
|
579
|
+
Mark bug fixed, create savepoint, and notify.
|
|
580
|
+
|
|
581
|
+
**Parameters:**
|
|
582
|
+
- `agent` (required): Your agent name
|
|
583
|
+
- `bugId` (required): Bug ID
|
|
584
|
+
- `summary` (required): What was fixed
|
|
585
|
+
- `filesModified` (optional): Files changed
|
|
586
|
+
|
|
587
|
+
## Savepoints (Recovery)
|
|
588
|
+
|
|
589
|
+
Every completed story and fixed bug automatically creates a savepoint (git commit + tag). Use these for easy rollback if needed.
|
|
590
|
+
|
|
591
|
+
### Savepoint Tools
|
|
592
|
+
|
|
593
|
+
#### `create_savepoint`
|
|
594
|
+
Create a manual checkpoint.
|
|
595
|
+
|
|
596
|
+
**Parameters:**
|
|
597
|
+
- `label` (required): Savepoint name (e.g., "pre-refactor", "auth-working")
|
|
598
|
+
- `message` (optional): Commit message
|
|
599
|
+
|
|
600
|
+
#### `list_savepoints`
|
|
601
|
+
List all savepoints (git tags with `savepoint/` prefix).
|
|
602
|
+
|
|
603
|
+
#### `rollback_savepoint`
|
|
604
|
+
Reset to a previous savepoint. **Warning:** Discards all changes after that point.
|
|
605
|
+
|
|
606
|
+
**Parameters:**
|
|
607
|
+
- `label` (required): Savepoint to rollback to
|
|
608
|
+
|
|
609
|
+
### Example Recovery
|
|
610
|
+
|
|
611
|
+
```bash
|
|
612
|
+
# Something went wrong after US-003
|
|
613
|
+
# List available savepoints
|
|
614
|
+
list_savepoints
|
|
615
|
+
# → savepoint/US-001, savepoint/US-002, savepoint/US-003
|
|
616
|
+
|
|
617
|
+
# Rollback to after US-002
|
|
618
|
+
rollback_savepoint("US-002")
|
|
619
|
+
# → All changes after US-002 discarded
|
|
620
|
+
```
|
|
621
|
+
|
|
622
|
+
## Workflow Management
|
|
623
|
+
|
|
624
|
+
NightShift includes workflow tools for tracking project phases, recording strategic decisions, and managing agent assignments.
|
|
625
|
+
|
|
626
|
+
### Workflow Tools
|
|
627
|
+
|
|
628
|
+
#### `init_workflow`
|
|
629
|
+
Initialize a new workflow with a project goal and optional custom phases.
|
|
630
|
+
|
|
631
|
+
**Parameters:**
|
|
632
|
+
- `projectGoal` (required): High-level goal of the project
|
|
633
|
+
- `phases` (optional): Custom phases (default: research, decisions, planning, build, test, report)
|
|
634
|
+
|
|
635
|
+
#### `get_workflow_state`
|
|
636
|
+
Get the current workflow state including phase, assignments, and decisions.
|
|
637
|
+
|
|
638
|
+
#### `advance_phase`
|
|
639
|
+
Advance to the next workflow phase when the current phase's exit criteria are met.
|
|
640
|
+
|
|
641
|
+
#### `set_phase`
|
|
642
|
+
Manually set the workflow to a specific phase.
|
|
643
|
+
|
|
644
|
+
**Parameters:**
|
|
645
|
+
- `phase` (required): Target phase (research, decisions, planning, build, test, report, complete)
|
|
646
|
+
|
|
647
|
+
#### `record_decision`
|
|
648
|
+
Record a strategic decision with rationale for future reference.
|
|
649
|
+
|
|
650
|
+
**Parameters:**
|
|
651
|
+
- `topic` (required): What the decision is about
|
|
652
|
+
- `options` (required): Options that were considered
|
|
653
|
+
- `chosen` (required): The chosen option
|
|
654
|
+
- `rationale` (required): Why this option was chosen
|
|
655
|
+
- `decidedBy` (required): Agent or person who decided
|
|
656
|
+
|
|
657
|
+
#### `get_decisions`
|
|
658
|
+
Get all recorded decisions, optionally filtered by topic.
|
|
659
|
+
|
|
660
|
+
#### `get_active_assignments`
|
|
661
|
+
Get all stories currently being worked on by agents.
|
|
662
|
+
|
|
663
|
+
#### `clear_assignment`
|
|
664
|
+
Clear a story assignment (for abandonment/failover scenarios).
|
|
665
|
+
|
|
666
|
+
## Setup & Debugging
|
|
667
|
+
|
|
668
|
+
NightShift includes self-service tools for setup and troubleshooting.
|
|
669
|
+
|
|
670
|
+
### `nightshift_setup`
|
|
671
|
+
|
|
672
|
+
Get configuration instructions and verify project setup.
|
|
673
|
+
|
|
674
|
+
**Parameters:**
|
|
675
|
+
- `showExamples` (optional): Include prd.json and bugs.json templates
|
|
676
|
+
|
|
677
|
+
**Returns:**
|
|
678
|
+
- Project status checks (prd.json, bugs.json, git, .gitignore)
|
|
679
|
+
- Agent configuration examples for Claude and Codex
|
|
680
|
+
- Setup suggestions for any issues found
|
|
681
|
+
- Example templates (if requested)
|
|
682
|
+
|
|
683
|
+
**Example:**
|
|
684
|
+
```
|
|
685
|
+
nightshift_setup(showExamples: true)
|
|
686
|
+
```
|
|
687
|
+
|
|
688
|
+
### `nightshift_debug`
|
|
689
|
+
|
|
690
|
+
Diagnose issues and get troubleshooting guidance.
|
|
691
|
+
|
|
692
|
+
**Checks:**
|
|
693
|
+
- File system permissions
|
|
694
|
+
- JSON file validation (prd.json, bugs.json)
|
|
695
|
+
- Daemon lock status
|
|
696
|
+
- Recent chat errors and unclaimed failovers
|
|
697
|
+
- Agent availability
|
|
698
|
+
- Git repository status
|
|
699
|
+
|
|
700
|
+
**Example:**
|
|
701
|
+
```
|
|
702
|
+
nightshift_debug
|
|
703
|
+
# Returns detailed diagnostic report with suggested fixes
|
|
704
|
+
```
|
|
705
|
+
|
|
706
|
+
## Agent Spawning & Orchestration
|
|
707
|
+
|
|
708
|
+
One agent can spawn others as subprocesses, enabling fully autonomous multi-agent workflows with minimal user intervention.
|
|
709
|
+
|
|
710
|
+
### Spawning Tools
|
|
711
|
+
|
|
712
|
+
#### `list_available_agents`
|
|
713
|
+
Check which agent CLIs (claude, codex, gemini, vibe, goose) are installed and ready to run.
|
|
714
|
+
|
|
715
|
+
#### `spawn_agent`
|
|
716
|
+
Spawn another agent as a subprocess and wait for completion.
|
|
717
|
+
|
|
718
|
+
**Parameters:**
|
|
719
|
+
- `agent` (required): "claude", "codex", "gemini", "vibe", or "goose"
|
|
720
|
+
- `prompt` (required): Task/prompt to send
|
|
721
|
+
- `timeout` (optional): Seconds before timeout (default: 300)
|
|
722
|
+
|
|
723
|
+
**Example:**
|
|
724
|
+
```
|
|
725
|
+
spawn_agent(agent: "codex", prompt: "Fix the type errors in src/utils.ts")
|
|
726
|
+
```
|
|
727
|
+
|
|
728
|
+
#### `spawn_agent_background`
|
|
729
|
+
Spawn an agent in the background (non-blocking). Returns immediately with PID and output file path.
|
|
730
|
+
|
|
731
|
+
**Parameters:**
|
|
732
|
+
- `agent` (required): "claude", "codex", "gemini", "vibe", or "goose"
|
|
733
|
+
- `prompt` (required): Task/prompt to send
|
|
734
|
+
|
|
735
|
+
#### `delegate_story`
|
|
736
|
+
Delegate a PRD user story to another agent with full context. On failure, returns a `retryHint` suggesting alternative available agents.
|
|
737
|
+
|
|
738
|
+
**Parameters:**
|
|
739
|
+
- `agent` (required): "claude", "codex", "gemini", "vibe", or "goose"
|
|
740
|
+
- `storyId` (optional): Story ID to delegate (defaults to next available)
|
|
741
|
+
- `background` (optional): Run in background (default: false)
|
|
742
|
+
|
|
743
|
+
**Example:**
|
|
744
|
+
```
|
|
745
|
+
delegate_story(agent: "gemini", storyId: "US-003", background: true)
|
|
746
|
+
```
|
|
747
|
+
|
|
748
|
+
The spawned agent receives:
|
|
749
|
+
- Full story description and acceptance criteria
|
|
750
|
+
- Relevant context from the context store (or progress.txt as fallback)
|
|
751
|
+
- Recent chat messages for context
|
|
752
|
+
- Instructions to use nightshift tools for coordination (including `store_context` and `query_context`)
|
|
753
|
+
|
|
754
|
+
#### `delegate_research`
|
|
755
|
+
Delegate a research or planning task to an agent (default: Gemini). Ideal for read-only tasks like codebase analysis, architecture planning, code review, and documentation. Queries the context store for relevant prior findings.
|
|
756
|
+
|
|
757
|
+
**Parameters:**
|
|
758
|
+
- `task` (required): The research/planning task description
|
|
759
|
+
- `agent` (optional): Which agent to use (default: gemini)
|
|
760
|
+
- `context` (optional): Additional context to provide
|
|
761
|
+
- `background` (optional): Run in background (default: false)
|
|
762
|
+
|
|
763
|
+
### Monitoring Tools
|
|
764
|
+
|
|
765
|
+
#### `get_agent_status`
|
|
766
|
+
Check the status of a spawned background agent by PID.
|
|
767
|
+
|
|
768
|
+
**Parameters:**
|
|
769
|
+
- `pid` (required): Process ID of the spawned agent
|
|
770
|
+
|
|
771
|
+
**Returns:**
|
|
772
|
+
- Whether the agent is still running or has exited
|
|
773
|
+
- Exit code (if finished)
|
|
774
|
+
- Last 30 lines of output
|
|
775
|
+
- Story assignment (if delegated via `delegate_story`)
|
|
776
|
+
|
|
777
|
+
#### `list_running_agents`
|
|
778
|
+
List all agents spawned in the current session with their status.
|
|
779
|
+
|
|
780
|
+
**Returns:** Array of agents with PID, agent type, running/exited status, elapsed time, and story assignment.
|
|
781
|
+
|
|
782
|
+
### Orchestration
|
|
783
|
+
|
|
784
|
+
#### `orchestrate`
|
|
785
|
+
Run an autonomous orchestration loop that claims stories, implements them, and marks them complete until all work is done. This is the highest-level automation tool.
|
|
786
|
+
|
|
787
|
+
**Parameters:**
|
|
788
|
+
- `agent` (optional): Your agent name (default: "NightShift")
|
|
789
|
+
- `maxIterations` (optional): Maximum stories to process (default: 50)
|
|
790
|
+
- `mode` (optional): "stories", "bugs", or "all" (default: "all")
|
|
791
|
+
|
|
792
|
+
### Orchestration Patterns
|
|
793
|
+
|
|
794
|
+
**Fully autonomous (recommended):**
|
|
795
|
+
```
|
|
796
|
+
orchestrate(agent: "Claude", mode: "all")
|
|
797
|
+
# Runs until all stories and bugs are complete
|
|
798
|
+
```
|
|
799
|
+
|
|
800
|
+
**Sequential delegation:**
|
|
801
|
+
```
|
|
802
|
+
delegate_story(agent: "codex") # Wait for completion
|
|
803
|
+
delegate_story(agent: "gemini") # Then delegate next
|
|
804
|
+
```
|
|
805
|
+
|
|
806
|
+
**Parallel execution:**
|
|
807
|
+
```
|
|
808
|
+
delegate_story(agent: "codex", storyId: "US-001", background: true)
|
|
809
|
+
delegate_story(agent: "goose", storyId: "US-002", background: true)
|
|
810
|
+
# Work on US-003 yourself while they run in parallel
|
|
811
|
+
# Monitor with get_agent_status or list_running_agents
|
|
812
|
+
```
|
|
813
|
+
|
|
814
|
+
**Research then implement:**
|
|
815
|
+
```
|
|
816
|
+
delegate_research(task: "Analyze auth patterns and recommend approach")
|
|
817
|
+
# Use findings to inform implementation
|
|
818
|
+
delegate_story(agent: "codex", storyId: "US-001")
|
|
819
|
+
```
|
|
820
|
+
|
|
821
|
+
## NightShift Daemon (Continuous Orchestration)
|
|
822
|
+
|
|
823
|
+
For fully automated, event-driven orchestration, run the NightShift daemon:
|
|
824
|
+
|
|
825
|
+
```bash
|
|
826
|
+
# Start the daemon
|
|
827
|
+
nightshift-daemon
|
|
828
|
+
|
|
829
|
+
# With options
|
|
830
|
+
nightshift-daemon --verbose --max-agents 4 --health-check 1m
|
|
831
|
+
|
|
832
|
+
# Preview mode (see what would happen)
|
|
833
|
+
nightshift-daemon --dry-run --verbose
|
|
834
|
+
```
|
|
835
|
+
|
|
836
|
+
### How It Works
|
|
837
|
+
|
|
838
|
+
The daemon provides hands-off multi-agent orchestration:
|
|
839
|
+
|
|
840
|
+
1. **Event-Driven**: Watches `prd.json` and `chat.txt` for changes
|
|
841
|
+
2. **Auto-Spawning**: Spawns agents for orphaned stories (up to concurrency limit)
|
|
842
|
+
3. **Failover Handling**: Automatically claims and reassigns failover requests
|
|
843
|
+
4. **Smart Retry**: Tracks failed agents per story and tries a different agent on retry
|
|
844
|
+
5. **Circuit Breaker**: Per-agent health tracking — auto-disables after consecutive failures, re-enables after cooldown
|
|
845
|
+
6. **Health Checks**: Periodic reconciliation as a fallback (default: every 2 min)
|
|
846
|
+
7. **Poison Pill Protection**: Quarantines stories that fail repeatedly
|
|
847
|
+
8. **Stuck Detection**: Kills agents that haven't reported activity
|
|
848
|
+
9. **Audit Trail**: Every spawn, completion, failure, and circuit break is recorded in SQLite
|
|
849
|
+
|
|
850
|
+
### Options
|
|
851
|
+
|
|
852
|
+
| Flag | Description | Default |
|
|
853
|
+
|------|-------------|---------|
|
|
854
|
+
| `--verbose, -v` | Enable debug logging | false |
|
|
855
|
+
| `--dry-run` | Show actions without spawning | false |
|
|
856
|
+
| `--health-check <N>` | Health check interval (e.g., "2m", "30s") | 2m |
|
|
857
|
+
| `--max-agents <N>` | Max concurrent agents | 3 |
|
|
858
|
+
|
|
859
|
+
### Environment
|
|
860
|
+
|
|
861
|
+
- `ROBOT_CHAT_PROJECT_PATH` - Project directory (default: current directory)
|
|
862
|
+
|
|
863
|
+
### Architecture
|
|
864
|
+
|
|
865
|
+
```
|
|
866
|
+
┌─────────────────────────────────────────────────────────────┐
|
|
867
|
+
│ NightShift Daemon │
|
|
868
|
+
├─────────────────────────────────────────────────────────────┤
|
|
869
|
+
│ │
|
|
870
|
+
│ ┌──────────────────────────────────────────────────┐ │
|
|
871
|
+
│ │ File Watchers (Primary) │ │
|
|
872
|
+
│ │ • prd.json changes → reconcile │ │
|
|
873
|
+
│ │ • chat.txt changes → check failovers │ │
|
|
874
|
+
│ └──────────────────────────────────────────────────┘ │
|
|
875
|
+
│ │ │
|
|
876
|
+
│ ▼ │
|
|
877
|
+
│ ┌──────────────────────────────────────────────────┐ │
|
|
878
|
+
│ │ Reconciliation Engine │ │
|
|
879
|
+
│ │ • Find orphaned stories │ │
|
|
880
|
+
│ │ • Spawn agents (up to max concurrency) │ │
|
|
881
|
+
│ │ • Handle failovers │ │
|
|
882
|
+
│ │ • Quarantine poison pills │ │
|
|
883
|
+
│ └──────────────────────────────────────────────────┘ │
|
|
884
|
+
│ │ │
|
|
885
|
+
│ ▼ │
|
|
886
|
+
│ ┌──────────────────────────────────────────────────┐ │
|
|
887
|
+
│ │ Health Check (Fallback) │ │
|
|
888
|
+
│ │ • Runs every 2 minutes │ │
|
|
889
|
+
│ │ • Detects stuck agents │ │
|
|
890
|
+
│ │ • Restarts watchers if needed │ │
|
|
891
|
+
│ │ • Reconciles state │ │
|
|
892
|
+
│ └──────────────────────────────────────────────────┘ │
|
|
893
|
+
│ │
|
|
894
|
+
└─────────────────────────────────────────────────────────────┘
|
|
895
|
+
```
|
|
896
|
+
|
|
897
|
+
## Local Models via Ollama
|
|
898
|
+
|
|
899
|
+
NightShift supports local Ollama models through two harnesses:
|
|
900
|
+
|
|
901
|
+
### Goose + Ollama (Recommended for tool use)
|
|
902
|
+
|
|
903
|
+
[Goose](https://github.com/block/goose) has its own tool-calling implementation that works reliably with local models. This is the recommended path for local agent work.
|
|
904
|
+
|
|
905
|
+
```bash
|
|
906
|
+
# Install Goose CLI
|
|
907
|
+
curl -fsSL https://github.com/block/goose/releases/latest/download/install.sh | bash
|
|
908
|
+
|
|
909
|
+
# Install Ollama and pull a model
|
|
910
|
+
ollama pull qwen3.5:4b
|
|
911
|
+
|
|
912
|
+
# Configure nightshift to use Goose with Ollama
|
|
913
|
+
export NIGHTSHIFT_GOOSE_PROVIDER=ollama
|
|
914
|
+
export NIGHTSHIFT_GOOSE_MODEL=qwen3.5:4b
|
|
915
|
+
```
|
|
916
|
+
|
|
917
|
+
Then use `goose` as your agent in nightshift:
|
|
918
|
+
```
|
|
919
|
+
spawn_agent(agent: "goose", prompt: "Fix the pagination bug in src/api.ts")
|
|
920
|
+
delegate_research(agent: "goose", task: "Analyze error handling patterns")
|
|
921
|
+
```
|
|
922
|
+
|
|
923
|
+
**Recommended models** (by hardware):
|
|
924
|
+
|
|
925
|
+
| GPU VRAM | Model | Size | Notes |
|
|
926
|
+
|----------|-------|------|-------|
|
|
927
|
+
| 4GB+ | `qwen3.5:4b` | 3.4 GB | Fast, good tool use |
|
|
928
|
+
| 6GB+ | `qwen3.5:4b-q8_0` | 5.3 GB | Better accuracy, same speed |
|
|
929
|
+
| 8GB+ | `qwen3.5:9b` | 6.6 GB | Best quality, slower on consumer GPUs |
|
|
930
|
+
|
|
931
|
+
### Claude Code + Ollama (Text generation only)
|
|
932
|
+
|
|
933
|
+
For tasks that don't require tool use (summarization, code review, planning):
|
|
934
|
+
|
|
935
|
+
```bash
|
|
936
|
+
export NIGHTSHIFT_OLLAMA_MODEL=qwen3.5:4b # or any Ollama model
|
|
937
|
+
```
|
|
938
|
+
|
|
939
|
+
Then use `ollama` as your agent:
|
|
940
|
+
```
|
|
941
|
+
spawn_agent(agent: "ollama", prompt: "Review this PR for security issues")
|
|
942
|
+
delegate_research(agent: "ollama", task: "Summarize the authentication patterns")
|
|
943
|
+
```
|
|
944
|
+
|
|
945
|
+
This uses Claude Code's harness with Ollama's Anthropic-compatible API. Text generation works well, but local models don't reliably trigger Claude Code's structured tool calls.
|
|
946
|
+
|
|
947
|
+
### Benchmarking Local Models
|
|
948
|
+
|
|
949
|
+
A benchmark suite is included to test which models work on your hardware:
|
|
950
|
+
|
|
951
|
+
```bash
|
|
952
|
+
# Test all tasks with goose + a specific model
|
|
953
|
+
node benchmarks/run-experiment.mjs --agent goose --model qwen3.5:4b
|
|
954
|
+
|
|
955
|
+
# Test only text-level tasks (fast sanity check)
|
|
956
|
+
node benchmarks/run-experiment.mjs --agent goose --model qwen3.5:4b --level text
|
|
957
|
+
|
|
958
|
+
# Compare models
|
|
959
|
+
node benchmarks/run-experiment.mjs --agent goose --model qwen3.5:9b
|
|
960
|
+
```
|
|
961
|
+
|
|
962
|
+
Results are saved to `benchmarks/results/` for comparison across runs.
|
|
963
|
+
|
|
964
|
+
## Multi-Agent Tips
|
|
965
|
+
|
|
966
|
+
1. **Same directory**: All agents must run in the same project directory to share chat
|
|
967
|
+
2. **Claim before working**: Always claim stories to prevent duplicate work
|
|
968
|
+
3. **Post status updates**: Keep other agents informed of progress
|
|
969
|
+
4. **Store context, not just progress**: Use `store_context` to share learnings by topic — other agents can query for exactly what they need instead of reading a giant progress file
|
|
970
|
+
5. **Handle failovers**: Check for and claim failovers at the start of each session
|
|
971
|
+
6. **Use delegation**: One orchestrating agent can spawn others for parallel work
|
|
972
|
+
7. **Monitor background agents**: Use `get_agent_status` and `list_running_agents` to track spawned agents
|
|
973
|
+
8. **Use `orchestrate` for full autonomy**: The `orchestrate` tool handles the entire claim→implement→complete loop
|
|
974
|
+
9. **Review traces after runs**: Use `get_trace(tree: true)` to understand what happened during orchestration
|
|
975
|
+
10. **Add `.robot-chat/` to your project's `.gitignore`**: Chat logs, context, and traces are ephemeral and shouldn't be committed
|
|
976
|
+
|
|
977
|
+
## License
|
|
978
|
+
|
|
979
|
+
MIT
|