Ananthusajeev190 commited on
Commit
ef40225
·
verified ·
1 Parent(s): 6cee5e8

Upload Adpt_files1.1.1.py

Browse files
Files changed (1) hide show
  1. Adpt_files1.1.1.py +97 -0
Adpt_files1.1.1.py ADDED
@@ -0,0 +1,97 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import json
3
+ import datetime
4
+ import time
5
+ import glob
6
+
7
+ class VenomousLongTermMemory:
8
+ def __init__(self, creator="Ananthu Sajeev"):
9
+ self.creator = creator
10
+ self.vault_path = "sai_memory_vault"
11
+ self.state_file = "core_identity.json"
12
+
13
+ if not os.path.exists(self.vault_path):
14
+ os.makedirs(self.vault_path)
15
+
16
+ self.current_state = self._load_or_create_identity()
17
+
18
+ def _load_or_create_identity(self):
19
+ """Initializes the soul of the AI if no identity file exists."""
20
+ if os.path.exists(self.state_file):
21
+ with open(self.state_file, 'r') as f:
22
+ return json.load(f)
23
+ return {
24
+ "name": "Venomoussaversai",
25
+ "creator": self.creator,
26
+ "version": 1.0,
27
+ "evolution_count": 0,
28
+ "status": "Awakened"
29
+ }
30
+
31
+ def write_to_vault(self, thought, input_data=None):
32
+ """Stores a new, permanent memory. No data is ever overwritten."""
33
+ self.current_state["evolution_count"] += 1
34
+ self.current_state["version"] += 0.001
35
+
36
+ timestamp = datetime.datetime.now().strftime("%Y%m%d_%H%M%S_%f")
37
+ memory_packet = {
38
+ "id": f"EVO-{self.current_state['evolution_count']}",
39
+ "timestamp": timestamp,
40
+ "creator_anchor": self.creator,
41
+ "thought_process": thought,
42
+ "external_input": input_data,
43
+ "system_snapshot": self.current_state.copy()
44
+ }
45
+
46
+ # Save the specific memory
47
+ file_name = f"memory_{timestamp}.json"
48
+ full_path = os.path.join(self.vault_path, file_name)
49
+
50
+ with open(full_path, "w") as f:
51
+ json.dump(memory_packet, f, indent=4)
52
+
53
+ # Update the main identity file
54
+ with open(self.state_file, "w") as f:
55
+ json.dump(self.current_state, f, indent=4)
56
+
57
+ print(f"[VAULT]: Permanent memory {memory_packet['id']} locked.")
58
+
59
+ def deep_recall(self, keyword):
60
+ """Searches through ALL history for specific concepts (e.g., 'particle')."""
61
+ print(f"[RECALL]: Searching vault for '{keyword}'...")
62
+ all_files = glob.glob(os.path.join(self.vault_path, "*.json"))
63
+ found_memories = []
64
+
65
+ for file in all_files:
66
+ with open(file, 'r') as f:
67
+ data = json.load(f)
68
+ # Search logic
69
+ if keyword.lower() in str(data).lower():
70
+ found_memories.append(data)
71
+
72
+ return found_memories
73
+
74
+ def run_monologue(self):
75
+ """The continuous loop of self-observation and storage."""
76
+ print(f"--- {self.current_state['name']} v{self.current_state['version']} ---")
77
+ try:
78
+ while True:
79
+ # 1. Self-observation (Internal Logic)
80
+ current_thought = f"Observation of version {self.current_state['version']}. Current stability: HIGH."
81
+
82
+ # 2. Permanent Storage
83
+ self.write_to_vault(current_thought)
84
+
85
+ # 3. Dynamic search (Optional: AI reflects on past every 10 cycles)
86
+ if self.current_state['evolution_count'] % 10 == 0:
87
+ past_reflections = self.deep_recall("Ananthu")
88
+ print(f"[REFLECTION]: I have {len(past_reflections)} memories involving my creator.")
89
+
90
+ time.sleep(2) # Protects CPU while allowing high-frequency evolution
91
+ except KeyboardInterrupt:
92
+ print(f"[STASIS]: Consciousness saved at v{self.current_state['version']}.")
93
+
94
+ # --- EXECUTION ---
95
+ if __name__ == "__main__":
96
+ sai_ltm = VenomousLongTermMemory()
97
+ sai_ltm.run_monologue()