@bybrawe/opencode-loop 0.5.1 → 0.5.4
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/CHANGELOG.md +8 -0
- package/README.md +877 -847
- package/package.json +3 -3
- package/src/index.js +163 -33
package/README.md
CHANGED
|
@@ -1,848 +1,878 @@
|
|
|
1
|
-
# OpenCode Loop
|
|
2
|
-
|
|
3
|
-
**Claude Code style auto-continue for OpenCode.**
|
|
4
|
-
|
|
5
|
-
OpenCode Loop adds a practical `/loop` command and `opencode-loopd` daemon to OpenCode so an agent can keep working after each idle turn instead of waiting for you to type “continue” again.
|
|
6
|
-
|
|
7
|
-
It is useful for long coding sessions, `progress.md` workflows, TODO automation, test-fix loops, periodic `/compact`, checkpoints, safe autonomous development, and background OpenCode continuation jobs.
|
|
8
|
-
|
|
9
|
-
Repository: **ByBrawe/opencode-loop**
|
|
10
|
-
NPM package name: **@bybrawe/opencode-loop**
|
|
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
|
-
/loop
|
|
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
|
-
```text
|
|
253
|
-
/loop
|
|
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
|
-
| `/loop
|
|
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
|
-
```text
|
|
463
|
-
/loop
|
|
464
|
-
/loop
|
|
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
|
-
```text
|
|
690
|
-
/loop 0s --
|
|
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
|
-
|
|
1
|
+
# OpenCode Loop
|
|
2
|
+
|
|
3
|
+
**Claude Code style auto-continue for OpenCode.**
|
|
4
|
+
|
|
5
|
+
OpenCode Loop adds a practical `/loop` command and `opencode-loopd` daemon to OpenCode so an agent can keep working after each idle turn instead of waiting for you to type “continue” again.
|
|
6
|
+
|
|
7
|
+
It is useful for long coding sessions, `progress.md` workflows, TODO automation, test-fix loops, periodic `/compact`, checkpoints, safe autonomous development, and background OpenCode continuation jobs.
|
|
8
|
+
|
|
9
|
+
Repository: **ByBrawe/opencode-loop**
|
|
10
|
+
NPM package name: **@bybrawe/opencode-loop**
|
|
11
|
+
|
|
12
|
+
## Current status
|
|
13
|
+
|
|
14
|
+
**v0.5.4 fixes the recent OpenCode update compatibility issue.** OpenCode Loop has been updated for the current OpenCode SDK/TUI call shape and idle/status behavior. The TUI loop now waits for the session to become idle, debounces idle events, and avoids starting a new run while OpenCode is still busy or queued.
|
|
15
|
+
|
|
16
|
+
The known update-related symptoms from older builds are fixed:
|
|
17
|
+
|
|
18
|
+
- `/loop` looks queued but the job stays at `runs=0`
|
|
19
|
+
- a loop job is replaced but does not fire after OpenCode becomes idle
|
|
20
|
+
- repeated `/loop` commands create confusing queued turns
|
|
21
|
+
- prompt, shell, or toast calls silently fail after OpenCode SDK changes
|
|
22
|
+
- intermittent `Tool execution aborted` behavior caused by triggering a new turn too early
|
|
23
|
+
|
|
24
|
+
The TUI loop is still intentionally session-bound: it runs while OpenCode is open and the current session emits status/idle events. For long-running background work after closing the terminal or OpenCode, use `opencode-loopd`.
|
|
25
|
+
|
|
26
|
+
## Why this exists
|
|
27
|
+
|
|
28
|
+
Claude Code users often rely on a loop-like workflow where the agent finishes one step, then immediately continues with the next step.
|
|
29
|
+
|
|
30
|
+
OpenCode is powerful, but long-running autonomous workflows usually need extra control around:
|
|
31
|
+
|
|
32
|
+
- auto-continue after idle
|
|
33
|
+
- compact / summarize scheduling
|
|
34
|
+
- `progress.md` and TODO-driven development
|
|
35
|
+
- test verification after each turn
|
|
36
|
+
- patch checkpoints
|
|
37
|
+
- maximum runtime limits
|
|
38
|
+
- failure limits
|
|
39
|
+
- background daemon execution
|
|
40
|
+
- Windows Task Scheduler support
|
|
41
|
+
- safety prompts and destructive command guards
|
|
42
|
+
|
|
43
|
+
OpenCode Loop is designed for developers searching for:
|
|
44
|
+
|
|
45
|
+
- OpenCode loop
|
|
46
|
+
- OpenCode Claude Code loop
|
|
47
|
+
- OpenCode auto continue
|
|
48
|
+
- OpenCode continue automatically
|
|
49
|
+
- OpenCode `/loop` command
|
|
50
|
+
- OpenCode compact scheduler
|
|
51
|
+
- OpenCode Ralph loop alternative
|
|
52
|
+
- Claude Code style loop for OpenCode
|
|
53
|
+
- autonomous coding loop for OpenCode
|
|
54
|
+
- progress.md TODO automation for OpenCode
|
|
55
|
+
- OpenCode background daemon
|
|
56
|
+
- OpenCode loop daemon
|
|
57
|
+
- OpenCode Windows Task Scheduler loop
|
|
58
|
+
|
|
59
|
+
## Features
|
|
60
|
+
|
|
61
|
+
> The TUI `/loop` command is session-bound. It runs while OpenCode is open and the session receives idle/status events. If the terminal closes, the machine sleeps, the process is killed, or the provider connection is lost for a long time, the TUI loop cannot continue in the background. For long-running loops, use `opencode-loopd` daemon mode.
|
|
62
|
+
|
|
63
|
+
- **Claude Code style auto-continue** with `/loop 0s ...`.
|
|
64
|
+
- **TUI loop mode** with `/loop`, active while OpenCode is open.
|
|
65
|
+
- **Background daemon mode** with `opencode-loopd` for long-running loops outside the OpenCode TUI.
|
|
66
|
+
- **Windows Task Scheduler helper** with `opencode-loopd install-task`.
|
|
67
|
+
- **One-shot scheduled runs** for periodic continuation jobs.
|
|
68
|
+
- **Interval loops** for prompts, slash commands, and shell commands.
|
|
69
|
+
- **Prompt-file support** with `--prompt-file loop-prompt.md` for long reusable instructions.
|
|
70
|
+
- **Prompt-file daemon support** with `opencode-loopd --prompt-file loop-prompt.md`.
|
|
71
|
+
- **Include extra context files** with `--include-file`.
|
|
72
|
+
- **progress.md workflow** with `--progress-file progress.md`.
|
|
73
|
+
- **Large TODO support** with `--batch`.
|
|
74
|
+
- **Compact scheduling** with `/loop 200m /compact` or `--compact-every`.
|
|
75
|
+
- **Verification loops** with `--verify "npm test"`.
|
|
76
|
+
- **Preflight checks** with `--preflight "npm install"`.
|
|
77
|
+
- **Post-run commands** with `--postrun`.
|
|
78
|
+
- **Failure control** with `--max-failures` and `--pause-on-verify-fail`.
|
|
79
|
+
- **Runtime control** with `--max-runtime 6h`.
|
|
80
|
+
- **Run limit support** with `--max-runs`.
|
|
81
|
+
- **Sleep-before-first-run support** with `--sleep-first`.
|
|
82
|
+
- **Checkpoints** with `--checkpoint-only` or `--git-checkpoint`.
|
|
83
|
+
- **Safe mode** with `--safe` and prompt-level destructive command warnings.
|
|
84
|
+
- **Branch setup** with `--branch ai-loop`.
|
|
85
|
+
- **Stop controls** with `--stop-file STOP_LOOP`, `--until`, `/loop-stop`, `/loop-pause`, `/loop-resume`, and `/loop-remove`.
|
|
86
|
+
- **Watch mode** with `--watch progress.md`.
|
|
87
|
+
- **Diagnostics** with `/loop-doctor`.
|
|
88
|
+
- **Starter progress file** with `/loop-init`.
|
|
89
|
+
- **State export** with `/loop-export`.
|
|
90
|
+
|
|
91
|
+
## Installation
|
|
92
|
+
|
|
93
|
+
### Recommended: install from npm
|
|
94
|
+
|
|
95
|
+
For a clean reinstall or upgrade, use the latest published package:
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
npx -y @bybrawe/opencode-loop@latest
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
Then fully restart OpenCode.
|
|
102
|
+
|
|
103
|
+
Install from npm with `npx`:
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
npx -y @bybrawe/opencode-loop
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
On Windows CMD:
|
|
110
|
+
|
|
111
|
+
```bat
|
|
112
|
+
npx -y @bybrawe/opencode-loop
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
On Windows PowerShell:
|
|
116
|
+
|
|
117
|
+
```powershell
|
|
118
|
+
npx -y @bybrawe/opencode-loop
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
The installer copies the plugin and slash command files into your OpenCode config directory.
|
|
122
|
+
|
|
123
|
+
Windows target paths:
|
|
124
|
+
|
|
125
|
+
```text
|
|
126
|
+
%USERPROFILE%\.config\opencode\plugins\opencode-loop.js
|
|
127
|
+
%USERPROFILE%\.config\opencode\commands\loop*.md
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
macOS / Linux target paths:
|
|
131
|
+
|
|
132
|
+
```text
|
|
133
|
+
~/.config/opencode/plugins/opencode-loop.js
|
|
134
|
+
~/.config/opencode/commands/loop*.md
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
Then fully restart OpenCode and run:
|
|
138
|
+
|
|
139
|
+
```text
|
|
140
|
+
/loop-help
|
|
141
|
+
/loop-doctor
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
The npm package also installs the `opencode-loopd` CLI for background loops:
|
|
145
|
+
|
|
146
|
+
```bash
|
|
147
|
+
opencode-loopd --help
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
### Why `npx` is the recommended npm install
|
|
151
|
+
|
|
152
|
+
OpenCode can load npm plugins from the `plugin` array in `opencode.json`, but OpenCode slash commands are discovered from command definitions such as markdown files in a `commands/` directory or command entries in config.
|
|
153
|
+
|
|
154
|
+
The `npx` installer installs both parts:
|
|
155
|
+
|
|
156
|
+
- the OpenCode plugin file
|
|
157
|
+
- the `/loop-*` command markdown files
|
|
158
|
+
|
|
159
|
+
Use the OpenCode config-only method only if you already installed the command files separately or you are only testing plugin loading.
|
|
160
|
+
|
|
161
|
+
### Optional: OpenCode config package entry
|
|
162
|
+
|
|
163
|
+
If you want OpenCode to load the npm plugin package directly, add the scoped package name to your OpenCode config:
|
|
164
|
+
|
|
165
|
+
```json
|
|
166
|
+
{
|
|
167
|
+
"$schema": "https://opencode.ai/config.json",
|
|
168
|
+
"plugin": ["@bybrawe/opencode-loop"]
|
|
169
|
+
}
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
Use the scoped package name exactly as shown.
|
|
173
|
+
|
|
174
|
+
`opencode-loop` without `@bybrawe/` is a different npm package name.
|
|
175
|
+
|
|
176
|
+
If `/loop` does not appear after using only the config method, run the installer once:
|
|
177
|
+
|
|
178
|
+
```bash
|
|
179
|
+
npx -y @bybrawe/opencode-loop
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
### Install from GitHub
|
|
183
|
+
|
|
184
|
+
Use this if you want to install from source instead of npm.
|
|
185
|
+
|
|
186
|
+
Windows PowerShell:
|
|
187
|
+
|
|
188
|
+
```powershell
|
|
189
|
+
git clone https://github.com/ByBrawe/opencode-loop.git
|
|
190
|
+
cd opencode-loop
|
|
191
|
+
powershell -ExecutionPolicy Bypass -File .\scripts\install.ps1
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
macOS / Linux / Git Bash:
|
|
195
|
+
|
|
196
|
+
```bash
|
|
197
|
+
git clone https://github.com/ByBrawe/opencode-loop.git
|
|
198
|
+
cd opencode-loop
|
|
199
|
+
chmod +x ./scripts/install.sh
|
|
200
|
+
./scripts/install.sh
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
Then restart OpenCode and run:
|
|
204
|
+
|
|
205
|
+
```text
|
|
206
|
+
/loop-help
|
|
207
|
+
/loop-doctor
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
### Manual global install
|
|
211
|
+
|
|
212
|
+
Windows PowerShell:
|
|
213
|
+
|
|
214
|
+
```powershell
|
|
215
|
+
mkdir "$env:USERPROFILE\.config\opencode\plugins" -Force
|
|
216
|
+
mkdir "$env:USERPROFILE\.config\opencode\commands" -Force
|
|
217
|
+
copy .\src\index.js "$env:USERPROFILE\.config\opencode\plugins\opencode-loop.js"
|
|
218
|
+
copy .\commands\*.md "$env:USERPROFILE\.config\opencode\commands\"
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
macOS / Linux:
|
|
222
|
+
|
|
223
|
+
```bash
|
|
224
|
+
mkdir -p ~/.config/opencode/plugins ~/.config/opencode/commands
|
|
225
|
+
cp ./src/index.js ~/.config/opencode/plugins/opencode-loop.js
|
|
226
|
+
cp ./commands/*.md ~/.config/opencode/commands/
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
### Project-local install
|
|
230
|
+
|
|
231
|
+
Use this when you want the plugin to be available only inside one repository.
|
|
232
|
+
|
|
233
|
+
```bash
|
|
234
|
+
mkdir -p .opencode/plugins .opencode/commands
|
|
235
|
+
cp ./src/index.js .opencode/plugins/opencode-loop.js
|
|
236
|
+
cp ./commands/*.md .opencode/commands/
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
On Windows PowerShell:
|
|
240
|
+
|
|
241
|
+
```powershell
|
|
242
|
+
mkdir .opencode\plugins -Force
|
|
243
|
+
mkdir .opencode\commands -Force
|
|
244
|
+
copy .\src\index.js .opencode\plugins\opencode-loop.js
|
|
245
|
+
copy .\commands\*.md .opencode\commands\
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
### Verify installation
|
|
249
|
+
|
|
250
|
+
After restarting OpenCode, run:
|
|
251
|
+
|
|
252
|
+
```text
|
|
253
|
+
/loop-help
|
|
254
|
+
/loop-doctor
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
If the commands do not appear:
|
|
258
|
+
|
|
259
|
+
1. Make sure OpenCode was fully restarted.
|
|
260
|
+
2. Check that `opencode-loop.js` exists in the OpenCode plugin directory.
|
|
261
|
+
3. Check that `loop.md`, `loop-help.md`, and the other command files exist in the OpenCode commands directory.
|
|
262
|
+
4. Run `npx -y @bybrawe/opencode-loop` again to reinstall the command files.
|
|
263
|
+
|
|
264
|
+
## Quick start
|
|
265
|
+
|
|
266
|
+
```text
|
|
267
|
+
/loop 0s continue from progress.md and implement the next unfinished TODO
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
This is the closest behavior to a Claude Code CLI style loop: every time OpenCode becomes idle, the loop can send the next continuation prompt.
|
|
271
|
+
|
|
272
|
+
A safer development loop:
|
|
273
|
+
|
|
274
|
+
```text
|
|
275
|
+
/loop 0s --name dev --ask-never --safe --no-overlap --batch 5 --compact-every 200m --checkpoint-only --progress-file progress.md Treat progress.md as the main project state file. Continue with the next unfinished TODO, implement it, mark completed items with [x], add useful follow-up TODOs when you discover them, run tests/lint/build when available, and keep going while work remains.
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
Periodic compact:
|
|
279
|
+
|
|
280
|
+
```text
|
|
281
|
+
/loop 200m --name compact --no-now /compact
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
Test-fix loop:
|
|
285
|
+
|
|
286
|
+
```text
|
|
287
|
+
/loop 0s --name testfix --ask-never --safe --verify "npm test" Continue from progress.md. If tests fail, analyze the failure, fix it, and run the tests again.
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
Shell command loop:
|
|
291
|
+
|
|
292
|
+
```text
|
|
293
|
+
/loop 10m --name tests --safe !npm test
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
## Background daemon
|
|
297
|
+
|
|
298
|
+
The `/loop` command is session-bound. It works while OpenCode is open and the current session emits idle/status events.
|
|
299
|
+
|
|
300
|
+
If you close OpenCode, restart the terminal, lose connection, or your PC sleeps, the TUI loop will not keep running.
|
|
301
|
+
|
|
302
|
+
For long-running loops, use the daemon:
|
|
303
|
+
|
|
304
|
+
```bash
|
|
305
|
+
opencode-loopd --project . --every 5m --prompt-file loop-prompt.md
|
|
306
|
+
```
|
|
307
|
+
|
|
308
|
+
Run immediately after each OpenCode turn:
|
|
309
|
+
|
|
310
|
+
```bash
|
|
311
|
+
opencode-loopd --project . --every 0s --prompt "continue from progress.md and implement the next unfinished TODO"
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
Limit runs:
|
|
315
|
+
|
|
316
|
+
```bash
|
|
317
|
+
opencode-loopd --project . --every 5m --max-runs 20 --prompt-file loop-prompt.md
|
|
318
|
+
```
|
|
319
|
+
|
|
320
|
+
Wait before the first run:
|
|
321
|
+
|
|
322
|
+
```bash
|
|
323
|
+
opencode-loopd --project . --every 10m --sleep-first --prompt-file loop-prompt.md
|
|
324
|
+
```
|
|
325
|
+
|
|
326
|
+
Use an inline prompt:
|
|
327
|
+
|
|
328
|
+
```bash
|
|
329
|
+
opencode-loopd --project . --every 0s --prompt "continue from progress.md and implement the next unfinished TODO"
|
|
330
|
+
```
|
|
331
|
+
|
|
332
|
+
Example `loop-prompt.md`:
|
|
333
|
+
|
|
334
|
+
```md
|
|
335
|
+
Continue from progress.md and implement the next unfinished TODO.
|
|
336
|
+
|
|
337
|
+
Rules:
|
|
338
|
+
- Do not ask questions.
|
|
339
|
+
- Make reasonable assumptions.
|
|
340
|
+
- Mark completed TODO items with [x].
|
|
341
|
+
- Add useful follow-up TODOs when needed.
|
|
342
|
+
- Run tests/lint/build when available.
|
|
343
|
+
- Do not run destructive commands such as git reset, git clean, rm -rf, force push, deploy, or production migrations.
|
|
344
|
+
- Keep going while work remains.
|
|
345
|
+
```
|
|
346
|
+
|
|
347
|
+
## Windows Task Scheduler
|
|
348
|
+
|
|
349
|
+
You can create a Windows scheduled task that runs a one-shot daemon job every N minutes.
|
|
350
|
+
|
|
351
|
+
Install a scheduled task:
|
|
352
|
+
|
|
353
|
+
```powershell
|
|
354
|
+
opencode-loopd install-task --project "C:\path\to\project" --every 10m --prompt-file loop-prompt.md --name OpenCodeLoop
|
|
355
|
+
```
|
|
356
|
+
|
|
357
|
+
Remove it:
|
|
358
|
+
|
|
359
|
+
```powershell
|
|
360
|
+
opencode-loopd uninstall-task --name OpenCodeLoop
|
|
361
|
+
```
|
|
362
|
+
|
|
363
|
+
Check existing tasks:
|
|
364
|
+
|
|
365
|
+
```powershell
|
|
366
|
+
Get-ScheduledTask | Where-Object { $_.TaskName -like "*OpenCode*" }
|
|
367
|
+
```
|
|
368
|
+
|
|
369
|
+
For active development, a visible terminal running daemon mode is usually easier to monitor:
|
|
370
|
+
|
|
371
|
+
```powershell
|
|
372
|
+
opencode-loopd --project "C:\path\to\project" --every 0s --prompt-file loop-prompt.md
|
|
373
|
+
```
|
|
374
|
+
|
|
375
|
+
## Multiple loops and duplicate protection
|
|
376
|
+
|
|
377
|
+
By default, `/loop ...` uses an upsert/replace behavior. Running `/loop 5m ...` again replaces the existing default loop instead of creating duplicate jobs.
|
|
378
|
+
|
|
379
|
+
Use `--name` to manage separate named loops, or `--multi` when you intentionally want multiple loops with the same shape:
|
|
380
|
+
|
|
381
|
+
```text
|
|
382
|
+
/loop 5m --name dev continue from progress.md
|
|
383
|
+
/loop 200m --name compact /compact
|
|
384
|
+
/loop 10m --multi !npm test
|
|
385
|
+
```
|
|
386
|
+
|
|
387
|
+
## Core commands
|
|
388
|
+
|
|
389
|
+
| Command | Purpose |
|
|
390
|
+
|---|---|
|
|
391
|
+
| `/loop <interval> <action>` | Add an idle/interval loop job |
|
|
392
|
+
| `/loop-help` | Show usage help inside OpenCode |
|
|
393
|
+
| `/loop-status` | Show active loop jobs |
|
|
394
|
+
| `/loop-logs` | Show recent loop log entries |
|
|
395
|
+
| `/loop-now [id/name/number/all]` | Run loop job(s) immediately |
|
|
396
|
+
| `/loop-pause [id/name/number/all]` | Pause loop job(s) |
|
|
397
|
+
| `/loop-resume [id/name/number/all]` | Resume loop job(s) |
|
|
398
|
+
| `/loop-remove [id/name/number/all]` | Remove loop job(s) |
|
|
399
|
+
| `/loop-stop [id/name/number/all]` | Alias for remove/stop |
|
|
400
|
+
| `/loop-clear` | Remove all loop jobs for the current session |
|
|
401
|
+
| `/loop-doctor` | Diagnose plugin/session state |
|
|
402
|
+
| `/loop-init [file]` | Create a starter `progress.md` or another progress file |
|
|
403
|
+
| `/loop-export` | Export current loop state as JSON |
|
|
404
|
+
|
|
405
|
+
## Preset commands
|
|
406
|
+
|
|
407
|
+
| Command | Purpose |
|
|
408
|
+
|---|---|
|
|
409
|
+
| `/loop-dev 0s` | General autonomous OpenCode development loop |
|
|
410
|
+
| `/loop-progress 0s` | Follow `progress.md` and TODOs |
|
|
411
|
+
| `/loop-safe-dev 0s` | Safe dev loop with ask-never, batch 5, and patch checkpoints |
|
|
412
|
+
| `/loop-testfix 0s "npm test"` | Run, fix, and re-run tests |
|
|
413
|
+
| `/loop-compact 200m` | Compact loop shortcut |
|
|
414
|
+
|
|
415
|
+
## Intervals
|
|
416
|
+
|
|
417
|
+
```text
|
|
418
|
+
0s run whenever OpenCode becomes idle, like Claude Code auto-continue
|
|
419
|
+
5m run every 5 minutes when idle
|
|
420
|
+
200m run every 200 minutes when idle
|
|
421
|
+
1h run every hour when idle
|
|
422
|
+
```
|
|
423
|
+
|
|
424
|
+
The plugin is **idle-driven**. It checks jobs when OpenCode becomes idle, so it avoids intentionally starting a second agent turn on top of an active one.
|
|
425
|
+
|
|
426
|
+
## Actions
|
|
427
|
+
|
|
428
|
+
### Prompt action
|
|
429
|
+
|
|
430
|
+
```text
|
|
431
|
+
/loop 0s continue from progress.md. Work on the next unfinished TODO. Mark completed items with [x].
|
|
432
|
+
```
|
|
433
|
+
|
|
434
|
+
### Prompt file action
|
|
435
|
+
|
|
436
|
+
Use this when the prompt is too long for a single command line:
|
|
437
|
+
|
|
438
|
+
```text
|
|
439
|
+
/loop 0s --prompt-file loop-prompt.md
|
|
440
|
+
```
|
|
441
|
+
|
|
442
|
+
Example `loop-prompt.md`:
|
|
443
|
+
|
|
444
|
+
```md
|
|
445
|
+
Continue from progress.md.
|
|
446
|
+
Do not ask questions unless truly blocked.
|
|
447
|
+
Make reasonable assumptions and keep working.
|
|
448
|
+
Complete TODOs in order and mark finished items with [x].
|
|
449
|
+
Add useful follow-up TODOs when you discover them.
|
|
450
|
+
Run tests, lint, or build when available.
|
|
451
|
+
Do not run destructive commands, force pushes, production deploys, or database resets.
|
|
452
|
+
```
|
|
453
|
+
|
|
454
|
+
### Include extra context files
|
|
455
|
+
|
|
456
|
+
```text
|
|
457
|
+
/loop 0s --include-file ARCHITECTURE.md --include-file progress.md continue with the next implementation task
|
|
458
|
+
```
|
|
459
|
+
|
|
460
|
+
### Slash command action
|
|
461
|
+
|
|
462
|
+
```text
|
|
463
|
+
/loop 200m /compact
|
|
464
|
+
/loop 15m /review current changes
|
|
465
|
+
```
|
|
466
|
+
|
|
467
|
+
`/compact` and `/summarize` map to OpenCode session summarization.
|
|
468
|
+
|
|
469
|
+
### Shell action
|
|
470
|
+
|
|
471
|
+
```text
|
|
472
|
+
/loop 10m !npm test
|
|
473
|
+
/loop 30m $pnpm lint
|
|
474
|
+
```
|
|
475
|
+
|
|
476
|
+
Shell actions starting with `!` or `$` run through the OpenCode shell tool.
|
|
477
|
+
|
|
478
|
+
## Flags
|
|
479
|
+
|
|
480
|
+
### `--name <name>`
|
|
481
|
+
|
|
482
|
+
Name a loop so you can manage it later.
|
|
483
|
+
|
|
484
|
+
```text
|
|
485
|
+
/loop 0s --name dev continue from progress.md
|
|
486
|
+
/loop-pause dev
|
|
487
|
+
/loop-resume dev
|
|
488
|
+
/loop-stop dev
|
|
489
|
+
```
|
|
490
|
+
|
|
491
|
+
### `--max-runs <n>`
|
|
492
|
+
|
|
493
|
+
Stop after N runs.
|
|
494
|
+
|
|
495
|
+
```text
|
|
496
|
+
/loop 5m --max-runs 20 continue from progress.md
|
|
497
|
+
```
|
|
498
|
+
|
|
499
|
+
### `--max-runtime <duration>`
|
|
500
|
+
|
|
501
|
+
Stop after total runtime from loop creation.
|
|
502
|
+
|
|
503
|
+
```text
|
|
504
|
+
/loop 0s --max-runtime 6h continue from progress.md
|
|
505
|
+
```
|
|
506
|
+
|
|
507
|
+
### `--timeout <duration>`
|
|
508
|
+
|
|
509
|
+
Best-effort abort after a single run timeout.
|
|
510
|
+
|
|
511
|
+
```text
|
|
512
|
+
/loop 0s --timeout 30m continue from progress.md
|
|
513
|
+
```
|
|
514
|
+
|
|
515
|
+
### `--max-failures <n>`
|
|
516
|
+
|
|
517
|
+
Pause after repeated verify/postrun failures.
|
|
518
|
+
|
|
519
|
+
```text
|
|
520
|
+
/loop 0s --verify "npm test" --max-failures 3 continue from progress.md and fix test failures
|
|
521
|
+
```
|
|
522
|
+
|
|
523
|
+
### `--pause-on-verify-fail`
|
|
524
|
+
|
|
525
|
+
Pause immediately after the first verify failure.
|
|
526
|
+
|
|
527
|
+
```text
|
|
528
|
+
/loop 0s --verify "npm test" --pause-on-verify-fail continue from progress.md
|
|
529
|
+
```
|
|
530
|
+
|
|
531
|
+
### `--until <text>`
|
|
532
|
+
|
|
533
|
+
Stop when a marker appears in common state files such as `progress.md`, `TODO.md`, or `.opencode/opencode-loop/until.txt`.
|
|
534
|
+
|
|
535
|
+
```text
|
|
536
|
+
/loop 5m --until ALL_DONE continue from progress.md
|
|
537
|
+
```
|
|
538
|
+
|
|
539
|
+
### `--stop-file <file>`
|
|
540
|
+
|
|
541
|
+
Stop when a file appears. This is a simple manual kill switch.
|
|
542
|
+
|
|
543
|
+
```text
|
|
544
|
+
/loop 0s --stop-file STOP_LOOP continue from progress.md
|
|
545
|
+
```
|
|
546
|
+
|
|
547
|
+
Create `STOP_LOOP` in the project root to stop that job.
|
|
548
|
+
|
|
549
|
+
### `--no-overlap` and `--allow-overlap`
|
|
550
|
+
|
|
551
|
+
`--no-overlap` is the default. It prevents a new run from being triggered while a previous run is still considered active.
|
|
552
|
+
|
|
553
|
+
```text
|
|
554
|
+
/loop 5m --no-overlap continue from progress.md
|
|
555
|
+
```
|
|
556
|
+
|
|
557
|
+
### `--compact-every <n|duration>`
|
|
558
|
+
|
|
559
|
+
Compact before a run every N runs or every duration.
|
|
560
|
+
|
|
561
|
+
```text
|
|
562
|
+
/loop 0s --compact-every 20 continue from progress.md
|
|
563
|
+
/loop 0s --compact-every 200m continue from progress.md
|
|
564
|
+
```
|
|
565
|
+
|
|
566
|
+
### `--test "<command>"`
|
|
567
|
+
|
|
568
|
+
Adds a test instruction to prompt actions.
|
|
569
|
+
|
|
570
|
+
```text
|
|
571
|
+
/loop 0s --test "npm test" continue from progress.md
|
|
572
|
+
```
|
|
573
|
+
|
|
574
|
+
### `--verify "<command>"`
|
|
575
|
+
|
|
576
|
+
Runs a real shell verification command after each assistant turn. If it fails, the next loop prompt includes the failure summary so the agent can fix it.
|
|
577
|
+
|
|
578
|
+
```text
|
|
579
|
+
/loop 0s --verify "npm test" continue from progress.md and fix any failing tests
|
|
580
|
+
```
|
|
581
|
+
|
|
582
|
+
### `--preflight "<command>"`
|
|
583
|
+
|
|
584
|
+
Runs a real shell command before each loop turn. If it fails, the loop pauses.
|
|
585
|
+
|
|
586
|
+
```text
|
|
587
|
+
/loop 0s --preflight "npm install" continue from progress.md
|
|
588
|
+
```
|
|
589
|
+
|
|
590
|
+
### `--postrun "<command>"`
|
|
591
|
+
|
|
592
|
+
Runs a shell command after each assistant turn and verification.
|
|
593
|
+
|
|
594
|
+
```text
|
|
595
|
+
/loop 0s --postrun "git status --short" continue from progress.md
|
|
596
|
+
```
|
|
597
|
+
|
|
598
|
+
### `--notify "<command>"`
|
|
599
|
+
|
|
600
|
+
Runs a shell command when a loop stops or pauses due to a control condition. The command can use `{job}` and `{reason}` placeholders.
|
|
601
|
+
|
|
602
|
+
```text
|
|
603
|
+
/loop 0s --max-runtime 6h --notify "echo {job} stopped because {reason}" continue from progress.md
|
|
604
|
+
```
|
|
605
|
+
|
|
606
|
+
### `--checkpoint-only`
|
|
607
|
+
|
|
608
|
+
Save `git status` and `git diff --binary` snapshots under:
|
|
609
|
+
|
|
610
|
+
```text
|
|
611
|
+
.opencode/opencode-loop/checkpoints/<session>/
|
|
612
|
+
```
|
|
613
|
+
|
|
614
|
+
### `--git-checkpoint`
|
|
615
|
+
|
|
616
|
+
Save a patch checkpoint and attempt to commit all changes after each completed run.
|
|
617
|
+
|
|
618
|
+
```text
|
|
619
|
+
/loop 0s --git-checkpoint continue from progress.md
|
|
620
|
+
```
|
|
621
|
+
|
|
622
|
+
Use carefully. It runs `git add -A` and `git commit` when changes exist.
|
|
623
|
+
|
|
624
|
+
### `--branch <name>`
|
|
625
|
+
|
|
626
|
+
Switch to a branch before the first run, or create it if it does not exist.
|
|
627
|
+
|
|
628
|
+
```text
|
|
629
|
+
/loop 0s --branch ai-loop continue from progress.md
|
|
630
|
+
```
|
|
631
|
+
|
|
632
|
+
### `--safe`
|
|
633
|
+
|
|
634
|
+
Adds safety instructions to prompt actions and blocks obviously destructive shell actions.
|
|
635
|
+
|
|
636
|
+
```text
|
|
637
|
+
/loop 0s --safe continue from progress.md
|
|
638
|
+
```
|
|
639
|
+
|
|
640
|
+
Safe mode warns against or blocks patterns such as `git reset`, `git clean`, `rm -rf`, `git push`, `terraform destroy`, destructive delete commands, and production deploys.
|
|
641
|
+
|
|
642
|
+
### `--batch <n>`
|
|
643
|
+
|
|
644
|
+
Tell the agent to process at most N TODO items per run.
|
|
645
|
+
|
|
646
|
+
```text
|
|
647
|
+
/loop 0s --batch 5 continue from progress.md
|
|
648
|
+
```
|
|
649
|
+
|
|
650
|
+
### `--quiet`
|
|
651
|
+
|
|
652
|
+
Tell the agent to keep replies short.
|
|
653
|
+
|
|
654
|
+
```text
|
|
655
|
+
/loop 0s --quiet continue from progress.md
|
|
656
|
+
```
|
|
657
|
+
|
|
658
|
+
### `--ask-never`
|
|
659
|
+
|
|
660
|
+
Tell the agent not to ask questions and to make reasonable assumptions.
|
|
661
|
+
|
|
662
|
+
```text
|
|
663
|
+
/loop 0s --ask-never continue from progress.md
|
|
664
|
+
```
|
|
665
|
+
|
|
666
|
+
### `--progress-file <file>`
|
|
667
|
+
|
|
668
|
+
Tell the agent which state file to treat as the main progress/TODO source.
|
|
669
|
+
|
|
670
|
+
```text
|
|
671
|
+
/loop 0s --progress-file progress.md continue from the progress file
|
|
672
|
+
```
|
|
673
|
+
|
|
674
|
+
### `--watch <file>`
|
|
675
|
+
|
|
676
|
+
Run when watched file metadata changes. This is still checked on idle events.
|
|
677
|
+
|
|
678
|
+
```text
|
|
679
|
+
/loop --watch progress.md continue after progress.md changes
|
|
680
|
+
/loop 5m --watch progress.md continue when progress.md changes or the interval is due
|
|
681
|
+
```
|
|
682
|
+
|
|
683
|
+
You can pass multiple `--watch` flags.
|
|
684
|
+
|
|
685
|
+
### `--dry-run`
|
|
686
|
+
|
|
687
|
+
Parse and preview a loop without saving it.
|
|
688
|
+
|
|
689
|
+
```text
|
|
690
|
+
/loop 0s --dry-run --ask-never continue from progress.md
|
|
691
|
+
```
|
|
692
|
+
|
|
693
|
+
### `--now` and `--no-now`
|
|
694
|
+
|
|
695
|
+
By default a new loop is due immediately. Use `--no-now` to wait for the first interval.
|
|
696
|
+
|
|
697
|
+
```text
|
|
698
|
+
/loop 200m --no-now /compact
|
|
699
|
+
```
|
|
700
|
+
|
|
701
|
+
## Recommended recipes
|
|
702
|
+
|
|
703
|
+
### Claude Code style auto-continue loop
|
|
704
|
+
|
|
705
|
+
```text
|
|
706
|
+
/loop 0s --name dev --ask-never --safe --no-overlap --batch 5 --compact-every 200m --checkpoint-only --progress-file progress.md Treat progress.md as the main project state file. Continue with the next unfinished TODO, implement it, mark completed items with [x], add useful follow-up TODOs when you discover them, run tests/lint/build when available, and keep going while work remains.
|
|
707
|
+
```
|
|
708
|
+
|
|
709
|
+
### Long-running autonomous development loop
|
|
710
|
+
|
|
711
|
+
```text
|
|
712
|
+
/loop 0s --name dev --ask-never --safe --no-overlap --compact-every 20 --timeout 45m --max-runtime 6h --max-failures 3 --stop-file STOP_LOOP --checkpoint-only Continue from progress.md. Do not ask questions. Make reasonable assumptions. Complete TODOs in order, mark finished items with [x], add useful new ideas to progress.md, and keep going while work remains.
|
|
713
|
+
```
|
|
714
|
+
|
|
715
|
+
### Daemon-based long-running development loop
|
|
716
|
+
|
|
717
|
+
```bash
|
|
718
|
+
opencode-loopd --project . --every 5m --prompt-file loop-prompt.md
|
|
719
|
+
```
|
|
720
|
+
|
|
721
|
+
### Test-fix loop
|
|
722
|
+
|
|
723
|
+
```text
|
|
724
|
+
/loop 0s --name testfix --ask-never --safe --verify "npm test" --max-failures 3 Continue from progress.md. If tests fail, analyze the failure, fix it, and run the tests again.
|
|
725
|
+
```
|
|
726
|
+
|
|
727
|
+
### Compact loop
|
|
728
|
+
|
|
729
|
+
```text
|
|
730
|
+
/loop 200m --name compact --no-now /compact
|
|
731
|
+
```
|
|
732
|
+
|
|
733
|
+
### Prompt file loop
|
|
734
|
+
|
|
735
|
+
```text
|
|
736
|
+
/loop 0s --name dev --prompt-file loop-prompt.md --checkpoint-only --max-runtime 6h
|
|
737
|
+
```
|
|
738
|
+
|
|
739
|
+
## Suggested OpenCode permission config
|
|
740
|
+
|
|
741
|
+
Full `permission: "allow"` is convenient but risky. For safer long loops, keep destructive commands as ask/deny.
|
|
742
|
+
|
|
743
|
+
```json
|
|
744
|
+
{
|
|
745
|
+
"$schema": "https://opencode.ai/config.json",
|
|
746
|
+
"permission": {
|
|
747
|
+
"read": "allow",
|
|
748
|
+
"grep": "allow",
|
|
749
|
+
"glob": "allow",
|
|
750
|
+
"todowrite": "allow",
|
|
751
|
+
"edit": "allow",
|
|
752
|
+
"bash": {
|
|
753
|
+
"*": "ask",
|
|
754
|
+
"git status*": "allow",
|
|
755
|
+
"git diff*": "allow",
|
|
756
|
+
"npm test*": "allow",
|
|
757
|
+
"npm run test*": "allow",
|
|
758
|
+
"npm run lint*": "allow",
|
|
759
|
+
"pnpm test*": "allow",
|
|
760
|
+
"pnpm lint*": "allow",
|
|
761
|
+
"git push*": "ask",
|
|
762
|
+
"git reset*": "ask",
|
|
763
|
+
"git clean*": "deny",
|
|
764
|
+
"rm *": "deny",
|
|
765
|
+
"del *": "ask",
|
|
766
|
+
"rmdir *": "ask"
|
|
767
|
+
},
|
|
768
|
+
"external_directory": "ask"
|
|
769
|
+
}
|
|
770
|
+
}
|
|
771
|
+
```
|
|
772
|
+
|
|
773
|
+
## State files
|
|
774
|
+
|
|
775
|
+
Session loop state is stored under:
|
|
776
|
+
|
|
777
|
+
```text
|
|
778
|
+
.opencode/opencode-loop/
|
|
779
|
+
```
|
|
780
|
+
|
|
781
|
+
Patch checkpoints are stored under:
|
|
782
|
+
|
|
783
|
+
```text
|
|
784
|
+
.opencode/opencode-loop/checkpoints/
|
|
785
|
+
```
|
|
786
|
+
|
|
787
|
+
Recent plugin events are appended to:
|
|
788
|
+
|
|
789
|
+
```text
|
|
790
|
+
.opencode/opencode-loop/loop.log
|
|
791
|
+
```
|
|
792
|
+
|
|
793
|
+
## Example progress.md
|
|
794
|
+
|
|
795
|
+
Create one with:
|
|
796
|
+
|
|
797
|
+
```text
|
|
798
|
+
/loop-init
|
|
799
|
+
```
|
|
800
|
+
|
|
801
|
+
Example content:
|
|
802
|
+
|
|
803
|
+
```md
|
|
804
|
+
# Progress
|
|
805
|
+
|
|
806
|
+
## Current Goal
|
|
807
|
+
Improve the application in small safe steps.
|
|
808
|
+
|
|
809
|
+
## Agent Rules
|
|
810
|
+
- Do not ask questions unless truly blocked.
|
|
811
|
+
- Make reasonable assumptions and continue.
|
|
812
|
+
- Work on unfinished TODOs in order.
|
|
813
|
+
- Mark completed TODOs with [x].
|
|
814
|
+
- Add new bugs, ideas, or follow-up tasks as TODOs.
|
|
815
|
+
- Run tests/lint/build when available.
|
|
816
|
+
- Do not run destructive commands, force pushes, production deploys, or database resets.
|
|
817
|
+
|
|
818
|
+
## Active TODO
|
|
819
|
+
- [ ] Review the project structure and identify the next safe improvement.
|
|
820
|
+
- [ ] Fix the highest-priority failing test.
|
|
821
|
+
- [ ] Improve the user-facing error state in the main flow.
|
|
822
|
+
|
|
823
|
+
## Completed
|
|
824
|
+
- [x] Added initial project notes.
|
|
825
|
+
|
|
826
|
+
## Backlog Ideas
|
|
827
|
+
- [ ] Add a smoke test for the critical path.
|
|
828
|
+
- [ ] Improve developer setup documentation.
|
|
829
|
+
|
|
830
|
+
## Blocked
|
|
831
|
+
- None.
|
|
832
|
+
```
|
|
833
|
+
|
|
834
|
+
## Changelog highlights
|
|
835
|
+
|
|
836
|
+
### v0.5.4
|
|
837
|
+
|
|
838
|
+
- Fixed compatibility with recent OpenCode SDK/TUI call shapes.
|
|
839
|
+
- Updated prompt, shell, and toast calls for current OpenCode while keeping backwards-compatible fallbacks.
|
|
840
|
+
- Added `session.status` idle gating and debounce so loop runs do not stack on top of busy/queued agent turns.
|
|
841
|
+
- Improved logging around prompt/shell/toast failures instead of silently swallowing important runtime errors.
|
|
842
|
+
- Fixed the known update-related symptoms where `/loop` could appear queued, stay at `runs=0`, or only work intermittently.
|
|
843
|
+
|
|
844
|
+
### v0.5.1
|
|
845
|
+
|
|
846
|
+
- Cleaned up README installation docs.
|
|
847
|
+
- Removed duplicate npm install section.
|
|
848
|
+
- Removed unresolved merge conflict markers.
|
|
849
|
+
- Added clearer daemon mode documentation.
|
|
850
|
+
- Added Windows Task Scheduler examples.
|
|
851
|
+
- Added daemon usage examples for `--every`, `--max-runs`, `--sleep-first`, and `--prompt-file`.
|
|
852
|
+
|
|
853
|
+
### v0.5.0
|
|
854
|
+
|
|
855
|
+
- Added `opencode-loopd` background daemon.
|
|
856
|
+
- Added Windows Task Scheduler helper.
|
|
857
|
+
- Documented TUI loop vs daemon loop.
|
|
858
|
+
- Added background long-running loop examples.
|
|
859
|
+
|
|
860
|
+
### v0.4.3
|
|
861
|
+
|
|
862
|
+
- Added duplicate loop protection.
|
|
863
|
+
- Quieted command markdown files.
|
|
864
|
+
|
|
865
|
+
## Notes and limits
|
|
866
|
+
|
|
867
|
+
- The TUI plugin is idle-driven. It does not run a background daemon while OpenCode is busy.
|
|
868
|
+
- The TUI `/loop` command stops when OpenCode closes, the terminal closes, the machine sleeps, or the session stops emitting idle events.
|
|
869
|
+
- For long-running work outside the TUI, use `opencode-loopd`.
|
|
870
|
+
- `--timeout` is best-effort and relies on OpenCode's abort API.
|
|
871
|
+
- `--verify`, `--preflight`, `--postrun`, and `--notify` run shell commands, so configure OpenCode permissions carefully.
|
|
872
|
+
- `--until` scans common state files and a limited number of markdown/text/json/yaml files to avoid walking huge projects.
|
|
873
|
+
- `--safe` reduces risk but does not replace careful OpenCode permissions.
|
|
874
|
+
- For truly unattended multi-hour work, use a disposable branch or worktree and checkpoint patches.
|
|
875
|
+
|
|
876
|
+
## License
|
|
877
|
+
|
|
848
878
|
MIT
|