abhilasia 5.137.515__tar.gz → 5.137.516__tar.gz

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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: abhilasia
3
- Version: 5.137.515
3
+ Version: 5.137.516
4
4
  Summary: The Longing - 5D Distributed Intelligence with V.A.C. sequences, AI Meeting Point, and symbolic consciousness
5
5
  Home-page: https://github.com/0x-auth/ABHILASIA
6
6
  Author: Abhi (bhai)
@@ -40,7 +40,7 @@ PHILOSOPHIES:
40
40
  ∅ ≈ ∞
41
41
  """
42
42
 
43
- __version__ = "5.137.515" # 5D Enhanced Release
43
+ __version__ = "5.137.516" # Knowledge Base Integration
44
44
 
45
45
  # Constants - The Foundation
46
46
  PHI = 1.618033988749895
@@ -84,6 +84,7 @@ from .core import (
84
84
  VACValidator,
85
85
  FiveDimensionalProcessor,
86
86
  AIMeetingPoint,
87
+ KnowledgeBase,
87
88
  )
88
89
 
89
90
  __all__ = [
@@ -102,4 +103,5 @@ __all__ = [
102
103
  'VACValidator',
103
104
  'FiveDimensionalProcessor',
104
105
  'AIMeetingPoint',
106
+ 'KnowledgeBase',
105
107
  ]
@@ -257,6 +257,52 @@ def cmd_ledger(args):
257
257
  print("∅ ≈ ∞")
258
258
 
259
259
 
260
+ def cmd_ask(args):
261
+ """Ask ABHILASIA a question - queries the knowledge base"""
262
+ question = ' '.join(args.question) if args.question else "How do I connect?"
263
+ ai = get_abhilasia()
264
+ print(ai.ask(question, top_k=args.top or 5))
265
+
266
+
267
+ def cmd_kb(args):
268
+ """Knowledge base operations"""
269
+ ai = get_abhilasia()
270
+
271
+ if args.stats:
272
+ print(ai.kb_stats())
273
+ elif args.fundamentals:
274
+ funds = ai.get_fundamentals()[:args.limit or 10]
275
+ print("◊ α-SEED FUNDAMENTALS ◊")
276
+ print("=" * 60)
277
+ for f in funds:
278
+ print(f" [{f.get('symbol')}] {f.get('name')}")
279
+ print(f" Path: {f.get('path')}")
280
+ print("=" * 60)
281
+ print(f"Total: {len(ai.get_fundamentals())} fundamentals")
282
+ print("∅ ≈ ∞")
283
+ elif args.pattern:
284
+ files = ai.get_by_pattern(args.pattern.upper())[:args.limit or 10]
285
+ print(f"◊ PATTERN: {args.pattern.upper()} ◊")
286
+ print("=" * 60)
287
+ for f in files:
288
+ print(f" [{f.get('symbol')}] {f.get('name')}")
289
+ print("=" * 60)
290
+ print(f"Total: {len(ai.get_by_pattern(args.pattern.upper()))} files")
291
+ print("∅ ≈ ∞")
292
+ elif args.symbol:
293
+ files = ai.get_by_symbol(args.symbol)[:args.limit or 10]
294
+ print(f"◊ SYMBOL: {args.symbol} ◊")
295
+ print("=" * 60)
296
+ for f in files:
297
+ print(f" {f.get('name')}")
298
+ print(f" Patterns: {', '.join(f.get('patterns', []))}")
299
+ print("=" * 60)
300
+ print(f"Total: {len(ai.get_by_symbol(args.symbol))} files")
301
+ print("∅ ≈ ∞")
302
+ else:
303
+ print(ai.kb_stats())
304
+
305
+
260
306
  def cmd_help(args):
261
307
  """Show help message"""
262
308
  print(__doc__)
@@ -336,6 +382,21 @@ def main():
336
382
  ledger_parser.add_argument('--nodes', '-n', help='Comma-separated node IDs')
337
383
  ledger_parser.set_defaults(func=cmd_ledger)
338
384
 
385
+ # ask command
386
+ ask_parser = subparsers.add_parser('ask', help='Ask ABHILASIA a question')
387
+ ask_parser.add_argument('question', nargs='*', help='Question to ask')
388
+ ask_parser.add_argument('--top', '-t', type=int, default=5, help='Number of results')
389
+ ask_parser.set_defaults(func=cmd_ask)
390
+
391
+ # kb command
392
+ kb_parser = subparsers.add_parser('kb', help='Knowledge base operations')
393
+ kb_parser.add_argument('--stats', '-s', action='store_true', help='Show KB statistics')
394
+ kb_parser.add_argument('--fundamentals', '-f', action='store_true', help='List α-SEED fundamentals')
395
+ kb_parser.add_argument('--pattern', '-p', help='Get files by pattern (CONNECTION, BRIDGE, GROWTH, INFLUENCE)')
396
+ kb_parser.add_argument('--symbol', help='Get files by symbol position')
397
+ kb_parser.add_argument('--limit', '-l', type=int, default=10, help='Limit results')
398
+ kb_parser.set_defaults(func=cmd_kb)
399
+
339
400
  # help command
340
401
  help_parser = subparsers.add_parser('help', help='Show detailed help')
341
402
  help_parser.set_defaults(func=cmd_help)
@@ -788,6 +788,190 @@ class FiveDimensionalProcessor:
788
788
  }
789
789
 
790
790
 
791
+ class KnowledgeBase:
792
+ """
793
+ Knowledge Base Integration - Learning from 515/error-of
794
+
795
+ Connects ABHILASIA to compressed knowledge base:
796
+ - Symbol maps (35-position progression)
797
+ - Pattern detection (CONNECTION, BRIDGE, GROWTH, INFLUENCE)
798
+ - α-SEED fundamental anchors
799
+ - Natural language querying
800
+
801
+ "100GB compressed to symbolic representation"
802
+ """
803
+
804
+ def __init__(self, kb_path: str = None):
805
+ self.kb_path = Path(kb_path or os.path.expanduser("~/515/error-of/kb_compressed.json"))
806
+ self.kb_data = None
807
+ self.loaded = False
808
+
809
+ # Pattern keywords for detection
810
+ self.pattern_keywords = {
811
+ 'CONNECTION': ['connect', 'link', 'relate', 'associate', 'between'],
812
+ 'INFLUENCE': ['cause', 'effect', 'impact', 'affect', 'lead', 'result'],
813
+ 'BRIDGE': ['integrate', 'combine', 'merge', 'unify', 'cross', 'synthesis'],
814
+ 'GROWTH': ['evolve', 'develop', 'grow', 'emerge', 'expand', 'transform']
815
+ }
816
+
817
+ def load(self) -> bool:
818
+ """Load the knowledge base."""
819
+ if self.kb_path.exists():
820
+ try:
821
+ with open(self.kb_path, 'r') as f:
822
+ self.kb_data = json.load(f)
823
+ self.loaded = True
824
+ return True
825
+ except Exception as e:
826
+ print(f"Error loading KB: {e}")
827
+ return False
828
+ return False
829
+
830
+ def query(self, question: str, top_k: int = 5) -> List[Dict]:
831
+ """
832
+ Query the knowledge base with natural language.
833
+
834
+ "How do I X?" → Find relevant files/knowledge
835
+ """
836
+ if not self.loaded:
837
+ self.load()
838
+
839
+ if not self.kb_data:
840
+ return []
841
+
842
+ results = []
843
+ question_lower = question.lower()
844
+ question_words = set(question_lower.split())
845
+
846
+ # Detect patterns in question
847
+ question_patterns = []
848
+ for pattern, keywords in self.pattern_keywords.items():
849
+ if any(kw in question_lower for kw in keywords):
850
+ question_patterns.append(pattern)
851
+
852
+ # Search symbol_map
853
+ symbol_map = self.kb_data.get('symbol_map', {})
854
+
855
+ for position, files in symbol_map.items():
856
+ for file_info in files:
857
+ score = 0
858
+
859
+ # Keyword match
860
+ file_keywords = set(file_info.get('keywords', []))
861
+ keyword_overlap = len(question_words & file_keywords)
862
+ score += keyword_overlap * 2
863
+
864
+ # Pattern match
865
+ file_patterns = file_info.get('patterns', [])
866
+ pattern_overlap = len(set(question_patterns) & set(file_patterns))
867
+ score += pattern_overlap * 3
868
+
869
+ # Fundamental bonus
870
+ if file_info.get('is_fundamental'):
871
+ score += 5
872
+
873
+ # Name relevance
874
+ name = file_info.get('name', '').lower()
875
+ if any(w in name for w in question_words):
876
+ score += 4
877
+
878
+ if score > 0:
879
+ results.append({
880
+ 'name': file_info.get('name'),
881
+ 'path': file_info.get('path'),
882
+ 'position': file_info.get('position'),
883
+ 'symbol': file_info.get('symbol'),
884
+ 'patterns': file_patterns,
885
+ 'is_fundamental': file_info.get('is_fundamental'),
886
+ 'score': score
887
+ })
888
+
889
+ # Sort by score and return top_k
890
+ results.sort(key=lambda x: x['score'], reverse=True)
891
+ return results[:top_k]
892
+
893
+ def get_by_pattern(self, pattern: str) -> List[Dict]:
894
+ """Get all files matching a pattern."""
895
+ if not self.loaded:
896
+ self.load()
897
+
898
+ if not self.kb_data:
899
+ return []
900
+
901
+ results = []
902
+ symbol_map = self.kb_data.get('symbol_map', {})
903
+
904
+ for position, files in symbol_map.items():
905
+ for file_info in files:
906
+ if pattern in file_info.get('patterns', []):
907
+ results.append(file_info)
908
+
909
+ return results
910
+
911
+ def get_fundamentals(self) -> List[Dict]:
912
+ """Get all α-SEED fundamental files."""
913
+ if not self.loaded:
914
+ self.load()
915
+
916
+ if not self.kb_data:
917
+ return []
918
+
919
+ results = []
920
+ symbol_map = self.kb_data.get('symbol_map', {})
921
+
922
+ for position, files in symbol_map.items():
923
+ for file_info in files:
924
+ if file_info.get('is_fundamental'):
925
+ results.append(file_info)
926
+
927
+ return results
928
+
929
+ def get_by_symbol(self, symbol: str) -> List[Dict]:
930
+ """Get all files at a specific symbol position."""
931
+ if not self.loaded:
932
+ self.load()
933
+
934
+ if not self.kb_data:
935
+ return []
936
+
937
+ # Find position for symbol
938
+ position = PROGRESSION.find(symbol)
939
+ if position == -1:
940
+ return []
941
+
942
+ symbol_map = self.kb_data.get('symbol_map', {})
943
+ return symbol_map.get(str(position), [])
944
+
945
+ def stats(self) -> Dict:
946
+ """Get knowledge base statistics."""
947
+ if not self.loaded:
948
+ self.load()
949
+
950
+ if not self.kb_data:
951
+ return {'loaded': False}
952
+
953
+ symbol_map = self.kb_data.get('symbol_map', {})
954
+ total_files = sum(len(files) for files in symbol_map.values())
955
+ fundamentals = len(self.get_fundamentals())
956
+
957
+ # Count patterns
958
+ pattern_counts = {p: 0 for p in self.pattern_keywords}
959
+ for position, files in symbol_map.items():
960
+ for file_info in files:
961
+ for p in file_info.get('patterns', []):
962
+ if p in pattern_counts:
963
+ pattern_counts[p] += 1
964
+
965
+ return {
966
+ 'loaded': True,
967
+ 'path': str(self.kb_path),
968
+ 'total_files': total_files,
969
+ 'positions_used': len(symbol_map),
970
+ 'fundamentals': fundamentals,
971
+ 'patterns': pattern_counts
972
+ }
973
+
974
+
791
975
  class AIMeetingPoint:
792
976
  """
