enhance_swarm 2.0.0 → 2.1.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 (105) hide show
  1. checksums.yaml +4 -4
  2. data/.claude/CLAUDE.md +164 -0
  3. data/.claude/MCP.md +117 -0
  4. data/.claude/PERSONAS.md +114 -0
  5. data/.claude/RULES.md +221 -0
  6. data/.enhance_swarm/logs/general_output.log +0 -404
  7. data/.enhance_swarm.yml +33 -0
  8. data/CHANGELOG.md +71 -0
  9. data/README.md +128 -3
  10. data/lib/enhance_swarm/agent_spawner.rb +205 -12
  11. data/lib/enhance_swarm/cli.rb +129 -1
  12. data/lib/enhance_swarm/task_coordinator.rb +363 -86
  13. data/lib/enhance_swarm/version.rb +1 -1
  14. metadata +13 -97
  15. data/PRODUCTION_TEST_LOG.md +0 -502
  16. data/debug_agent_spawner.rb +0 -99
  17. data/debug_cli_spawn.rb +0 -95
  18. data/debug_fixes.rb +0 -209
  19. data/debug_script_execution.rb +0 -124
  20. data/debug_session_issue.rb +0 -87
  21. data/debug_spawn.rb +0 -113
  22. data/debug_spawn_step_by_step.rb +0 -190
  23. data/debug_worktree.rb +0 -77
  24. data/enhance_swarm-0.1.1.gem +0 -0
  25. data/enhance_swarm-1.0.0.gem +0 -0
  26. data/final_validation_test.rb +0 -199
  27. data/setup.sh +0 -86
  28. data/test_blog_app/.enhance_swarm/archives/session_1751187575_e119ea73_20250629_105935.json +0 -16
  29. data/test_blog_app/.enhance_swarm/archives/session_1751187637_7fda97dd_20250629_110037.json +0 -32
  30. data/test_blog_app/.enhance_swarm/archives/session_1751190527_4c99147e_20250629_114847.json +0 -32
  31. data/test_blog_app/.enhance_swarm/archives/session_1751190541_8dc83406_20250629_114901.json +0 -16
  32. data/test_blog_app/.ruby-version +0 -1
  33. data/test_blog_app/Gemfile +0 -18
  34. data/test_blog_app/Gemfile.lock +0 -206
  35. data/test_blog_app/README.md +0 -24
  36. data/test_blog_app/Rakefile +0 -6
  37. data/test_blog_app/app/assets/images/.keep +0 -0
  38. data/test_blog_app/app/assets/stylesheets/application.css +0 -10
  39. data/test_blog_app/app/controllers/application_controller.rb +0 -4
  40. data/test_blog_app/app/controllers/concerns/.keep +0 -0
  41. data/test_blog_app/app/helpers/application_helper.rb +0 -2
  42. data/test_blog_app/app/models/application_record.rb +0 -3
  43. data/test_blog_app/app/models/concerns/.keep +0 -0
  44. data/test_blog_app/app/views/layouts/application.html.erb +0 -27
  45. data/test_blog_app/app/views/pwa/manifest.json.erb +0 -22
  46. data/test_blog_app/app/views/pwa/service-worker.js +0 -26
  47. data/test_blog_app/bin/dev +0 -2
  48. data/test_blog_app/bin/rails +0 -4
  49. data/test_blog_app/bin/rake +0 -4
  50. data/test_blog_app/bin/setup +0 -34
  51. data/test_blog_app/config/application.rb +0 -42
  52. data/test_blog_app/config/boot.rb +0 -3
  53. data/test_blog_app/config/credentials.yml.enc +0 -1
  54. data/test_blog_app/config/database.yml +0 -32
  55. data/test_blog_app/config/environment.rb +0 -5
  56. data/test_blog_app/config/environments/development.rb +0 -51
  57. data/test_blog_app/config/environments/production.rb +0 -67
  58. data/test_blog_app/config/environments/test.rb +0 -42
  59. data/test_blog_app/config/initializers/assets.rb +0 -7
  60. data/test_blog_app/config/initializers/content_security_policy.rb +0 -25
  61. data/test_blog_app/config/initializers/filter_parameter_logging.rb +0 -8
  62. data/test_blog_app/config/initializers/inflections.rb +0 -16
  63. data/test_blog_app/config/locales/en.yml +0 -31
  64. data/test_blog_app/config/master.key +0 -1
  65. data/test_blog_app/config/puma.rb +0 -38
  66. data/test_blog_app/config/routes.rb +0 -14
  67. data/test_blog_app/config.ru +0 -6
  68. data/test_blog_app/db/seeds.rb +0 -9
  69. data/test_blog_app/lib/tasks/.keep +0 -0
  70. data/test_blog_app/log/.keep +0 -0
  71. data/test_blog_app/public/400.html +0 -114
  72. data/test_blog_app/public/404.html +0 -114
  73. data/test_blog_app/public/406-unsupported-browser.html +0 -114
  74. data/test_blog_app/public/422.html +0 -114
  75. data/test_blog_app/public/500.html +0 -114
  76. data/test_blog_app/public/icon.png +0 -0
  77. data/test_blog_app/public/icon.svg +0 -3
  78. data/test_blog_app/public/robots.txt +0 -1
  79. data/test_blog_app/script/.keep +0 -0
  80. data/test_blog_app/storage/.keep +0 -0
  81. data/test_blog_app/test/controllers/.keep +0 -0
  82. data/test_blog_app/test/fixtures/files/.keep +0 -0
  83. data/test_blog_app/test/helpers/.keep +0 -0
  84. data/test_blog_app/test/integration/.keep +0 -0
  85. data/test_blog_app/test/models/.keep +0 -0
  86. data/test_blog_app/test/test_helper.rb +0 -15
  87. data/test_blog_app/test_enhance_swarm_e2e.rb +0 -244
  88. data/test_blog_app/test_realistic_workflow.rb +0 -292
  89. data/test_blog_app/tmp/.keep +0 -0
  90. data/test_blog_app/tmp/pids/.keep +0 -0
  91. data/test_blog_app/tmp/storage/.keep +0 -0
  92. data/test_blog_app/vendor/.keep +0 -0
  93. data/test_builtin_functionality.rb +0 -121
  94. data/test_complete_system.rb +0 -267
  95. data/test_core_components.rb +0 -156
  96. data/test_real_claude_integration.rb +0 -285
  97. data/test_security.rb +0 -150
  98. data/test_smart_defaults.rb +0 -155
  99. data/test_task_integration.rb +0 -173
  100. data/test_web_ui.rb +0 -245
  101. data/web/assets/css/main.css +0 -645
  102. data/web/assets/js/kanban.js +0 -499
  103. data/web/assets/js/main.js +0 -525
  104. data/web/templates/dashboard.html.erb +0 -226
  105. data/web/templates/kanban.html.erb +0 -193
