Files
remember/lucidia/contradiction_log.py
Alexa Amundson 897707f24b sync: update from blackroad-operator 2026-03-14
Synced from BlackRoad-OS-Inc/blackroad-operator/orgs/personal/remember
BlackRoad OS — Pave Tomorrow.

RoadChain-SHA2048: de497960b2bf455e
RoadChain-Identity: alexa@sovereign
RoadChain-Full: de497960b2bf455eef9af5db0cd022d8b6c36461a5d504e8bdf54646405ae14b684d135ff94bfa57c47ba0c4fd8a1c9a01c94fcf02df1fb83d796610ab1cb3d01c9a9bcb53f84685e609c1fffafb3f3b0c7c210cb4b4eb9a2c80c5d95a9ab0738640af71682aab465283c5c4c42b186f01f0810ce0bde2b00a4c2ebfc1e25c4f3309de5d6b869d2f0c41da1bd604adf433413246cd0971fd1b2c5d731323c73fdaad6203bf667cbbe0554f5f77fd7ba96e7efe0abc468e7535d79dc185073c1590fef6f279342b4b25f549ccb2d574006a93591d831de73c666bb5ffce4cabc1393dc2c7fbdbf03595058bea8a30fa39a8dd644dd04ae900a8e3bf059c63d894
2026-03-14 15:10:01 -05:00

50 lines
1.4 KiB
Python

"""Contradiction log for Lucidia.
This module provides a basic interface to record instances where the system's response
contradicts prior outputs or expected truths. Each log entry includes a timestamp,
the user prompt, and the assistant's reply.
The intent is to build a transparent record for later analysis.
"""
from __future__ import annotations
import json
import time
from dataclasses import dataclass, asdict
from typing import List
@dataclass
class ContradictionEntry:
timestamp: float
prompt: str
reply: str
class ContradictionLog:
def __init__(self, path: str = "contradiction_log.jsonl") -> None:
self.path = path
def append(self, prompt: str, reply: str) -> None:
entry = ContradictionEntry(time.time(), prompt, reply)
with open(self.path, "a", encoding="utf-8") as f:
f.write(json.dumps(asdict(entry)) + "\n")
def read_all(self) -> List[ContradictionEntry]:
entries: List[ContradictionEntry] = []
try:
with open(self.path, "r", encoding="utf-8") as f:
for line in f:
data = json.loads(line.strip())
entries.append(ContradictionEntry(**data))
except FileNotFoundError:
pass
return entries
if __name__ == "__main__":
# Example usage:
log = ContradictionLog()
log.append("Example prompt", "Example contradictory reply")
for e in log.read_all():
print(e)