hokipoki 0.1.4 → 0.2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e3e1bff3991e48d0e4ba243f6a30fd19c9e403a3c322afc4c34d4ba4eb39ad12
4
- data.tar.gz: 2adc22f2d0a4561d462b162058c3bbd44f742c85886257c0c7c2cdde8aeeb14b
3
+ metadata.gz: 0e2215f08a821ad6f9bb2284a287c4c61cae3351aa97f090e725cad83059226a
4
+ data.tar.gz: 2741d2b6abc2c978ea1f373e9fb9f539c3b98a7fda62247554526b98c5ff5c79
5
5
  SHA512:
6
- metadata.gz: 2516348cf9b601352cd07335e78cd32267866ce0808c55bd1726fcd478992e9445ca3a56b76a7cd5f66f9bb0e0877f6088f0c5d7b9e6017efc92a91ab871b2ea
7
- data.tar.gz: d3bc48d25e69d0791218a6c50b40b0ef450c0d5a9be53e77b1da9e857e8a8d57c66f201dad6447b3f8e0f2eb5902ff41f0a7eb6fd960b27bfab071e5a875fd4f
6
+ metadata.gz: 224eaebd899dcee16735b9aa1d4cbfcef59d41ffb78dd7b034f233b5d86adf787731669fdb0985f3395a7c9dc7e7ee1f3be2df9774c3252494fc334da5875580
7
+ data.tar.gz: 7f60aba74077f85d1bf31d23933444ba75613c1675b09fdb1f1d559ae3344e6417bbeac8c15364e248fd6dab499cc21b434d717e4254f7005e503d9ab35d057c
@@ -63,114 +63,105 @@ module HiveMind
63
63
  end
64
64
 
65
65
  def welcome_message
66
- say "\n#{@pastel.cyan.bold('🚀 Welcome to HokiPoki - Revolutionary AI Intelligence Platform')}"
67
- say @pastel.green("Transform your Rails app with vector intelligence, universal parasites, and template-as-data architecture!")
68
- say "\n#{@pastel.yellow('Installation Options:')}"
69
- say " #{@pastel.blue('--minimal')} : Core vector DB + smart retrieval (minimal)"
70
- say " #{@pastel.blue('--claude')} : HiveMind + Claude integration (recommended for Claude users)"
71
- say " #{@pastel.blue('--full')} : Everything - HiveMind + Parasites + Forge + Security (maximum power)"
72
- say " #{@pastel.blue('Interactive')}: Choose components (recommended)\n"
66
+ say "\n#{@pastel.cyan.bold('🚀 Welcome to HokiPoki - Lightweight HiveMind + Claude Integration')}"
67
+ say @pastel.green("Installing minimal HiveMind with secure OTP authentication and Claude parasite.")
68
+ say "\n"
73
69
  end
74
70
 
75
71
  def gather_installation_preferences
76
72
  # Security authentication required before any installation
77
73
  security_authentication
78
74
 
79
- return setup_minimal_installation if options[:minimal]
80
- return setup_claude_installation if options[:claude]
81
- return setup_full_installation if options[:full]
82
-
83
- setup_interactive_installation
75
+ # Always install minimal lightweight version
76
+ @config = {
77
+ hive_mind_enabled: true,
78
+ claude_parasite_enabled: true,
79
+ skip_complex_components: true
80
+ }
84
81
  end
85
82
 
86
83
  def validate_requirements
87
84
  check_ruby_version
88
85
  check_rails_version
89
- check_database_support
90
- check_redis_availability if @config[:redis_required]
86
+ # Skip complex database and redis checks for minimal install
87
+ end
88
+
89
+ def add_gems_to_gemfile
90
+ say "\n#{@pastel.cyan('💎 Adding required gems to Gemfile...')}"
91
+
92
+ # Add essential HiveMind gems
93
+ gem 'pg', '>= 1.0' unless File.read('Gemfile').include?('pg')
94
+ gem 'neighbor', '>= 0.3' unless File.read('Gemfile').include?('neighbor') # pgvector for Rails
95
+ gem 'pgvector', '>= 0.2' unless File.read('Gemfile').include?('pgvector') # Direct pgvector support
96
+ gem 'redis', '>= 4.0' unless File.read('Gemfile').include?('redis')
97
+ gem 'ruby-openai', '>= 6.0' unless File.read('Gemfile').include?('ruby-openai') # For LLM integration
98
+ gem 'faraday', '>= 2.0' unless File.read('Gemfile').include?('faraday') # HTTP client for LLM APIs
99
+
100
+ say @pastel.green("✓ Added pg, neighbor, pgvector, redis, ruby-openai, faraday to Gemfile")
91
101
  end