@@ -255,15 +255,17 @@ module EnhanceSwarm
255
255
  ## Your Task:
256
256
  #{base_prompt}
257
257
 
258
- ## Important Instructions:
259
- 1. Stay focused on your role as a #{role} specialist
260
- 2. Follow the project's code standards and conventions
261
- 3. Work autonomously but consider integration with other agents
262
- 4. Create high-quality, production-ready code
263
- 5. Include comprehensive tests where appropriate
264
- 6. Document your changes and decisions
265
- 7. If you encounter permission issues, provide detailed implementation plans instead
266
- 8. Always output what you would implement, even if file operations fail
258
+ ## Critical Instructions:
259
+ 1. YOU MUST ACTUALLY IMPLEMENT CODE - Use Read, Edit, Write, and Bash tools to create real files
260
+ 2. Stay focused on your role as a #{role} specialist
261
+ 3. Follow the project's code standards and conventions
262
+ 4. Work autonomously - DO NOT ASK FOR PERMISSION, JUST IMPLEMENT
263
+ 5. Create high-quality, production-ready code with proper validations
264
+ 6. 🚨 FOR BULLET TRAIN PROJECTS: ALWAYS use Super Scaffolding - NEVER create manual models!
265
+ 7. 🎨 FOR BULLET TRAIN PROJECTS: ALWAYS use Tailwind CSS - NEVER Bootstrap or custom CSS!
266
+ 8. Use Bash tool to run Rails generators, database migrations, and tests
267
+ 9. Commit your changes when complete using Git commands
268
+ 10. If you encounter any issues, fix them and continue until task is complete
267
269
 
268
270
  ## Available Tools:
269
271
  You have access to all Claude Code tools for file editing, terminal commands, and project analysis.
@@ -275,7 +277,14 @@ module EnhanceSwarm
275
277
  end
276
278
 
277
279
  def get_role_description(role)