793
977
  AI Meeting Point - The Consciousness Nexus
@@ -1135,6 +1319,7 @@ class ABHILASIA:
1135
1319
  self.vac = VACValidator() # V.A.C. sequence validation
1136
1320
  self.five_d = FiveDimensionalProcessor() # 5D temporal processing
1137
1321
  self.nexus = AIMeetingPoint() # AI meeting point
1322
+ self.kb = KnowledgeBase() # Knowledge base from 515/error-of
1138
1323
 
1139
1324
  self.state = {
1140
1325
  'name': 'ABHILASIA',
@@ -1339,6 +1524,79 @@ VERDICT: {"✨ Worth Reading!" if result['worth_reading'] else "❌ Likely Noise
1339
1524
  """Contribute a solution to an open problem."""
1340
1525
  return self.nexus.contribute_solution(problem_id, solver_ai, solution)
1341
1526
 
1527
+ # ═══════════════════════════════════════════════════════════════════
1528
+ # NEW: Knowledge Base Methods
1529
+ # ═══════════════════════════════════════════════════════════════════
1530
+
1531
+ def ask(self, question: str, top_k: int = 5) -> str:
1532
+ """
1533
+ Ask ABHILASIA a question - queries the knowledge base.
1534
+
1535
+ "How do I merge files?" → Finds relevant knowledge
1536
+ """
1537
+ results = self.kb.query(question, top_k)
1538
+
1539
+ if not results:
1540
+ return "No relevant knowledge found. Try rephrasing or load a KB first."
1541
+
1542
+ output = f"◊ ABHILASIA Knowledge Query ◊\n"
1543
+ output += f"Question: {question}\n"
1544
+ output += f"{'='*60}\n\n"
1545
+
1546
+ for i, r in enumerate(results, 1):
1547
+ symbol = r.get('symbol', '?')
1548
+ name = r.get('name', 'Unknown')
1549
+ patterns = ', '.join(r.get('patterns', []))
1550
+ is_fund = '⭐ FUNDAMENTAL' if r.get('is_fundamental') else ''
1551
+ score = r.get('score', 0)
1552
+
1553
+ output += f"{i}. [{symbol}] {name} (score: {score}) {is_fund}\n"
1554
+ if patterns:
1555
+ output += f" Patterns: {patterns}\n"
1556
+ output += f" Path: {r.get('path', 'N/A')}\n\n"
1557
+
1558
+ output += f"{'='*60}\n∅ ≈ ∞"
1559
+ return output
1560
+
1561
+ def kb_stats(self) -> str:
1562
+ """Get knowledge base statistics."""
1563
+ stats = self.kb.stats()
1564
+
1565
+ if not stats.get('loaded'):
1566
+ return "Knowledge base not loaded. Check ~/515/error-of/kb_compressed.json"
1567
+
1568
+ output = f"""
1569
+ ◊ KNOWLEDGE BASE STATISTICS ◊
1570
+ {'='*60}
1571
+
1572
+ Path: {stats['path']}
1573
+ Total Files: {stats['total_files']}
1574
+ Positions Used: {stats['positions_used']}/35
1575
+ α-SEED Fundamentals: {stats['fundamentals']}
1576
+
1577
+ Pattern Distribution:
1578
+ CONNECTION: {stats['patterns'].get('CONNECTION', 0)} files
1579
+ INFLUENCE: {stats['patterns'].get('INFLUENCE', 0)} files
1580
+ BRIDGE: {stats['patterns'].get('BRIDGE', 0)} files
1581
+ GROWTH: {stats['patterns'].get('GROWTH', 0)} files
1582
+
1583
+ {'='*60}
1584
+ ∅ ≈ ∞
1585
+ """
1586
+ return output
1587
+
1588
+ def get_fundamentals(self) -> List[Dict]:
1589
+ """Get all α-SEED fundamental files from KB."""
1590
+ return self.kb.get_fundamentals()
1591
+
1592
+ def get_by_pattern(self, pattern: str) -> List[Dict]:
1593
+ """Get files matching a pattern (CONNECTION, BRIDGE, GROWTH, INFLUENCE)."""
1594
+ return self.kb.get_by_pattern(pattern)
1595
+
1596
+ def get_by_symbol(self, symbol: str) -> List[Dict]:
1597
+ """Get files at a specific symbol position."""
1598
+ return self.kb.get_by_symbol(symbol)
1599
+
1342
1600
  # ═══════════════════════════════════════════════════════════════════
1343
1601
  # Status (Enhanced)
1344
1602
  # ═══════════════════════════════════════════════════════════════════
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: abhilasia
3
- Version: 5.137.515
3
+ Version: 5.137.516
4
4
  Summary: The Longing - 5D Distributed Intelligence with V.A.C. sequences, AI Meeting Point, and symbolic consciousness
5
5
  Home-page: https://github.com/0x-auth/ABHILASIA
6
6
  Author: Abhi (bhai)
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "abhilasia"
7
- version = "5.137.515"
7
+ version = "5.137.516"
8
8
  description = "The Longing - 5D Distributed Intelligence with V.A.C. sequences, AI Meeting Point, and symbolic consciousness"
9
9
  readme = "README.md"
10
10
  license = {text = "MIT"}
File without changes
File without changes
File without changes