@sylphx/flow 0.2.13 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (129) hide show
  1. package/CHANGELOG.md +185 -0
  2. package/LOOP_MODE.md +446 -0
  3. package/package.json +44 -93
  4. package/README.md +0 -625
  5. package/assets/agents/coder.md +0 -32
  6. package/assets/agents/orchestrator.md +0 -36
  7. package/assets/agents/reviewer.md +0 -30
  8. package/assets/agents/writer.md +0 -30
  9. package/assets/knowledge/data/sql.md +0 -216
  10. package/assets/knowledge/guides/saas-template.md +0 -85
  11. package/assets/knowledge/guides/system-prompt.md +0 -344
  12. package/assets/knowledge/guides/tech-stack.md +0 -92
  13. package/assets/knowledge/guides/ui-ux.md +0 -44
  14. package/assets/knowledge/stacks/nextjs-app.md +0 -165
  15. package/assets/knowledge/stacks/node-api.md +0 -220
  16. package/assets/knowledge/stacks/react-app.md +0 -232
  17. package/assets/knowledge/universal/deployment.md +0 -109
  18. package/assets/knowledge/universal/performance.md +0 -121
  19. package/assets/knowledge/universal/security.md +0 -79
  20. package/assets/knowledge/universal/testing.md +0 -111
  21. package/assets/output-styles/silent.md +0 -23
  22. package/assets/rules/core.md +0 -197
  23. package/assets/slash-commands/commit.md +0 -23
  24. package/assets/slash-commands/context.md +0 -112
  25. package/assets/slash-commands/explain.md +0 -35
  26. package/assets/slash-commands/mep.md +0 -63
  27. package/assets/slash-commands/review.md +0 -39
  28. package/assets/slash-commands/test.md +0 -30
  29. package/dist/assets/agents/coder.md +0 -32
  30. package/dist/assets/agents/orchestrator.md +0 -36
  31. package/dist/assets/agents/reviewer.md +0 -30
  32. package/dist/assets/agents/writer.md +0 -30
  33. package/dist/assets/knowledge/data/sql.md +0 -216
  34. package/dist/assets/knowledge/guides/saas-template.md +0 -85
  35. package/dist/assets/knowledge/guides/system-prompt.md +0 -344
  36. package/dist/assets/knowledge/guides/tech-stack.md +0 -92
  37. package/dist/assets/knowledge/guides/ui-ux.md +0 -44
  38. package/dist/assets/knowledge/stacks/nextjs-app.md +0 -165
  39. package/dist/assets/knowledge/stacks/node-api.md +0 -220
  40. package/dist/assets/knowledge/stacks/react-app.md +0 -232
  41. package/dist/assets/knowledge/universal/deployment.md +0 -109
  42. package/dist/assets/knowledge/universal/performance.md +0 -121
  43. package/dist/assets/knowledge/universal/security.md +0 -79
  44. package/dist/assets/knowledge/universal/testing.md +0 -111
  45. package/dist/assets/output-styles/silent.md +0 -23
  46. package/dist/assets/rules/core.md +0 -197
  47. package/dist/assets/slash-commands/commit.md +0 -23
  48. package/dist/assets/slash-commands/context.md +0 -112
  49. package/dist/assets/slash-commands/explain.md +0 -35
  50. package/dist/assets/slash-commands/mep.md +0 -63
  51. package/dist/assets/slash-commands/review.md +0 -39
  52. package/dist/assets/slash-commands/test.md +0 -30
  53. package/dist/chunk-01gv4qey.js +0 -4
  54. package/dist/chunk-01gv4qey.js.map +0 -11
  55. package/dist/chunk-1e8xf3f6.js +0 -27
  56. package/dist/chunk-1e8xf3f6.js.map +0 -23
  57. package/dist/chunk-3m9whg4q.js +0 -4
  58. package/dist/chunk-3m9whg4q.js.map +0 -9
  59. package/dist/chunk-3qxj0zy3.js +0 -23
  60. package/dist/chunk-3qxj0zy3.js.map +0 -11
  61. package/dist/chunk-3w6pd43t.js +0 -25
  62. package/dist/chunk-3w6pd43t.js.map +0 -61
  63. package/dist/chunk-4e5g3df9.js +0 -105
  64. package/dist/chunk-4e5g3df9.js.map +0 -27
  65. package/dist/chunk-4nm4ere4.js +0 -4
  66. package/dist/chunk-4nm4ere4.js.map +0 -11
  67. package/dist/chunk-4vrj3f8r.js +0 -26
  68. package/dist/chunk-4vrj3f8r.js.map +0 -75
  69. package/dist/chunk-5njgv5k5.js +0 -161
  70. package/dist/chunk-5njgv5k5.js.map +0 -83
  71. package/dist/chunk-67n29s4q.js +0 -7
  72. package/dist/chunk-67n29s4q.js.map +0 -10
  73. package/dist/chunk-7yyg008s.js +0 -27
  74. package/dist/chunk-7yyg008s.js.map +0 -14
  75. package/dist/chunk-86ce45n6.js +0 -3
  76. package/dist/chunk-86ce45n6.js.map +0 -10
  77. package/dist/chunk-99pz5wm0.js +0 -75
  78. package/dist/chunk-99pz5wm0.js.map +0 -12
  79. package/dist/chunk-cv1nhr27.js +0 -2
  80. package/dist/chunk-cv1nhr27.js.map +0 -9
  81. package/dist/chunk-g4baca7p.js +0 -10
  82. package/dist/chunk-g4baca7p.js.map +0 -23
  83. package/dist/chunk-gc66xe7z.js +0 -4
  84. package/dist/chunk-gc66xe7z.js.map +0 -11
  85. package/dist/chunk-hj6qtsqp.js +0 -15
  86. package/dist/chunk-hj6qtsqp.js.map +0 -10
  87. package/dist/chunk-jbd95k1f.js +0 -14
  88. package/dist/chunk-jbd95k1f.js.map +0 -20
  89. package/dist/chunk-jk1ebfqn.js +0 -23
  90. package/dist/chunk-jk1ebfqn.js.map +0 -132
  91. package/dist/chunk-kn908zkk.js +0 -4
  92. package/dist/chunk-kn908zkk.js.map +0 -10
  93. package/dist/chunk-mw13a082.js +0 -4
  94. package/dist/chunk-mw13a082.js.map +0 -10
  95. package/dist/chunk-n8vzewr3.js +0 -4
  96. package/dist/chunk-n8vzewr3.js.map +0 -12
  97. package/dist/chunk-nke51f3c.js +0 -4
  98. package/dist/chunk-nke51f3c.js.map +0 -10
  99. package/dist/chunk-ns5atzyz.js +0 -3
  100. package/dist/chunk-ns5atzyz.js.map +0 -10
  101. package/dist/chunk-q4nh3vst.js +0 -54
  102. package/dist/chunk-q4nh3vst.js.map +0 -53
  103. package/dist/chunk-q5gqgs0p.js +0 -4
  104. package/dist/chunk-q5gqgs0p.js.map +0 -10
  105. package/dist/chunk-qpej66sh.js +0 -6
  106. package/dist/chunk-qpej66sh.js.map +0 -11
  107. package/dist/chunk-s9bsh0gp.js +0 -4
  108. package/dist/chunk-s9bsh0gp.js.map +0 -10
  109. package/dist/chunk-waemzsf4.js +0 -4
  110. package/dist/chunk-waemzsf4.js.map +0 -10
  111. package/dist/chunk-wnhhwtsy.js +0 -19
  112. package/dist/chunk-wnhhwtsy.js.map +0 -11
  113. package/dist/chunk-xs370t8p.js +0 -119
  114. package/dist/chunk-xs370t8p.js.map +0 -26
  115. package/dist/chunk-xtrn4wn0.js +0 -3
  116. package/dist/chunk-xtrn4wn0.js.map +0 -10
  117. package/dist/index.js +0 -854
  118. package/dist/index.js.map +0 -920
  119. package/drizzle/0000_wooden_lady_bullseye.sql +0 -52
  120. package/drizzle/0001_material_pyro.sql +0 -85
  121. package/drizzle/0002_lyrical_random.sql +0 -2
  122. package/drizzle/0003_romantic_lockjaw.sql +0 -4
  123. package/drizzle/0004_blushing_meteorite.sql +0 -6
  124. package/drizzle/meta/0000_snapshot.json +0 -310
  125. package/drizzle/meta/0001_snapshot.json +0 -906
  126. package/drizzle/meta/0002_snapshot.json +0 -920
  127. package/drizzle/meta/0003_snapshot.json +0 -920
  128. package/drizzle/meta/0004_snapshot.json +0 -921
  129. package/drizzle/meta/_journal.json +0 -41