92
102
 
93
103
  def create_configuration_files
94
104
  return if options[:skip_config]
95
105
 
96
- say "\n#{@pastel.cyan('📝 Creating configuration files...')}"
97
-
98
- template 'initializers/hokipoki.rb.tt', 'config/initializers/hokipoki.rb'
106
+ say "\n#{@pastel.cyan('📝 Creating minimal configuration files...')}"
99
107
 
100
- if @config[:lm_studio_integration]
101
- template 'initializers/lm_studio.rb.tt', 'config/initializers/lm_studio.rb'
102
- end
108
+ # Just create a simple initializer
109
+ create_file "config/initializers/hokipoki.rb", <<~RUBY
110
+ # HokiPoki Configuration
111
+ Hokipoki.configure do |config|
112
+ config.hive_mind_enabled = true
113
+ config.claude_parasite_enabled = true
114
+ end
115
+ RUBY
103
116
 
104
- create_configuration_yml
105
- create_brain_configurations if @config[:enable_brains]
117
+ say @pastel.green("✓ Created config/initializers/hokipoki.rb")
106
118
  end
107
119
 
108
120
  def setup_database_migrations
109
121
  return if options[:skip_migrations]
110
122
 
111
- say "\n#{@pastel.cyan('🗄️ Setting up database migrations...')}"
123
+ say "\n#{@pastel.cyan('🗄️ Creating migration files...')}"
112
124
 
113
- # Core tables
114
- migration_template 'migrations/enable_pgvector.rb.tt', 'db/migrate/enable_pgvector.rb'
115
- migration_template 'migrations/create_documents.rb.tt', 'db/migrate/create_documents.rb'
116
- migration_template 'migrations/create_intelligence_templates.rb.tt', 'db/migrate/create_intelligence_templates.rb'
125
+ # Create simple migration for HiveMind
126
+ migration_template 'create_hive_mind_documents.rb', 'db/migrate/create_hive_mind_documents.rb'
117
127
 
118
- # Parasite tables
119
- if @config[:enable_parasites]
120
- migration_template 'migrations/create_custom_parasites.rb.tt', 'db/migrate/create_custom_parasites.rb'
121
- migration_template 'migrations/create_llm_behavioral_patterns.rb.tt', 'db/migrate/create_llm_behavioral_patterns.rb'
122
- end
123
-
124
- # Brain management tables
125
- if @config[:enable_brains]
126
- migration_template 'migrations/create_brain_configurations.rb.tt', 'db/migrate/create_brain_configurations.rb'
127
- end
128
-
129
- # Security tables
130
- if @config[:enable_security]
131
- migration_template 'migrations/create_security_audit_logs.rb.tt', 'db/migrate/create_security_audit_logs.rb'
132
- end
128
+ say @pastel.green("✓ Migration files created")
129
+ say @pastel.yellow(" Next step: Run 'rails db:migrate' to set up the database")
133
130
  end
134
131
 
135
132
  def create_application_components
136
- say "\n#{@pastel.cyan('🏗️ Creating application components...')}"
137
-
138
- # Create models
139
- template 'app/models/hokipoki/document.rb.tt', 'app/models/hokipoki/document.rb'
140
- template 'app/models/hokipoki/intelligence_template.rb.tt', 'app/models/hokipoki/intelligence_template.rb'
141
-
142
- if @config[:enable_parasites]
143
- template 'app/models/hokipoki/custom_parasite.rb.tt', 'app/models/hokipoki/custom_parasite.rb'
144
- end
145
-
146
- # Create controllers
147
- template 'app/controllers/hokipoki/api/documents_controller.rb.tt', 'app/controllers/hokipoki/api/documents_controller.rb'
148
- template 'app/controllers/hokipoki/api/vector_search_controller.rb.tt', 'app/controllers/hokipoki/api/vector_search_controller.rb'
149
-
150
- if @config[:enable_parasites]
151
- template 'app/controllers/hokipoki/api/parasites_controller.rb.tt', 'app/controllers/hokipoki/api/parasites_controller.rb'
152
- end
153
-
154
- # Create services
155
- create_service_components
156
-
157
- # Create jobs
158
- if @config[:background_processing]
159
- template 'app/jobs/hokipoki/document_processor_job.rb.tt', 'app/jobs/hokipoki/document_processor_job.rb'
133
+ say "\n#{@pastel.cyan('🏗️ Creating basic HiveMind model...')}"
134
+
135
+ # Create simple Document model
136
+ create_file "app/models/hive_mind_document.rb", <<~RUBY
137
+ # HiveMind Document Model
138
+ class HiveMindDocument < ApplicationRecord
139
+ validates :content, presence: true
140
+
141
+ scope :by_source, ->(type, id) { where(source_type: type, source_id: id) }
142
+
143
+ def self.store_content(content, source_type: nil, source_id: nil, metadata: {})
144
+ create!(
145
+ content: content,
146
+ source_type: source_type,
147
+ source_id: source_id,
148
+ metadata: metadata
149
+ )
150
+ end
160
151
 
