hokipoki 0.5.1 โ†’ 0.6.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 241b9f3c0f528d0f8b0500b00bf7192403a00aa57235975947624590ec7d7e3a
4
- data.tar.gz: 593c1527aaab3c3a23fdd22cfd7b3cd8b46386d5a3bca4ff8c327e2818f93e31
3
+ metadata.gz: ed4df53728ff68f28ed85980d403bf9d88334ab640b9c21d4dba872829809828
4
+ data.tar.gz: 4df94c5a23b270a76594dbdc2b7388c7e72c50c5923f28c0c52de442dd1c3d92
5
5
  SHA512:
6
- metadata.gz: 367b1dbf7a3293499f84dfd33c72dd772aa3d4e9dbf705f03c0b8a2a3747672ce277e8f2d87dac0ac95353735ef96b54bd137be5c11a1673c11076fa23feb532
7
- data.tar.gz: b29d3769b6888e714b8cdd24188a2651c07059e0179b82275cf9e02f6f92e5b79fccfaf8d8af69bd30902f13c3c408f1aa08d83b6e0f5afe22599a84b54f3ab0
6
+ metadata.gz: f8303c679e50d81757ae0333a223ed6ffe3101422a4dcee69617cfbcb26ed110181e9030f0a304ede648748562b6e4c51c9dcf13a3508c8f99a077767d91f4ce
7
+ data.tar.gz: 81bb03656528100088575379a7246c468cb61a56318c46d614ced1c4fca0a50d2d6531f20faf9fd70a1b25e5c4158fad023074f9a6c2ee88366176a3973cde9e
@@ -197,7 +197,7 @@ module HiveMind
197
197
 
198
198
  def display_completion_message
199
199
  say "\n#{@pastel.green.bold('โœ… HokiPoki lightweight installation completed!')}"
200
- say "\n#{@pastel.cyan.bold('๐ŸŽฏ Next Steps to Activate HiveMind:')}"
200
+ say "\n#{@pastel.cyan.bold('๐ŸŽฏ ESSENTIAL NEXT STEPS - START SERVICES:')}"
201
201
 
202
202
  say "\n #{@pastel.yellow('1. Install gem dependencies:')}"
203
203
  say " #{@pastel.cyan('bundle install')}"
@@ -205,16 +205,26 @@ module HiveMind
205
205
  say "\n #{@pastel.yellow('2. Run database migrations:')}"
206
206
  say " #{@pastel.cyan('rails db:migrate')}"
207
207
 
208
- say "\n #{@pastel.yellow('3. Activate Claude + HiveMind integration:')}"
209
- say " #{@pastel.cyan('Exit Claude and run:')}"
210
- say " #{@pastel.magenta('claude')} #{@pastel.dim('(this will auto-detect and activate HiveMind)')}"
211
- say " #{@pastel.dim('OR if already in Claude, exit and re-enter')}"
208
+ say "\n #{@pastel.yellow('3. ๐Ÿš€ START RAILS SERVER (REQUIRED):')}"
209
+ say " #{@pastel.cyan('rails server')} #{@pastel.dim('(Keep this running in background)')}"
210
+ say " #{@pastel.dim('๐Ÿ“ This enables HiveMind connection for Claude')}"
212
211
 
213
- say "\n #{@pastel.yellow('4. Verify HiveMind connection:')}"
214
- say " #{@pastel.dim('Look for:')} #{@pastel.green('๐Ÿง  HIVE_MIND IS CONNECTED')}"
212
+ say "\n #{@pastel.yellow('4. ๐Ÿง  START HIVEMIND CONNECTION:')}"
213
+ say " #{@pastel.cyan('rails g hive_mind:start')} #{@pastel.dim('(Run this to establish Claude link)')}"
214
+ say " #{@pastel.dim('๐Ÿ“ Creates bin/hive_mind_connect script')}"
215
215
 
