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