-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpipeline-explainer.html
More file actions
853 lines (768 loc) · 43.7 KB
/
pipeline-explainer.html
File metadata and controls
853 lines (768 loc) · 43.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
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
404
405
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
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
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>auto-dev Pipeline — Visual Explainer</title>
<meta name="description" content="Interactive visual guide to the auto-dev autonomous development pipeline: bugbot scans, nightshift implements, self-review triages.">
<meta property="og:title" content="auto-dev Pipeline — Visual Explainer">
<meta property="og:description" content="12-phase autonomous development pipeline. Bugbot scans for issues, nightshift implements fixes with Claude Code, self-review triages PRs.">
<meta property="og:type" content="website">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Sora:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500;600&display=swap" rel="stylesheet">
<style>
:root {
--font-body: 'Sora', system-ui, sans-serif;
--font-mono: 'IBM Plex Mono', 'SF Mono', Consolas, monospace;
--bg: #0a0e1a;
--surface: #111827;
--surface2: #1a2236;
--border: rgba(255, 255, 255, 0.06);
--border-bright: rgba(255, 255, 255, 0.12);
--text: #e2e8f0;
--text-dim: #7c8db5;
--bash: #f59e0b;
--bash-dim: rgba(245, 158, 11, 0.12);
--ts: #3b82f6;
--ts-dim: rgba(59, 130, 246, 0.12);
--review: #a855f7;
--review-dim: rgba(168, 85, 247, 0.12);
--green: #22c55e;
--green-dim: rgba(34, 197, 94, 0.12);
--red: #ef4444;
--red-dim: rgba(239, 68, 68, 0.12);
--orange: #f97316;
--orange-dim: rgba(249, 115, 22, 0.12);
--cyan: #22d3ee;
--cyan-dim: rgba(34, 211, 238, 0.12);
}
@media (prefers-color-scheme: light) {
:root {
--bg: #f8fafc;
--surface: #ffffff;
--surface2: #f1f5f9;
--border: rgba(0, 0, 0, 0.07);
--border-bright: rgba(0, 0, 0, 0.14);
--text: #0f172a;
--text-dim: #64748b;
--bash: #d97706;
--bash-dim: rgba(217, 119, 6, 0.08);
--ts: #2563eb;
--ts-dim: rgba(37, 99, 235, 0.08);
--review: #9333ea;
--review-dim: rgba(147, 51, 234, 0.08);
--green: #16a34a;
--green-dim: rgba(22, 163, 74, 0.08);
--red: #dc2626;
--red-dim: rgba(220, 38, 38, 0.08);
--orange: #ea580c;
--orange-dim: rgba(234, 88, 12, 0.08);
--cyan: #0891b2;
--cyan-dim: rgba(8, 145, 178, 0.08);
}
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
background: var(--bg);
background-image:
radial-gradient(at 20% 10%, var(--ts-dim) 0%, transparent 50%),
radial-gradient(at 80% 60%, var(--review-dim) 0%, transparent 50%);
color: var(--text);
font-family: var(--font-body);
min-height: 100vh;
overflow-wrap: break-word;
padding: 40px;
}
/* Accessibility: visually hidden but available to screen readers */
.sr-only {
position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
@keyframes fadeUp {
from { opacity: 0; transform: translateY(12px); }
to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeScale {
from { opacity: 0; transform: scale(0.92); }
to { opacity: 1; transform: scale(1); }
}
.animate { animation: fadeUp 0.4s ease-out both; animation-delay: calc(var(--i, 0) * 0.06s); }
.animate-scale { animation: fadeScale 0.35s ease-out both; animation-delay: calc(var(--i, 0) * 0.06s); }
@media (prefers-reduced-motion: reduce) {
*, *::before, *::after {
animation-duration: 0.01ms !important;
animation-delay: 0ms !important;
transition-duration: 0.01ms !important;
}
}
/* Layout */
.wrap {
max-width: 1300px;
margin: 0 auto;
display: grid;
grid-template-columns: 170px 1fr;
gap: 0 40px;
}
.main { min-width: 0; }
/* TOC */
.toc {
position: sticky; top: 24px; align-self: start;
padding: 14px 0; grid-row: 1 / -1;
max-height: calc(100vh - 48px);
max-height: calc(100dvh - 48px);
overflow-y: auto;
}
.toc::-webkit-scrollbar { width: 3px; }
.toc::-webkit-scrollbar-thumb { background: var(--surface2); border-radius: 2px; }
.toc-title {
font-family: var(--font-mono); font-size: 9px; font-weight: 700;
text-transform: uppercase; letter-spacing: 2px; color: var(--text-dim);
padding: 0 0 10px; margin-bottom: 8px; border-bottom: 1px solid var(--border);
}
.toc a {
display: block; font-size: 11px; color: var(--text-dim); text-decoration: none;
padding: 4px 8px; border-radius: 5px; border-left: 2px solid transparent;
transition: all 0.15s; line-height: 1.4; margin-bottom: 1px;
}
.toc a:hover { color: var(--text); background: var(--surface2); }
.toc a.active { color: var(--text); border-left-color: var(--cyan); }
@media (max-width: 1000px) {
.wrap { grid-template-columns: 1fr; padding-top: 0; }
body { padding: 16px; padding-top: 0; }
.toc {
position: sticky; top: 0; z-index: 200; max-height: none;
display: flex; gap: 4px; align-items: center; overflow-x: auto;
-webkit-overflow-scrolling: touch; background: var(--bg);
border-bottom: 1px solid var(--border); padding: 10px 0;
margin: 0 -16px; padding-left: 16px; padding-right: 16px; grid-row: auto;
mask-image: linear-gradient(to right, black 85%, transparent);
-webkit-mask-image: linear-gradient(to right, black 85%, transparent);
}
.toc::-webkit-scrollbar { display: none; }
.toc-title { display: none; }
.toc a {
white-space: nowrap; flex-shrink: 0; border-left: none;
border-bottom: 2px solid transparent; border-radius: 4px 4px 0 0; padding: 6px 10px; font-size: 10px;
}
.toc a.active { border-left: none; border-bottom-color: var(--cyan); background: var(--surface); }
.main { padding-top: 20px; }
.sec-head { scroll-margin-top: 52px; }
}
/* Typography */
h1 { font-size: 38px; font-weight: 700; letter-spacing: -1px; margin-bottom: 6px; text-wrap: balance; }
.subtitle { color: var(--text-dim); font-family: var(--font-mono); font-size: 12px; margin-bottom: 32px; }
h2 { font-size: 20px; font-weight: 600; margin-bottom: 16px; }
.sec-head {
font-family: var(--font-mono); font-size: 11px; font-weight: 600;
text-transform: uppercase; letter-spacing: 1.5px; padding: 24px 0 12px;
border-bottom: 1px solid var(--border); margin-bottom: 20px;
}
p.desc { font-size: 14px; line-height: 1.7; color: var(--text-dim); margin-bottom: 24px; max-width: 700px; }
p.desc code {
font-family: var(--font-mono); font-size: 12px;
background: var(--cyan-dim); color: var(--cyan); padding: 1px 5px; border-radius: 3px;
}
/* Cards */
.card {
background: var(--surface); border: 1px solid var(--border);
border-radius: 10px; padding: 16px 20px; margin-bottom: 12px;
transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.card:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,0.15); }
.card-label {
font-family: var(--font-mono); font-size: 10px; font-weight: 600;
text-transform: uppercase; letter-spacing: 1.5px; margin-bottom: 6px;
display: flex; align-items: center; gap: 8px;
}
.card h3 { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.card p { font-size: 13px; line-height: 1.6; color: var(--text-dim); }
.card code {
font-family: var(--font-mono); font-size: 11px;
background: var(--cyan-dim); color: var(--cyan); padding: 1px 5px; border-radius: 3px;
}
/* Legend swatches — shape + color for accessibility */
.legend-swatch { width: 12px; height: 12px; display: inline-flex; align-items: center; justify-content: center; font-size: 8px; font-weight: 700; color: #fff; }
.legend-swatch--bash { background: var(--bash); border-radius: 2px; }
.legend-swatch--ts { background: var(--ts); border-radius: 50%; }
.legend-swatch--review { background: var(--review); transform: rotate(45deg); }
.legend-swatch--review span { transform: rotate(-45deg); }
.legend-swatch--green { background: var(--green); border-radius: 2px; }
.legend-swatch--orange { background: var(--orange); border-radius: 50%; }
.legend-swatch--red { background: var(--red); clip-path: polygon(50% 0%, 0% 100%, 100% 100%); }
/* Card label icons — shape prefix instead of color-only dot */
.card-label--bash::before { content: 'B'; display: inline-flex; width: 16px; height: 16px; align-items: center; justify-content: center; font-size: 9px; font-weight: 700; background: var(--bash); color: #fff; border-radius: 2px; }
.card-label--ts::before { content: 'T'; display: inline-flex; width: 16px; height: 16px; align-items: center; justify-content: center; font-size: 9px; font-weight: 700; background: var(--ts); color: #fff; border-radius: 50%; }
.card-label--review::before { content: 'R'; display: inline-flex; width: 16px; height: 16px; align-items: center; justify-content: center; font-size: 9px; font-weight: 700; background: var(--review); color: #fff; border-radius: 2px; transform: rotate(45deg); }
.card-label--review span { display: inline-block; }
.card-label--infra::before { content: 'I'; display: inline-flex; width: 16px; height: 16px; align-items: center; justify-content: center; font-size: 9px; font-weight: 700; background: var(--cyan); color: #fff; border-radius: 2px; }
/* Phase grid */
.phase-grid {
display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
gap: 12px; margin-bottom: 24px;
}
/* Tags */
.tag {
font-family: var(--font-mono); font-size: 10px; font-weight: 500;
padding: 2px 7px; border-radius: 4px; display: inline-block;
}
.tag--bash { background: var(--bash-dim); color: var(--bash); }
.tag--ts { background: var(--ts-dim); color: var(--ts); }
.tag--review { background: var(--review-dim); color: var(--review); }
.tag--green { background: var(--green-dim); color: var(--green); }
.tag--red { background: var(--red-dim); color: var(--red); }
.tag--orange { background: var(--orange-dim); color: var(--orange); }
/* Mermaid */
.mermaid-wrap {
position: relative; background: var(--surface); border: 1px solid var(--border);
border-radius: 12px; padding: 32px 24px; overflow: auto; margin-bottom: 24px;
scrollbar-width: thin; scrollbar-color: var(--border) transparent;
}
.mermaid-wrap::-webkit-scrollbar { width: 6px; height: 6px; }
.mermaid-wrap::-webkit-scrollbar-track { background: transparent; }
.mermaid-wrap::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
.mermaid-wrap .mermaid {
display: flex; justify-content: center;
transition: transform 0.2s ease; transform-origin: top center;
}
.zoom-controls {
position: absolute; top: 8px; right: 8px; display: flex; gap: 2px;
z-index: 10; background: var(--surface); border: 1px solid var(--border);
border-radius: 6px; padding: 2px;
}
.zoom-controls button {
min-width: 44px; min-height: 44px; border: none; background: transparent;
color: var(--text-dim); font-family: var(--font-mono); font-size: 14px;
cursor: pointer; border-radius: 4px; display: flex; align-items: center;
justify-content: center; transition: background 0.15s ease, color 0.15s ease;
}
.zoom-controls button:hover { background: var(--border); color: var(--text); }
.zoom-controls button:focus-visible { outline: 2px solid var(--cyan); outline-offset: -2px; }
.mermaid-wrap.is-zoomed { cursor: grab; }
.mermaid-wrap.is-panning { cursor: grabbing; user-select: none; }
.mermaid .nodeLabel { font-family: var(--font-body) !important; font-size: 14px !important; color: var(--text) !important; }
.mermaid .edgeLabel { font-family: var(--font-mono) !important; font-size: 11px !important; color: var(--text-dim) !important; background-color: var(--bg) !important; }
.mermaid .edgeLabel rect { fill: var(--bg) !important; }
.mermaid .node rect, .mermaid .node circle, .mermaid .node polygon { stroke-width: 1.5px !important; }
.mermaid .edge-pattern-solid { stroke-width: 1.5px !important; }
/* Legend */
.legend { display: flex; gap: 20px; flex-wrap: wrap; margin-bottom: 24px; }
.legend-item { display: flex; align-items: center; gap: 6px; font-family: var(--font-mono); font-size: 11px; color: var(--text-dim); }
/* Collapsible */
details.collapsible { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; margin-bottom: 12px; }
details.collapsible summary {
padding: 14px 20px; background: var(--surface); font-family: var(--font-mono);
font-size: 12px; font-weight: 600; cursor: pointer; list-style: none;
display: flex; align-items: center; gap: 8px; color: var(--text); transition: background 0.15s ease;
}
details.collapsible summary:hover { background: var(--surface2); }
details.collapsible summary::-webkit-details-marker { display: none; }
details.collapsible summary::before { content: '\25B8'; font-size: 11px; color: var(--text-dim); transition: transform 0.15s ease; }
details.collapsible[open] summary::before { transform: rotate(90deg); }
details.collapsible .body { padding: 16px 20px; border-top: 1px solid var(--border); font-size: 13px; line-height: 1.6; color: var(--text-dim); }
details.collapsible .body code {
font-family: var(--font-mono); font-size: 11px;
background: var(--cyan-dim); color: var(--cyan); padding: 1px 5px; border-radius: 3px;
}
/* Summary block */
.summary-block {
background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
padding: 20px 24px; font-family: var(--font-mono); font-size: 13px; line-height: 1.8;
white-space: pre-wrap; margin-bottom: 24px;
}
/* Label lifecycle */
.label-flow {
display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
margin-bottom: 24px; font-size: 13px;
}
.label-flow .arrow { color: var(--text-dim); font-size: 16px; }
@media (max-width: 768px) {
h1 { font-size: 24px; }
.phase-grid { grid-template-columns: 1fr; }
.mermaid-wrap { padding: 16px 12px; }
}
</style>
</head>
<body>
<div class="wrap">
<nav class="toc" id="toc" aria-label="Table of contents">
<div class="toc-title">Contents</div>
<a href="#s1">Overview</a>
<a href="#s2">Pipeline Flow</a>
<a href="#s3">Bash Phases (1-5)</a>
<a href="#s4">TS Phases (6-9)</a>
<a href="#s5">Self-Review (10-12)</a>
<a href="#s6">Classification</a>
<a href="#s7">Labels</a>
<a href="#s8">Infrastructure</a>
<a href="#s9">Morning Summary</a>
</nav>
<div class="main">
<h1 class="animate" style="--i:0">auto-dev Pipeline</h1>
<p class="subtitle animate" style="--i:1">bugbot → nightshift → autonomous PRs</p>
<p class="desc animate" style="--i:2">
<strong>bugbot</strong> scans the codebase for issues and files them on GitHub.
<strong>nightshift</strong> picks them up and implements fixes autonomously using Claude Code,
then self-reviews its own PRs and triages them for the morning summary.
The wave promoter re-queues unblocked issues, creating a self-sustaining loop.
12+ phases, zero human intervention overnight.
</p>
<!-- ─── OVERVIEW ─── -->
<div id="s1" class="sec-head animate" style="--i:3">Overview</div>
<div class="phase-grid">
<div class="card animate" style="--i:4">
<div class="card-label card-label--bash" style="color:var(--bash)">Bugbot</div>
<h3>Code Scanner</h3>
<p>Scans for dead code, type holes, missing tests, stale comments, input validation gaps. Files findings as GitHub issues with <code>nightshift</code>, <code>auto-ready</code>, <code>bugbot</code>, <code>bugbot:{category}</code>, and <code>priority:{level}</code> labels.</p>
</div>
<div class="card animate" style="--i:5">
<div class="card-label card-label--ts" style="color:var(--ts)">Nightshift</div>
<h3>Job Queue</h3>
<p>Discovers <code>nightshift</code>-labeled issues (max 50 per run). Runs Claude Code headlessly in isolated git worktrees with a 90-minute timeout per issue. Supports scheduling (<code>--at 2:00</code>) and concurrency (<code>--concurrency N</code>) via a semaphore-based worker pool.</p>
</div>
<div class="card animate" style="--i:6">
<div class="card-label card-label--review" style="color:var(--review)">Self-Review</div>
<h3>Auto-Triage</h3>
<p>Reviews its own PRs after all issues are processed (once per batch, each PR individually). Auto-fixes mechanical issues. Flags scope/design questions for human review.</p>
</div>
</div>
<!-- ─── PIPELINE FLOW ─── -->
<div id="s2" class="sec-head animate" style="--i:7">Pipeline Flow</div>
<figure class="mermaid-wrap animate" style="--i:8" role="img" aria-label="Pipeline flow diagram showing 12+ phases: bugbot scan creates GitHub issues, queue.ts discovers and prioritizes them, auto-dev.sh runs phases 2-5 in a worktree, worker.ts runs phases 6-9 for panel review and PR creation, pr-self-review.ts runs phases 10-12 for auto-triage, and the wave promoter feeds unblocked issues back into the queue.">
<figcaption class="sr-only">Pipeline flow from bugbot scan through discovery, bash execution, TypeScript panel review, self-review triage, and wave promotion feedback loop.</figcaption>
<div class="zoom-controls">
<button onclick="zoomDiagram(this, 1.2)" title="Zoom in" aria-label="Zoom in">+</button>
<button onclick="zoomDiagram(this, 0.8)" title="Zoom out" aria-label="Zoom out">−</button>
<button onclick="resetZoom(this)" title="Reset zoom" aria-label="Reset zoom">↺</button>
</div>
<pre class="mermaid">
graph TD
BB["Bugbot Scan"] --> ISS["GitHub Issue"]
ISS --> D["Phase 1: Discover (queue.ts)"]
subgraph bash["auto-dev.sh (Bash)"]
S["Phase 2: Setup Worktree"] --> E["Phase 3: Execute"]
E --> SM["Phase 4: Simplify"]
SM --> V["Phase 5: Verify"]
end
D --> S
V --> SNT["Write Sentinel JSON"]
subgraph ts["worker.ts (TypeScript)"]
SNT --> PR["Phase 6: Panel Review"]
PR -->|pass| SF["Phase 6.5: Simplify Filter"]
PR -->|fail| PFAIL["Pipeline Stopped"]
SF --> FX["Phase 7: Fix Findings"]
FX --> RV["Phase 8: Re-verify"]
RV --> PB["Phase 9: Publish Draft PR"]
end
PB --> P10["Phase 10: Self-Review"]
subgraph rev["pr-self-review.ts"]
P10 --> PRE["Phase 12a: Pre-check Triage"]
PRE -->|auto_fixable| AF["Phase 11: Auto-Fix Loop"]
PRE -->|clean / false_positive| DONE["Auto-Approved"]
PRE -->|needs_human| HPRE["Needs Human"]
AF --> REREV["Re-review Diff"]
REREV --> TR["Phase 12: Final Triage"]
end
TR --> OUT{Outcome}
OUT -->|clean| APR["Auto-Approved"]
OUT -->|fixed| SFX["Self-Fixed"]
OUT -->|scope issue| HUM["Needs Human"]
OUT -.->|"error (reserved)"| RFAIL["Review Failed"]
APR --> WP["Wave Promoter"]
SFX --> WP
WP -->|"unblocked issues"| ISS
classDef bashNode fill:#f59e0b22,stroke:#f59e0b
classDef tsNode fill:#3b82f622,stroke:#3b82f6
classDef revNode fill:#a855f722,stroke:#a855f7
classDef greenNode fill:#22c55e22,stroke:#22c55e
classDef orangeNode fill:#f9731622,stroke:#f97316
classDef redNode fill:#ef444422,stroke:#ef4444
classDef cyanNode fill:#22d3ee22,stroke:#22d3ee
class S,E,SM,V bashNode
class D,PR,SF,FX,RV,PB tsNode
class P10,PRE,AF,REREV,TR revNode
class APR,DONE greenNode
class SFX orangeNode
class HUM,HPRE,PFAIL,RFAIL redNode
class WP cyanNode
</pre>
</figure>
<div class="legend animate" style="--i:9">
<div class="legend-item"><div class="legend-swatch legend-swatch--ts" aria-hidden="true"></div> Queue + TS (queue.ts, worker.ts)</div>
<div class="legend-item"><div class="legend-swatch legend-swatch--bash" aria-hidden="true"></div> Bash (auto-dev.sh)</div>
<div class="legend-item"><div class="legend-swatch legend-swatch--review" aria-hidden="true"></div> Self-Review (pr-self-review.ts)</div>
<div class="legend-item"><div class="legend-swatch legend-swatch--green" aria-hidden="true"></div> Auto-approved</div>
<div class="legend-item"><div class="legend-swatch legend-swatch--orange" aria-hidden="true"></div> Self-fixed</div>
<div class="legend-item"><div class="legend-swatch legend-swatch--red" aria-hidden="true"></div> Needs human / Failed</div>
</div>
<!-- ─── BASH PHASES ─── -->
<div id="s3" class="sec-head animate" style="--i:10"><span class="tag tag--bash">bash</span> Phases 1-5</div>
<p class="desc">Phase 1 runs in TypeScript (<code>queue.ts</code>). Phases 2-5 run in a bash script (<code>auto-dev.sh</code>). Claude Code is invoked headlessly to implement the fix in a fresh git worktree. Each issue has a 90-minute timeout and up to 3 retry attempts.</p>
<details class="collapsible animate" style="--i:11">
<summary><span class="tag tag--ts">1</span> Discover</summary>
<div class="body">Runs in <code>queue.ts</code>, not bash. Fetches <code>nightshift</code>-labeled issues via <code>gh issue list --label nightshift --limit 50</code>. Builds a prioritized work queue. If <code>--issue</code> flag is passed, processes specific issues instead. The worker pool (<code>pool.ts</code>) distributes issues across <code>--concurrency N</code> parallel workers, each in an isolated git worktree.</div>
</details>
<details class="collapsible animate" style="--i:12">
<summary><span class="tag tag--bash">2</span> Setup Worktree</summary>
<div class="body">Clean-slate setup: remove stale worktree + local branch + remote branch. Then <code>git worktree add</code> from <code>origin/main</code>, create feature branch <code>feat/gh-{N}-{slug}</code>, symlink <code>node_modules</code>.</div>
</details>
<details class="collapsible animate" style="--i:13">
<summary><span class="tag tag--bash">3</span> Execute</summary>
<div class="body">Run <code>claude --print --permission-mode bypassPermissions</code> with the issue spec as prompt. Claude implements the fix, runs <code>npm run verify</code>. Prompt includes scope constraints: no cascade deletions, replace references with inline defaults rather than deleting consuming code.</div>
</details>
<details class="collapsible animate" style="--i:14">
<summary><span class="tag tag--bash">4</span> Simplify</summary>
<div class="body">Second Claude pass reviewing <code>git diff origin/main</code> against the spec. Simplifies for clarity, consistency, maintainability. No feature changes. Scope-limited: will not delete functions or logic blocks the spec didn't ask to remove.</div>
</details>
<details class="collapsible animate" style="--i:15">
<summary><span class="tag tag--bash">5</span> Verify</summary>
<div class="body">
Guardrails gate:
<br>• Gate 1: <code>npm run verify</code> must pass
<br>• Gate 2: Files changed ≤ 15
<br>• Gate 3: Lines changed ≤ 500
<br>• Gate 4: No unexpected dependency changes (spec must use add/install/require + dependency noun)
<br>• Gate 5: Deletion budget — net deletions ≤ 15, gross deletions ≤ 40 (unless spec explicitly requests large-scale removal)
<br>Writes sentinel JSON (with <code>net_deletions</code> and <code>head_sha</code>) on success. This artifact is the handoff to the TypeScript layer.
</div>
</details>
<!-- ─── TS PHASES ─── -->
<div id="s4" class="sec-head animate" style="--i:16"><span class="tag tag--ts">ts</span> Phases 6-9 — worker.ts</div>
<p class="desc">These phases run in TypeScript. A multi-agent panel reviews the code, filters overengineered suggestions, applies fixes, and publishes a draft PR. If the panel verdict is <code>fail</code>, the pipeline stops early — no PR is created.</p>
<details class="collapsible animate" style="--i:17">
<summary><span class="tag tag--ts">6</span> Panel Review</summary>
<div class="body">
Multi-agent review using Claude CLI:
<br>• <strong>Always</strong>: code-reviewer, spec-compliance-checker, test-coverage-checker, scope-checker
<br>• <strong>Conditional</strong>: red-team (auth/security files), ml-specialist (scoring/threshold files)
<br>Agents run in parallel. Findings are deduplicated, scored, and compiled into a ReviewBrief.
<br><br>Scope-checker verifies the diff doesn't change anything the spec didn't ask for. Detects cascade deletions and out-of-scope modifications.
<br><br>If the panel verdict is <code>fail</code>, the pipeline stops — the issue is marked <code>auto-failed</code> and no PR is created.
</div>
</details>
<details class="collapsible animate" style="--i:18">
<summary><span class="tag tag--ts">6.5</span> Simplify Filter</summary>
<div class="body">Sonnet call removes overengineered review suggestions. Keeps real bugs, security issues, spec gaps. Removes style nits, premature abstractions, unnecessary complexity.</div>
</details>
<details class="collapsible animate" style="--i:19">
<summary><span class="tag tag--ts">7</span> Fix</summary>
<div class="body">Applies actionable findings (trivial/small effort) via a punch list prompt. The spec is passed as untrusted context — Claude follows only the punch list.</div>
</details>
<details class="collapsible animate" style="--i:20">
<summary><span class="tag tag--ts">8</span> Re-verify</summary>
<div class="body"><code>npm run verify</code> after fixes. If it fails, the pipeline stops — no broken code gets published.</div>
</details>
<details class="collapsible animate" style="--i:21">
<summary><span class="tag tag--ts">9</span> Publish</summary>
<div class="body">
<code>git add -u</code>, commit, push, <code>gh pr create --draft</code>.
Posts ReviewBrief as PR comment. Updates labels: removes <code>auto-ready</code> + <code>nightshift</code>, adds <code>auto-pr-ready</code>. PR body includes <code>Closes #N</code> so GitHub auto-closes the issue on merge.
<br><br>If no changes exist (empty diff), removes <code>auto-ready</code> + <code>nightshift</code> labels, posts an explanatory comment, and auto-closes the issue instead of creating a PR.
</div>
</details>
<!-- ─── SELF-REVIEW PHASES ─── -->
<div id="s5" class="sec-head animate" style="--i:22"><span class="tag tag--review">review</span> Phases 10-12 — pr-self-review.ts</div>
<p class="desc">After all issues are processed, nightshift reviews its own PRs. Runs once per batch, then reviews each PR individually. Triage runs twice per PR: once as a pre-check to decide whether to attempt fixes, and again after fixes to confirm resolution.</p>
<details class="collapsible animate" style="--i:23" open>
<summary><span class="tag tag--review">10</span> Self-Review</summary>
<div class="body">
Fetches PR diff via <code>gh pr diff</code>. Single sonnet agent reviews against the original spec.
Each finding gets a <code>fixability</code> tag: <span class="tag tag--green">auto_fixable</span>, <span class="tag tag--red">needs_human</span>, or <span class="tag tag--orange">false_positive</span>.
</div>
</details>
<details class="collapsible animate" style="--i:24" open>
<summary><span class="tag tag--review">12a</span> Pre-check Triage</summary>
<div class="body">
Deterministic classification (no LLM) runs <em>before</em> any fix attempt:
<br>• No findings or all false_positive → skip fixes, go straight to <span class="tag tag--green">auto_approved</span>
<br>• Any needs_human finding → skip fixes, mark <span class="tag tag--red">needs_human</span>
<br>• Only auto_fixable findings → proceed to Phase 11 (Auto-Fix Loop)
</div>
</details>
<details class="collapsible animate" style="--i:25" open>
<summary><span class="tag tag--review">11</span> Auto-Fix Loop</summary>
<div class="body">
For PRs with auto-fixable findings (max 2 iterations):
<br>• Build punch list from findings
<br>• <code>execClaude</code> with sonnet to apply fixes
<br>• <code>npm run verify</code> — if fails, mark needs_human
<br>• Commit and push
<br>• Re-review the PR diff to confirm findings are resolved
<br>• If findings remain, loop (up to 2 iterations total)
</div>
</details>
<details class="collapsible animate" style="--i:26" open>
<summary><span class="tag tag--review">12b</span> Final Triage</summary>
<div class="body">
Same deterministic classification, run after Phase 11 completes:
<br>• No findings or all false_positive → <span class="tag tag--green">auto_approved</span>
<br>• All auto_fixable resolved (12b returns <code>auto_approved</code> after Phase 11 succeeded) → orchestrator marks <span class="tag tag--orange">self_fixed</span>
<br>• Remaining needs_human findings → <span class="tag tag--red">needs_human</span>
<br>• Review itself failed (unparseable output) → <span class="tag tag--red">review_failed</span> <em>(reserved — currently unreachable; unparseable output is treated as clean)</em>
<br><br>Actions: auto-approved/self-fixed PRs get <code>gh pr ready</code>. Needs-human PRs get a triage comment.
</div>
</details>
<!-- ─── CLASSIFICATION ─── -->
<div id="s6" class="sec-head animate" style="--i:27">Classification Decision Tree</div>
<p class="desc">How nightshift decides whether a review finding can be auto-fixed or needs human judgment. Classification happens inside the review prompt, not as a separate step. All three dimensions (category, severity, scope) are checked for each finding.</p>
<figure class="mermaid-wrap animate" style="--i:28" role="img" aria-label="Classification decision tree showing how review findings are categorized as auto_fixable, needs_human, or false_positive based on category, effort level, severity confidence, and scope checks.">
<figcaption class="sr-only">Decision tree: findings are classified by category (actionable/security go to effort check, tradeoff/scope_violation go to needs_human, false_positive is skipped), then by effort (trivial/small is auto_fixable, medium is needs_human), with additional gates for low-confidence critical findings and scope violations.</figcaption>
<div class="zoom-controls">
<button onclick="zoomDiagram(this, 1.2)" title="Zoom in" aria-label="Zoom in">+</button>
<button onclick="zoomDiagram(this, 0.8)" title="Zoom out" aria-label="Zoom out">−</button>
<button onclick="resetZoom(this)" title="Reset zoom" aria-label="Reset zoom">↺</button>
</div>
<pre class="mermaid">
graph TD
F["Review Finding"] --> CAT{Category?}
CAT -->|"actionable, style, test_gap"| EFF{Effort?}
EFF -->|"trivial / small"| AUTO["auto_fixable"]
EFF -->|"medium"| HUM["needs_human"]
CAT -->|"security"| SEFF{Effort?}
SEFF -->|"trivial / small"| AUTO
SEFF -->|"medium"| HUM
CAT -->|"tradeoff, question, spec_gap"| HUM
CAT -->|"scope_violation"| HUM
CAT -->|"false_positive"| FP["false_positive"]
AUTO --> SEV{Severity + Confidence?}
SEV -->|"critical + confidence < 80"| HUM
SEV -->|"otherwise"| SCOPE{"Scope check"}
SCOPE -->|"removed existing features not in spec"| HUM
SCOPE -->|"added behavior not in spec"| HUM
SCOPE -->|"within spec"| PASS["Confirmed auto_fixable"]
classDef greenNode fill:#22c55e22,stroke:#22c55e
classDef redNode fill:#ef444422,stroke:#ef4444
classDef orangeNode fill:#f9731622,stroke:#f97316
class AUTO,PASS greenNode
class HUM redNode
class FP orangeNode
</pre>
</figure>
<div class="phase-grid">
<div class="card animate" style="--i:29; border-left: 3px solid var(--green);">
<div class="card-label" style="color:var(--green)">Auto-Fixable</div>
<p>Magic numbers, missing imports, unused code, missing tests for existing patterns, style issues with clear mechanical fixes.</p>
</div>
<div class="card animate" style="--i:30; border-left: 3px solid var(--red);">
<div class="card-label" style="color:var(--red)">Needs Human</div>
<p>Scope violations, cascade deletions, removed functionality, architectural choices, design tradeoffs, spec gaps, uncertain critical findings.</p>
</div>
<div class="card animate" style="--i:31; border-left: 3px solid var(--orange);">
<div class="card-label" style="color:var(--orange)">False Positive</div>
<p>Reviewer was wrong. The code is correct per spec. Skipped — no action taken.</p>
</div>
</div>
<!-- ─── LABELS ─── -->
<div id="s7" class="sec-head animate" style="--i:32">Label Lifecycle</div>
<div class="label-flow animate" style="--i:33">
<span class="tag tag--bash">bugbot files issue</span>
<span class="arrow">→</span>
<span class="tag" style="background:var(--cyan-dim);color:var(--cyan);">auto-ready</span>
<span>+</span>
<span class="tag" style="background:var(--ts-dim);color:var(--ts);">nightshift</span>
<span>+</span>
<span class="tag" style="background:var(--bash-dim);color:var(--bash);">bugbot</span>
<span>+</span>
<span class="tag" style="background:var(--bash-dim);color:var(--bash);">bugbot:{category}</span>
<span>+</span>
<span class="tag" style="background:var(--orange-dim);color:var(--orange);">priority:{level}</span>
<span class="arrow">→</span>
<span class="tag" style="background:var(--review-dim);color:var(--review);">nightshift picks up</span>
<span class="arrow">→</span>
<span class="tag tag--green">auto-pr-ready</span>
<span>or</span>
<span class="tag tag--red">auto-failed</span>
<span>or</span>
<span class="tag" style="background:var(--text-dim);color:var(--bg);">closed</span>
</div>
<div class="phase-grid">
<div class="card animate" style="--i:34">
<h3><code>nightshift</code></h3>
<p>Scoped for autonomous processing. Applied by bugbot or manually. Consumed by nightshift's discovery phase.</p>
</div>
<div class="card animate" style="--i:35">
<h3><code>auto-ready</code></h3>
<p>Broader gate — issue is specced and ready. Used by the wave promoter for dependency tracking. Both labels required for nightshift to pick up an issue.</p>
</div>
<div class="card animate" style="--i:36">
<h3><code>auto-pr-ready</code></h3>
<p>PR created, awaiting human merge. Counts as "satisfied" for dependency tracking in wave promotion.</p>
</div>
<div class="card animate" style="--i:37">
<h3><code>auto-failed</code></h3>
<p>Pipeline failed. Issue gets a comment explaining the failure phase. Needs investigation.</p>
</div>
<div class="card animate" style="--i:38">
<h3><code>bugbot</code> + <code>bugbot:{category}</code></h3>
<p>Applied by bugbot to track scanner origin. Categories include <code>bugbot:dead-code</code>, <code>bugbot:type-holes</code>, <code>bugbot:stale-comments</code>, etc.</p>
</div>
<div class="card animate" style="--i:39">
<h3><code>priority:{level}</code></h3>
<p>Severity-based priority applied by bugbot. Levels: <code>priority:high</code>, <code>priority:medium</code>, <code>priority:low</code>. Nightshift processes higher-priority issues first.</p>
</div>
</div>
<!-- ─── INFRASTRUCTURE ─── -->
<div id="s8" class="sec-head animate" style="--i:40"><span class="tag" style="background:var(--cyan-dim);color:var(--cyan);">infra</span> Infrastructure</div>
<p class="desc">Safety mechanisms that keep the pipeline running unattended overnight. These components are not phases themselves but operate across the entire pipeline.</p>
<div class="phase-grid">
<div class="card animate" style="--i:41">
<div class="card-label card-label--infra" style="color:var(--cyan)">Circuit Breaker</div>
<h3>Consecutive Failure Protection</h3>
<p>Tracks consecutive <em>systemic</em> failures (crashes, timeouts, setup errors) and halts the queue after N trips (default 3, configurable via <code>--max-failures</code>). Spec-level failures (verify gate, panel review) are treated as issue-specific and <em>reset</em> the counter — they don't indicate infrastructure problems.</p>
</div>
<div class="card animate" style="--i:42">
<div class="card-label card-label--infra" style="color:var(--cyan)">PID Lock</div>
<h3>Concurrent Run Prevention</h3>
<p>Atomic <code>O_EXCL</code> lockfile at <code>$STATE_DIR/nightshift.lock</code> prevents overlapping nightshift runs. Auto-reclaims stale locks from dead processes. Safe to call <code>nightshift start</code> from tmux or the scheduler without risking parallel execution.</p>
</div>
<div class="card animate" style="--i:43">
<div class="card-label card-label--infra" style="color:var(--cyan)">Worker Pool</div>
<h3>Concurrency Semaphore</h3>
<p>Controls parallel execution via <code>--concurrency N</code>. Each worker gets its own isolated git worktree. A single <code>git fetch origin</code> runs before the pool starts to avoid fetch contention between workers.</p>
</div>
<div class="card animate" style="--i:44">
<div class="card-label card-label--infra" style="color:var(--cyan)">Wave Promoter</div>
<h3>Dependency-Aware Re-queuing</h3>
<p>Runs after each batch completes (<code>nightshift promote</code>). Uses Kahn's algorithm to find issues whose dependencies are all satisfied (closed or <code>auto-pr-ready</code>). Promotes them by adding the <code>auto-ready</code> label, re-entering them into the queue for the next nightshift run. This creates the self-sustaining feedback loop.</p>
</div>
</div>
<!-- ─── MORNING SUMMARY ─── -->
<div id="s9" class="sec-head animate" style="--i:45">Morning Summary</div>
<p class="desc">What you see when you check nightshift the next morning. The triage section tells you exactly what needs attention.</p>
<div class="summary-block animate" style="--i:46"><span aria-label="passed">✅</span> = auto-approved <span aria-label="self-fixed">🔄</span> = self-fixed <span aria-label="needs human">⚠️</span> = needs human
# Nightshift Summary — 2026-03-14
Started: 02:00 | Finished: 02:05 | Duration: 5m 11s
## Results
[PASS] #87 (3m 42s) [panel: pass] → PR #241
[PASS] #215 (2m 40s) [panel: pass]
[PASS] #219 (4m 41s) [panel: pass]
[PASS] #225 (4m 03s) [panel: pass] → PR #238
[PASS] #232 (4m 10s) [panel: pass] → PR #237
[PASS] #234 (4m 37s) [panel: pass] → PR #236
[PASS] #253 (5m 10s) [panel: pass] → PR #265
## Totals
Completed: 12/15 | Failed: 0 | Skipped: 0
## Triage
[APPROVED] Auto-approved: #87, #232, #253
[HUMAN] Needs human: #225 (pairwiseTokenScore not unexported)
[HUMAN] Needs human: #234 (silent clamping vs error messages)</div>
</div><!-- /main -->
</div><!-- /wrap -->
<script type="module">
import mermaid from 'https://cdn.jsdelivr.net/npm/mermaid@11/dist/mermaid.esm.min.mjs';
const isDark = window.matchMedia('(prefers-color-scheme: dark)').matches;
mermaid.initialize({
startOnLoad: true,
theme: 'base',
look: 'classic',
themeVariables: {
primaryColor: isDark ? '#1a2236' : '#f1f5f9',
primaryBorderColor: isDark ? '#3b82f6' : '#2563eb',
primaryTextColor: isDark ? '#e2e8f0' : '#0f172a',
secondaryColor: isDark ? '#1a1433' : '#faf5ff',
secondaryBorderColor: isDark ? '#a855f7' : '#9333ea',
secondaryTextColor: isDark ? '#e2e8f0' : '#0f172a',
tertiaryColor: isDark ? '#27201a' : '#fffbeb',
tertiaryBorderColor: isDark ? '#f59e0b' : '#d97706',
tertiaryTextColor: isDark ? '#e2e8f0' : '#0f172a',
lineColor: isDark ? '#7c8db5' : '#64748b',
fontSize: '14px',
fontFamily: "'Sora', system-ui, sans-serif",
}
});
</script>
<script>
// Zoom controls
function updateZoomState(wrap) {
var target = wrap.querySelector('.mermaid');
var zoom = parseFloat(target.dataset.zoom || '1');
wrap.classList.toggle('is-zoomed', zoom > 1);
}
function zoomDiagram(btn, factor) {
var wrap = btn.closest('.mermaid-wrap');
var target = wrap.querySelector('.mermaid');
var current = parseFloat(target.dataset.zoom || '1');
var next = Math.min(Math.max(current * factor, 0.3), 5);
target.dataset.zoom = next;
target.style.transform = 'scale(' + next + ')';
updateZoomState(wrap);
}
function resetZoom(btn) {
var wrap = btn.closest('.mermaid-wrap');
var target = wrap.querySelector('.mermaid');
target.dataset.zoom = '1';
target.style.transform = 'scale(1)';
updateZoomState(wrap);
}
// Delegated pan/zoom handlers (single listener per event, not per diagram)
var activePan = null;
document.addEventListener('mousedown', function(e) {
var wrap = e.target.closest('.mermaid-wrap');
if (!wrap || e.target.closest('.zoom-controls')) return;
var target = wrap.querySelector('.mermaid');
if (parseFloat(target.dataset.zoom || '1') <= 1) return;
wrap.classList.add('is-panning');
activePan = { wrap: wrap, startX: e.clientX, startY: e.clientY, scrollL: wrap.scrollLeft, scrollT: wrap.scrollTop };
});
document.addEventListener('mousemove', function(e) {
if (!activePan) return;
activePan.wrap.scrollLeft = activePan.scrollL - (e.clientX - activePan.startX);
activePan.wrap.scrollTop = activePan.scrollT - (e.clientY - activePan.startY);
});
document.addEventListener('mouseup', function() {
if (activePan) { activePan.wrap.classList.remove('is-panning'); activePan = null; }
});
document.querySelectorAll('.mermaid-wrap').forEach(function(wrap) {
wrap.addEventListener('wheel', function(e) {
if (!e.ctrlKey && !e.metaKey) return;
e.preventDefault();
var target = wrap.querySelector('.mermaid');
var current = parseFloat(target.dataset.zoom || '1');
var factor = e.deltaY < 0 ? 1.1 : 0.9;
var next = Math.min(Math.max(current * factor, 0.3), 5);
target.dataset.zoom = next;
target.style.transform = 'scale(' + next + ')';
updateZoomState(wrap);
}, { passive: false });
});
// Scroll spy
(function() {
var toc = document.getElementById('toc');
var links = toc.querySelectorAll('a');
var sections = [];
links.forEach(function(link) {
var id = link.getAttribute('href').slice(1);
var el = document.getElementById(id);
if (el) sections.push({ id: id, el: el, link: link });
});
var observer = new IntersectionObserver(function(entries) {
var topmost = null;
entries.forEach(function(entry) {
if (entry.isIntersecting) {
var match = sections.find(function(s) { return s.el === entry.target; });
if (match && (!topmost || match.el.getBoundingClientRect().top < topmost.el.getBoundingClientRect().top)) {
topmost = match;
}
}
});
if (topmost) {
links.forEach(function(l) { l.classList.remove('active'); });
topmost.link.classList.add('active');
if (window.innerWidth <= 1000) {
topmost.link.scrollIntoView({ behavior: 'smooth', block: 'nearest', inline: 'center' });
}
}
}, { rootMargin: '-10% 0px -80% 0px' });
sections.forEach(function(s) { observer.observe(s.el); });
links.forEach(function(link) {
link.addEventListener('click', function(e) {
e.preventDefault();
var id = link.getAttribute('href').slice(1);
var el = document.getElementById(id);
if (el) { el.scrollIntoView({ behavior: 'smooth', block: 'start' }); history.replaceState(null, '', '#' + id); }
});
});
})();
</script>
</body>
</html>