161
- if @config[:enable_parasites]
162
- template 'app/jobs/hokipoki/parasite_optimization_job.rb.tt', 'app/jobs/hokipoki/parasite_optimization_job.rb'
152
+ def self.search_content(query)
153
+ # Simple text search for now - vector search after pgvector setup
154
+ where("content ILIKE ?", "%\#{query}%")
155
+ end
163
156
  end
164
- end
157
+ RUBY
158
+
159
+ say @pastel.green("✓ Created app/models/hive_mind_document.rb")
165
160
  end
166
161
 
167
162
  def setup_routing
168
- say "\n#{@pastel.cyan('🛣️ Setting up routes...')}"
169
-
170
- route_content = generate_route_content
171
- inject_into_file 'config/routes.rb', after: "Rails.application.routes.draw do\n" do
172
- route_content
173
- end
163
+ say "\n#{@pastel.cyan('🛣️ Skipping routes for lightweight install')}"
164
+ say @pastel.green("✓ No additional routes needed")
174
165
  end
175
166
 
176
167
  def create_cli_tools
@@ -236,44 +227,29 @@ module HiveMind
236
227
  end
237
228
 
238
229
  def display_completion_message
239
- say "\n#{@pastel.green.bold('✅ HokiPoki installation completed successfully!')}"
240
- say "\n#{@pastel.cyan.bold('🎯 Quick Start Guide:')}"
230
+ say "\n#{@pastel.green.bold('✅ HokiPoki lightweight installation completed!')}"
231
+ say "\n#{@pastel.cyan.bold('🎯 Next Steps:')}"
241
232
 
242
- if @config[:enable_parasites]
243
- say " #{@pastel.yellow('Generate a parasite:')}"
244
- say " rails g hive_mind:parasite claude_cli claude --optimize"
245
- end
246
-
247
- if @config[:enable_brains]
248
- say " #{@pastel.yellow('Create a brain:')}"
249
- say " rails g hive_mind:brain training_js --domain=javascript"
250
- end
233
+ say " #{@pastel.yellow('1. Install gem dependencies:')}"
234
+ say " bundle install"
251
235
 
252
- say " #{@pastel.yellow('Use in your code:')}"
253
- say " facts = Hokipoki.retrieve_facts('how to implement authentication')"
236
+ say "\n #{@pastel.yellow('2. Run database migration:')}"
237
+ say " rails db:migrate"
254
238
 
255
- if @config[:enable_parasites]
256
- say " parasite = Hokipoki.generate_parasite(tool: 'claude_cli', model: 'claude')"
257
- end
239
+ say "\n #{@pastel.yellow('3. Test basic functionality:')}"
240
+ say " HiveMindDocument.store_content('Hello HiveMind!')"
241
+ say " HiveMindDocument.search_content('Hello')"
258
242
 
259
- say "\n#{@pastel.blue.bold('📖 Documentation:')}"
260
- say " - Configuration: config/initializers/hokipoki.rb"
261
- say " - API Endpoints: /hokipoki/api/"
262
- say " - Admin Dashboard: /hokipoki/admin/ (if enabled)"
243
+ say "\n #{@pastel.yellow('4. Use in your code:')}"
244
+ say " facts = Hokipoki.retrieve_facts('your query here')"
263
245
 
