@bybrawe/opencode-loop 0.5.0 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +171 -141
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,14 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
**Claude Code style auto-continue for OpenCode.**
|
|
4
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.
|
|
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.
|
|
6
8
|
|
|
7
9
|
Repository: **ByBrawe/opencode-loop**
|
|
8
10
|
NPM package name: **@bybrawe/opencode-loop**
|
|
9
11
|
|
|
10
12
|
## Why this exists
|
|
11
13
|
|
|
12
|
-
Claude Code users often rely on a loop-like workflow where the agent finishes one step, then immediately continues with the next step.
|
|
14
|
+
Claude Code users often rely on a loop-like workflow where the agent finishes one step, then immediately continues with the next step.
|
|
15
|
+
|
|
16
|
+
OpenCode is powerful, but long-running autonomous workflows usually need extra control around:
|
|
13
17
|
|
|
14
18
|
- auto-continue after idle
|
|
15
19
|
- compact / summarize scheduling
|
|
@@ -18,6 +22,8 @@ Claude Code users often rely on a loop-like workflow where the agent finishes on
|
|
|
18
22
|
- patch checkpoints
|
|
19
23
|
- maximum runtime limits
|
|
20
24
|
- failure limits
|
|
25
|
+
- background daemon execution
|
|
26
|
+
- Windows Task Scheduler support
|
|
21
27
|
- safety prompts and destructive command guards
|
|
22
28
|
|
|
23
29
|
OpenCode Loop is designed for developers searching for:
|
|
@@ -32,16 +38,22 @@ OpenCode Loop is designed for developers searching for:
|
|
|
32
38
|
- Claude Code style loop for OpenCode
|
|
33
39
|
- autonomous coding loop for OpenCode
|
|
34
40
|
- progress.md TODO automation for OpenCode
|
|
41
|
+
- OpenCode background daemon
|
|
42
|
+
- OpenCode loop daemon
|
|
43
|
+
- OpenCode Windows Task Scheduler loop
|
|
35
44
|
|
|
36
45
|
## Features
|
|
37
46
|
|
|
38
|
-
>
|
|
39
|
-
|
|
47
|
+
> 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.
|
|
40
48
|
|
|
41
|
-
- **Claude Code style auto-continue** with `/loop 0s ...`.
|
|
49
|
+
- **Claude Code style auto-continue** with `/loop 0s ...`.
|
|
50
|
+
- **TUI loop mode** with `/loop`, active while OpenCode is open.
|
|
42
51
|
- **Background daemon mode** with `opencode-loopd` for long-running loops outside the OpenCode TUI.
|
|
52
|
+
- **Windows Task Scheduler helper** with `opencode-loopd install-task`.
|
|
53
|
+
- **One-shot scheduled runs** for periodic continuation jobs.
|
|
43
54
|
- **Interval loops** for prompts, slash commands, and shell commands.
|
|
44
55
|
- **Prompt-file support** with `--prompt-file loop-prompt.md` for long reusable instructions.
|
|
56
|
+
- **Prompt-file daemon support** with `opencode-loopd --prompt-file loop-prompt.md`.
|
|
45
57
|
- **Include extra context files** with `--include-file`.
|
|
46
58
|
- **progress.md workflow** with `--progress-file progress.md`.
|
|
47
59
|
- **Large TODO support** with `--batch`.
|
|
@@ -51,6 +63,8 @@ OpenCode Loop is designed for developers searching for:
|
|
|
51
63
|
- **Post-run commands** with `--postrun`.
|
|
52
64
|
- **Failure control** with `--max-failures` and `--pause-on-verify-fail`.
|
|
53
65
|
- **Runtime control** with `--max-runtime 6h`.
|
|
66
|
+
- **Run limit support** with `--max-runs`.
|
|
67
|
+
- **Sleep-before-first-run support** with `--sleep-first`.
|
|
54
68
|
- **Checkpoints** with `--checkpoint-only` or `--git-checkpoint`.
|
|
55
69
|
- **Safe mode** with `--safe` and prompt-level destructive command warnings.
|
|
56
70
|
- **Branch setup** with `--branch ai-loop`.
|
|
@@ -60,94 +74,6 @@ OpenCode Loop is designed for developers searching for:
|
|
|
60
74
|
- **Starter progress file** with `/loop-init`.
|
|
61
75
|
- **State export** with `/loop-export`.
|
|
62
76
|
|
|
63
|
-
## Quick start
|
|
64
|
-
|
|
65
|
-
```text
|
|
66
|
-
/loop 0s continue from progress.md and implement the next unfinished TODO
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
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.
|
|
70
|
-
|
|
71
|
-
A safer development loop:
|
|
72
|
-
|
|
73
|
-
```text
|
|
74
|
-
/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.
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
Periodic compact:
|
|
78
|
-
|
|
79
|
-
```text
|
|
80
|
-
/loop 200m --name compact --no-now /compact
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
Test-fix loop:
|
|
84
|
-
|
|
85
|
-
```text
|
|
86
|
-
/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.
|
|
87
|
-
```
|
|
88
|
-
|
|
89
|
-
Shell command loop:
|
|
90
|
-
|
|
91
|
-
```text
|
|
92
|
-
/loop 10m --name tests --safe !npm test
|
|
93
|
-
```
|
|
94
|
-
|
|
95
|
-
## Background daemon
|
|
96
|
-
|
|
97
|
-
The `/loop` command is session-bound. It works while OpenCode is open and the current session emits idle/status events.
|
|
98
|
-
|
|
99
|
-
If you close OpenCode, restart the terminal, lose connection, or your PC sleeps, the TUI loop will not keep running.
|
|
100
|
-
|
|
101
|
-
For long-running loops, use the daemon:
|
|
102
|
-
|
|
103
|
-
```bash
|
|
104
|
-
opencode-loopd --project . --every 5m --prompt-file loop-prompt.md
|
|
105
|
-
```
|
|
106
|
-
|
|
107
|
-
Run immediately after each OpenCode turn:
|
|
108
|
-
|
|
109
|
-
```bash
|
|
110
|
-
opencode-loopd --project . --every 0s --prompt "continue from progress.md and implement the next unfinished TODO"
|
|
111
|
-
```
|
|
112
|
-
|
|
113
|
-
Limit runs:
|
|
114
|
-
|
|
115
|
-
```bash
|
|
116
|
-
opencode-loopd --project . --every 5m --max-runs 20 --prompt-file loop-prompt.md
|
|
117
|
-
```
|
|
118
|
-
|
|
119
|
-
Example `loop-prompt.md`:
|
|
120
|
-
|
|
121
|
-
```md
|
|
122
|
-
Continue from progress.md and implement the next unfinished TODO.
|
|
123
|
-
|
|
124
|
-
Rules:
|
|
125
|
-
- Do not ask questions.
|
|
126
|
-
- Make reasonable assumptions.
|
|
127
|
-
- Mark completed TODO items with [x].
|
|
128
|
-
- Add useful follow-up TODOs when needed.
|
|
129
|
-
- Run tests/lint/build when available.
|
|
130
|
-
- Do not run destructive commands such as git reset, git clean, rm -rf, force push, deploy, or production migrations.
|
|
131
|
-
- Keep going while work remains.
|
|
132
|
-
```
|
|
133
|
-
|
|
134
|
-
### Windows Task Scheduler
|
|
135
|
-
|
|
136
|
-
You can create a Windows scheduled task that runs a one-shot daemon job every N minutes:
|
|
137
|
-
|
|
138
|
-
```powershell
|
|
139
|
-
opencode-loopd install-task --project "C:\path\to\project" --every 10m --prompt-file loop-prompt.md --name OpenCodeLoop
|
|
140
|
-
```
|
|
141
|
-
|
|
142
|
-
Remove it:
|
|
143
|
-
|
|
144
|
-
```powershell
|
|
145
|
-
opencode-loopd uninstall-task --name OpenCodeLoop
|
|
146
|
-
```
|
|
147
|
-
|
|
148
|
-
For active development, a visible terminal running `opencode-loopd --project . --every 0s ...` is easier to monitor.
|
|
149
|
-
|
|
150
|
-
|
|
151
77
|
## Installation
|
|
152
78
|
|
|
153
79
|
### Recommended: install from npm
|
|
@@ -191,17 +117,22 @@ Then fully restart OpenCode and run:
|
|
|
191
117
|
```text
|
|
192
118
|
/loop-help
|
|
193
119
|
/loop-doctor
|
|
194
|
-
```
|
|
195
|
-
|
|
196
|
-
The npm package also installs the `opencode-loopd` CLI for background loops:
|
|
197
|
-
|
|
198
|
-
```bash
|
|
199
|
-
opencode-loopd --help
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
The npm package also installs the `opencode-loopd` CLI for background loops:
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
opencode-loopd --help
|
|
200
126
|
```
|
|
201
127
|
|
|
202
128
|
### Why `npx` is the recommended npm install
|
|
203
129
|
|
|
204
|
-
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.
|
|
130
|
+
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.
|
|
131
|
+
|
|
132
|
+
The `npx` installer installs both parts:
|
|
133
|
+
|
|
134
|
+
- the OpenCode plugin file
|
|
135
|
+
- the `/loop-*` command markdown files
|
|
205
136
|
|
|
206
137
|
Use the OpenCode config-only method only if you already installed the command files separately or you are only testing plugin loading.
|
|
207
138
|
|
|
@@ -216,7 +147,9 @@ If you want OpenCode to load the npm plugin package directly, add the scoped pac
|
|
|
216
147
|
}
|
|
217
148
|
```
|
|
218
149
|
|
|
219
|
-
Use the scoped package name exactly as shown.
|
|
150
|
+
Use the scoped package name exactly as shown.
|
|
151
|
+
|
|
152
|
+
`opencode-loop` without `@bybrawe/` is a different npm package name.
|
|
220
153
|
|
|
221
154
|
If `/loop` does not appear after using only the config method, run the installer once:
|
|
222
155
|
|
|
@@ -290,52 +223,132 @@ copy .\src\index.js .opencode\plugins\opencode-loop.js
|
|
|
290
223
|
copy .\commands\*.md .opencode\commands\
|
|
291
224
|
```
|
|
292
225
|
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
226
|
+
### Verify installation
|
|
227
|
+
|
|
228
|
+
After restarting OpenCode, run:
|
|
229
|
+
|
|
230
|
+
```text
|
|
231
|
+
/loop-help
|
|
232
|
+
/loop-doctor
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
If the commands do not appear:
|
|
236
|
+
|
|
237
|
+
1. Make sure OpenCode was fully restarted.
|
|
238
|
+
2. Check that `opencode-loop.js` exists in the OpenCode plugin directory.
|
|
239
|
+
3. Check that `loop.md`, `loop-help.md`, and the other command files exist in the OpenCode commands directory.
|
|
240
|
+
4. Run `npx -y @bybrawe/opencode-loop` again to reinstall the command files.
|
|
241
|
+
|
|
242
|
+
## Quick start
|
|
243
|
+
|
|
244
|
+
```text
|
|
245
|
+
/loop 0s continue from progress.md and implement the next unfinished TODO
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
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.
|
|
249
|
+
|
|
250
|
+
A safer development loop:
|
|
251
|
+
|
|
252
|
+
```text
|
|
253
|
+
/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.
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
Periodic compact:
|
|
296
257
|
|
|
297
|
-
|
|
258
|
+
```text
|
|
259
|
+
/loop 200m --name compact --no-now /compact
|
|
260
|
+
```
|
|
298
261
|
|
|
299
|
-
|
|
262
|
+
Test-fix loop:
|
|
300
263
|
|
|
301
264
|
```text
|
|
302
|
-
|
|
265
|
+
/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.
|
|
303
266
|
```
|
|
304
267
|
|
|
305
|
-
|
|
268
|
+
Shell command loop:
|
|
269
|
+
|
|
270
|
+
```text
|
|
271
|
+
/loop 10m --name tests --safe !npm test
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
## Background daemon
|
|
275
|
+
|
|
276
|
+
The `/loop` command is session-bound. It works while OpenCode is open and the current session emits idle/status events.
|
|
277
|
+
|
|
278
|
+
If you close OpenCode, restart the terminal, lose connection, or your PC sleeps, the TUI loop will not keep running.
|
|
279
|
+
|
|
280
|
+
For long-running loops, use the daemon:
|
|
306
281
|
|
|
307
282
|
```bash
|
|
308
|
-
|
|
283
|
+
opencode-loopd --project . --every 5m --prompt-file loop-prompt.md
|
|
309
284
|
```
|
|
310
285
|
|
|
311
|
-
|
|
286
|
+
Run immediately after each OpenCode turn:
|
|
312
287
|
|
|
313
|
-
|
|
288
|
+
```bash
|
|
289
|
+
opencode-loopd --project . --every 0s --prompt "continue from progress.md and implement the next unfinished TODO"
|
|
290
|
+
```
|
|
314
291
|
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
}
|
|
292
|
+
Limit runs:
|
|
293
|
+
|
|
294
|
+
```bash
|
|
295
|
+
opencode-loopd --project . --every 5m --max-runs 20 --prompt-file loop-prompt.md
|
|
320
296
|
```
|
|
321
297
|
|
|
298
|
+
Wait before the first run:
|
|
322
299
|
|
|
323
|
-
|
|
324
|
-
|
|
300
|
+
```bash
|
|
301
|
+
opencode-loopd --project . --every 10m --sleep-first --prompt-file loop-prompt.md
|
|
302
|
+
```
|
|
325
303
|
|
|
326
|
-
|
|
304
|
+
Use an inline prompt:
|
|
327
305
|
|
|
328
|
-
```
|
|
329
|
-
|
|
330
|
-
/loop-doctor
|
|
306
|
+
```bash
|
|
307
|
+
opencode-loopd --project . --every 0s --prompt "continue from progress.md and implement the next unfinished TODO"
|
|
331
308
|
```
|
|
332
309
|
|
|
333
|
-
|
|
310
|
+
Example `loop-prompt.md`:
|
|
334
311
|
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
312
|
+
```md
|
|
313
|
+
Continue from progress.md and implement the next unfinished TODO.
|
|
314
|
+
|
|
315
|
+
Rules:
|
|
316
|
+
- Do not ask questions.
|
|
317
|
+
- Make reasonable assumptions.
|
|
318
|
+
- Mark completed TODO items with [x].
|
|
319
|
+
- Add useful follow-up TODOs when needed.
|
|
320
|
+
- Run tests/lint/build when available.
|
|
321
|
+
- Do not run destructive commands such as git reset, git clean, rm -rf, force push, deploy, or production migrations.
|
|
322
|
+
- Keep going while work remains.
|
|
323
|
+
```
|
|
324
|
+
|
|
325
|
+
## Windows Task Scheduler
|
|
326
|
+
|
|
327
|
+
You can create a Windows scheduled task that runs a one-shot daemon job every N minutes.
|
|
328
|
+
|
|
329
|
+
Install a scheduled task:
|
|
330
|
+
|
|
331
|
+
```powershell
|
|
332
|
+
opencode-loopd install-task --project "C:\path\to\project" --every 10m --prompt-file loop-prompt.md --name OpenCodeLoop
|
|
333
|
+
```
|
|
334
|
+
|
|
335
|
+
Remove it:
|
|
336
|
+
|
|
337
|
+
```powershell
|
|
338
|
+
opencode-loopd uninstall-task --name OpenCodeLoop
|
|
339
|
+
```
|
|
340
|
+
|
|
341
|
+
Check existing tasks:
|
|
342
|
+
|
|
343
|
+
```powershell
|
|
344
|
+
Get-ScheduledTask | Where-Object { $_.TaskName -like "*OpenCode*" }
|
|
345
|
+
```
|
|
346
|
+
|
|
347
|
+
For active development, a visible terminal running daemon mode is usually easier to monitor:
|
|
348
|
+
|
|
349
|
+
```powershell
|
|
350
|
+
opencode-loopd --project "C:\path\to\project" --every 0s --prompt-file loop-prompt.md
|
|
351
|
+
```
|
|
339
352
|
|
|
340
353
|
## Multiple loops and duplicate protection
|
|
341
354
|
|
|
@@ -677,6 +690,12 @@ By default a new loop is due immediately. Use `--no-now` to wait for the first i
|
|
|
677
690
|
/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.
|
|
678
691
|
```
|
|
679
692
|
|
|
693
|
+
### Daemon-based long-running development loop
|
|
694
|
+
|
|
695
|
+
```bash
|
|
696
|
+
opencode-loopd --project . --every 5m --prompt-file loop-prompt.md
|
|
697
|
+
```
|
|
698
|
+
|
|
680
699
|
### Test-fix loop
|
|
681
700
|
|
|
682
701
|
```text
|
|
@@ -790,23 +809,34 @@ Improve the application in small safe steps.
|
|
|
790
809
|
- None.
|
|
791
810
|
```
|
|
792
811
|
|
|
793
|
-
##
|
|
812
|
+
## Changelog highlights
|
|
813
|
+
|
|
814
|
+
### v0.5.1
|
|
815
|
+
|
|
816
|
+
- Cleaned up README installation docs.
|
|
817
|
+
- Removed duplicate npm install section.
|
|
818
|
+
- Removed unresolved merge conflict markers.
|
|
819
|
+
- Added clearer daemon mode documentation.
|
|
820
|
+
- Added Windows Task Scheduler examples.
|
|
821
|
+
- Added daemon usage examples for `--every`, `--max-runs`, `--sleep-first`, and `--prompt-file`.
|
|
822
|
+
|
|
823
|
+
### v0.5.0
|
|
824
|
+
|
|
825
|
+
- Added `opencode-loopd` background daemon.
|
|
826
|
+
- Added Windows Task Scheduler helper.
|
|
827
|
+
- Documented TUI loop vs daemon loop.
|
|
828
|
+
- Added background long-running loop examples.
|
|
829
|
+
|
|
830
|
+
### v0.4.3
|
|
794
831
|
|
|
795
|
-
-
|
|
796
|
-
-
|
|
797
|
-
- Added `--prompt-file` for long prompts instead of huge command lines.
|
|
798
|
-
- Added `--include-file` for extra context files.
|
|
799
|
-
- Added `--max-runtime` so loops can stop after a total runtime.
|
|
800
|
-
- Added `--max-failures` and `--pause-on-verify-fail` for failing verification loops.
|
|
801
|
-
- Added `--postrun` and `--notify` hooks.
|
|
802
|
-
- Added `/loop-doctor`, `/loop-init`, and `/loop-export`.
|
|
803
|
-
- Fixed the max-runs/checkpoint ordering issue so the last run can still finalize and checkpoint.
|
|
804
|
-
- Improved no-overlap behavior and state cleanup for non-assistant actions such as `/compact`.
|
|
805
|
-
- Kept all README examples in English for public GitHub discovery.
|
|
832
|
+
- Added duplicate loop protection.
|
|
833
|
+
- Quieted command markdown files.
|
|
806
834
|
|
|
807
835
|
## Notes and limits
|
|
808
836
|
|
|
809
|
-
- The plugin is idle-driven. It does not run a background daemon while OpenCode is busy.
|
|
837
|
+
- The TUI plugin is idle-driven. It does not run a background daemon while OpenCode is busy.
|
|
838
|
+
- The TUI `/loop` command stops when OpenCode closes, the terminal closes, the machine sleeps, or the session stops emitting idle events.
|
|
839
|
+
- For long-running work outside the TUI, use `opencode-loopd`.
|
|
810
840
|
- `--timeout` is best-effort and relies on OpenCode's abort API.
|
|
811
841
|
- `--verify`, `--preflight`, `--postrun`, and `--notify` run shell commands, so configure OpenCode permissions carefully.
|
|
812
842
|
- `--until` scans common state files and a limited number of markdown/text/json/yaml files to avoid walking huge projects.
|
|
@@ -815,4 +845,4 @@ Improve the application in small safe steps.
|
|
|
815
845
|
|
|
816
846
|
## License
|
|
817
847
|
|
|
818
|
-
MIT
|
|
848
|
+
MIT
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bybrawe/opencode-loop",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"description": "Claude Code style /loop command and background daemon for OpenCode: auto-continue, progress.md TODO automation, compact scheduling, verification, checkpoints, and safe autonomous coding loops.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.js",
|