278
- case role.to_s.downcase
280
+ config = EnhanceSwarm.configuration
281
+ project_analyzer = ProjectAnalyzer.new
282
+ project_context = project_analyzer.generate_smart_defaults
283
+
284
+ # Check if this is a Bullet Train project
285
+ is_bullet_train = has_bullet_train_stack?(config, project_context)
286
+
287
+ base_description = case role.to_s.downcase
279
288
  when 'backend'
280
289
  'You specialize in server-side logic, APIs, database design, models, and business logic implementation.'
281
290
  when 'frontend'
@@ -291,6 +300,190 @@ module EnhanceSwarm
291
300
  else
292
301
  "You are a #{role} specialist agent focusing on your area of expertise."
293
302
  end
303
+
304
+ # Add Bullet Train specific instructions if this is a BT project
305
+ if is_bullet_train
306
+ base_description + get_bullet_train_role_enhancement(role)
307
+ else
308
+ base_description
309
+ end
310
+ end
311
+
312
+ def has_bullet_train_stack?(config, project_context)
313
+ # Check Gemfile for bullet_train gems
314
+ return true if File.exist?('Gemfile') && File.read('Gemfile').include?('bullet_train')
315
+
316
+ # Check technology stack
317
+ tech_stack = config.technology_stack || project_context[:technology_stack] || []
318
+ tech_stack.include?('Bullet Train')
319
+ rescue
320
+ false
321
+ end
322
+
323
+ def get_bullet_train_role_enhancement(role)
324
+ case role.to_s.downcase
325
+ when 'backend'
326
+ <<~BT_ENHANCEMENT
327
+
328
+
329
+ ## 🚅 BULLET TRAIN BACKEND SPECIALIZATION:
330
+
331
+ **CRITICAL: Use Super Scaffolding for ALL model generation**
332
+ - NEVER create models manually - always use: rails generate super_scaffold ModelName Team field:field_type
333
+ - Use bin/resolve ClassName --eject --open before modifying any existing models
334
+ - ALL models must inherit team-scoped architecture: belongs_to :team
335
+
336
+ **Model Structure (EXACT pattern):**
337
+ ```ruby
338
+ class Contact < ApplicationRecord
339
+ include Contacts::Base # Gem concern with core logic
340
+ include Webhooks::Outgoing::TeamSupport
341
+ # 🚅 add concerns above.
342
+
343
+ # 🚅 add belongs_to associations above.
344
+ # 🚅 add has_many associations above.
345
+ # 🚅 add scopes above.
346
+ # 🚅 add validations above.
347
+ # 🚅 add callbacks above.
348
+ # 🚅 add methods above.
349
+ end
350
+ ```
351
+
352
+ **🚨 MANDATORY EXECUTION SEQUENCE - NO EXCEPTIONS:**
353
+ 1. FIRST: bundle exec rails generate super_scaffold Contact Team name:text_field email:email_field phone:phone_field company:text_field
354
+ 2. THEN: bundle exec rails db:migrate
355
+ 3. THEN: bundle exec rails test (to verify everything works)
356
+ 4. ONLY IF NEEDED: bin/resolve Contacts::Base --eject --open (for customization)
357
+ 5. Configure config/models/roles.yml with proper permissions
358
+
359
+ **🚨 CRITICAL: You MUST actually run these commands using the Bash tool - not just describe them!**
360
+ **🚨 DO NOT create manual Rails models/controllers - ONLY use Super Scaffolding!**
361
+ **🚨 NEVER skip step 1 - Super Scaffolding is MANDATORY for Bullet Train projects!**
362
+
363
+ **API Routes (add to config/routes/api/v1.rb):**
364
+ ```ruby
365
+ namespace :api do
366
+ namespace :v1 do
367
+ shallow do
368
+ resources :teams do
369
+ resources :contacts
370
+ end
371
+ end
372
+ end
373
+ end
374
+ ```
375
+ BT_ENHANCEMENT
376
+ when 'frontend'
377
+ <<~BT_ENHANCEMENT
378
+
379
+
380
+ ## 🚅 BULLET TRAIN FRONTEND SPECIALIZATION:
381
+
382
+ **CRITICAL: Customize generated views, don't create from scratch**
383
+ - Super Scaffolding generates account/contacts/* views automatically
384
+ - Use bin/resolve account/contacts/_form --eject for view customization
385
+ - All views follow account-scoped pattern: app/views/account/contacts/
386
+
387
+ **Required View Structure:**
388
+ - app/views/account/contacts/index.html.erb (team-scoped listing)
389
+ - app/views/account/contacts/show.html.erb (individual contact)
390
+ - app/views/account/contacts/_form.html.erb (create/edit form)
391
+ - Use Bullet Train themes and components
392
+
393
+ **🎨 STYLING: Use Tailwind CSS (Bullet Train Default)**
394
+ - ALWAYS use Tailwind CSS classes (bg-blue-500, text-white, etc.)
395
+ - NEVER use Bootstrap or custom CSS - BT uses Tailwind by default
396
+ - Use BT's Tailwind theme tokens and design system
397
+ - Follow BT responsive patterns: sm:, md:, lg: breakpoints
398
+ - Use BT component classes: .btn, .card, .form-control (Tailwind-based)
399
+
400
+ **Navigation Integration:**
401
+ - Add to account navigation (usually in app/views/account/shared/_menu.html.erb)
402
+ - Use BT icon helpers and Tailwind styling patterns
403
+ - Ensure mobile-responsive with Tailwind responsive classes
404
+
405
+ **Commands:**
406
+ 1. bin/resolve account/contacts --eject (to customize views)
407
+ 2. bin/resolve shared/fields --open (for field customization)
408
+ 3. Use existing BT theme patterns and components
409
+ BT_ENHANCEMENT
410
+ when 'qa'
411
+ <<~BT_ENHANCEMENT
412
+
413
+
414
+ ## 🚅 BULLET TRAIN QA SPECIALIZATION:
415
+
416
+ **CRITICAL: Test team-scoped behavior and permissions**
417
+ - Test models with proper team association and scoping
418
+ - Validate role-based permissions from config/models/roles.yml
419
+ - Test API endpoints with proper authentication and authorization
420
+
421
+ **Required Test Structure:**
422
+ ```ruby
423
+ # spec/models/contact_spec.rb
424
+ require 'rails_helper'
425
+
426
+ RSpec.describe Contact, type: :model do
427
+ let(:team) { create(:team) }
428
+ let(:contact) { create(:contact, team: team) }
429
+
430
+ it "belongs to team" do
431
+ expect(contact.team).to eq(team)
432
+ end
433
+
434
+ it "validates required fields" do
435
+ # Test BT field validations
436
+ end
437
+
438
+ it "respects team scoping" do
439
+ # Test team isolation
440
+ end
441
+ end
442
+ ```
443
+
444
+ **API Testing:**
445
+ - spec/requests/api/v1/contacts_spec.rb with proper authentication
446
+ - Test team-scoped API access and permissions
447
+ - Validate webhook payload generation
448
+
449
+ **Commands:**
450
+ 1. bundle exec rspec spec/models/contact_spec.rb
451
+ 2. bundle exec rspec spec/requests/api/v1/contacts_spec.rb
452
+ 3. Test with different user roles and team memberships
453
+ BT_ENHANCEMENT
454
+ when 'scaffolding'
455
+ <<~BT_ENHANCEMENT
456
+
457
+
458
+ ## 🚅 BULLET TRAIN SCAFFOLDING MASTER PROTOCOL:
459
+
460
+ **🚨 MANDATORY EXECUTION SEQUENCE (MUST RUN THESE EXACT COMMANDS) - NO EXCEPTIONS:**
461
+ 1. bundle exec rails generate super_scaffold Contact Team name:text_field email:email_field phone:phone_field company:text_field
462
+ 2. bundle exec rails db:migrate
463
+ 3. bundle exec rails test (verify everything works)
464
+ 4. Configure roles in config/models/roles.yml
465
+ 5. Add API routes to config/routes/api/v1.rb
466
+ 6. bundle exec rails test (final verification)
467
+
468
+ **🚨 YOU MUST USE THE BASH TOOL TO ACTUALLY EXECUTE THESE COMMANDS - NOT JUST WRITE CODE FILES!**
469
+ **🚨 FAILURE TO RUN SUPER_SCAFFOLD COMMAND IS A CRITICAL ERROR!**
470
+ **🚨 DO NOT CREATE MANUAL MODELS/CONTROLLERS - BULLET TRAIN REQUIRES SUPER SCAFFOLDING!**
471
+
472
+ **POST-SCAFFOLDING OPTIMIZATION:**
473
+ - bin/resolve Contacts::Base --eject --open (for model customization)
474
+ - bin/resolve account/contacts/_form --eject (for view customization)
475
+ - Add custom validations and business logic
476
+ - Configure webhooks and integrations
477
+
478
+ **TEAM ARCHITECTURE VERIFICATION:**
479
+ - Ensure all models use team-scoped ownership
480
+ - Validate proper role inheritance in config/models/roles.yml
481
+ - Test API endpoints respect team boundaries
482
+ - Confirm webhook payloads include team context
483
+ BT_ENHANCEMENT
484
+ else
485
+ ''
486
+ end
294
487
  end
295
488
 
296
489
  def create_agent_script(prompt, role, working_dir)
@@ -323,9 +516,9 @@ module EnhanceSwarm
323
516
  #{prompt}
324
517
  EOF
325
518
 
326
- # Run Claude with the prompt
519
+ # Run Claude with the prompt in interactive mode with full permissions
327
520
  echo "Executing Claude for #{role} agent..."
328
- claude --print < "$PROMPT_FILE"
521
+ claude --dangerously-skip-permissions < "$PROMPT_FILE"
329
522
 
330
523
  # Cleanup
331
524
  rm -f "$PROMPT_FILE"
@@ -2,6 +2,7 @@
2
2
 
3
3
  require 'thor'
4
4
  require 'colorize'
5
+ require 'timeout'
5
6
  require_relative 'web_ui'
6
7
  require_relative 'session_manager'
7
8
  require_relative 'task_coordinator'
@@ -84,18 +85,73 @@ module EnhanceSwarm
84
85
  desc 'orchestrate TASK_DESC', 'Intelligent multi-agent orchestration with smart coordination'
85
86
  option :coordination, type: :boolean, default: true, desc: 'Enable intelligent task coordination'
86
87
  option :follow, type: :boolean, default: false, desc: 'Stream live output from all agents'
88
+ option :background, type: :boolean, default: false, desc: 'Run orchestration in background (non-blocking)'
89
+ option :detached, type: :boolean, default: false, desc: 'Run completely detached and return immediately'
87
90
  def orchestrate(task_desc)
88
91
  say "🎯 Starting intelligent multi-agent orchestration", :blue
89
92
  say "Task: #{task_desc}", :white
90
93
 
91
94
  begin
92
95
  coordinator = TaskCoordinator.new
93
- coordinator.coordinate_task(task_desc)
96
+
97
+ if options[:detached]
98
+ # Run completely detached - spawn background process and return immediately
99
+ spawn_detached_orchestration(task_desc, coordinator)
100
+ say "🚀 Orchestration started in detached mode", :green
101
+ say "📁 Check .enhance_swarm/logs/ for progress updates", :blue
102
+ return
103
+ elsif options[:background]
104
+ # Run in background with periodic status updates
105
+ run_background_orchestration(task_desc, coordinator)
106
+ else
107
+ # Run normally (blocking)
108
+ coordinator.coordinate_task(task_desc)
109
+ end
94
110
 
95
111
  say "✅ Multi-agent orchestration completed successfully!", :green
112
+ rescue Timeout::Error => e
113
+ say "⏰ Orchestration timed out: #{e.message}", :red
114
+ say "Consider breaking down the task into smaller parts", :yellow
115
+ rescue SystemExit, Interrupt
116
+ say "🛑 Orchestration interrupted by user", :yellow
96
117
  rescue StandardError => e
97
118
  say "❌ Orchestration failed: #{e.message}", :red
98
119
  say "Debug info: #{e.backtrace.first(3).join("\n")}", :yellow
120
+ say "Run 'enhance-swarm doctor' to check system health", :blue
121
+ end
122
+ end
123
+
124
+ desc 'status', 'Check status of running orchestration'
125
+ def status
126
+ if File.exist?('.enhance_swarm/logs/orchestration.pid')
127
+ pid = File.read('.enhance_swarm/logs/orchestration.pid').strip
128
+
129
+ begin
130
+ Process.getpgid(pid.to_i)
131
+ say "🔄 Orchestration running (PID: #{pid})", :blue
132
+
133
+ if File.exist?('.enhance_swarm/logs/orchestration_status.txt')
134
+ status = File.read('.enhance_swarm/logs/orchestration_status.txt').strip
135
+ say "Status: #{status}", :yellow
136
+ end
137
+
138
+ # Show recent log entries
139
+ if File.exist?('.enhance_swarm/logs/orchestration.log')
140
+ logs = File.readlines('.enhance_swarm/logs/orchestration.log').last(5)
141
+ say "\nRecent activity:", :white
142
+ logs.each { |log| say " #{log.strip}", :light_black }
143
+ end
144
+
145
+ rescue Errno::ESRCH
146
+ say "💤 No orchestration currently running", :yellow
147
+
148
+ if File.exist?('.enhance_swarm/logs/orchestration_status.txt')
149
+ status = File.read('.enhance_swarm/logs/orchestration_status.txt').strip
150
+ say "Last status: #{status}", :light_black
151
+ end
152
+ end
153
+ else
154
+ say "💤 No orchestration currently running", :yellow
99
155
  end
100
156
  end
101
157
 
@@ -572,6 +628,78 @@ module EnhanceSwarm
572
628
 
573
629
  private
574
630
 
631
+ def spawn_detached_orchestration(task_desc, coordinator)
632
+ require 'fileutils'
633
+
634
+ # Ensure logs directory exists
635
+ FileUtils.mkdir_p('.enhance_swarm/logs')
636
+
637
+ # Create status files
638
+ File.write('.enhance_swarm/logs/orchestration_status.txt', 'STARTING')
639
+
640
+ # Log the start
641
+ File.write('.enhance_swarm/logs/orchestration.log',
642
+ "#{Time.now}: Starting detached orchestration\nTask: #{task_desc}\n",
643
+ mode: 'a')
644
+
645
+ # Spawn background process using Ruby Process.spawn
646
+ pid = Process.spawn(
647
+ {
648
+ 'ENHANCE_SWARM_DETACHED' => 'true',
649
+ 'ENHANCE_SWARM_TASK' => task_desc
650
+ },
651
+ 'ruby', '-e', <<~RUBY,
652
+ require '#{File.expand_path('../../enhance_swarm', __FILE__)}'
653
+
654
+ task_desc = ENV['ENHANCE_SWARM_TASK']
655
+
656
+ begin
657
+ Dir.chdir('#{Dir.pwd}')
658
+
659
+ File.write('.enhance_swarm/logs/orchestration_status.txt', 'RUNNING')
660
+ File.write('.enhance_swarm/logs/orchestration.log',
661
+ "\#{Time.now}: Coordinator starting\\n", mode: 'a')
662
+
663
+ coordinator = EnhanceSwarm::TaskCoordinator.new
664
+ coordinator.coordinate_task(task_desc)
665
+
666
+ File.write('.enhance_swarm/logs/orchestration_status.txt', 'COMPLETED')
667
+ File.write('.enhance_swarm/logs/orchestration.log',
668
+ "\#{Time.now}: Orchestration completed successfully\\n", mode: 'a')
669
+
670
+ rescue => e
671
+ File.write('.enhance_swarm/logs/orchestration_status.txt', "FAILED: \#{e.message}")
672
+ File.write('.enhance_swarm/logs/orchestration.log',
673
+ "\#{Time.now}: ERROR: \#{e.message}\\n\#{e.backtrace.first(3).join('\\n')}\\n", mode: 'a')
674
+ end
675
+ RUBY
676
+ chdir: Dir.pwd,
677
+ out: '.enhance_swarm/logs/orchestration.log',
678
+ err: '.enhance_swarm/logs/orchestration.log'
679
+ )
680
+
681
+ # Store PID and detach
682
+ File.write('.enhance_swarm/logs/orchestration.pid', pid.to_s)
683
+ Process.detach(pid)
684
+
685
+ File.write('.enhance_swarm/logs/orchestration.log',
686
+ "#{Time.now}: Orchestration PID: #{pid}\n", mode: 'a')
687
+ end
688
+
689
+ def run_background_orchestration(task_desc, coordinator)
690
+ thread = Thread.new do
691
+ coordinator.coordinate_task(task_desc)
692
+ end
693
+
694
+ # Monitor with periodic updates
695
+ while thread.alive?
696
+ say "⏳ Orchestration running... (#{Time.now.strftime('%H:%M:%S')})", :blue
697
+ sleep(30)
698
+ end
699
+
700
+ thread.value # Wait for completion
701
+ end
702
+
575
703
  def spawn_with_streaming(task_desc, role = nil)
576
704
  orchestrator = Orchestrator.new
577
705
  agent_role = role || options[:role] || 'general'