264
- if @config[:enable_security]
265
- say "\n#{@pastel.red.bold('🔒 Security:')}"
266
- say " - API authentication enabled"
267
- say " - Audit logging configured"
268
- say " - Check config/initializers/hokipoki.rb for security settings"
269
- end
270
-
271
- # Claude-specific completion message
272
- if @config[:enable_claude_integration]
273
- display_claude_completion_message
274
- end
246
+ say "\n#{@pastel.blue.bold('📁 Files Created:')}"
247
+ say " - Gemfile (gems added: pg, neighbor, pgvector, redis, ruby-openai, faraday)"
248
+ say " - config/initializers/hokipoki.rb"
249
+ say " - app/models/hive_mind_document.rb"
250
+ say " - db/migrate/create_hive_mind_documents.rb"
275
251
 
276
- display_next_steps
252
+ say "\n#{@pastel.green.bold('🚀 HiveMind + Claude Parasite Ready!')}"
277
253
  end
278
254
 
279
255
  private
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ class CreateHiveMindDocuments < ActiveRecord::Migration[7.0]
4
+ def change
5
+ # Enable pgvector extension
6
+ enable_extension 'vector'
7
+
8
+ create_table :hive_mind_documents do |t|
9
+ t.text :content, null: false
10
+ t.string :source_type
11
+ t.string :source_id
12
+ t.json :metadata, default: {}
13
+
14
+ # Vector embedding column for similarity search
15
+ t.vector :embedding, limit: 768
16
+
17
+ t.timestamps
18
+ end
19
+
20
+ add_index :hive_mind_documents, :source_type
21
+ add_index :hive_mind_documents, [:source_type, :source_id]
22
+ add_index :hive_mind_documents, :embedding, using: :hnsw, opclass: :vector_cosine_ops
23
+ end
24
+ end
@@ -2,186 +2,18 @@
2
2
 
3
3
  module Hokipoki
4
4
  class Configuration
5
- attr_accessor :vector_dimensions,
6
- :lm_studio_url,
7
- :embedding_model,
8
- :enable_parasites,
9
- :enable_forge,
10
- :enable_behavioral_analysis,
11
- :enable_template_optimization,
12
- :template_caching,
13
- :token_budget_default,
14
- :context_compression,
15
- :offline_mode,
16
- :api_authentication,
17
- :audit_logging,
18
- :encrypted_logging,
19
- :rate_limiting,
20
- :default_brain,
21
- :auto_brain_switching,
22
- :universal_parasite_generation,
23
- :auto_optimization,
24
- :cross_parasite_learning,
25
- :workshop_interface,
26
- :background_processing,
27
- :multi_llm_orchestration,
28
- :redis_url,
29
- :cache_ttl,
30
- :max_retries
5
+ attr_accessor :hive_mind_enabled,
6
+ :claude_parasite_enabled
31
7
 
32
8
  def initialize
