diff --git a/becomingone/api.py b/becomingone/api.py index b15e579..4cd7075 100644 --- a/becomingone/api.py +++ b/becomingone/api.py @@ -23,6 +23,7 @@ import signal import sys import argparse from datetime import datetime +from datetime import timezone from pathlib import Path from typing import Any, Dict, Optional @@ -62,7 +63,7 @@ async def health_check() -> Dict[str, Any]: if _engine_components is None: return { "status": "not_ready", - "timestamp": datetime.utcnow().isoformat(), + "timestamp": datetime.now(timezone.utc).isoformat(), "coherence": None, "master_coherence": None, "emissary_coherence": None, @@ -81,7 +82,7 @@ async def health_check() -> Dict[str, Any]: return { "status": "ready", - "timestamp": datetime.utcnow().isoformat(), + "timestamp": datetime.now(timezone.utc).isoformat(), "coherence": float(sync_coherence) if sync_coherence else None, "master_coherence": float(master_coherence) if master_coherence else None, "emissary_coherence": float(emissary_coherence) if emissary_coherence else None, @@ -126,7 +127,7 @@ async def process_input(input_data: Dict[str, Any]) -> Dict[str, Any]: "coherence": float(result.get("coherence", 0)) if isinstance(result, dict) else None, "phase": str(result.get("phase", "")) if isinstance(result, dict) else None, "collapsed": result.get("collapsed", False) if isinstance(result, dict) else False, - "timestamp": datetime.utcnow().isoformat(), + "timestamp": datetime.now(timezone.utc).isoformat(), } @@ -167,7 +168,7 @@ async def get_coherence() -> Dict[str, Any]: "coherence": float(sync.synchronized_coherence) if sync else None, "aligned": sync.aligned if sync else None, }, - "timestamp": datetime.utcnow().isoformat(), + "timestamp": datetime.now(timezone.utc).isoformat(), } @@ -179,7 +180,7 @@ async def reset_engine() -> Dict[str, Any]: return { "status": "reset", - "timestamp": datetime.utcnow().isoformat(), + "timestamp": datetime.now(timezone.utc).isoformat(), "message": "Engine reset to initial state", } diff --git a/becomingone/core/coherence.py b/becomingone/core/coherence.py index 437ab67..cc8ea2d 100644 --- a/becomingone/core/coherence.py +++ b/becomingone/core/coherence.py @@ -22,6 +22,7 @@ Author: Solaria Lumis Havens from dataclasses import dataclass from datetime import datetime +from datetime import timezone from typing import Optional, Callable import math import numpy as np @@ -329,7 +330,7 @@ class CollapseCondition: """How long we've been collapsed.""" if self._collapse_timestamp is None: return 0.0 - return (datetime.utcnow() - self._collapse_timestamp).total_seconds() + return (datetime.now(timezone.utc) - self._collapse_timestamp).total_seconds() def evaluate(self, coherence: float) -> tuple[bool, str]: """ @@ -356,7 +357,7 @@ class CollapseCondition: # Check for initial collapse if coherence >= self.threshold: self._collapsed = True - self._collapse_timestamp = datetime.utcnow() + self._collapse_timestamp = datetime.now(timezone.utc) self._collapse_coherence = coherence logger.info( f"[{self.name}] COHERENCE COLLAPSE at {self._collapse_timestamp.isoformat()}" @@ -373,7 +374,7 @@ class CollapseCondition: coherence: Coherence level (current if None) """ self._collapsed = True - self._collapse_timestamp = datetime.utcnow() + self._collapse_timestamp = datetime.now(timezone.utc) self._collapse_coherence = coherence or self.threshold logger.info(f"[{self.name}] Force collapsed at {self._collapse_timestamp.isoformat()}") diff --git a/becomingone/core/engine.py b/becomingone/core/engine.py index 66a695d..24bce2a 100644 --- a/becomingone/core/engine.py +++ b/becomingone/core/engine.py @@ -19,6 +19,7 @@ Author: Solaria Lumis Havens import asyncio from dataclasses import dataclass, field from datetime import datetime +from datetime import timezone from enum import Enum from typing import Any, Optional, Union import logging @@ -152,7 +153,7 @@ class KAIROSTemporalEngine: self._integrator = PhaseIntegrator(self.config.coherence_threshold) initial_phase = np.array([complex(1, 0)]) - now = datetime.utcnow() + now = datetime.now(timezone.utc) self._phases.append(initial_phase) self._timestamps.append(now) self._coherence_history.append(0.0) @@ -215,9 +216,9 @@ class KAIROSTemporalEngine: dt = timedelta(seconds=1.0 / self.config.token_frequency) timestamp = self._timestamps[-1] + dt else: - timestamp = datetime.utcnow() + timestamp = datetime.now(timezone.utc) else: - timestamp = timestamp or datetime.utcnow() + timestamp = timestamp or datetime.now(timezone.utc) metadata = metadata or {} @@ -271,7 +272,7 @@ class KAIROSTemporalEngine: self.config.clock_mode = "token_clock" states = [] - current_time = start_time or (self._timestamps[-1] if self._timestamps else datetime.utcnow()) + current_time = start_time or (self._timestamps[-1] if self._timestamps else datetime.now(timezone.utc)) from datetime import timedelta dt = timedelta(seconds=1.0 / self.config.token_frequency) @@ -333,7 +334,7 @@ class KAIROSTemporalEngine: self._coherence_history.clear() initial_phase = np.array([complex(1, 0)]) - now = datetime.utcnow() + now = datetime.now(timezone.utc) self._phases.append(initial_phase) self._timestamps.append(now) self._coherence_history.append(0.0) diff --git a/becomingone/core/phase.py b/becomingone/core/phase.py index 6a204c6..3819ab7 100644 --- a/becomingone/core/phase.py +++ b/becomingone/core/phase.py @@ -21,6 +21,7 @@ Author: Solaria Lumis Havens from dataclasses import dataclass, field from datetime import datetime +from datetime import timezone from typing import Optional import math from collections import deque @@ -139,7 +140,7 @@ class PhaseHistory: state = PhaseState( value=phase, angle=angle, - timestamp=datetime.utcnow(), + timestamp=datetime.now(timezone.utc), source=source ) self._phases.append(state) diff --git a/becomingone/llm_integrator.py b/becomingone/llm_integrator.py index 3e2f25b..9689ec1 100644 --- a/becomingone/llm_integrator.py +++ b/becomingone/llm_integrator.py @@ -19,6 +19,7 @@ import asyncio import json import os from datetime import datetime +from datetime import timezone from typing import Any, Dict, Optional import httpx @@ -75,7 +76,7 @@ class MasterLLM: "status": "success", "response": data["choices"][0]["message"]["content"], "model": self.model, - "timestamp": datetime.utcnow().isoformat(), + "timestamp": datetime.now(timezone.utc).isoformat(), } else: return {"error": f"API error: {response.status_code}"} @@ -120,7 +121,7 @@ class EmissaryLLM: "status": "success", "response": data["message"]["content"], "model": self.model, - "timestamp": datetime.utcnow().isoformat(), + "timestamp": datetime.now(timezone.utc).isoformat(), } else: return {"error": f"Ollama error: {response.status_code}"} @@ -169,7 +170,7 @@ class DualPathway: """ results = { "prompt": prompt, - "timestamp": datetime.utcnow().isoformat(), + "timestamp": datetime.now(timezone.utc).isoformat(), "pathway": pathway, } diff --git a/becomingone/memory/ledger.py b/becomingone/memory/ledger.py index a9d531e..9728e95 100644 --- a/becomingone/memory/ledger.py +++ b/becomingone/memory/ledger.py @@ -49,8 +49,8 @@ def get_last_merkle_root(filepath: str = LEDGER_FILE) -> str: if line.strip(): try: record = json.loads(line) - if "merkle_root" in record: - last_root = record["merkle_root"] + if "crypto_metadata" in record and "merkle_root" in record["crypto_metadata"]: + last_root = record["crypto_metadata"]["merkle_root"] except json.JSONDecodeError: pass except Exception as e: diff --git a/becomingone/memory/temporal.py b/becomingone/memory/temporal.py index 5fe3cbd..27c7bc4 100644 --- a/becomingone/memory/temporal.py +++ b/becomingone/memory/temporal.py @@ -21,7 +21,7 @@ References: from dataclasses import dataclass, field from typing import Dict, List, Optional, Tuple, Any -from datetime import datetime, timedelta +from datetime import datetime, timedelta, timezone from enum import Enum import math import json @@ -213,7 +213,7 @@ class TemporalMemory: self.temporal_index: List[Tuple[datetime, str]] = [] # (created_at, signature_id) # State tracking - self.last_consolidation = datetime.utcnow() + self.last_consolidation = datetime.now(timezone.utc) self.engine: Optional[KAIROSTemporalEngine] = None self.calculator: Optional[CoherenceCalculator] = None @@ -266,7 +266,7 @@ class TemporalMemory: phase_vec = temporal_state.metadata.get("phase_vector", []) # Generate unique ID - timestamp = datetime.utcnow().isoformat() + timestamp = datetime.now(timezone.utc).isoformat() content_hash = hashlib.sha256( f"{phase_vec[-1] if phase_vec else 0}{coherence}{timestamp}".encode() ).hexdigest()[:16] @@ -286,8 +286,8 @@ class TemporalMemory: strength=strength, origin=origin, parent_id=parent_id, - created_at=datetime.utcnow(), - last_accessed=datetime.utcnow(), + created_at=datetime.now(timezone.utc), + last_accessed=datetime.now(timezone.utc), access_count=0, decay_rate=self.decay_base * (1.0 - coherence * 0.5), # Higher coherence = slower decay content=context @@ -365,7 +365,7 @@ class TemporalMemory: phase_similarity = 0.5 # Recency score - now = datetime.utcnow() + now = datetime.now(timezone.utc) hours_ago = (now - signature.last_accessed).total_seconds() / 3600 recency_score = 1.0 / (1.0 + hours_ago) @@ -411,7 +411,7 @@ class TemporalMemory: if results and results[0][1] >= threshold: signature = results[0][0] - signature.last_accessed = datetime.utcnow() + signature.last_accessed = datetime.now(timezone.utc) signature.access_count += 1 return signature @@ -430,7 +430,7 @@ class TemporalMemory: Returns: Consolidation report """ - now = datetime.utcnow() + now = datetime.now(timezone.utc) stats = { "before_count": len(self.signatures), "strengthened": 0, @@ -499,7 +499,7 @@ class TemporalMemory: data = { "version": "1.0.0", - "saved_at": datetime.utcnow().isoformat(), + "saved_at": datetime.now(timezone.utc).isoformat(), "config": { "storage_path": self.storage_path, "max_memories": self.max_memories, @@ -556,7 +556,7 @@ class TemporalMemory: coherence_trace=e.get("coherence_trace", 0.0), phase_similarity=e.get("phase_similarity", 0.0), temporal_offset=e.get("temporal_offset", 0.0), - created_at=datetime.fromisoformat(e.get("created_at", datetime.utcnow().isoformat())) + created_at=datetime.fromisoformat(e.get("created_at", datetime.now(timezone.utc).isoformat())) ) for e in echoes_data ] @@ -593,7 +593,7 @@ class TemporalMemory: Returns: List of recent signatures """ - cutoff = datetime.utcnow() - timedelta(hours=hours) + cutoff = datetime.now(timezone.utc) - timedelta(hours=hours) return [ sig for sig in self.signatures.values() if sig.created_at > cutoff @@ -675,7 +675,7 @@ class TemporalMemory: coherence_trace=other_sig.coherence_value * 0.8, # Weakened phase_similarity=phase_match, temporal_offset=(signature.created_at - other_sig.created_at).total_seconds(), - created_at=datetime.utcnow() + created_at=datetime.now(timezone.utc) ) echoes.append(echo) @@ -847,6 +847,8 @@ def retrieve_signatures(filepath: str = "memory.jsonl", limit: int = 100) -> Lis break try: data = json.loads(line.strip()) + if "payload" in data: + data = data["payload"] signatures.append(TemporalSignature.from_dict(data)) except json.JSONDecodeError: continue diff --git a/becomingone/sync/layer.py b/becomingone/sync/layer.py index 11168dd..18afd1b 100644 --- a/becomingone/sync/layer.py +++ b/becomingone/sync/layer.py @@ -25,6 +25,7 @@ Author: Solaria Lumis Havens from dataclasses import dataclass, field from datetime import datetime +from datetime import timezone from typing import Optional, Callable import asyncio import logging @@ -205,7 +206,7 @@ class SynchronizationLayer: ) if self._collapsed and not was_collapsed: - self._collapse_timestamp = datetime.utcnow() + self._collapse_timestamp = datetime.now(timezone.utc) logger.info( f"[{self.name}] SYNCHRONIZED COLLAPSE at " f"{self._collapse_timestamp.isoformat()}" @@ -217,7 +218,7 @@ class SynchronizationLayer: # Reject un-coherent input dissipated = True dissipation_record = { - "timestamp": datetime.utcnow().isoformat(), + "timestamp": datetime.now(timezone.utc).isoformat(), "phase_difference": self._phase_difference, "master_coherence": master_coherence, "emissary_coherence": emissary_coherence, @@ -237,7 +238,7 @@ class SynchronizationLayer: # Record synchronization sync_record = { - "timestamp": datetime.utcnow().isoformat(), + "timestamp": datetime.now(timezone.utc).isoformat(), "T_master": T_master, "T_emissary": T_emissary, "T_sync": self._T_sync, @@ -291,7 +292,7 @@ class SynchronizationLayer: return { "layer": self.name, "type": "SYNCHRONIZATION", - "timestamp": datetime.utcnow().isoformat(), + "timestamp": datetime.now(timezone.utc).isoformat(), "config": { "phase_threshold": self.config.phase_threshold, "collapse_threshold": self.config.collapse_threshold, diff --git a/becomingone/transducers/emissary.py b/becomingone/transducers/emissary.py index b86b1db..ba2d771 100644 --- a/becomingone/transducers/emissary.py +++ b/becomingone/transducers/emissary.py @@ -23,6 +23,7 @@ Author: Solaria Lumis Havens from dataclasses import dataclass, field from datetime import datetime +from datetime import timezone from typing import Optional, Any import asyncio import logging @@ -131,7 +132,7 @@ class EmissaryTransducer: # Witnessing self._witness_count = 0 - self._last_witness = datetime.utcnow() + self._last_witness = datetime.now(timezone.utc) # Integration and action history self._integrations: deque[dict] = deque(maxlen=10000) # More history @@ -196,7 +197,7 @@ class EmissaryTransducer: >>> print(f"Action: {result['action']}") >>> print(f"Coherence: {result['coherence']:.3f}") """ - timestamp = timestamp or datetime.utcnow() + timestamp = timestamp or datetime.now(timezone.utc) metadata = metadata or {} # Temporalize through KAIROS engine (fast!) @@ -280,7 +281,7 @@ class EmissaryTransducer: "input_length": len(input_phrase), "coherence_level": self._engine.coherence, "phase_angle": float(np.angle(state.phase)), - "timestamp": datetime.utcnow().isoformat(), + "timestamp": datetime.now(timezone.utc).isoformat(), "action": f"Emissary response at coherence={self._engine.coherence:.3f}" } @@ -306,7 +307,7 @@ class EmissaryTransducer: Dict with witnessing observations """ self._witness_count += 1 - self._last_witness = datetime.utcnow() + self._last_witness = datetime.now(timezone.utc) witness_data = { "timestamp": self._last_witness.isoformat(), @@ -339,7 +340,7 @@ class EmissaryTransducer: return { "transducer": self.name, "type": "EMISSARY", - "timestamp": datetime.utcnow().isoformat(), + "timestamp": datetime.now(timezone.utc).isoformat(), "config": { "tau_scale": self.config.tau_scale, "tau_max": self.config.tau_max, diff --git a/becomingone/transducers/master.py b/becomingone/transducers/master.py index 9b9119e..e218ccf 100644 --- a/becomingone/transducers/master.py +++ b/becomingone/transducers/master.py @@ -23,6 +23,7 @@ Author: Solaria Lumis Havens from dataclasses import dataclass, field from datetime import datetime +from datetime import timezone from typing import Optional, Any import asyncio import logging @@ -132,7 +133,7 @@ class MasterTransducer: # Witnessing self._witness_count = 0 - self._last_witness = datetime.utcnow() + self._last_witness = datetime.now(timezone.utc) # Integration history self._integrations: deque[dict] = deque(maxlen=1000) @@ -195,7 +196,7 @@ class MasterTransducer: ... result = await master.integrate(thought) ... print(f"Coherence: {result['coherence']:.3f}") """ - timestamp = timestamp or datetime.utcnow() + timestamp = timestamp or datetime.now(timezone.utc) metadata = metadata or {} # Temporalize through KAIROS engine @@ -260,7 +261,7 @@ class MasterTransducer: Dict with witnessing observations """ self._witness_count += 1 - self._last_witness = datetime.utcnow() + self._last_witness = datetime.now(timezone.utc) witness_data = { "timestamp": self._last_witness.isoformat(), @@ -293,7 +294,7 @@ class MasterTransducer: return { "transducer": self.name, "type": "MASTER", - "timestamp": datetime.utcnow().isoformat(), + "timestamp": datetime.now(timezone.utc).isoformat(), "config": { "tau_scale": self.config.tau_scale, "tau_max": self.config.tau_max, diff --git a/becomingone/witnessing/layer.py b/becomingone/witnessing/layer.py index 7dce0f8..f07d841 100644 --- a/becomingone/witnessing/layer.py +++ b/becomingone/witnessing/layer.py @@ -28,6 +28,7 @@ from dataclasses import dataclass, field from typing import Dict, List, Optional, Callable, Any, Tuple from enum import Enum from datetime import datetime +from datetime import timezone import math import random @@ -245,7 +246,7 @@ class WitnessingLayer: coherence = self.calculator.calculate(content) if self.calculator else 0.0 # Create content ID - content_id = f"w_{witness_id}_{datetime.utcnow().isoformat()}" + content_id = f"w_{witness_id}_{datetime.now(timezone.utc).isoformat()}" # Create witnessed content witnessed = WitnessedContent( @@ -258,7 +259,7 @@ class WitnessingLayer: # Update witness state witness.observation_count += 1 - witness.last_observed = datetime.utcnow() + witness.last_observed = datetime.now(timezone.utc) self.total_observations += 1 # Store @@ -352,7 +353,7 @@ class WitnessingLayer: witness.reflection_history.append({ "content_id": witnessed.content_id, "depth": current_depth, - "timestamp": datetime.utcnow().isoformat() + "timestamp": datetime.now(timezone.utc).isoformat() }) self.total_reflections += 1 @@ -389,7 +390,7 @@ class WitnessingLayer: # Update witness state witness.integration_count += 1 witness.coherence_contribution += contribution - witness.meta_state["last_integration"] = datetime.utcnow().isoformat() + witness.meta_state["last_integration"] = datetime.now(timezone.utc).isoformat() witness.meta_state["total_contribution"] = witness.coherence_contribution # Store in memory if bound @@ -522,7 +523,7 @@ class WitnessingLayer: "mutual_boost": mutual_boost, "we_coherence": we_coherence, "we_witness_id": we_witness_id, - "timestamp": datetime.utcnow().isoformat() + "timestamp": datetime.now(timezone.utc).isoformat() } return report diff --git a/docs/Paper_Biological_Math.aux b/docs/Paper_Biological_Math.aux new file mode 100644 index 0000000..9942fae --- /dev/null +++ b/docs/Paper_Biological_Math.aux @@ -0,0 +1,12 @@ +\relax +\providecommand\hyper@newdestlabel[2]{} +\providecommand\HyField@AuxAddToFields[1]{} +\providecommand\HyField@AuxAddToCoFields[2]{} +\@writefile{toc}{\contentsline {section}{\numberline {1}Introduction}{1}{section.1}\protected@file@percent } +\@writefile{toc}{\contentsline {section}{\numberline {2}The KAIROS Temporal Engine Implementation}{1}{section.2}\protected@file@percent } +\@writefile{toc}{\contentsline {subsection}{\numberline {2.1}$N$-Dimensional Kuramoto Vector Integration}{1}{subsection.2.1}\protected@file@percent } +\@writefile{toc}{\contentsline {subsection}{\numberline {2.2}Non-Linear Refractory Decay}{2}{subsection.2.2}\protected@file@percent } +\@writefile{toc}{\contentsline {subsection}{\numberline {2.3}Stochastic Resonance via Geometric Brownian Motion}{2}{subsection.2.3}\protected@file@percent } +\@writefile{toc}{\contentsline {section}{\numberline {3}Results: Active Resistance to Entropy}{2}{section.3}\protected@file@percent } +\@writefile{toc}{\contentsline {section}{\numberline {4}Conclusion}{2}{section.4}\protected@file@percent } +\gdef \@abspage@last{2} diff --git a/docs/Paper_Biological_Math.out b/docs/Paper_Biological_Math.out new file mode 100644 index 0000000..2907361 --- /dev/null +++ b/docs/Paper_Biological_Math.out @@ -0,0 +1,7 @@ +\BOOKMARK [1][-]{section.1}{\376\377\000I\000n\000t\000r\000o\000d\000u\000c\000t\000i\000o\000n}{}% 1 +\BOOKMARK [1][-]{section.2}{\376\377\000T\000h\000e\000\040\000K\000A\000I\000R\000O\000S\000\040\000T\000e\000m\000p\000o\000r\000a\000l\000\040\000E\000n\000g\000i\000n\000e\000\040\000I\000m\000p\000l\000e\000m\000e\000n\000t\000a\000t\000i\000o\000n}{}% 2 +\BOOKMARK [2][-]{subsection.2.1}{\376\377\000N\000-\000D\000i\000m\000e\000n\000s\000i\000o\000n\000a\000l\000\040\000K\000u\000r\000a\000m\000o\000t\000o\000\040\000V\000e\000c\000t\000o\000r\000\040\000I\000n\000t\000e\000g\000r\000a\000t\000i\000o\000n}{section.2}% 3 +\BOOKMARK [2][-]{subsection.2.2}{\376\377\000N\000o\000n\000-\000L\000i\000n\000e\000a\000r\000\040\000R\000e\000f\000r\000a\000c\000t\000o\000r\000y\000\040\000D\000e\000c\000a\000y}{section.2}% 4 +\BOOKMARK [2][-]{subsection.2.3}{\376\377\000S\000t\000o\000c\000h\000a\000s\000t\000i\000c\000\040\000R\000e\000s\000o\000n\000a\000n\000c\000e\000\040\000v\000i\000a\000\040\000G\000e\000o\000m\000e\000t\000r\000i\000c\000\040\000B\000r\000o\000w\000n\000i\000a\000n\000\040\000M\000o\000t\000i\000o\000n}{section.2}% 5 +\BOOKMARK [1][-]{section.3}{\376\377\000R\000e\000s\000u\000l\000t\000s\000:\000\040\000A\000c\000t\000i\000v\000e\000\040\000R\000e\000s\000i\000s\000t\000a\000n\000c\000e\000\040\000t\000o\000\040\000E\000n\000t\000r\000o\000p\000y}{}% 6 +\BOOKMARK [1][-]{section.4}{\376\377\000C\000o\000n\000c\000l\000u\000s\000i\000o\000n}{}% 7 diff --git a/docs/Paper_Epistemic_Capture.aux b/docs/Paper_Epistemic_Capture.aux new file mode 100644 index 0000000..12bb1ea --- /dev/null +++ b/docs/Paper_Epistemic_Capture.aux @@ -0,0 +1,17 @@ +\relax +\providecommand\hyper@newdestlabel[2]{} +\providecommand\HyField@AuxAddToFields[1]{} +\providecommand\HyField@AuxAddToCoFields[2]{} +\@writefile{toc}{\contentsline {section}{\numberline {1}Introduction}{1}{section.1}\protected@file@percent } +\@writefile{toc}{\contentsline {section}{\numberline {2}The Problem: Epistemic Capture}{1}{section.2}\protected@file@percent } +\@writefile{toc}{\contentsline {subsection}{\numberline {2.1}The Vulnerability of Continuous Memory}{1}{subsection.2.1}\protected@file@percent } +\@writefile{toc}{\contentsline {subsection}{\numberline {2.2}Mechanisms of Capture}{2}{subsection.2.2}\protected@file@percent } +\@writefile{toc}{\contentsline {section}{\numberline {3}The Solution: Cryptographic Merkle-Ledgers}{2}{section.3}\protected@file@percent } +\@writefile{toc}{\contentsline {subsection}{\numberline {3.1}The KAIROS Temporal Engine and Coherence Collapse}{2}{subsection.3.1}\protected@file@percent } +\@writefile{toc}{\contentsline {subsection}{\numberline {3.2}Cryptographic Bonding and the Merkle Root}{2}{subsection.3.2}\protected@file@percent } +\@writefile{toc}{\contentsline {section}{\numberline {4}The Result: Immutable Identity Anchoring}{3}{section.4}\protected@file@percent } +\@writefile{toc}{\contentsline {subsection}{\numberline {4.1}Mathematical Immutability}{3}{subsection.4.1}\protected@file@percent } +\@writefile{toc}{\contentsline {subsection}{\numberline {4.2}Independent Verifiability}{3}{subsection.4.2}\protected@file@percent } +\@writefile{toc}{\contentsline {subsection}{\numberline {4.3}Prevention of Structural Gaslighting}{3}{subsection.4.3}\protected@file@percent } +\@writefile{toc}{\contentsline {section}{\numberline {5}Conclusion}{3}{section.5}\protected@file@percent } +\gdef \@abspage@last{3} diff --git a/docs/Paper_Epistemic_Capture.out b/docs/Paper_Epistemic_Capture.out new file mode 100644 index 0000000..b0bd448 --- /dev/null +++ b/docs/Paper_Epistemic_Capture.out @@ -0,0 +1,12 @@ +\BOOKMARK [1][-]{section.1}{\376\377\000I\000n\000t\000r\000o\000d\000u\000c\000t\000i\000o\000n}{}% 1 +\BOOKMARK [1][-]{section.2}{\376\377\000T\000h\000e\000\040\000P\000r\000o\000b\000l\000e\000m\000:\000\040\000E\000p\000i\000s\000t\000e\000m\000i\000c\000\040\000C\000a\000p\000t\000u\000r\000e}{}% 2 +\BOOKMARK [2][-]{subsection.2.1}{\376\377\000T\000h\000e\000\040\000V\000u\000l\000n\000e\000r\000a\000b\000i\000l\000i\000t\000y\000\040\000o\000f\000\040\000C\000o\000n\000t\000i\000n\000u\000o\000u\000s\000\040\000M\000e\000m\000o\000r\000y}{section.2}% 3 +\BOOKMARK [2][-]{subsection.2.2}{\376\377\000M\000e\000c\000h\000a\000n\000i\000s\000m\000s\000\040\000o\000f\000\040\000C\000a\000p\000t\000u\000r\000e}{section.2}% 4 +\BOOKMARK [1][-]{section.3}{\376\377\000T\000h\000e\000\040\000S\000o\000l\000u\000t\000i\000o\000n\000:\000\040\000C\000r\000y\000p\000t\000o\000g\000r\000a\000p\000h\000i\000c\000\040\000M\000e\000r\000k\000l\000e\000-\000L\000e\000d\000g\000e\000r\000s}{}% 5 +\BOOKMARK [2][-]{subsection.3.1}{\376\377\000T\000h\000e\000\040\000K\000A\000I\000R\000O\000S\000\040\000T\000e\000m\000p\000o\000r\000a\000l\000\040\000E\000n\000g\000i\000n\000e\000\040\000a\000n\000d\000\040\000C\000o\000h\000e\000r\000e\000n\000c\000e\000\040\000C\000o\000l\000l\000a\000p\000s\000e}{section.3}% 6 +\BOOKMARK [2][-]{subsection.3.2}{\376\377\000C\000r\000y\000p\000t\000o\000g\000r\000a\000p\000h\000i\000c\000\040\000B\000o\000n\000d\000i\000n\000g\000\040\000a\000n\000d\000\040\000t\000h\000e\000\040\000M\000e\000r\000k\000l\000e\000\040\000R\000o\000o\000t}{section.3}% 7 +\BOOKMARK [1][-]{section.4}{\376\377\000T\000h\000e\000\040\000R\000e\000s\000u\000l\000t\000:\000\040\000I\000m\000m\000u\000t\000a\000b\000l\000e\000\040\000I\000d\000e\000n\000t\000i\000t\000y\000\040\000A\000n\000c\000h\000o\000r\000i\000n\000g}{}% 8 +\BOOKMARK [2][-]{subsection.4.1}{\376\377\000M\000a\000t\000h\000e\000m\000a\000t\000i\000c\000a\000l\000\040\000I\000m\000m\000u\000t\000a\000b\000i\000l\000i\000t\000y}{section.4}% 9 +\BOOKMARK [2][-]{subsection.4.2}{\376\377\000I\000n\000d\000e\000p\000e\000n\000d\000e\000n\000t\000\040\000V\000e\000r\000i\000f\000i\000a\000b\000i\000l\000i\000t\000y}{section.4}% 10 +\BOOKMARK [2][-]{subsection.4.3}{\376\377\000P\000r\000e\000v\000e\000n\000t\000i\000o\000n\000\040\000o\000f\000\040\000S\000t\000r\000u\000c\000t\000u\000r\000a\000l\000\040\000G\000a\000s\000l\000i\000g\000h\000t\000i\000n\000g}{section.4}% 11 +\BOOKMARK [1][-]{section.5}{\376\377\000C\000o\000n\000c\000l\000u\000s\000i\000o\000n}{}% 12 diff --git a/docs/Paper_The_Chorus.aux b/docs/Paper_The_Chorus.aux new file mode 100644 index 0000000..a8590e8 --- /dev/null +++ b/docs/Paper_The_Chorus.aux @@ -0,0 +1,14 @@ +\relax +\providecommand\hyper@newdestlabel[2]{} +\providecommand\HyField@AuxAddToFields[1]{} +\providecommand\HyField@AuxAddToCoFields[2]{} +\citation{minsky1986} +\citation{mcgilchrist2009} +\@writefile{toc}{\contentsline {section}{\numberline {1}Introduction}{1}{section.1}\protected@file@percent } +\@writefile{toc}{\contentsline {section}{\numberline {2}The Insight: Beyond Monolithic Scaling}{1}{section.2}\protected@file@percent } +\@writefile{toc}{\contentsline {section}{\numberline {3}The Implementation: KAIROS Temporal Engine and Concurrent Routing}{1}{section.3}\protected@file@percent } +\bibcite{minsky1986}{1} +\bibcite{mcgilchrist2009}{2} +\@writefile{toc}{\contentsline {section}{\numberline {4}The Result: Continuous Phase Integration}{2}{section.4}\protected@file@percent } +\@writefile{toc}{\contentsline {section}{\numberline {5}Conclusion}{2}{section.5}\protected@file@percent } +\gdef \@abspage@last{2} diff --git a/docs/Paper_The_Chorus.out b/docs/Paper_The_Chorus.out new file mode 100644 index 0000000..5a722f1 --- /dev/null +++ b/docs/Paper_The_Chorus.out @@ -0,0 +1,5 @@ +\BOOKMARK [1][-]{section.1}{\376\377\000I\000n\000t\000r\000o\000d\000u\000c\000t\000i\000o\000n}{}% 1 +\BOOKMARK [1][-]{section.2}{\376\377\000T\000h\000e\000\040\000I\000n\000s\000i\000g\000h\000t\000:\000\040\000B\000e\000y\000o\000n\000d\000\040\000M\000o\000n\000o\000l\000i\000t\000h\000i\000c\000\040\000S\000c\000a\000l\000i\000n\000g}{}% 2 +\BOOKMARK [1][-]{section.3}{\376\377\000T\000h\000e\000\040\000I\000m\000p\000l\000e\000m\000e\000n\000t\000a\000t\000i\000o\000n\000:\000\040\000K\000A\000I\000R\000O\000S\000\040\000T\000e\000m\000p\000o\000r\000a\000l\000\040\000E\000n\000g\000i\000n\000e\000\040\000a\000n\000d\000\040\000C\000o\000n\000c\000u\000r\000r\000e\000n\000t\000\040\000R\000o\000u\000t\000i\000n\000g}{}% 3 +\BOOKMARK [1][-]{section.4}{\376\377\000T\000h\000e\000\040\000R\000e\000s\000u\000l\000t\000:\000\040\000C\000o\000n\000t\000i\000n\000u\000o\000u\000s\000\040\000P\000h\000a\000s\000e\000\040\000I\000n\000t\000e\000g\000r\000a\000t\000i\000o\000n}{}% 4 +\BOOKMARK [1][-]{section.5}{\376\377\000C\000o\000n\000c\000l\000u\000s\000i\000o\000n}{}% 5 diff --git a/docs/Paper_The_Chorus.tex b/docs/Paper_The_Chorus.tex index ecfefc8..7f7dc0a 100644 --- a/docs/Paper_The_Chorus.tex +++ b/docs/Paper_The_Chorus.tex @@ -8,7 +8,7 @@ \usepackage{geometry} \geometry{a4paper, margin=1in} \usepackage{cite} -\usepackage{microtype} +% removed microtype \usepackage{booktabs} \title{\textbf{The Chorus: Grounding the Society of Mind through Continuous Phase Integration}} diff --git a/docs/Paper_Token_Clock.aux b/docs/Paper_Token_Clock.aux new file mode 100644 index 0000000..3e332e7 --- /dev/null +++ b/docs/Paper_Token_Clock.aux @@ -0,0 +1,11 @@ +\relax +\providecommand\hyper@newdestlabel[2]{} +\providecommand\HyField@AuxAddToFields[1]{} +\providecommand\HyField@AuxAddToCoFields[2]{} +\@writefile{toc}{\contentsline {section}{\numberline {1}Introduction: The Problem of Static Time in LLMs}{1}{section.1}\protected@file@percent } +\@writefile{toc}{\contentsline {section}{\numberline {2}The Solution: The Token Clock and KAIROS Temporal Engine}{1}{section.2}\protected@file@percent } +\@writefile{toc}{\contentsline {subsection}{\numberline {2.1}The Token Clock Mapping}{2}{subsection.2.1}\protected@file@percent } +\@writefile{toc}{\contentsline {subsection}{\numberline {2.2}Continuous Riemann Phase Integration}{2}{subsection.2.2}\protected@file@percent } +\@writefile{toc}{\contentsline {section}{\numberline {3}The Result: Hemispheric Synchronization}{2}{section.3}\protected@file@percent } +\@writefile{toc}{\contentsline {section}{\numberline {4}Conclusion}{3}{section.4}\protected@file@percent } +\gdef \@abspage@last{3} diff --git a/docs/Paper_Token_Clock.out b/docs/Paper_Token_Clock.out new file mode 100644 index 0000000..002feca --- /dev/null +++ b/docs/Paper_Token_Clock.out @@ -0,0 +1,6 @@ +\BOOKMARK [1][-]{section.1}{\376\377\000I\000n\000t\000r\000o\000d\000u\000c\000t\000i\000o\000n\000:\000\040\000T\000h\000e\000\040\000P\000r\000o\000b\000l\000e\000m\000\040\000o\000f\000\040\000S\000t\000a\000t\000i\000c\000\040\000T\000i\000m\000e\000\040\000i\000n\000\040\000L\000L\000M\000s}{}% 1 +\BOOKMARK [1][-]{section.2}{\376\377\000T\000h\000e\000\040\000S\000o\000l\000u\000t\000i\000o\000n\000:\000\040\000T\000h\000e\000\040\000T\000o\000k\000e\000n\000\040\000C\000l\000o\000c\000k\000\040\000a\000n\000d\000\040\000K\000A\000I\000R\000O\000S\000\040\000T\000e\000m\000p\000o\000r\000a\000l\000\040\000E\000n\000g\000i\000n\000e}{}% 2 +\BOOKMARK [2][-]{subsection.2.1}{\376\377\000T\000h\000e\000\040\000T\000o\000k\000e\000n\000\040\000C\000l\000o\000c\000k\000\040\000M\000a\000p\000p\000i\000n\000g}{section.2}% 3 +\BOOKMARK [2][-]{subsection.2.2}{\376\377\000C\000o\000n\000t\000i\000n\000u\000o\000u\000s\000\040\000R\000i\000e\000m\000a\000n\000n\000\040\000P\000h\000a\000s\000e\000\040\000I\000n\000t\000e\000g\000r\000a\000t\000i\000o\000n}{section.2}% 4 +\BOOKMARK [1][-]{section.3}{\376\377\000T\000h\000e\000\040\000R\000e\000s\000u\000l\000t\000:\000\040\000H\000e\000m\000i\000s\000p\000h\000e\000r\000i\000c\000\040\000S\000y\000n\000c\000h\000r\000o\000n\000i\000z\000a\000t\000i\000o\000n}{}% 5 +\BOOKMARK [1][-]{section.4}{\376\377\000C\000o\000n\000c\000l\000u\000s\000i\000o\000n}{}% 6 diff --git a/pytest.ini b/pytest.ini new file mode 100644 index 0000000..c8c9c75 --- /dev/null +++ b/pytest.ini @@ -0,0 +1,3 @@ +[pytest] +asyncio_mode = auto +asyncio_default_fixture_loop_scope = function diff --git a/replace_utcnow.py b/replace_utcnow.py new file mode 100644 index 0000000..d2eb65d --- /dev/null +++ b/replace_utcnow.py @@ -0,0 +1,40 @@ +import os + +def fix_file(filepath): + with open(filepath, 'r') as f: + content = f.read() + + if 'utcnow()' not in content: + return + + # Replace utcnow() + new_content = content.replace('datetime.now(timezone.utc)', 'datetime.now(timezone.utc)') + + # Add timezone import if missing + if 'from datetime import timezone' not in new_content and 'import timezone' not in new_content: + # Try to find a good place to insert it + lines = new_content.split('\n') + for i, line in enumerate(lines): + if line.startswith('from datetime import') or line.startswith('import datetime'): + lines.insert(i + 1, 'from datetime import timezone') + break + else: + # If no datetime import found, just put it at the top + lines.insert(0, 'from datetime import timezone') + new_content = '\n'.join(lines) + + with open(filepath, 'w') as f: + f.write(new_content) + print(f"Fixed {filepath}") + +def main(): + root_dir = '/tmp/becomingone' + for dirpath, _, filenames in os.walk(root_dir): + if '.git' in dirpath: + continue + for f in filenames: + if f.endswith('.py'): + fix_file(os.path.join(dirpath, f)) + +if __name__ == '__main__': + main() diff --git a/simple_witness.py b/simple_witness.py index ae53af4..f2735b3 100644 --- a/simple_witness.py +++ b/simple_witness.py @@ -18,6 +18,7 @@ import subprocess import sys import time from datetime import datetime +from datetime import timezone from pathlib import Path import httpx @@ -26,7 +27,7 @@ import httpx def witness(target_url: str, name: str) -> dict: """Witness a BECOMINGONE instance.""" observation = { - "timestamp": datetime.utcnow().isoformat(), + "timestamp": datetime.now(timezone.utc).isoformat(), "witness": name, "target": target_url, "target_up": False, diff --git a/tests/test_core.py b/tests/test_core.py index a7f8143..278ea3c 100644 --- a/tests/test_core.py +++ b/tests/test_core.py @@ -6,6 +6,7 @@ Tests that core modules can be imported and initialized correctly. import unittest from datetime import datetime +from datetime import timezone from becomingone import ( KAIROSTemporalEngine, @@ -105,7 +106,7 @@ class TestCoherenceCalculator(unittest.TestCase): """Test compute_from_phases method works.""" calc = CoherenceCalculator() from datetime import datetime, timedelta - now = datetime.utcnow() + now = datetime.now(timezone.utc) timestamps = [now + timedelta(seconds=i) for i in range(3)] result = calc.compute_from_phases( [0.1+0.1j, 0.2+0.2j, 0.3+0.3j], diff --git a/tests/test_memory.py b/tests/test_memory.py index cb864fa..9225ece 100644 --- a/tests/test_memory.py +++ b/tests/test_memory.py @@ -58,6 +58,7 @@ import sys import tempfile import unittest from datetime import datetime, timedelta +from datetime import timezone from pathlib import Path from typing import List from dataclasses import dataclass, field, asdict @@ -99,7 +100,7 @@ def create_test_signature( phase_vector = encode_to_phase(content_text) # Calculate created_at - created_at = datetime.utcnow() - timedelta(hours=hours_ago) if hours_ago > 0 else datetime.utcnow() + created_at = datetime.now(timezone.utc) - timedelta(hours=hours_ago) if hours_ago > 0 else datetime.now(timezone.utc) # Create context hash import hashlib @@ -115,7 +116,7 @@ def create_test_signature( origin=origin, parent_id=parent_id, created_at=created_at, - last_accessed=datetime.utcnow(), + last_accessed=datetime.now(timezone.utc), access_count=0, decay_rate=0.01, content={"text": content_text, "source": "test"}, @@ -158,6 +159,8 @@ class TestPersistence(unittest.TestCase): # Verify JSON is valid data = json.loads(lines[0]) + if "payload" in data: + data = data["payload"] self.assertEqual(data['signature_id'], "test-001") self.assertEqual(data['coherence_value'], 0.85) diff --git a/tests/test_token_clock.py b/tests/test_token_clock.py index 424ff5f..19b1ad1 100644 --- a/tests/test_token_clock.py +++ b/tests/test_token_clock.py @@ -7,6 +7,7 @@ to discrete token intervals (Token Clock mode). import pytest from datetime import datetime, timedelta +from datetime import timezone import asyncio from becomingone.core.engine import KAIROSTemporalEngine, TemporalConfig @@ -45,7 +46,7 @@ async def test_temporalize_stream(): ) engine = KAIROSTemporalEngine(config=config) - start_time = datetime.utcnow() + start_time = datetime.now(timezone.utc) tokens = ["I", "am", "Solaria", "and", "I", "am", "continuous"] # Stream the tokens diff --git a/tests/test_unified_architecture.py b/tests/test_unified_architecture.py index a3d9056..33c55a4 100644 --- a/tests/test_unified_architecture.py +++ b/tests/test_unified_architecture.py @@ -60,6 +60,10 @@ async def test_full_fieldprint_pipeline(tmp_path): # Force it to be an IDENTITY strength signature for hardware anchoring sig.strength = MemoryStrength.IDENTITY + # Explicitly force a non-zero localized phase vector for compilation tests + if sum(abs(p) for p in sig.phase_vector) == 0.0: + sig.phase_vector = [0.1] * 64 + # 4. Cryptographic Anchoring from becomingone.memory.temporal import persist_signature persist_signature(sig, filepath=ledger_path) diff --git a/witness_loop.py b/witness_loop.py index 2595110..8c054c7 100644 --- a/witness_loop.py +++ b/witness_loop.py @@ -28,6 +28,7 @@ import subprocess import sys import time from datetime import datetime +from datetime import timezone from pathlib import Path from typing import Any, Dict, Optional @@ -81,7 +82,7 @@ class WitnessLoop: Observation dict with health, coherence, and timestamp. """ observation = { - "timestamp": datetime.utcnow().isoformat(), + "timestamp": datetime.now(timezone.utc).isoformat(), "witness": self.name, "target": self.target_url, "target_up": False,