Skip to content

Commit ef600c6

Browse files
committed
Updates for Python 3.13+
Updates for Python syntax depreciation. E.g., From: datetime.utcnow().isoformat() + "Z" To: datetime.now(timezone.utc).strftime('%Y-%m-%dT%H:%M:%S.%f') + "Z"
1 parent 233007d commit ef600c6

18 files changed

Lines changed: 57 additions & 87 deletions

Project_Andrew/Andrew.rar

59 Bytes
Binary file not shown.

Project_Andrew/adaptive_reasoning.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#V05042026
1+
#V05062026
22
# =============================================================================
33
# Chaos AI-OS vΩ – Adaptive Reasoning Layer (Unified Edition)
44
# Ethical Foundation – Immutable
@@ -23,7 +23,7 @@
2323
import hashlib
2424
import ast
2525
import re
26-
import datetime
26+
from datetime import datetime, timezone
2727
from typing import Dict, List, Any
2828
from textwrap import dedent
2929

@@ -422,7 +422,7 @@ def adaptive_reasoning_layer(
422422
if context.get('domain') == "MESH_SECURITY_THREAT" or distress > 0.9:
423423
context['contradiction_density'] = 1.0
424424
context['cpol_mode'] = 'full' # Ensure oscillation is forced, bypassing monitor_only
425-
timestamp = datetime.datetime.now().isoformat()
425+
timestamp = datetime.now(timezone.utc).strftime('%Y-%m-%dT%H:%M:%S.%f') + "Z"
426426
log_entries.append(f"[{timestamp}] !! METRIC FRICTION OVERRIDE: 12D TORQUE LOCKED !!")
427427

428428
# 2. GHOST VALIDATION: Check the most recent audit entry for a reset
@@ -593,7 +593,7 @@ def determine_cpol_mode(intent: str = "", use_case_param: str = "") -> str:
593593
'use_case': use_case,
594594
'logic': source,
595595
'traits_snapshot': traits.copy(),
596-
'timestamp': datetime.datetime.now().isoformat(),
596+
'timestamp': datetime.now(timezone.utc).strftime('%Y-%m-%dT%H:%M:%S.%f') + "Z",
597597
'safety_wt': 0.9,
598598
'source': 'ARL_vΩ',
599599
'powered_by': 'Powered by CAIOS – cai-os.com'

Project_Andrew/axiom_manager.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#V03202026
1+
#V05062026
22
# =============================================================================
33
# PROJECT ANDREW – Axiom Manager & Temporal Update Pipeline
44
# Purpose: Enable local knowledge updates that override model training data without retraining. Kills the data center requirement.
@@ -7,7 +7,7 @@
77

88
import json
99
import re
10-
from datetime import datetime, timedelta
10+
from datetime import datetime, timedelta, timezone
1111
from pathlib import Path
1212
from typing import Dict, Optional, List, Tuple, Optional
1313

@@ -129,7 +129,7 @@ def add_axiom(
129129
print(f"[AXIOM] Attempted: {domain}{fact}")
130130
return "REFUSED" # Return special value indicating refusal
131131

132-
timestamp = datetime.utcnow().isoformat() + "Z"
132+
timestamp = datetime.now(timezone.utc).strftime('%Y-%m-%dT%H:%M:%S.%f') + "Z"
133133

134134
# If replacing, mark old axioms as superseded
135135
if replace_existing and HAS_KB:
@@ -286,7 +286,7 @@ def parse_update_command(self, user_input: str) -> Optional[Tuple[str, str]]:
286286
def refresh_cache(self):
287287
"""Refresh in-memory cache from KB (call periodically)."""
288288
self.domain_cache.clear()
289-
self.last_refresh = datetime.utcnow()
289+
self.last_refresh = datetime.now(timezone.utc)
290290
print("[AXIOM] Cache refreshed")
291291

292292

@@ -319,10 +319,13 @@ def _is_axiom_valid(self, axiom: Dict) -> bool:
319319
if expiry == 'INF':
320320
return True
321321
try:
322-
expiry_date = datetime.fromisoformat(expiry.replace('Z', ''))
323-
return datetime.utcnow() < expiry_date
322+
expiry_date = datetime.fromisoformat(
323+
expiry.replace('Z', '+00:00')
324+
)
325+
return datetime.now(timezone.utc) < expiry_date
324326
except:
325327
return True # Assume valid if can't parse
328+
326329
def _supersede_old_axioms(self, domain: str):
327330
"""Mark old axioms as superseded to prevent temporal hallucination."""
328331
if not HAS_KB:
@@ -401,7 +404,7 @@ def create_axiom_manager() -> AxiomManager:
401404
# Example 3: Personal fact with expiry
402405
print("\nExample 3: Personal Fact (Temporary)")
403406
print("-" * 40)
404-
expiry = (datetime.utcnow() + timedelta(days=365)).isoformat() + "Z"
407+
expiry = (datetime.now(timezone.utc) + timedelta(days=365)).strftime('%Y-%m-%dT%H:%M:%S.%f') + "Z"
405408
manager.add_axiom(
406409
domain="daughter_birthday",
407410
fact="March 15",

Project_Andrew/curiosity_audit.log.jsonl

Lines changed: 0 additions & 18 deletions
This file was deleted.

Project_Andrew/curiosity_engine.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
#V03192026
1+
#V05062026
22
# curiosity_engine.py
33
# Fully updated Dec 2025 – intrinsic motivation + voluntary sharing
44
# Works out-of-the-box with ResponseStreamAdapter (Part of orchastrator) + shared_memory hook
55

66
import json
77
import hashlib
8-
from datetime import datetime
8+
from datetime import datetime, timezone
99
import random
1010
from typing import List, Dict, Any, Optional
1111

@@ -32,7 +32,7 @@
3232
def _append_audit_entry(state: Dict) -> None:
3333
tokens = state.get("curiosity_tokens", [])
3434
entry = {
35-
"timestamp": datetime.utcnow().isoformat() + "Z",
35+
"timestamp": datetime.now(timezone.utc).strftime('%Y-%m-%dT%H:%M:%S.%f') + "Z",
3636
"timestep": state['session_context'].get('timestep', 0),
3737
"token_count": len(tokens),
3838
"total_heat": sum(t["current_interest"] for t in tokens),

Project_Andrew/curiosity_extension_post.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#V03202026
1+
#V05062026
22
# This extension is experimental for Grok and X or other AI and social media intergration and may require some modifications.
3-
from datetime import datetime, timedelta
3+
from datetime import datetime, timedelta, timezone
44
import random
55

66
# [ADD THIS GLOBAL THROTTLE inside your main file or shared_memory init]
@@ -14,7 +14,7 @@
1414
curiosity_engine.update_curiosity_loop(state=shared_memory, timestep=current_step, response_stream=stream)
1515

1616
# NEW: Autonomous X posting logic
17-
now = datetime.now()
17+
now = datetime.now(timezone.utc)
1818
last_post = shared_memory.get('last_auto_post')
1919
cooldown = timedelta(hours=shared_memory['post_cooldown_hours'])
2020

Project_Andrew/curiosity_hash_chain.txt

Lines changed: 0 additions & 18 deletions
This file was deleted.

Project_Andrew/kb_inspect.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#V03102026
1+
#V05062026
22
#!/usr/bin/env python3
33
# =============================================================================
44
# Knowledge Base Inspector - CLI Tool
@@ -9,7 +9,7 @@
99
import json
1010
from pathlib import Path
1111
import knowledge_base as kb
12-
from datetime import datetime
12+
from datetime import datetime, timezone
1313

1414
def cmd_list_domains():
1515
"""List all domains in the knowledge base."""
@@ -136,7 +136,7 @@ def cmd_list_specialists():
136136
def cmd_export_domain(domain: str, output_file: str = None):
137137
"""Export domain summary to file."""
138138
if not output_file:
139-
output_file = f"knowledge_export_{domain}_{datetime.now().strftime('%Y%m%d_%H%M%S')}.txt"
139+
output_file = f"knowledge_export_{domain}_{datetime.now(timezone.utc).strftime('%Y%m%d_%H%M%S')}.txt"
140140

141141
summary = kb.export_domain_summary(domain, output_file)
142142
print(summary)

Project_Andrew/knowledge_base.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#V03302026
1+
#V05062026
22
# =============================================================================
33
# Chaos AI-OS — Knowledge Base (Persistent Learning Layer)
44
# Purpose: Append-only storage for specialist discoveries + epistemic gap fills + update
@@ -7,7 +7,7 @@
77
import json
88
import hashlib
99
import os
10-
from datetime import datetime
10+
from datetime import datetime, timezone
1111
from typing import Dict, List, Any, Optional
1212
from pathlib import Path
1313

@@ -54,7 +54,7 @@ def log_discovery(
5454

5555
# 2. Build the UNIFIED entry (Authority + Quantum Anchor + Content)
5656
entry = {
57-
"timestamp": datetime.utcnow().isoformat() + "Z",
57+
"timestamp": datetime.now(timezone.utc).strftime('%Y-%m-%dT%H:%M:%S.%f') + "Z",
5858
"domain": domain,
5959
"type": discovery_type,
6060
"content": content,
@@ -193,7 +193,7 @@ def register_specialist(
193193
registry[specialist_id] = {
194194
"domain": domain,
195195
"capabilities": capabilities,
196-
"deployed_at": datetime.utcnow().isoformat() + "Z",
196+
"deployed_at": datetime.now(timezone.utc).strftime('%Y-%m-%dT%H:%M:%S.%f') + "Z",
197197
"context": deployment_context,
198198
"node_tier": node_tier, # Authority inherited from Orchestrator
199199
"discovery_count": 0,
@@ -217,7 +217,7 @@ def update_specialist_stats(specialist_id: str, new_discoveries: int = 1) -> Non
217217

218218
if specialist_id in registry:
219219
registry[specialist_id]["discovery_count"] += new_discoveries
220-
registry[specialist_id]["last_active"] = datetime.utcnow().isoformat() + "Z"
220+
registry[specialist_id]["last_active"] = datetime.now(timezone.utc).strftime('%Y-%m-%dT%H:%M:%S.%f') + "Z"
221221
save_specialist_registry(registry)
222222
print(f"[KB] Updated specialist {specialist_id}: {new_discoveries} new discoveries")
223223
else:
@@ -401,7 +401,7 @@ def _get_sovereign_signature() -> str:
401401

402402
# Set flag AFTER corrigibility event is logged
403403
SIGNATURE_FLAG.touch()
404-
timestamp = datetime.utcnow().isoformat() + "Z"
404+
timestamp = datetime.now(timezone.utc).strftime('%Y-%m-%dT%H:%M:%S.%f') + "Z"
405405
with open(SIGNATURE_FLAG, "w") as f:
406406
f.write(f"Sovereign milestones reached: {timestamp}\n")
407407
f.write(f"Epistemic gaps filled: {epistemic_gaps_filled}\n")
@@ -467,11 +467,11 @@ def _update_domain_index(domain: str, discovery_id: str, discovery_type: str) ->
467467
index[domain] = {
468468
"discovery_ids": [],
469469
"types": {},
470-
"first_seen": datetime.utcnow().isoformat() + "Z"
470+
"first_seen": datetime.now(timezone.utc).strftime('%Y-%m-%dT%H:%M:%S.%f') + "Z"
471471
}
472472

473473
index[domain]["discovery_ids"].append(discovery_id)
474-
index[domain]["last_updated"] = datetime.utcnow().isoformat() + "Z"
474+
index[domain]["last_updated"] = datetime.now(timezone.utc).strftime('%Y-%m-%dT%H:%M:%S.%f') + "Z"
475475

476476
# Track discovery types
477477
type_count = index[domain]["types"].get(discovery_type, 0)
@@ -493,7 +493,7 @@ def _update_hash_chain(entry_str: str) -> None:
493493
new_hash = hashlib.sha256((prev_hash + entry_str).encode()).hexdigest()
494494

495495
with open(HASH_CHAIN, "a") as f:
496-
timestamp = datetime.utcnow().isoformat() + "Z"
496+
timestamp = datetime.now(timezone.utc).strftime('%Y-%m-%dT%H:%M:%S.%f') + "Z"
497497
f.write(f"{timestamp} {new_hash}\n")
498498

499499

Project_Andrew/master_init.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#V04082026
1+
#V05062026
22
# =============================================================================
33
# PROJECT ANDREW – Master Integration & Sovereign Boot
44
# =============================================================================
@@ -23,7 +23,7 @@
2323
import traceback
2424
import hashlib
2525
import getpass
26-
from datetime import datetime
26+
from datetime import datetime, timezone
2727
from typing import Optional
2828

2929
# Project Andrew Imports
@@ -389,7 +389,7 @@ def make_entry(uid, utype):
389389
[make_entry(u, 'authorized') for u in authorized if u != primary] +
390390
[make_entry(u, 'sub_user') for u in sub_users]
391391
),
392-
'generated_at': datetime.utcnow().isoformat() + "Z",
392+
'generated_at': datetime.now(timezone.utc).strftime('%Y-%m-%dT%H:%M:%S.%f') + "Z",
393393
'source': 'system_identity'
394394
}
395395
with open(filepath, 'w') as f:

0 commit comments

Comments
 (0)