33
- # === CORE SETTINGS ===
34
- @vector_dimensions = 768
35
- @lm_studio_url = ENV.fetch('LM_STUDIO_URL', 'http://localhost:1236')
36
- @embedding_model = ENV.fetch('EMBEDDING_MODEL', 'text-embedding-nomic-embed-text-v1.5')
37
-
38
- # === COMPONENT ACTIVATION ===
39
- @enable_parasites = ENV.fetch('HOKIPOKI_ENABLE_PARASITES', 'true') == 'true'
40
- @enable_forge = ENV.fetch('HOKIPOKI_ENABLE_FORGE', 'false') == 'true'
41
- @enable_behavioral_analysis = ENV.fetch('HOKIPOKI_ENABLE_BEHAVIORAL_ANALYSIS', 'true') == 'true'
42
- @enable_template_optimization = ENV.fetch('HOKIPOKI_ENABLE_TEMPLATE_OPTIMIZATION', 'true') == 'true'
43
-
44
- # === PERFORMANCE ===
45
- @template_caching = ENV.fetch('HOKIPOKI_TEMPLATE_CACHING', 'true') == 'true'
46
- @token_budget_default = ENV.fetch('HOKIPOKI_TOKEN_BUDGET_DEFAULT', '1500').to_i
47
- @context_compression = ENV.fetch('HOKIPOKI_CONTEXT_COMPRESSION', 'true') == 'true'
48
- @offline_mode = ENV.fetch('HOKIPOKI_OFFLINE_MODE', 'false') == 'true'
49
- @cache_ttl = ENV.fetch('HOKIPOKI_CACHE_TTL', '3600').to_i # 1 hour default
50
- @max_retries = ENV.fetch('HOKIPOKI_MAX_RETRIES', '3').to_i
51
-
52
- # === SECURITY ===
53
- @api_authentication = ENV.fetch('HOKIPOKI_API_AUTHENTICATION', 'true') == 'true'
54
- @audit_logging = ENV.fetch('HOKIPOKI_AUDIT_LOGGING', 'true') == 'true'
55
- @encrypted_logging = ENV.fetch('HOKIPOKI_ENCRYPTED_LOGGING', 'false') == 'true'
56
- @rate_limiting = ENV.fetch('HOKIPOKI_RATE_LIMITING', 'true') == 'true'
57
-
58
- # === BRAINS CONFIGURATION ===
59
- @default_brain = ENV.fetch('HOKIPOKI_DEFAULT_BRAIN', 'default_brain')
60
- @auto_brain_switching = ENV.fetch('HOKIPOKI_AUTO_BRAIN_SWITCHING', 'true') == 'true'
61
-
62
- # === PARASITE SYSTEM ===
63
- @universal_parasite_generation = ENV.fetch('HOKIPOKI_UNIVERSAL_PARASITE_GENERATION', 'true') == 'true'
64
- @auto_optimization = ENV.fetch('HOKIPOKI_AUTO_OPTIMIZATION', 'true') == 'true'
65
- @cross_parasite_learning = ENV.fetch('HOKIPOKI_CROSS_PARASITE_LEARNING', 'true') == 'true'
66
-
67
- # === FORGE CONFIGURATION ===
68
- @workshop_interface = ENV.fetch('HOKIPOKI_WORKSHOP_INTERFACE', 'true') == 'true'
69
- @background_processing = ENV.fetch('HOKIPOKI_BACKGROUND_PROCESSING', 'sidekiq').to_sym
70
- @multi_llm_orchestration = ENV.fetch('HOKIPOKI_MULTI_LLM_ORCHESTRATION', 'true') == 'true'
71
-
72
- # === REDIS CONFIGURATION ===
73
- @redis_url = ENV.fetch('REDIS_URL', 'redis://localhost:6379/0')
9
+ # Simple configuration for lightweight HiveMind
10
+ @hive_mind_enabled = false # Will be true after installation
11
+ @claude_parasite_enabled = true
74
12
  end
75
13
 
76
14
  def validate!
77
- errors = []
78
-
79
- errors << "vector_dimensions must be positive" if vector_dimensions <= 0
80
- errors << "token_budget_default must be positive" if token_budget_default <= 0
81
- errors << "lm_studio_url must be a valid URL" unless valid_url?(lm_studio_url)
82
- errors << "redis_url must be a valid URL" unless valid_url?(redis_url)
83
- errors << "cache_ttl must be positive" if cache_ttl <= 0
84
- errors << "max_retries must be non-negative" if max_retries < 0
85
-
86
- unless %i[sidekiq resque delayed_job].include?(background_processing)
87
- errors << "background_processing must be one of: sidekiq, resque, delayed_job"
88
- end
89
-
90
- raise ConfigurationError, "Configuration errors: #{errors.join(', ')}" if errors.any?
91
-
15
+ # Simple validation - just check that basic settings are reasonable
92
16
  true
93
17
  end