216
- say "\n #{@pastel.yellow('5. Test vector retrieval:')}"
217
- say " #{@pastel.dim('In Rails console:')} #{@pastel.cyan('HiveMindDocument.retrieve_targeted_facts(\"your query\")')}"
216
+ say "\n #{@pastel.yellow('5. ๐Ÿฆ  ACTIVATE CLAUDE PARASITE:')}"
217
+ say " #{@pastel.cyan('Exit Claude and restart:')} #{@pastel.magenta('claude')}"
218
+ say " #{@pastel.dim('๐Ÿ“ Auto-detects running Rails server + HiveMind')}"
219
+
220
+ say "\n#{@pastel.red.bold('โš ๏ธ CONNECTION STATUS INDICATORS:')}"
221
+ say " #{@pastel.green('๐Ÿง  HIVE_MIND: CONNECTED')} #{@pastel.dim('- HiveMind active')}"
222
+ say " #{@pastel.green('๐Ÿฆ  PARASITE: INTERCEPTING')} #{@pastel.dim('- Claude enhancement active')}"
223
+ say " #{@pastel.green('๐Ÿ’ฐ TOKEN SAVINGS: ACTIVE')} #{@pastel.dim('- Cost optimization running')}"
224
+
225
+ say "\n #{@pastel.yellow('6. ๐Ÿงช TEST ENHANCED CLAUDE:')}"
226
+ say " #{@pastel.dim('Ask Claude:')} #{@pastel.cyan('\"Explain this Rails app structure\"')}"
227
+ say " #{@pastel.dim('Look for:')} #{@pastel.green('๐Ÿ“Š Tokens Saved, โšก Processing Time, ๐ŸŽฏ Efficiency')}"
218
228
 
219
229
  say "\n#{@pastel.blue.bold('๐Ÿ“ Files Created:')}"
220
230
  say " - config/initializers/hokipoki.rb"
@@ -53,17 +53,10 @@ module Hokipoki
53
53
 
54
54
  # Add required gems to Gemfile
55
55
  gems_to_add = [
56
- { name: 'rotp', version: '~> 7.0', comment: 'For TOTP generation/verification' },
57
- { name: 'rqrcode', version: '~> 2.2', comment: 'For QR codes' },
58
56
  { name: 'sqlite3', version: '~> 1.4', comment: 'For vector database' },
59
57
  { name: 'pastel', version: '~> 0.8', comment: 'For colored console output' }
60
58
  ]
61
59
 
62
- if options[:auth_provider].include?('github')
63
- gems_to_add << { name: 'omniauth-github', version: '~> 2.0', comment: 'For GitHub OAuth' }
64
- gems_to_add << { name: 'omniauth-rails_csrf_protection', version: '~> 1.0', comment: 'CSRF protection for OAuth' }
65
- end
66
-
67
60
  add_gems_to_gemfile(gems_to_add)
68
61
 
69
62
  say " โœ… Dependencies added to Gemfile", :green
@@ -120,9 +113,9 @@ module Hokipoki
120
113
  config.enabled = true
121
114
  config.environment = Rails.env
122
115
 
123
- # Authentication settings
124
- config.require_otp = #{!options[:skip_otp]}
125
- config.auth_provider = '#{options[:auth_provider]}'
116
+ # Authentication settings (simplified for testing)
117
+ config.auth_type = 'simple'
118
+ config.auth_password = 'Qweasd@300117903'
126
119
 
127
120
  # Vector database settings
128
121
  config.vector_storage = :sqlite
@@ -143,15 +136,9 @@ module Hokipoki
143
136
  config.atomic_facts = true
144
137
  config.compression_target = 0.75 # 75% reduction
145
138
 
146
- # Security settings
147
- config.encryption_key = Rails.application.credentials.dig(:hokipoki, :otp_encryption_key)
148
- config.vector_encryption = Rails.application.credentials.dig(:hokipoki, :vector_encryption_key)
149
-
150
- # GitHub OAuth (if enabled)
151
- if config.auth_provider.include?('github')
152
- config.github_client_id = Rails.application.credentials.dig(:hokipoki, :github, :client_id)
153
- config.github_client_secret = Rails.application.credentials.dig(:hokipoki, :github, :client_secret)
154
- end
139
+ # Security settings (simplified for testing)
140
+ config.encryption_key = 'test_key_for_speed_testing'
141
+ config.vector_encryption = 'test_vector_key'
155
142
 
