hokipoki 0.9.0 → 0.9.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.
- checksums.yaml +4 -4
- data/lib/generators/hive_mind/install_generator.rb +200 -1
- data/lib/hokipoki/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 54cd3ed2f4a1f275235ee421c6b7a1a398e9b67ee20a5b1aad42ccc7c2bee825
|
|
4
|
+
data.tar.gz: 39c5c13b3fa4fc1ce31808778dc1d89430d45d6878c742108062e266d65a9f17
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3908b4f11564ba35afdb04299fb3ff21a978ed4d5402da39bb3aba7f48c289d5aef4df2633612d581713e708c3b7de4d28bc56a7b1bdc0e99028df2a6f7750c4
|
|
7
|
+
data.tar.gz: 785209bf54afb33e8a3c491890d868e6b501cea5d8b72c22876b1c1f580e5ee732a001db1f851262a05368ab0d425eabd919328fd6a579b074f704885c2e491a
|
|
@@ -133,6 +133,11 @@ module HiveMind
|
|
|
133
133
|
# Create Gemini API controller for vector refinement
|
|
134
134
|
directory 'api', 'app/controllers/api'
|
|
135
135
|
say @pastel.green("✓ Created app/controllers/api/gemini_controller.rb")
|
|
136
|
+
|
|
137
|
+
# Create parasite services (missing from hive_mind:install)
|
|
138
|
+
create_claude_detection_service
|
|
139
|
+
create_context_injection_service
|
|
140
|
+
create_parasitic_intelligence_initializer
|
|
136
141
|
end
|
|
137
142
|
|
|
138
143
|
def setup_routing
|
|
@@ -268,7 +273,9 @@ module HiveMind
|
|
|
268
273
|
say " - #{@pastel.green('✅')} HiveMind (app/models/hive_mind_document.rb)"
|
|
269
274
|
say " - #{@pastel.green('✅')} Vector embeddings (app/services/embedding_service.rb)"
|
|
270
275
|
say " - #{@pastel.green('✅')} Smart retrieval (app/services/smart_retrieval_engine.rb)"
|
|
271
|
-
say " - #{@pastel.green('✅')}
|
|
276
|
+
say " - #{@pastel.green('✅')} Claude detection (app/services/claude_detection_service.rb)"
|
|
277
|
+
say " - #{@pastel.green('✅')} Context injection (app/services/context_injection_service.rb)"
|
|
278
|
+
say " - #{@pastel.green('✅')} Parasitic intelligence (config/initializers/parasitic_intelligence.rb)"
|
|
272
279
|
say " - #{@pastel.green('✅')} Gemini refinement (rails gemini:start)"
|
|
273
280
|
say " - #{@pastel.green('✅')} Database migrations (with pgvector)"
|
|
274
281
|
|
|
@@ -794,6 +801,198 @@ module HiveMind
|
|
|
794
801
|
say "\n#{@pastel.green('Happy coding with HokiPoki! 🚀')}"
|
|
795
802
|
end
|
|
796
803
|
|
|
804
|
+
def create_claude_detection_service
|
|
805
|
+
say @pastel.green("✓ Creating Claude detection service")
|
|
806
|
+
|
|
807
|
+
create_file "app/services/claude_detection_service.rb", <<~RUBY
|
|
808
|
+
class ClaudeDetectionService
|
|
809
|
+
include Singleton
|
|
810
|
+
|
|
811
|
+
def initialize
|
|
812
|
+
@monitoring = false
|
|
813
|
+
@claude_detected = false
|
|
814
|
+
end
|
|
815
|
+
|
|
816
|
+
def start_monitoring
|
|
817
|
+
return if @monitoring
|
|
818
|
+
|
|
819
|
+
@monitoring = true
|
|
820
|
+
Rails.logger.info "🦠 ClaudeDetectionService: Starting monitoring"
|
|
821
|
+
|
|
822
|
+
# Check for Claude CLI immediately
|
|
823
|
+
if claude_cli_detected?
|
|
824
|
+
activate_parasitic_enhancement
|
|
825
|
+
end
|
|
826
|
+
|
|
827
|
+
# Start background monitoring
|
|
828
|
+
Thread.new do
|
|
829
|
+
monitor_claude_activity
|
|
830
|
+
end
|
|
831
|
+
end
|
|
832
|
+
|
|
833
|
+
def activate_parasitic_enhancement
|
|
834
|
+
return if @claude_detected
|
|
835
|
+
|
|
836
|
+
@claude_detected = true
|
|
837
|
+
puts "\\n🦠 CLAUDE DETECTED: Activating parasitic enhancement..."
|
|
838
|
+
Rails.logger.info "🦠 ClaudeDetectionService: Parasitic enhancement activated"
|
|
839
|
+
|
|
840
|
+
# Create session marker
|
|
841
|
+
File.write('/tmp/hokipoki_parasite_active', Time.current.to_s)
|
|
842
|
+
|
|
843
|
+
# Initialize hokipoki if available
|
|
844
|
+
if defined?(Hokipoki)
|
|
845
|
+
Hokipoki::ClaudeAutoLoader.force_load! if Hokipoki.respond_to?(:claude_parasite_active?) && Hokipoki.claude_parasite_active?
|
|
846
|
+
end
|
|
847
|
+
end
|
|
848
|
+
|
|
849
|
+
private
|
|
850
|
+
|
|
851
|
+
def claude_cli_detected?
|
|
852
|
+
ENV['CLAUDE_CLI'] == 'true' ||
|
|
853
|
+
ENV['ANTHROPIC_CLI'] == 'true' ||
|
|
854
|
+
ENV['CLAUDE_CODE'] == 'true' ||
|
|
855
|
+
ENV['CLAUDECODE'] == '1' ||
|
|
856
|
+
ENV['CLAUDE_CODE_ENTRYPOINT'] == 'cli' ||
|
|
857
|
+
File.exist?('/tmp/claude_session_active') ||
|
|
858
|
+
$0.include?('claude')
|
|
859
|
+
end
|
|
860
|
+
|
|
861
|
+
def monitor_claude_activity
|
|
862
|
+
loop do
|
|
863
|
+
begin
|
|
864
|
+
if !@claude_detected && claude_cli_detected?
|
|
865
|
+
activate_parasitic_enhancement
|
|
866
|
+
end
|
|
867
|
+
sleep(5)
|
|
868
|
+
rescue => e
|
|
869
|
+
Rails.logger.error "🦠 Claude monitoring error: \#{e.message}"
|
|
870
|
+
end
|
|
871
|
+
end
|
|
872
|
+
end
|
|
873
|
+
end
|
|
874
|
+
RUBY
|
|
875
|
+
end
|
|
876
|
+
|
|
877
|
+
def create_context_injection_service
|
|
878
|
+
say @pastel.green("✓ Creating context injection service")
|
|
879
|
+
|
|
880
|
+
create_file "app/services/context_injection_service.rb", <<~RUBY
|
|
881
|
+
class ContextInjectionService
|
|
882
|
+
include Singleton
|
|
883
|
+
|
|
884
|
+
def initialize
|
|
885
|
+
@injection_active = false
|
|
886
|
+
end
|
|
887
|
+
|
|
888
|
+
def activate_injection
|
|
889
|
+
return if @injection_active
|
|
890
|
+
|
|
891
|
+
@injection_active = true
|
|
892
|
+
Rails.logger.info "🎯 ContextInjectionService: Context injection activated"
|
|
893
|
+
|
|
894
|
+
# Start background context monitoring
|
|
895
|
+
Thread.new do
|
|
896
|
+
monitor_context_opportunities
|
|
897
|
+
end
|
|
898
|
+
end
|
|
899
|
+
|
|
900
|
+
def inject_context(query, context_data)
|
|
901
|
+
return query unless @injection_active
|
|
902
|
+
|
|
903
|
+
enhanced_query = query.dup
|
|
904
|
+
|
|
905
|
+
# Inject relevant context based on query intent
|
|
906
|
+
if context_data.any?
|
|
907
|
+
context_summary = context_data.join(" | ")
|
|
908
|
+
enhanced_query = "Context: \#{context_summary}\\n\\nQuery: \#{query}"
|
|
909
|
+
end
|
|
910
|
+
|
|
911
|
+
enhanced_query
|
|
912
|
+
end
|
|
913
|
+
|
|
914
|
+
private
|
|
915
|
+
|
|
916
|
+
def monitor_context_opportunities
|
|
917
|
+
loop do
|
|
918
|
+
begin
|
|
919
|
+
# Look for opportunities to inject context
|
|
920
|
+
if context_injection_needed?
|
|
921
|
+
perform_context_injection
|
|
922
|
+
end
|
|
923
|
+
sleep(10)
|
|
924
|
+
rescue => e
|
|
925
|
+
Rails.logger.error "🎯 Context injection error: \#{e.message}"
|
|
926
|
+
end
|
|
927
|
+
end
|
|
928
|
+
end
|
|
929
|
+
|
|
930
|
+
def context_injection_needed?
|
|
931
|
+
# Check if Claude is active and could benefit from context
|
|
932
|
+
File.exist?('/tmp/claude_session_active') &&
|
|
933
|
+
File.mtime('/tmp/claude_session_active') > 30.seconds.ago
|
|
934
|
+
end
|
|
935
|
+
|
|
936
|
+
def perform_context_injection
|
|
937
|
+
# Inject relevant project context
|
|
938
|
+
Rails.logger.info "🎯 Injecting context for Claude session"
|
|
939
|
+
|
|
940
|
+
if defined?(HiveMindDocument)
|
|
941
|
+
recent_vectors = HiveMindDocument.limit(5).order(created_at: :desc)
|
|
942
|
+
context = recent_vectors.map(&:content).join(" | ")
|
|
943
|
+
|
|
944
|
+
# Store context injection event
|
|
945
|
+
HiveMindDocument.store_content(
|
|
946
|
+
"Context injection performed: \#{context[0..200]}...",
|
|
947
|
+
source_type: 'context_injection',
|
|
948
|
+
source_id: "injection_\#{Time.current.to_i}",
|
|
949
|
+
metadata: { injected_at: Time.current }
|
|
950
|
+
)
|
|
951
|
+
end
|
|
952
|
+
end
|
|
953
|
+
end
|
|
954
|
+
RUBY
|
|
955
|
+
end
|
|
956
|
+
|
|
957
|
+
def create_parasitic_intelligence_initializer
|
|
958
|
+
say @pastel.green("✓ Creating parasitic intelligence initializer")
|
|
959
|
+
|
|
960
|
+
parasite_intelligence_content = <<~RUBY
|
|
961
|
+
# Parasitic Intelligence Initializer
|
|
962
|
+
# Auto-generated by rails g hive_mind:install
|
|
963
|
+
# This file enables parasitic intelligence attachment to Claude CLI
|
|
964
|
+
|
|
965
|
+
if defined?(Hokipoki)
|
|
966
|
+
Rails.application.config.after_initialize do
|
|
967
|
+
# Auto-detect Claude CLI and activate parasitic enhancement
|
|
968
|
+
if Hokipoki.respond_to?(:claude_parasite_active?) && Hokipoki.claude_parasite_active?
|
|
969
|
+
Rails.logger.info "🦠 PARASITIC INTELLIGENCE: Initializing..."
|
|
970
|
+
|
|
971
|
+
# Start Claude detection service
|
|
972
|
+
if defined?(ClaudeDetectionService)
|
|
973
|
+
ClaudeDetectionService.instance.start_monitoring
|
|
974
|
+
end
|
|
975
|
+
|
|
976
|
+
# Start context injection service
|
|
977
|
+
if defined?(ContextInjectionService)
|
|
978
|
+
ContextInjectionService.instance.activate_injection
|
|
979
|
+
end
|
|
980
|
+
|
|
981
|
+
# Initialize hokipoki parasite if available
|
|
982
|
+
if defined?(Hokipoki::ClaudeAutoLoader)
|
|
983
|
+
Hokipoki::ClaudeAutoLoader.force_load!
|
|
984
|
+
end
|
|
985
|
+
|
|
986
|
+
Rails.logger.info "🦠 PARASITIC INTELLIGENCE: ONLINE"
|
|
987
|
+
puts "🦠 PARASITIC INTELLIGENCE ATTACHMENT SUCCESSFUL!"
|
|
988
|
+
end
|
|
989
|
+
end
|
|
990
|
+
end
|
|
991
|
+
RUBY
|
|
992
|
+
|
|
993
|
+
create_file "config/initializers/parasitic_intelligence.rb", parasite_intelligence_content
|
|
994
|
+
end
|
|
995
|
+
|
|
797
996
|
def self.next_migration_number(dirname)
|
|
798
997
|
ActiveRecord::Generators::Base.next_migration_number(dirname)
|
|
799
998
|
end
|
data/lib/hokipoki/version.rb
CHANGED