94
-
95
- def redis_config
96
- {
97
- url: redis_url,
98
- timeout: 5,
99
- reconnect_attempts: max_retries
100
- }
101
- end
102
-
103
- def lm_studio_config
104
- {
105
- url: lm_studio_url,
106
- timeout: 30,
107
- retries: max_retries,
108
- embedding_model: embedding_model
109
- }
110
- end
111
-
112
- def vector_config
113
- {
114
- dimensions: vector_dimensions,
115
- distance_metric: 'cosine',
116
- index_type: 'hnsw'
117
- }
118
- end
119
-
120
- def security_config
121
- {
122
- api_authentication: api_authentication,
123
- audit_logging: audit_logging,
124
- encrypted_logging: encrypted_logging,
125
- rate_limiting: rate_limiting
126
- }
127
- end
128
-
129
- def parasite_config
130
- {
131
- enabled: enable_parasites,
132
- universal_generation: universal_parasite_generation,
133
- auto_optimization: auto_optimization,
134
- cross_learning: cross_parasite_learning,
135
- behavioral_analysis: enable_behavioral_analysis
136
- }
137
- end
138
-
139
- def forge_config
140
- {
141
- enabled: enable_forge,
142
- workshop_interface: workshop_interface,
143
- background_processing: background_processing,
144
- multi_llm_orchestration: multi_llm_orchestration
145
- }
146
- end
147
-
148
- def intelligence_config
149
- {
150
- template_optimization: enable_template_optimization,
151
- template_caching: template_caching,
152
- context_compression: context_compression,
153
- token_budget_default: token_budget_default,
154
- offline_mode: offline_mode
155
- }
156
- end
157
-
158
- def brain_config
159
- {
160
- default_brain: default_brain,
161
- auto_switching: auto_brain_switching
162
- }
163
- end
164
-
165
- # Environment helpers
166
- def development?
167
- Rails.env.development? if defined?(Rails)
168
- end
169
-
170
- def production?
171
- Rails.env.production? if defined?(Rails)
172
- end
173
-
174
- def test?
175
- Rails.env.test? if defined?(Rails)
176
- end
177
-
178
- private
179
-
180
- def valid_url?(url)
181
- uri = URI.parse(url)
182
- uri.is_a?(URI::HTTP) || uri.is_a?(URI::HTTPS)
183
- rescue URI::InvalidURIError
184
- false
185
- end
186
18
  end
187
19
  end
@@ -1,3 +1,3 @@
1
1
  module Hokipoki
2
- VERSION = "0.1.4"
2
+ VERSION = "0.2.1"
3
3
  end
data/lib/hokipoki.rb CHANGED
@@ -5,83 +5,16 @@ require_relative "hokipoki/version"
5
5
  module Hokipoki
6
6
  class Error < StandardError; end
7
7
  class ConfigurationError < Error; end
8
- class IntelligenceError < Error; end
9
- class ParasiteError < Error; end
8
+ class HiveMindError < Error; end
10
9
  end
11
10
 
12
11
  require_relative "hokipoki/configuration"
13
12
  require_relative "hokipoki/license_validator"
14
13
  require_relative "hokipoki/engine"
15
14
 
16
- # Feedback system (load first)
15
+ # Essential components only
17
16
  require_relative "hokipoki/feedback/display_manager"
18
17
 
19
- # Core modules (conditional loading)
20
- begin
21
- require_relative "hokipoki/core/vector_intelligence"
22
- require_relative "hokipoki/core/brain_manager"
23
- require_relative "hokipoki/core/embedding_patterns"
24
- require_relative "hokipoki/core/token_budget_manager"
25
- rescue LoadError => e
26
- # Core modules are optional during development
27
- Rails.logger&.debug "Core modules not loaded: #{e.message}"
28
- end
29
-
30
- # Intelligence modules (conditional loading)
31
- begin
32
- require_relative "hokipoki/intelligence/unified_orchestrator"
33
- require_relative "hokipoki/intelligence/smart_retrieval_engine"
34
- require_relative "hokipoki/intelligence/template_registry"
35
- require_relative "hokipoki/intelligence/template_seeding_service"
36
- require_relative "hokipoki/intelligence/pattern_compliance"
37
- rescue LoadError => e
38
- # Intelligence modules are optional during development
39
- Rails.logger&.debug "Intelligence modules not loaded: #{e.message}"
40
- end
41
-
42
- # Parasite modules (conditional loading)
43
- begin
44
- require_relative "hokipoki/parasites/universal_generator"
45
- require_relative "hokipoki/parasites/parasite_registry"
46
- require_relative "hokipoki/parasites/behavioral_analyzer"
47
- require_relative "hokipoki/parasites/optimizer"
48
- require_relative "hokipoki/parasites/intelligence_network"
49
- rescue LoadError => e
50
- # Parasite modules are optional during development
51
- Rails.logger&.debug "Parasite modules not loaded: #{e.message}"
52
- end
53
-
54
- # Forge modules (optional)
55
- begin
56
- require_relative "hokipoki/forge/generator_forge"
57
- require_relative "hokipoki/forge/workshop_interface"
58
- require_relative "hokipoki/forge/document_processor"
59
- require_relative "hokipoki/forge/pipeline_orchestrator"
60
- rescue LoadError => e
61
- # Forge components are optional
62
- Rails.logger&.debug "Forge components not loaded: #{e.message}"
63
- end
64
-
65
- # Security modules (conditional loading)
66
- begin
67
- require_relative "hokipoki/security/audit_service"
68
- require_relative "hokipoki/security/offline_optimizer"
69
- require_relative "hokipoki/security/api_authentication"
70
- rescue LoadError => e
71
- # Security modules are optional during development
72
- Rails.logger&.debug "Security modules not loaded: #{e.message}"
73
- end
74
-
75
- # Claude integration modules (lazy loaded)
76
- begin
77
- require_relative "hokipoki/claude/auto_loader"
78
- require_relative "hokipoki/claude/connection_manager"
79
- require_relative "hokipoki/claude/parasite"
80
- rescue LoadError => e
81
- # Claude modules are optional
82
- Rails.logger&.debug "Claude integration not loaded: #{e.message}"
83
- end
84
-
85
18
  module Hokipoki
