"use client"; import { useState, useEffect } from "react"; import { useMemory } from "@blackroad/sdk"; interface MemoryEntry { hash: string; prev_hash: string; content: string; kind: "fact" | "observation" | "inference" | "commitment"; truth_state: 1 | 0 | -1; timestamp: string; } const KIND_COLOR: Record = { fact: "text-green-400", observation: "text-blue-400", inference: "text-yellow-400", commitment: "text-purple-400", }; const TRUTH_LABEL: Record = { 1: "TRUE", 0: "UNKNOWN", "-1": "FALSE" }; const TRUTH_COLOR: Record = { 1: "text-green-400", 0: "text-yellow-400", "-1": "text-red-400" }; export default function MemoryPage() { const { entries, loading, error, write, verifyChain } = useMemory(); const [chainValid, setChainValid] = useState(null); const [newContent, setNewContent] = useState(""); const [newKind, setNewKind] = useState<"fact" | "observation" | "inference">("fact"); const [filter, setFilter] = useState(""); useEffect(() => { verifyChain().then(setChainValid); }, [entries]); const handleWrite = async (e: React.FormEvent) => { e.preventDefault(); if (!newContent.trim()) return; await write(newContent, newKind); setNewContent(""); }; const filtered = filter ? entries.filter((e) => e.content.toLowerCase().includes(filter.toLowerCase())) : entries; return (

Memory Chain

PS-SHA∞ tamper-evident knowledge store

{chainValid !== null && (
{chainValid ? "✓ CHAIN VALID" : "✗ CHAIN BROKEN"}
)}
{/* Write new memory */}

Store Memory