You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: replace background jobs with tmux for persistence
- Update background process management section to use tmux
- Add tmux session naming conventions (dev-*, agent-*, etc.)
- Replace all & background job examples with tmux patterns
- Add session persistence guidance and metadata tracking
- Include fallback to container-use when tmux unavailable
- Document random port assignment in tmux sessions
- Add Playwright testing in tmux sessions
CRITICAL: When starting any long-running server process (web servers, development servers, APIs, etc.), you MUST:
180
+
CRITICAL: When starting any long-running server process (web servers, development servers, APIs, etc.), you MUST use tmux for persistence and management:
181
181
182
-
1.**Always Run in Background**
182
+
1.**Always Run in tmux Sessions**
183
183
- NEVER run servers in foreground as this will block the agent process indefinitely
184
-
- Use background execution (`&` or `nohup`) or container-use background mode
184
+
- ALWAYS use tmux for background execution (provides persistence across disconnects)
185
+
- Fallback to container-use background mode if tmux unavailable
185
186
- Examples of foreground-blocking commands:
186
187
-`npm run dev` or `npm start`
187
188
-`python app.py` or `flask run`
@@ -193,96 +194,164 @@ CRITICAL: When starting any long-running server process (web servers, developmen
193
194
- ALWAYS use random/dynamic ports to avoid conflicts between parallel sessions
194
195
- Generate random port: `PORT=$(shuf -i 3000-9999 -n 1)`
195
196
- Pass port via environment variable or command line argument
196
-
- Document the assigned port in logs for reference
197
+
- Document the assigned port in session metadata
197
198
198
-
3.**Mandatory Log Redirection**
199
-
-Redirect all output to log files: `command > app.log 2>&1 &`
-**ALWAYS run Playwright tests in background** to prevent agent blocking
263
-
-**NEVER open test report servers** - they will block agent execution indefinitely
264
-
- Use `--reporter=json` and `--reporter=line` for programmatic result parsing
265
-
- Redirect all output to log files for later analysis
294
+
-**Run Playwright tests in tmux** for persistence and log monitoring
295
+
-**NEVER open test report servers** - they block agent execution
296
+
- Use `--reporter=json` and `--reporter=line` for programmatic parsing
266
297
- Examples:
267
298
268
299
```bash
269
-
# ✅ CORRECT - Background Playwright execution
270
-
npx playwright test --reporter=json > playwright-results.log 2>&1&
300
+
# ✅ CORRECT - Playwright in tmux session
301
+
SESSION="test-playwright-$(date +%s)"
302
+
tmux new-session -d -s "$SESSION" -n tests
303
+
tmux send-keys -t "$SESSION:tests""npx playwright test --reporter=json | tee playwright-results.log" C-m
271
304
272
-
# ✅ CORRECT - Custom config with background execution
273
-
npx playwright test --config=custom.config.js --reporter=line > test-output.log 2>&1&
305
+
# Monitor progress
306
+
tmux attach -t "$SESSION"
307
+
308
+
# ❌ DEPRECATED - Background job (no persistence)
309
+
npx playwright test --reporter=json > playwright-results.log 2>&1&
274
310
275
311
# ❌ WRONG - Will block agent indefinitely
276
312
npx playwright test --reporter=html
277
313
npx playwright show-report
278
314
279
315
# ✅ CORRECT - Parse results programmatically
280
-
cat playwright-results.json | jq '.stats'
281
-
tail -20 test-output.log
316
+
cat playwright-results.log | jq '.stats'
282
317
```
283
318
319
+
**Using Generic /start-* Commands:**
320
+
321
+
For common development scenarios, use the generic commands:
322
+
323
+
```bash
324
+
# Start local web development (auto-detects framework)
325
+
/start-local development # Uses .env.development
326
+
/start-local staging # Uses .env.staging
327
+
/start-local production # Uses .env.production
328
+
329
+
# Start iOS development (auto-detects project type)
330
+
/start-ios Debug # Uses .env.development
331
+
/start-ios Staging # Uses .env.staging
332
+
/start-ios Release # Uses .env.production
333
+
334
+
# Start Android development (auto-detects project type)
335
+
/start-android debug # Uses .env.development
336
+
/start-android staging # Uses .env.staging
337
+
/start-android release # Uses .env.production
338
+
```
284
339
285
-
RATIONALE: Background execution with random ports prevents agent process deadlock while enabling parallel sessions to coexist without interference. Port-based process management ensures safe cleanup without affecting other concurrent development sessions. This maintains full visibility into server status through logs while ensuring continuous agent operation.
RATIONALE: tmux provides persistence across disconnects, better visibility through split panes, and session organization. Random ports prevent conflicts between parallel sessions. Port-based or session-based process management ensures safe cleanup. Generic /start-* commands provide consistent, framework-agnostic development environments.
0 commit comments