package/CHANGELOG.md ADDED
@@ -0,0 +1,185 @@
1
+ # @sylphx/flow
2
+
3
+ ## 1.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - # 1.0.0 - Major Release
8
+
9
+ Sylphx Flow 1.0.0 is a complete reimagination of AI-powered development workflow automation. This release represents months of refinement, optimization, and user feedback integration.
10
+
11
+ ## 🚀 Major Features
12
+
13
+ ### Loop Mode - Autonomous Continuous Execution
14
+
15
+ Revolutionary loop mode that enables truly autonomous AI agents:
16
+
17
+ - **Continuous execution** with automatic context preservation
18
+ - **Zero wait time default** - task execution is the natural interval
19
+ - **Smart continue mode** - auto-enables from 2nd iteration
20
+ - **Graceful shutdown** - Ctrl+C handling with summaries
21
+ - **Configurable wait times** for rate limiting or polling scenarios
22
+
23
+ ```bash
24
+ # Continuous autonomous work
25
+ sylphx-flow "process all github issues" --loop
26
+
27
+ # With wait time for polling
28
+ sylphx-flow "check for new commits" --loop 300 --max-runs 20
29
+ ```
30
+
31
+ ### File Input Support
32
+
33
+ Load prompts from files for complex, reusable instructions:
34
+
35
+ - **@file syntax** - `@prompt.txt` or `@/path/to/prompt.txt`
36
+ - **No shell escaping issues** - write natural language prompts
37
+ - **Version control friendly** - commit prompts alongside code
38
+ - **Works seamlessly with loop mode**
39
+
40
+ ```bash
41
+ # Use file input
42
+ sylphx-flow "@task.txt" --loop --max-runs 10
43
+ ```
44
+
45
+ ### Smart Configuration System
46
+
47
+ Intelligent defaults that learn from your choices:
48
+
49
+ - **Auto-saves preferences** - provider, agent, target selections
50
+ - **Smart defaults** - uses saved preferences automatically
51
+ - **Selective override** - `--select-provider` / `--select-agent` flags
52
+ - **Inline API key setup** - configure keys when selecting providers
53
+ - **No repeated prompts** - set once, use forever
54
+
55
+ ### OpenCode Integration
56
+
57
+ Full support for OpenCode (Claude Code alternative):
58
+
59
+ - **Auto-detection** of OpenCode installation
60
+ - **Target-aware component checking**
61
+ - **JSONC config parsing** for OpenCode's commented configs
62
+ - **Directory structure adaptation** (singular vs plural naming)
63
+ - **Automatic migration** from old directory structures
64
+
65
+ ## 🔧 Major Improvements
66
+
67
+ ### Flow Orchestrator Architecture
68
+
69
+ Complete refactor for separation of concerns:
70
+
71
+ - **Modular design** - clean separation of init/setup/launch phases
72
+ - **State-driven decisions** - smart detection of project state
73
+ - **Positive logic patterns** - explicit conditions instead of negative flags
74
+ - **Component integrity** - automatic detection and repair of missing components
75
+
76
+ ### Performance Optimizations
77
+
78
+ - **Loop mode optimization** - setup once, execute repeatedly (no redundant checks)
79
+ - **Parallel execution** - concurrent independent operations
80
+ - **Smart caching** - reuse configuration across runs
81
+ - **Reduced overhead** - streamlined initialization flow
82
+
83
+ ### Developer Experience
84
+
85
+ - **Better error messages** - actionable feedback with suggestions
86
+ - **Progress indicators** - clear feedback during long operations
87
+ - **Dry-run mode** - preview commands before execution
88
+ - **Verbose mode** - detailed output for debugging
89
+ - **Headless mode** - `-p` for non-interactive execution
90
+
91
+ ## 🐛 Bug Fixes
92
+
93
+ ### Critical Fixes
94
+
95
+ - **Init command execution** - fixed Commander.js action() misuse that prevented initialization
96
+ - **State detection timing** - only check components after target is known
97
+ - **MCP detection** - proper JSONC parsing for OpenCode configs
98
+ - **Directory naming** - fixed OpenCode command/commands mismatch
99
+ - **Continue flag logic** - proper handling of conversation context
100
+
101
+ ### OpenCode Specific
102
+
103
+ - **YAML field compatibility** - removed unsupported fields (name, mode, rules)
104
+ - **Automatic cleanup** - removes legacy directories to prevent crashes
105
+ - **Config validation** - proper error handling for invalid configurations
106
+
107
+ ### Memory & Settings
108
+
109
+ - **Persistent settings** - fixed "re-prompt every run" issue
110
+ - **Target-specific configs** - separate settings per platform
111
+ - **Environment variables** - proper inheritance to spawned processes
112
+
113
+ ## 📚 Documentation
114
+
115
+ ### Comprehensive Guides
116
+
117
+ - **LOOP_MODE.md** - Complete loop mode documentation (English)
118
+ - **Updated help text** - clearer, more descriptive option descriptions
119
+ - **Inline examples** - usage examples in help output
120
+ - **Consistent terminology** - "wait time" instead of mixed "interval/cooldown"
121
+
122
+ ### API Reference
123
+
124
+ - Clear parameter descriptions
125
+ - Recommended values for all options
126
+ - When to use each feature
127
+ - Troubleshooting guides
128
+
129
+ ## ⚠️ Breaking Changes
130
+
131
+ ### Configuration File Rename
132
+
133
+ - Old: `.sylphx-flow/config.json`
134
+ - New: `.sylphx-flow/settings.json`
135
+ - Migration: Automatic on first run
136
+
137
+ ### Default Behavior Changes
138
+
139
+ - **Loop interval default**: 60s → 0s (immediate execution)
140
+ - **Init logic**: Negative logic → Positive logic (explicit conditions)
141
+ - **Provider selection**: Opt-in defaults → Smart defaults (auto-use saved)
142
+
143
+ ### Removed Features
144
+
145
+ - **Deprecated commands**: Old separate init/run commands (use integrated `flow` command)
146
+ - **Complex loop strategies**: Removed over-engineered exit conditions (until-success, until-stable)
147
+
148
+ ## 🔄 Migration Guide
149
+
150
+ ### From 0.x to 1.0
151
+
152
+ 1. **Update package**:
153
+
154
+ ```bash
155
+ bun update @sylphx/flow
156
+ ```
157
+
158
+ 2. **Config auto-migrates** on first run - no manual steps needed
159
+
160
+ 3. **Loop mode users**: If you were using `--loop 60`, consider removing the number for faster continuous execution:
161
+
162
+ ```bash
163
+ # Before (0.x)
164
+ sylphx-flow "task" --loop 60
165
+
166
+ # After (1.0 - faster)
167
+ sylphx-flow "task" --loop
168
+
169
+ # Or keep wait time if needed
170
+ sylphx-flow "task" --loop 60
171
+ ```
172
+
173
+ 4. **Provider/Agent selection**: No longer need `--use-defaults` - it's automatic now
174
+
175
+ ## 🙏 Acknowledgments
176
+
177
+ This release incorporates extensive user feedback and addresses real-world usage patterns. Thank you to all contributors and early adopters who helped shape this release.
178
+
179
+ ## 📊 Stats
180
+
181
+ - **50+ commits** since 0.3.0
182
+ - **15+ major features** added
183
+ - **20+ bug fixes**
184
+ - **Full OpenCode support**
185
+ - **10x faster loop execution** (setup overhead removed)
package/LOOP_MODE.md ADDED
@@ -0,0 +1,446 @@
1
+ # 🔄 Loop Mode - Continuous Autonomous Execution
2
+
3
+ Loop mode enables the LLM to continuously execute the same task, automatically preserving context, until you manually stop it.
4
+
5
+ ## 🎯 Core Concept
6
+
7
+ **Simple: Keep working on X until I stop you**
8
+
9
+ ```bash
10
+ bun dev:flow "process all GitHub issues" --loop
11
+ ```
12
+
13
+ **Behavior:**
14
+ 1. Execute task (fresh start)
15
+ 2. Immediately execute with `--continue` (preserve context)
16
+ 3. Immediately execute with `--continue` again
17
+ 4. ... infinite loop until Ctrl+C or max-runs
18
+
19
+ **With wait time:**
20
+ ```bash
21
+ bun dev:flow "check for new issues" --loop 300
22
+ ```
23
+ 1. Execute task
24
+ 2. Wait 300 seconds (5 minutes)
25
+ 3. Execute with `--continue`
26
+ 4. Wait 300 seconds
27
+ 5. ... continue until stopped
28
+
29
+ ---
30
+
31
+ ## 🚀 Basic Usage
32
+
33
+ ### Simplest - Use default (no wait time)
34
+ ```bash
35
+ bun dev:flow "task" --loop
36
+ # Execute continuously with no wait between iterations
37
+ ```
38
+
39
+ ### Specify wait time
40
+ ```bash
41
+ bun dev:flow "task" --loop 120
42
+ # Wait 120 seconds between each iteration
43
+ ```
44
+
45
+ ### Add safety limit
46
+ ```bash
47
+ bun dev:flow "task" --loop 60 --max-runs 20
48
+ # Stop after 20 iterations
49
+ ```
50
+
51
+ ### Combined usage
52
+ ```bash
53
+ # Default interval + max runs
54
+ bun dev:flow "task" --loop --max-runs 10
55
+
56
+ # Custom interval + max runs
57
+ bun dev:flow "task" --loop 300 --max-runs 5
58
+ ```
59
+
60
+ ---
61
+
62
+ ## 💡 Use Cases
63
+
64
+ ### 1. GitHub Issue Handling
65
+ ```bash
66
+ bun dev:flow "check github issues and handle them one by one" --loop 300
67
+ # Check every 5 minutes, continuously process issues
68
+ ```
69
+
70
+ ### 2. Code Review
71
+ ```bash
72
+ bun dev:flow "review recent commits and provide feedback" --loop 3600
73
+ # Review new commits every hour
74
+ ```
75
+
76
+ ### 3. Documentation Updates
77
+ ```bash
78
+ bun dev:flow "check if docs need update and fix them" --loop 1800
79
+ # Sync documentation every 30 minutes
80
+ ```
81
+
82
+ ### 4. Test Fixing
83
+ ```bash
84
+ bun dev:flow "run tests, if fail try to fix" --loop 60 --max-runs 10
85
+ # Try up to 10 times, wait 60 seconds each time
86
+ ```
87
+
88
+ ### 5. Incremental Refactoring
89
+ ```bash
90
+ bun dev:flow "continue refactoring legacy code" --loop 600 --max-runs 6
91
+ # Work every 10 minutes, total 1 hour
92
+ ```
93
+
94
+ ---
95
+
96
+ ## 📚 API Reference
97
+
98
+ ### `--loop [seconds]`
99
+ Enable loop mode with optional wait time between iterations
100
+
101
+ **Default:** 0 seconds (no wait - execute immediately after previous task completes)
102
+
103
+ **When to use wait time:**
104
+ - Rate limiting: Prevent hitting API limits
105
+ - Resource management: Give system time to recover
106
+ - Polling: Check for changes periodically
107
+ - Natural pacing: Space out operations
108
+
109
+ **Recommended values:**
110
+ - No wait: 0 seconds (default - for continuous work)
111
+ - Quick polling: 30-60 seconds
112
+ - Standard polling: 60-300 seconds (1-5 minutes)
113
+ - Long polling: 600-3600 seconds (10-60 minutes)
114
+
115
+ **Examples:**
116
+ ```bash
117
+ --loop # No wait (immediate re-execution after task completes)
118
+ --loop 0 # Same as above
119
+ --loop 60 # Wait 60 seconds between iterations
120
+ --loop 300 # Wait 5 minutes between iterations
121
+ --loop 3600 # Wait 1 hour between iterations
122
+ ```
123
+
124
+ **Note:** `[seconds]` is optional - defaults to 0 (no wait time)
125
+
126
+ **Why 0s default?**
127
+ - LLM tasks typically take 2-5 minutes
128
+ - Task execution time is already a natural interval
129
+ - No wasted idle time
130
+ - Add wait time only when needed (rate limits, polling, etc.)
131
+
132
+ ---
133
+
134
+ ### `--max-runs <count>`
135
+ Maximum number of iterations (optional, default: infinite)
136
+
137
+ Purpose: Prevent forgetting to stop loop, or set work time limit
138
+
139
+ **Examples:**
140
+ ```bash
141
+ --max-runs 10 # Maximum 10 iterations
142
+ --max-runs 100 # Maximum 100 iterations
143
+ ```
144
+
145
+ ---
146
+
147
+ ## 🎨 Output Format
148
+
149
+ ### Loop Start
150
+ ```
151
+ ━━━ 🔄 Loop Mode Activated
152
+
153
+ Wait time: 0s
154
+ Max runs: ∞
155
+ Stop: Ctrl+C or max-runs limit
156
+ ```
157
+
158
+ ### Each Iteration
159
+ ```
160
+ 🔄 Loop iteration 3/∞
161
+ Started: 14:32:15
162
+
163
+ [... task execution ...]
164
+
165
+ ⏳ Waiting 0s until next run... (completed: 3/∞)
166
+ ```
167
+ or with wait time:
168
+ ```
169
+ ⏳ Waiting 60s until next run... (completed: 3/∞)
170
+ ```
171
+
172
+ ### Loop End
173
+ ```
174
+ ⚠️ Interrupt received - finishing current iteration...
175
+
176
+ ━━━ 🏁 Loop Summary
177
+
178
+ Total iterations: 5
179
+ Successful: 4
180
+ Errors: 1
181
+ Duration: 5m 30s
182
+ ```
183
+
184
+ ---
185
+
186
+ ## 🛡️ Safety Features
187
+
188
+ ### 1. Graceful Shutdown
189
+ Press `Ctrl+C` to stop gracefully:
190
+ - Complete current iteration
191
+ - Display summary
192
+ - Clean up resources
193
+
194
+ ### 2. Error Resilience
195
+ Continues execution when encountering errors (won't stop):
196
+ ```
197
+ ⚠️ Task encountered error (continuing...)
198
+ Error: API rate limit
199
+
200
+ ⏳ Waiting 60s until next run...
201
+ ```
202
+
203
+ ### 3. Auto-headless Mode
204
+ Loop mode automatically enables headless mode:
205
+ - No interactive prompts
206
+ - Output only
207
+ - Suitable for background execution
208
+
209
+ ### 4. Context Persistence
210
+ **First iteration:** Fresh start
211
+ **2nd+ iterations:** Auto `--continue` (LLM builds on previous work)
212
+
213
+ This allows the LLM to continuously improve without repeating the same work.
214
+
215
+ ---
216
+
217
+ ## 📊 Work Time Calculation
218
+
219
+ **Note:** These estimates assume ~2-3 minutes average task execution time + wait time between iterations.
220
+
221
+ | Wait Time | Max Runs | Approx Total Time |
222
+ |-----------|----------|-------------------|
223
+ | 0s (no wait) | 10 | ~20-30 minutes (task time only) |
224
+ | 0s (no wait) | 30 | ~1-1.5 hours (task time only) |
225
+ | 60s wait | 10 | ~30-40 minutes (task + wait) |
226
+ | 60s wait | 30 | ~1.5-2 hours (task + wait) |
227
+ | 300s (5min) | 12 | ~2-3 hours |
228
+ | 600s (10min) | 6 | ~1.5-2 hours |
229
+ | 3600s (1 hour) | 8 | ~8-9 hours |
230
+
231
+ ---
232
+
233
+ ## 🎯 Best Practices
234
+
235
+ ### ✅ DO
236
+
237
+ 1. **Use default (0s) for most cases**
238
+ ```bash
239
+ --loop # No wait - continuous execution
240
+ --loop 60 # Add wait time if needed (e.g., API rate limits, polling)
241
+ ```
242
+
243
+ 2. **Use max-runs for safety**
244
+ ```bash
245
+ --max-runs 50 # Prevent infinite loop
246
+ ```
247
+
248
+ 3. **Clear task definition**
249
+ ```bash
250
+ # Good
251
+ "check new github issues and reply to them"
252
+
253
+ # Bad (too vague)
254
+ "do stuff"
255
+ ```
256
+
257
+ 4. **Test with small max-runs first**
258
+ ```bash
259
+ --loop --max-runs 3 # Test with 3 iterations first
260
+ ```
261
+
262
+ ### ❌ DON'T
263
+
264
+ 1. **Don't add wait time unnecessarily**
265
+ ```bash
266
+ # Unnecessary - task already takes time
267
+ --loop 60 # Only use if you need wait time for specific reason (rate limits, polling)
268
+
269
+ # Better for continuous work
270
+ --loop # No wait - task execution time is the natural interval
271
+ ```
272
+
273
+ 2. **Don't run production without max-runs**
274
+ ```bash
275
+ # Dangerous - may run forever
276
+ --loop
277
+
278
+ # Safe
279
+ --loop --max-runs 100
280
+ ```
281
+
282
+ 3. **Don't do destructive operations**
283
+ ```bash
284
+ # Dangerous!
285
+ "delete old files" --loop
286
+ ```
287
+
288
+ ---
289
+
290
+ ## 🐛 Troubleshooting
291
+
292
+ ### Q: Loop runs too fast
293
+ **A:** Increase interval
294
+ ```bash
295
+ --loop 120 # instead of --loop 30
296
+ ```
297
+
298
+ ### Q: Loop never stops
299
+ **A:** Add max-runs safety limit
300
+ ```bash
301
+ --loop 60 --max-runs 50
302
+ ```
303
+
304
+ ### Q: Want detailed output
305
+ **A:** Add verbose flag
306
+ ```bash
307
+ --loop 60 --verbose
308
+ ```
309
+
310
+ ### Q: Task keeps failing
311
+ **A:** Check error message, could be:
312
+ - API rate limit → Increase interval
313
+ - Permission issues → Fix permissions
314
+ - Task itself has problems → Test without loop first
315
+
316
+ ---
317
+
318
+ ## 🚀 Advanced Patterns
319
+
320
+ ### Pattern 1: Time-boxed Work
321
+ ```bash
322
+ # Work for exactly 1 hour (60 iterations × 60s)
323
+ bun dev:flow "work on feature X" --loop 60 --max-runs 60
324
+ ```
325
+
326
+ ### Pattern 2: Progressive Task
327
+ ```bash
328
+ # Iterate through large task
329
+ bun dev:flow "continue migrating to new API" --loop 180 --max-runs 20
330
+ # Each iteration makes progress, LLM remembers where it left off
331
+ ```
332
+
333
+ ### Pattern 3: Monitoring & Auto-fix
334
+ ```bash
335
+ # Check health and auto-fix issues
336
+ bun dev:flow "check system health and fix issues if found" --loop 300
337
+ ```
338
+
339
+ ### Pattern 4: Staged Execution
340
+ ```bash
341
+ # Stage 1: Quick pass (10 mins)
342
+ bun dev:flow "quick fixes" --loop 30 --max-runs 20
343
+
344
+ # Stage 2: Deep work (1 hour)
345
+ bun dev:flow "continue deep refactoring" --loop 300 --max-runs 12
346
+ ```
347
+
348
+ ---
349
+
350
+ ## 💡 Pro Tips
351
+
352
+ ### Tip 1: Task Phrasing
353
+ ```bash
354
+ # Good: Progressive phrasing
355
+ "continue working on X, pick up where you left off"
356
+
357
+ # Better: Context-aware
358
+ "check status of X, continue if not done, report if complete"
359
+ ```
360
+
361
+ ### Tip 2: Interval Selection
362
+ ```bash
363
+ # Quick iteration (testing, monitoring)
364
+ --loop 30
365
+
366
+ # Standard work (most tasks)
367
+ --loop 60-120
368
+
369
+ # Heavy tasks (reviews, analysis)
370
+ --loop 300-600
371
+
372
+ # Periodic checks (CI/CD, health)
373
+ --loop 1800-3600
374
+ ```
375
+
376
+ ### Tip 3: Safety Nets
377
+ ```bash
378
+ # Always set max-runs for important tasks
379
+ bun dev:flow "deploy changes" --loop 60 --max-runs 3
380
+
381
+ # Use longer intervals for destructive operations
382
+ bun dev:flow "cleanup old data" --loop 3600 --max-runs 5
383
+ ```
384
+
385
+ ### Tip 4: File Input Support
386
+ ```bash
387
+ # Load prompt from file for longer instructions
388
+ bun dev:flow "@long-task.txt" --loop 300 --max-runs 10
389
+
390
+ # Use absolute path
391
+ bun dev:flow "@/path/to/prompt.txt" --loop 60
392
+ ```
393
+
394
+ ---
395
+
396
+ ## 📊 Performance
397
+
398
+ **Memory:** ~50-100MB per iteration (cleaned up after)
399
+ **CPU:** Depends on task complexity
400
+ **API:** Respects rate limits automatically
401
+ **Network:** Each iteration makes API calls
402
+
403
+ ---
404
+
405
+ ## 🔧 Technical Details
406
+
407
+ ### Context Management
408
+ ```typescript
409
+ // Implementation
410
+ Iteration 1: options.continue = false // Fresh
411
+ Iteration 2+: options.continue = true // Build on previous
412
+ ```
413
+
414
+ ### State Tracking
415
+ ```typescript
416
+ {
417
+ iteration: number; // Current iteration
418
+ startTime: Date; // When loop started
419
+ successCount: number; // Successful runs
420
+ errorCount: number; // Failed runs
421
+ }
422
+ ```
423
+
424
+ ### Exit Conditions
425
+ 1. User interrupt (Ctrl+C) - Highest priority
426
+ 2. Max-runs reached
427
+ 3. Fatal error (rare)
428
+
429
+ ---
430
+
431
+ ## 📝 Changelog
432
+
433
+ ### v1.0.0 (Simplified)
434
+ - Core loop functionality
435
+ - Auto-continue from 2nd iteration
436
+ - Graceful shutdown
437
+ - Progress tracking
438
+ - Error resilience
439
+ - File input support for prompts
440
+
441
+ **Removed complexity:**
442
+ - ~~until-success~~
443
+ - ~~until-stable~~
444
+ - ~~on-error strategies~~
445
+
446
+ **Why:** Keep it simple - just "keep working until I stop you"