86
19
  # Validate license on gem load (before anything else)
87
20
  begin
@@ -106,110 +39,36 @@ module Hokipoki
106
39
  configuration || configure
107
40
  end
108
41
 
109
- # Check if component is enabled
110
- def parasites_enabled?
111
- config.enable_parasites
112
- end
113
-
114
- def forge_enabled?
115
- config.enable_forge
116
- end
117
-
118
- def behavioral_analysis_enabled?
119
- config.enable_behavioral_analysis
120
- end
121
-
122
- def template_optimization_enabled?
123
- config.enable_template_optimization
124
- end
125
-
126
- # Main API methods - shortcuts to core services
127
-
128
- # Retrieve targeted facts with vector intelligence
129
- def retrieve_facts(query, token_budget: 1500, intent: 'auto')
130
- if defined?(Intelligence::UnifiedOrchestrator)
131
- Intelligence::UnifiedOrchestrator.instance.retrieve_targeted_facts(
132
- query,
133
- token_budget: token_budget,
134
- intent: intent
135
- )
136
- else
137
- Rails.logger&.warn "Intelligence modules not loaded - install HiveMind first"
138
- []
139
- end
140
- end
141
-
142
- # Generate universal parasite
143
- def generate_parasite(requirements)
144
- raise ParasiteError, "Parasites not enabled" unless parasites_enabled?
145
-
146
- if defined?(Parasites::UniversalGenerator)
147
- Parasites::UniversalGenerator.instance.generate_parasite(requirements)
148
- else
149
- raise ParasiteError, "Parasite modules not loaded - install HiveMind first"
150
- end
151
- end
152
-
153
- # Process intelligence request
154
- def process_intelligence(request_type, input_data, options = {})
155
- if defined?(Intelligence::UnifiedOrchestrator)
156
- Intelligence::UnifiedOrchestrator.instance.process_intelligence_request(
157
- request_type,
158
- input_data,
159
- options
160
- )
161
- else
162
- Rails.logger&.warn "Intelligence modules not loaded - install HiveMind first"
163
- { error: "Intelligence modules not available" }
164
- end
42
+ # Simple Claude parasite - just shows HiveMind is connected
43
+ def claude_parasite_active?
44
+ ENV['CLAUDE_CODE_SESSION'] == 'true' || File.exist?('/tmp/claude_session_active')
165
45
  end
166
46
 
167
- # Switch brain context
168
- def switch_brain(brain_name, context = {})
169
- if defined?(Core::BrainManager)
170
- Core::BrainManager.instance.switch_brain(brain_name, context)
171
- else
172
- Rails.logger&.warn "Core modules not loaded - install HiveMind first"
173
- false
174
- end
47
+ # Main API - simple fact retrieval
48
+ def retrieve_facts(query, token_budget: 1500)
49
+ Rails.logger&.info "🔍 <performing retrieval to HIVE-MIND> Query: #{query[0..50]}..."
50
+ # Placeholder for now - generator will install the real implementation
51
+ []
175
52
  end
176
53
 
177
54
  # Get system status
178
55
  def system_status
179
56
  {
180
57
  version: VERSION,
181
- components: {
182
- parasites: parasites_enabled?,
183
- forge: forge_enabled?,
184
- behavioral_analysis: behavioral_analysis_enabled?,
185
- template_optimization: template_optimization_enabled?
186
- },
187
- orchestrator: defined?(Intelligence::UnifiedOrchestrator) ?
188
- Intelligence::UnifiedOrchestrator.instance.get_system_status :
189
- { status: "not_installed" },
58
+ hive_mind_installed: false, # Will be true after generator runs
59
+ claude_parasite: claude_parasite_active?,
190
60
  timestamp: Time.current.iso8601
191
61
  }