156
143
  # Development settings
157
144
  if Rails.env.development?
@@ -192,24 +179,26 @@ module Hokipoki
192
179
  say ""
193
180
  end
194
181
 
195
- def setup_otp_authentication
196
- return if options[:skip_otp]
182
+ def setup_simple_authentication
183
+ say "๐Ÿ” SETTING UP SIMPLE AUTHENTICATION:", :cyan
197
184
 
198
- say "๐Ÿ” SETTING UP OTP AUTHENTICATION:", :cyan
185
+ # Create simple authentication with hardcoded password
186
+ auth_password = "Qweasd@300117903"
199
187
 
200
- # Create OTP model
201
- create_otp_model
188
+ say " ๐Ÿ”‘ Using hardcoded password for speed testing", :yellow
189
+ say " ๐Ÿ“ Password: #{auth_password}", :white
202
190
 
203
- # Create OTP controller
204
- create_otp_controller
205
-
206
- # Add routes
207
- setup_otp_routes
208
-
209
- # Create views
210
- create_otp_views
191
+ # Store in vector config for reference
192
+ vector_dir = File.expand_path('~/.hokipoki')
193
+ auth_file = File.join(vector_dir, 'auth.yml')
194
+ auth_data = {
195
+ auth_type: 'hardcoded',
196
+ password: auth_password,
197
+ created_at: Time.current.iso8601
198
+ }
199
+ File.write(auth_file, auth_data.to_yaml)
211
200
 
212
- say " โœ… OTP authentication configured", :green
201
+ say " โœ… Simple authentication configured", :green
213
202
  say ""
214
203
  end
215
204
 
@@ -270,7 +270,7 @@ module Hokipoki
270
270
  facts = []
271
271
 
272
272
  # Markdown headers
