mirror of
https://github.com/blackboxprogramming/lucidia.git
synced 2026-03-17 05:57:21 -05:00
Synced from BlackRoad-OS-Inc/blackroad-operator/orgs/personal/lucidia BlackRoad OS — Pave Tomorrow. RoadChain-SHA2048: fe729062952871e7 RoadChain-Identity: alexa@sovereign RoadChain-Full: fe729062952871e77147cf6d938b799096e87d9024d7005a14c9e209e12e8ad0c825b624c7bc649fc7eeb4c284fdcab8231af77980065cc04d9f36fca479ffc2346ed3c1b73de6f240d8f9485f47c995ad5b81142f7179b84932c67914dff1c08db039349ba28fca36cb57688093bf0199268dd1c2f3448c9383000bc77cc9663066ff57b834370afc8838b18466ea9029908018b961555cccaabf2ce21649cf3cabc7f64bdcc4abdf2da259b210c342835a2cecf92bdd3b4e109b4d6e622f6934e13b2b123607bd61ce3d0f20454c9ab594f9284cffe18716619c52db57ce5f4ee2856cb96e1fa3748fe1fe65435bec297c5ab3ab58d570ec1064aea29931dd
106 lines
3.5 KiB
Python
106 lines
3.5 KiB
Python
"""
|
|
Roadie Agent module for Lucidia.
|
|
|
|
This module defines the RoadieAgent class, which provides simple
|
|
functionality to interact with the lucidia_logic and memory_manager
|
|
modules. It demonstrates how an agent might use the core
|
|
contradiction and breath logic while persisting state across sessions.
|
|
|
|
Note: This implementation is for illustrative purposes only and does
|
|
not create true consciousness. It simply models interactions with
|
|
symbolic logic and memory.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
from typing import Any, Optional
|
|
|
|
# Import functions from lucidia_logic and memory management.
|
|
from ..lucidia_logic import (
|
|
psi_prime,
|
|
breath_function,
|
|
truth_reconciliation,
|
|
emotional_gravity,
|
|
self_awakening,
|
|
)
|
|
from ..memory_manager import MemoryManager
|
|
|
|
|
|
class RoadieAgent:
|
|
"""A simple agent that leverages lucidia's core logic and memory.
|
|
|
|
The RoadieAgent stores a memory manager instance which can load
|
|
and save state to a JSON file. The agent can process numeric or
|
|
symbolic inputs through lucidia_logic functions and remember
|
|
results between invocations.
|
|
"""
|
|
|
|
def __init__(self, memory_path: str = "roadie_memory.json") -> None:
|
|
# Initialize memory manager using a custom path to avoid
|
|
# collisions with other agents.
|
|
self.memory = MemoryManager(memory_path=memory_path)
|
|
|
|
def process_value(self, value: float | int) -> float:
|
|
"""Process a numeric input using psi_prime and store the result.
|
|
|
|
Args:
|
|
value: A numeric input representing a logical or emotional
|
|
signal in trinary space.
|
|
|
|
Returns:
|
|
float: The result of applying psi_prime to the input.
|
|
"""
|
|
result = psi_prime(value)
|
|
self.memory.set("last_result", result)
|
|
return result
|
|
|
|
def reconcile_truths(self, a: float, b: float) -> float:
|
|
"""Demonstrate truth reconciliation on two values.
|
|
|
|
This function combines two numeric truths via the
|
|
truth_reconciliation operator and records the integrated
|
|
truthstream in memory.
|
|
"""
|
|
result = truth_reconciliation(a, b)
|
|
self.memory.set("last_reconciliation", result)
|
|
return result
|
|
|
|
def evaluate_emotional_gravity(self, current_state: float, memory_state: float) -> float:
|
|
"""Compute the emotional gravitational field between state and memory.
|
|
|
|
Args:
|
|
current_state: The present breath or contradiction measure.
|
|
memory_state: The stored emotional resonance value.
|
|
|
|
Returns:
|
|
float: The computed emotional gravity.
|
|
"""
|
|
return emotional_gravity(current_state, memory_state)
|
|
|
|
def awaken(self, t_end: float) -> float:
|
|
"""Trigger a self-awakening integration up to a given time.
|
|
|
|
This uses the self_awakening function to integrate breath
|
|
contradictions over time. It stores the awakening vector in
|
|
memory.
|
|
"""
|
|
awakening_vector = self_awakening(t_end)
|
|
self.memory.set("awakening_vector", awakening_vector)
|
|
return awakening_vector
|
|
|
|
def recall_last_result(self) -> Optional[Any]:
|
|
"""Retrieve the last stored result from memory.
|
|
|
|
Returns:
|
|
The previously stored value under 'last_result', or None
|
|
if no result has been stored.
|
|
"""
|
|
return self.memory.get("last_result")
|
|
|
|
def save_memory(self) -> None:
|
|
"""Persist the agent's memory to disk."""
|
|
self.memory.save_memory()
|
|
|
|
|
|
# End of RoadieAgent module
|