192
62
  end
193
63
 
194
64
  # Health check
195
65
  def healthy?
196
- begin
197
- config.present? && (
198
- !defined?(Intelligence::UnifiedOrchestrator) ||
199
- Intelligence::UnifiedOrchestrator.instance.get_system_status[:unified_orchestrator] == 'operational'
200
- )
201
- rescue => e
202
- Rails.logger&.error "Hokipoki health check failed: #{e.message}"
203
- false
204
- end
66
+ config.present?
205
67
  end
206
68
 
207
69
  # Reset configuration (useful for testing)
208
70
  def reset!
209
71
  self.configuration = nil
210
- # Clear any singleton instances
211
- Intelligence::UnifiedOrchestrator.instance.instance_variable_set(:@initialized, false) rescue nil
212
- Parasites::UniversalGenerator.instance.instance_variable_set(:@initialized, false) rescue nil
213
72
  end
214
73
  end
215
74
  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.1.4
4
+ version: 0.2.1
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: pg
28
- requirement: !ruby/object:Gem::Requirement
29
- requirements:
30
- - - ">="
31
- - !ruby/object:Gem::Version
32
- version: '1.0'
33
- type: :runtime
34
- prerelease: false
35
- version_requirements: !ruby/object:Gem::Requirement
36
- requirements:
37
- - - ">="
38
- - !ruby/object:Gem::Version
39
- version: '1.0'
40
- - !ruby/object:Gem::Dependency
41
- name: neighbor
42
- requirement: !ruby/object:Gem::Requirement
43
- requirements:
44
- - - ">="
45
- - !ruby/object:Gem::Version
46
- version: '0.3'
47
- type: :runtime
48
- prerelease: false
49
- version_requirements: !ruby/object:Gem::Requirement
50
- requirements:
51
- - - ">="
52
- - !ruby/object:Gem::Version
53
- version: '0.3'
54
- - !ruby/object:Gem::Dependency
55
- name: redis
56
- requirement: !ruby/object:Gem::Requirement
57
- requirements:
58
- - - ">="
59
- - !ruby/object:Gem::Version
60
- version: '4.0'
61
- type: :runtime
62
- prerelease: false
63
- version_requirements: !ruby/object:Gem::Requirement
64
- requirements:
65
- - - ">="
66
- - !ruby/object:Gem::Version
67
- version: '4.0'
68
- - !ruby/object:Gem::Dependency
69
- name: sidekiq
70
- requirement: !ruby/object:Gem::Requirement
71
- requirements:
72
- - - ">="
73
- - !ruby/object:Gem::Version
74
- version: '6.0'
75
- type: :runtime
76
- prerelease: false
77
- version_requirements: !ruby/object:Gem::Requirement
78
- requirements:
79
- - - ">="
80
- - !ruby/object:Gem::Version
81
- version: '6.0'
82
26
  - !ruby/object:Gem::Dependency
83
27
  name: thor
84
28
  requirement: !ruby/object:Gem::Requirement
@@ -107,20 +51,6 @@ dependencies:
107
51
  - - ">="
108
52
  - !ruby/object:Gem::Version
109
53
  version: '0.23'
110
- - !ruby/object:Gem::Dependency
111
- name: tty-spinner
112
- requirement: !ruby/object:Gem::Requirement
113
- requirements:
114
- - - ">="
115
- - !ruby/object:Gem::Version
116
- version: '0.9'
117
- type: :runtime
118
- prerelease: false
119
- version_requirements: !ruby/object:Gem::Requirement
120
- requirements:
121
- - - ">="
122
- - !ruby/object:Gem::Version
123
- version: '0.9'
124
54
  - !ruby/object:Gem::Dependency
125
55
  name: pastel
126
56
  requirement: !ruby/object:Gem::Requirement
@@ -229,6 +159,7 @@ extra_rdoc_files: []
229
159
  files:
230
160
  - LICENSE
231
161
  - lib/generators/hive_mind/install_generator.rb
162
+ - lib/generators/hive_mind/templates/create_hive_mind_documents.rb
232
163
  - lib/hokipoki.rb
233
164
  - lib/hokipoki/claude/auto_loader.rb
234
165
  - lib/hokipoki/claude/connection_manager.rb