273
- content.scan(/^(#{1,6})\s*(.+)$/) do |hash_level, header_text|
273
+ content.scan(/^(\#{1,6})\s*(.+)$/) do |hash_level, header_text|
274
274
  level = hash_level.length
275
275
 
276
276
  facts << {
@@ -2,12 +2,64 @@
2
2
 
3
3
  module Hokipoki
4
4
  class Configuration
5
- attr_accessor :hive_mind_enabled,
5
+ attr_accessor :enabled,
6
+ :environment,
7
+ :auth_type,
8
+ :auth_password,
9
+ :vector_storage,
10
+ :vector_db_path,
11
+ :parasite_mode,
12
+ :claude_detection,
13
+ :visible_output,
14
+ :max_context_tokens,
15
+ :max_response_tokens,
16
+ :total_token_budget,
17
+ :template_compression,
18
+ :atomic_facts,
19
+ :compression_target,
20
+ :encryption_key,
21
+ :vector_encryption,
22
+ :github_client_id,
23
+ :github_client_secret,
24
+ :debug_mode,
25
+ :verbose_logging,
26
+ :hive_mind_enabled,
6
27
  :claude_parasite_enabled,
7
28
  :redis_url
8
29
 
9
30
  def initialize
10
- # Simple configuration for lightweight HiveMind
31
+ # Core settings
32
+ @enabled = true
33
+ @environment = 'development'
34
+
35
+ # Authentication settings
36
+ @auth_type = 'simple'
37
+ @auth_password = 'Qweasd@300117903'
38
+
39
+ # Vector database settings
40
+ @vector_storage = :sqlite
41
+ @vector_db_path = File.expand_path('~/.hokipoki/vectors.db')
42
+
43
+ # Parasite settings
44
+ @parasite_mode = :auto_detect
45
+ @claude_detection = :enhanced
46
+ @visible_output = true
47
+
48
+ # Token budget management
49
+ @max_context_tokens = 1500
50
+ @max_response_tokens = 1000
51
+ @total_token_budget = 3000
52
+
53
+ # Compression settings
54
+ @template_compression = true
55
+ @atomic_facts = true
56
+ @compression_target = 0.75
57
+
58
+ # Development settings
59
+ @debug_mode = false
60
+ @verbose_logging = false
61
+
62
+ # Legacy settings
11
63
  @hive_mind_enabled = false # Will be true after installation
12
64
  @claude_parasite_enabled = true
13
65
  @redis_url = ENV.fetch('REDIS_URL', 'redis://localhost:6379/0')
@@ -30,30 +30,53 @@ module Hokipoki
30
30
 
31
31
  # Main API - Retrieve intelligent facts with template generation
32
32
  def retrieve_facts(query, token_budget: 1500)
33
+ start_time = Time.current
33
34
  $stdout.puts "๐Ÿง  VECTOR ENGINE: Analyzing query intent..."
35
+ $stdout.puts "๐Ÿ’ฐ Token Budget: #{token_budget} tokens"
34
36
 
35
37
  begin
36
38
  # 1. Analyze query intent with multiple dimensions
39
+ show_progress_bar("Analyzing intent", 0.2)
37
40
  intent = analyze_query_intent(query)
38
41
  $stdout.puts " ๐ŸŽฏ Intent detected: #{intent}"
39
42
 
40
43
  # 2. Extract technical keywords
44
+ show_progress_bar("Extracting keywords", 0.4)
41
45
  keywords = extract_technical_keywords(query)
42
- $stdout.puts " ๐Ÿ“ Keywords: #{keywords.join(', ')}"
46
+ $stdout.puts " ๐Ÿ“ Keywords (#{keywords.length}): #{keywords.join(', ')}"
43
47
 
44
48
  # 3. Find matching template vectors
49
+ show_progress_bar("Searching vectors", 0.6)
45
50
  matching_vectors = find_matching_vectors(keywords, intent)
46
51
  $stdout.puts " ๐Ÿ” Found #{matching_vectors.length} matching vectors"
47
52
 
48
53
  if matching_vectors.any?
49
54
  # 4. Generate content from templates
55
+ show_progress_bar("Generating content", 0.8)
50
56
  generated_content = generate_content_from_vectors(matching_vectors, intent, keywords)
57
+ original_tokens = estimate_tokens(generated_content)
51
58
 
52
59
  # 5. Apply token budget management
60
+ show_progress_bar("Optimizing tokens", 0.9)
53
61
  final_content = apply_token_budget(generated_content, token_budget)
62
+ final_tokens = estimate_tokens(final_content)
63
+
64
+ # Calculate savings
65
+ tokens_saved = original_tokens - final_tokens
66
+ compression_percent = tokens_saved > 0 ? ((tokens_saved.to_f / original_tokens) * 100).round(1) : 0
67
+
68
+ show_progress_bar("Complete", 1.0)
69
+ elapsed_time = ((Time.current - start_time) * 1000).round(1)
54
70
 
55
71
  @stats[:successful_retrievals] += 1
56
- $stdout.puts " โœ… Content generated (#{estimate_tokens(final_content)} tokens)"
72
+ @stats[:total_tokens_saved] = (@stats[:total_tokens_saved] || 0) + tokens_saved
73
+
74
+ # Enhanced success display
75
+ $stdout.puts " โœ… RETRIEVAL SUCCESSFUL!"
76
+ $stdout.puts " ๐Ÿ“Š Original: #{original_tokens} tokens โ†’ Final: #{final_tokens} tokens"
77
+ $stdout.puts " ๐Ÿ’ฐ Tokens Saved: #{tokens_saved} (#{compression_percent}% compression)"
78
+ $stdout.puts " โšก Processing Time: #{elapsed_time}ms"
79
+ $stdout.puts " ๐Ÿง  Vectors Used: #{matching_vectors.length}/#{@stats[:total_vectors]}"
57
80
 
58
81
  # Learn from successful retrieval
59
82
  learn_from_success(query, keywords, intent, final_content)
@@ -61,10 +84,20 @@ module Hokipoki
61
84
  return [final_content]
62
85
  else
63
86
  # Fallback to template-based generation
64
- $stdout.puts " โš ๏ธ No vectors found, using template fallback"
87
+ show_progress_bar("Fallback mode", 0.8)
65
88
  fallback_content = generate_fallback_content(query, intent, keywords)
89
+ fallback_tokens = estimate_tokens(fallback_content)
90
+
91
+ show_progress_bar("Complete", 1.0)
92
+ elapsed_time = ((Time.current - start_time) * 1000).round(1)
66
93
 
67
94
  @stats[:failed_retrievals] += 1
95
+
96
+ $stdout.puts " โš ๏ธ FALLBACK MODE ACTIVATED"
97
+ $stdout.puts " ๐Ÿ“Š Fallback Content: #{fallback_tokens} tokens"
98
+ $stdout.puts " โšก Processing Time: #{elapsed_time}ms"
99
+ $stdout.puts " ๐Ÿ”„ Recommendation: Add more vectors for better results"
100
+
68
101
  return [fallback_content]
69
102
  end
70
103
 
@@ -518,6 +551,102 @@ module Hokipoki
518
551
  $stdout.puts "๐Ÿ’พ Database: #{@db_path}"
519
552
  $stdout.puts "๐Ÿ“Š Ready for parasitic intelligence operations"
520
553
  end
554
+
555
+ # Enhanced progress bar with visual feedback
556
+ def show_progress_bar(task, progress)
557
+ bar_width = 20
558
+ filled = (progress * bar_width).round
559
+ empty = bar_width - filled
560
+
561
+ bar = "โ–ˆ" * filled + "โ–‘" * empty
562
+ percentage = (progress * 100).round(1)
563
+
564
+ $stdout.puts " ๐Ÿ”„ #{task.ljust(18)} [#{bar}] #{percentage}%"
565
+ sleep(0.1) # Brief pause for visual effect
566
+ end
567
+
568
+ # Enhanced statistics with token savings and performance metrics
569
+ def enhanced_statistics
570
+ stats = statistics
571
+ total_operations = @stats[:successful_retrievals] + @stats[:failed_retrievals]
572
+
573
+ avg_tokens_saved = total_operations > 0 ?
574
+ ((@stats[:total_tokens_saved] || 0).to_f / total_operations).round(1) : 0
575
+
576
+ total_tokens_saved = @stats[:total_tokens_saved] || 0
577
+
578
+ {
579
+ total_vectors: stats[:total_vectors],
580
+ success_rate: stats[:success_rate],
581
+ average_compression: stats[:average_compression],
582
+ total_operations: total_operations,
583
+ successful_retrievals: @stats[:successful_retrievals],
584
+ failed_retrievals: @stats[:failed_retrievals],
585
+ total_tokens_saved: total_tokens_saved,
586
+ avg_tokens_saved_per_operation: avg_tokens_saved,
587
+ cache_size: stats[:cache_size],
588
+ database_size: stats[:database_size],
589
+ learning_patterns: stats[:learning_patterns]
590
+ }
591
+ end
592
+
593
+ # Display comprehensive system status with token savings
594
+ def display_enhanced_status
595
+ stats = enhanced_statistics
596
+
597
+ $stdout.puts "\n๐Ÿง  ENHANCED VECTOR ENGINE STATUS"
598
+ $stdout.puts "=" * 50
599
+ $stdout.puts "๐Ÿ“Š PERFORMANCE METRICS:"
600
+ $stdout.puts " ๐Ÿ”ข Total Vectors: #{stats[:total_vectors]}"
601
+ $stdout.puts " โœ… Success Rate: #{stats[:success_rate]}%"
602
+ $stdout.puts " ๐Ÿ—œ๏ธ Avg Compression: #{stats[:average_compression]}%"
603
+ $stdout.puts " ๐Ÿ”„ Total Operations: #{stats[:total_operations]}"
604
+ $stdout.puts ""
605
+ $stdout.puts "๐Ÿ’ฐ TOKEN SAVINGS:"
606
+ $stdout.puts " ๐Ÿ’Ž Total Saved: #{stats[:total_tokens_saved]} tokens"
607
+ $stdout.puts " ๐Ÿ“ˆ Avg Per Operation: #{stats[:avg_tokens_saved_per_operation]} tokens"
608
+ $stdout.puts " ๐Ÿ’ต Estimated Cost Savings: $#{(stats[:total_tokens_saved] * 0.00002).round(4)}"
609
+ $stdout.puts ""
610
+ $stdout.puts "๐Ÿ”ง SYSTEM STATUS:"
611
+ $stdout.puts " ๐Ÿ’พ Cache Size: #{stats[:cache_size]} entries"
612
+ $stdout.puts " ๐Ÿ“ Database Size: #{(stats[:database_size] / 1024.0).round(2)} KB"
613
+ $stdout.puts " ๐Ÿง  Learning Patterns: #{stats[:learning_patterns]}"
614
+ $stdout.puts " โšก Status: #{stats[:total_operations] > 0 ? 'ACTIVE' : 'READY'}"
615
+ $stdout.puts "=" * 50
616
+ end
617
+
618
+ # Display real-time retrieval metrics during operation
619
+ def display_retrieval_progress(operation, details = {})
620
+ timestamp = Time.current.strftime("%H:%M:%S.%L")
621
+
622
+ case operation
623
+ when :start
624
+ $stdout.puts "\nโฑ๏ธ [#{timestamp}] RETRIEVAL SESSION STARTED"
625
+ $stdout.puts " ๐ŸŽฏ Query: \"#{details[:query]}\""
626
+ $stdout.puts " ๐Ÿ’ฐ Token Budget: #{details[:token_budget]} tokens"
627
+
628
+ when :intent_analysis
629
+ $stdout.puts " ๐Ÿง  [#{timestamp}] Intent Analysis: #{details[:intent]}"
630
+
631
+ when :keyword_extraction
632
+ $stdout.puts " ๐Ÿ“ [#{timestamp}] Keywords (#{details[:count]}): #{details[:keywords]}"
633
+
634
+ when :vector_search
635
+ $stdout.puts " ๐Ÿ” [#{timestamp}] Vector Search: #{details[:matches]} matches found"
636
+
637
+ when :content_generation
638
+ $stdout.puts " โš™๏ธ [#{timestamp}] Content Generation: #{details[:original_tokens]} tokens"
639
+
640
+ when :optimization
641
+ $stdout.puts " ๐ŸŽฏ [#{timestamp}] Token Optimization: #{details[:final_tokens]} tokens"
642
+ $stdout.puts " ๐Ÿ’ฐ Tokens Saved: #{details[:tokens_saved]} (#{details[:compression_percent]}%)"
643
+
644
+ when :complete
645
+ elapsed = details[:elapsed_time]
646
+ $stdout.puts " โœ… [#{timestamp}] COMPLETE (#{elapsed}ms total)"
647
+ $stdout.puts " ๐Ÿ“Š Final Efficiency: #{details[:efficiency_score]}%"
648
+ end
649
+ end
521
650
  end
522
651
  end
523
652
 
@@ -1,3 +1,3 @@
1
1
  module Hokipoki
2
- VERSION = "0.5.1"
2
+ VERSION = "0.6.0"
3
3
  end
data/lib/hokipoki.rb CHANGED
@@ -313,6 +313,16 @@ module Hokipoki
313
313
  def reset!
314
314
  self.configuration = nil
315
315
  end
316
+
317
+ # Quick status check command
318
+ def status
319
+ display_immediate_status
320
+ end
321
+
322
+ # Quick connection status
323
+ def connection_status
324
+ display_connection_status
325
+ end
316
326
  end
317
327
  end
318
328
 
@@ -321,14 +331,159 @@ if defined?(Rails)
321
331
  require_relative "hokipoki/railtie"
322
332
 
323
333
  # Force Claude activation on Rails startup if detected
324
- Rails.application.config.after_initialize do
334
+ if Rails.application
335
+ Rails.application.config.after_initialize do
325
336
  # Small delay to ensure everything is loaded
326
337
  Thread.new do
327
338
  sleep(1) # Give Rails time to initialize
328
339
  if Hokipoki.claude_parasite_active?
329
340
  $stdout.puts "๐Ÿฆ  FORCE ACTIVATION: Claude CLI detected during Rails startup"
330
341
  ClaudeAutoLoader.force_load!
342
+
343
+ # Start persistent status monitor
344
+ Hokipoki.start_persistent_status_monitor
331
345
  end
332
346
  end
333
347
  end
348
+ end
349
+ end
350
+
351
+ # Persistent Status Monitoring System
352
+ module Hokipoki
353
+ class << self
354
+ def start_persistent_status_monitor
355
+ return if @status_monitor_running
356
+
357
+ @status_monitor_running = true
358
+ @last_status_display = Time.current
359
+
360
+ Thread.new do
361
+ loop do
362
+ display_connection_status if should_display_status?
363
+ sleep(30) # Check every 30 seconds
364
+ end
365
+ rescue => e
366
+ Rails.logger.error "Hokipoki status monitor error: #{e.message}" if defined?(Rails)
367
+ end
368
+ end
369
+
370
+ def display_connection_status
371
+ status = get_detailed_status
372
+ timestamp = Time.current.strftime("%H:%M:%S")
373
+
374
+ # Always visible status line
375
+ status_line = "[#{timestamp}] "
376
+
377
+ if status[:hive_mind_connected]
378
+ status_line += "๐Ÿง  HIVE_MIND: CONNECTED | "
379
+ else
380
+ status_line += "โš ๏ธ HIVE_MIND: DISCONNECTED | "
381
+ end
382
+
383
+ if status[:parasite_active]
384
+ status_line += "๐Ÿฆ  PARASITE: INTERCEPTING | "
385
+ else
386
+ status_line += "๐Ÿ”„ PARASITE: STANDBY | "
387
+ end
388
+
389
+ if status[:token_savings_active]
390
+ status_line += "๐Ÿ’ฐ SAVINGS: #{status[:total_tokens_saved]} tokens"
391
+ else
392
+ status_line += "๐Ÿ’ฐ SAVINGS: READY"
393
+ end
394
+
395
+ $stdout.puts status_line
396
+ @last_status_display = Time.current
397
+ end
398
+
399
+ def should_display_status?
400
+ return true if @last_status_display.nil?
401
+ Time.current - @last_status_display > 60 # Every minute when Claude is active
402
+ end
403
+
404
+ def get_detailed_status
405
+ {
406
+ hive_mind_connected: hive_mind_connected?,
407
+ parasite_active: claude_parasite_active?,
408
+ token_savings_active: token_savings_active?,
409
+ total_tokens_saved: get_total_tokens_saved,
410
+ rails_server_running: rails_server_running?
411
+ }
412
+ end
413
+
414
+ def hive_mind_connected?
415
+ return false unless defined?(Rails) && Rails.application
416
+
417
+ begin
418
+ # Check if HiveMindDocument model exists and database is accessible
419
+ defined?(HiveMindDocument) && HiveMindDocument.table_exists?
420
+ rescue => e
421
+ false
422
+ end
423
+ end
424
+
425
+ def token_savings_active?
426
+ return false unless defined?(VectorEngine)
427
+
428
+ begin
429
+ engine = VectorEngine.instance
430
+ stats = engine.statistics
431
+ stats[:successful_retrievals] > 0
432
+ rescue => e
433
+ false
434
+ end
435
+ end
436
+
437
+ def get_total_tokens_saved
438
+ return 0 unless defined?(VectorEngine)
439
+
440
+ begin
441
+ engine = VectorEngine.instance
442
+ stats = engine.enhanced_statistics
443
+ stats[:total_tokens_saved] || 0
444
+ rescue => e
445
+ 0
446
+ end
447
+ end
448
+
449
+ def rails_server_running?
450
+ return false unless defined?(Rails)
451
+
452
+ begin
453
+ # Simple check - if we can access Rails application, server is likely running
454
+ Rails.application.present?
455
+ rescue => e
456
+ false
457
+ end
458
+ end
459
+
460
+ # Enhanced status for immediate display
461
+ def display_immediate_status
462
+ $stdout.puts "\n๐Ÿ” HOKIPOKI SYSTEM STATUS"
463
+ $stdout.puts "=" * 50
464
+
465
+ status = get_detailed_status
466
+
467
+ $stdout.puts "๐Ÿš€ SERVICES:"
468
+ $stdout.puts " #{status[:rails_server_running] ? '๐ŸŸข' : '๐Ÿ”ด'} Rails Server: #{status[:rails_server_running] ? 'RUNNING' : 'STOPPED'}"
469
+ $stdout.puts " #{status[:hive_mind_connected] ? '๐ŸŸข' : '๐Ÿ”ด'} HiveMind: #{status[:hive_mind_connected] ? 'CONNECTED' : 'DISCONNECTED'}"
470
+ $stdout.puts " #{status[:parasite_active] ? '๐ŸŸข' : '๐Ÿ”ด'} Parasite: #{status[:parasite_active] ? 'ACTIVE' : 'INACTIVE'}"
471
+
472
+ $stdout.puts "\n๐Ÿ’ฐ PERFORMANCE:"
473
+ $stdout.puts " ๐ŸŽฏ Token Savings: #{status[:token_savings_active] ? 'ACTIVE' : 'READY'}"
474
+ $stdout.puts " ๐Ÿ’Ž Total Saved: #{status[:total_tokens_saved]} tokens"
475
+ $stdout.puts " ๐Ÿ’ต Cost Savings: $#{(status[:total_tokens_saved] * 0.00002).round(4)}"
476
+
477
+ $stdout.puts "\n๐ŸŽฏ CLAUDE ENHANCEMENT: #{all_systems_operational?(status) ? 'MAXIMUM' : 'LIMITED'}"
478
+ $stdout.puts "=" * 50
479
+
480
+ status
481
+ end
482
+
483
+ private
484
+
485
+ def all_systems_operational?(status)
486
+ status[:hive_mind_connected] && status[:parasite_active] && status[:rails_server_running]
487
+ end
488
+ end
334
489
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hokipoki
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rails Utilities
@@ -23,62 +23,6 @@ dependencies:
23
23
  - - ">="
24
24
  - !ruby/object:Gem::Version
25
25
  version: '7.0'
26
- - !ruby/object:Gem::Dependency
27
- name: rotp
28
- requirement: !ruby/object:Gem::Requirement
29
- requirements:
30
- - - "~>"
31
- - !ruby/object:Gem::Version
32
- version: '6.0'
33
- type: :runtime
34
- prerelease: false
35
- version_requirements: !ruby/object:Gem::Requirement
36
- requirements:
37
- - - "~>"
38
- - !ruby/object:Gem::Version
39
- version: '6.0'
40
- - !ruby/object:Gem::Dependency
41
- name: rqrcode
42
- requirement: !ruby/object:Gem::Requirement
43
- requirements:
44
- - - "~>"
45
- - !ruby/object:Gem::Version
46
- version: '2.2'
47
- type: :runtime
48
- prerelease: false
49
- version_requirements: !ruby/object:Gem::Requirement
50
- requirements:
51
- - - "~>"
52
- - !ruby/object:Gem::Version
53
- version: '2.2'
54
- - !ruby/object:Gem::Dependency
55
- name: omniauth-github
56
- requirement: !ruby/object:Gem::Requirement
57
- requirements:
58
- - - "~>"
59
- - !ruby/object:Gem::Version
60
- version: '2.0'
61
- type: :runtime
62
- prerelease: false
63
- version_requirements: !ruby/object:Gem::Requirement
64
- requirements:
65
- - - "~>"
66
- - !ruby/object:Gem::Version
67
- version: '2.0'
68
- - !ruby/object:Gem::Dependency
69
- name: omniauth-rails_csrf_protection
70
- requirement: !ruby/object:Gem::Requirement
71
- requirements:
72
- - - "~>"
73
- - !ruby/object:Gem::Version
74
- version: '1.0'
75
- type: :runtime
76
- prerelease: false
77
- version_requirements: !ruby/object:Gem::Requirement
78
- requirements:
79
- - - "~>"
80
- - !ruby/object:Gem::Version
81
- version: '1.0'
82
26
  - !ruby/object:Gem::Dependency
83
27
  name: pg
84
28
  requirement: !ruby/object:Gem::Requirement