From dcd3a3111293a43dff6e90215a0f2416bde78846 Mon Sep 17 00:00:00 2001 From: Amr Gharbeia Date: Mon, 13 Apr 2026 14:29:15 -0400 Subject: [PATCH] ALIGN: Rename Object Store to Memory and enrich literate text --- README.org | 4 +- docs/deployment.org | 2 +- docs/rca/rca-bouncer.org | 4 +- literate/context.org | 18 ++-- literate/loop.org | 2 +- literate/{object-store.org => memory.org} | 98 ++++++++++--------- literate/package.org | 10 +- literate/perceive.org | 4 +- literate/system-definition.org | 6 +- org-agent.asd | 6 +- skills/org-skill-chat.org | 6 +- skills/org-skill-credentials-vault.org | 22 ++--- skills/org-skill-embedding.org | 4 +- skills/org-skill-environment-config.org | 14 +-- skills/org-skill-event-orchestrator.org | 8 +- skills/org-skill-homoiconic-memory.org | 4 +- skills/org-skill-lisp-validator.org | 4 +- skills/org-skill-peripheral-vision.org | 4 +- skills/org-skill-self-fix.org | 8 +- skills/org-skill-state-persistence.org | 26 ++--- src/chaos-logic.lisp | 4 +- src/chat-logic.lisp | 6 +- src/config-logic.lisp | 8 +- src/context-logic.lisp | 2 +- src/context.lisp | 6 +- src/credentials-vault.lisp | 2 +- src/deterministic.lisp | 4 +- src/embedding-logic.lisp | 2 +- src/embedding.lisp | 2 +- src/event-orchestrator.lisp | 4 +- src/latent-reflection.lisp | 4 +- src/lisp-validator.lisp | 4 +- src/loop.lisp | 2 +- src/{object-store.lisp => memory.lisp} | 24 ++--- src/package.lisp | 8 +- src/perceive.lisp | 2 +- src/self-fix.lisp | 6 +- src/state-persistence.lisp | 10 +- tests/bouncer-tests.lisp | 6 +- tests/chaos-qa.lisp | 4 +- tests/lisp-repair-tests.lisp | 2 +- ...ect-store-tests.lisp => memory-tests.lisp} | 30 +++--- tests/peripheral-vision-tests.lisp | 4 +- tests/persistence-tests.lisp | 6 +- tests/pipeline-tests.lisp | 12 +-- tests/task-orchestrator-tests.lisp | 6 +- tests/vault-tests.lisp | 4 +- 47 files changed, 215 insertions(+), 213 deletions(-) rename literate/{object-store.org => memory.org} (76%) rename src/{object-store.lisp => memory.lisp} (85%) rename tests/{object-store-tests.lisp => memory-tests.lisp} (85%) diff --git a/README.org b/README.org index 6645a38..899af59 100644 --- a/README.org +++ b/README.org @@ -39,7 +39,7 @@ To guarantee long-term stability, org-agent enforces a strict architectural boun ** The Minimalist Harness The Lisp microkernel does almost no actual "work." It is a thin, unbreakable harness strictly responsible for three things: -1. *The Object Store:* Maintaining the live graph of your Memex in RAM. +1. *The Memory:* Maintaining the live graph of your Memex in RAM. 2. *The Communication Protocol:* Managing the secure bridge between the agent and the outside world. While power users can connect natively via Emacs or Vim, the vast majority of users will interact with org-agent exclusively through chat clients (like Telegram, Signal, or Matrix), web dashboards, or a Terminal UI (TUI). The harness doesn't care; it just securely routes the messages. 3. *The Cognitive Loop:* Moving signals through the Perceive -> Probabilistic -> Deterministic -> Dispatch pipeline. @@ -61,7 +61,7 @@ When the system boots, it parses these single files, mathematically proves their ** The Anatomy: Three Data Stores The agent's "mind" is not a transient chat session; it is a durable, stateful architecture consisting of three layers: 1. *The Linguistic Substrate (Plaintext Files):* The human-readable Source of Truth on your hard drive. You can edit these files in any text editor, and the agent will instantly perceive the changes. -2. *The Lisp Object Store (RAM):* The "Active Brain," a live, threaded graph of Lisp objects representing every headline, paragraph, and tag in your Memex. It allows the agent to navigate your life instantly without constantly re-reading files. +2. *The Lisp Memory (RAM):* The "Active Brain," a live, threaded graph of Lisp objects representing every headline, paragraph, and tag in your Memex. It allows the agent to navigate your life instantly without constantly re-reading files. 3. *The Telemetry Store (External):* A high-volume database for sub-deterministic sensory data (e.g., smart home logs or system metrics), which the agent monitors and distills. ** The Psychology: The 2x2 Cognitive Matrix diff --git a/docs/deployment.org b/docs/deployment.org index 476d9d7..e3d284c 100644 --- a/docs/deployment.org +++ b/docs/deployment.org @@ -26,7 +26,7 @@ docker-compose logs -f * Volume Mapping The ~docker-compose.yml~ file automatically mounts your host's ~memex~ directory to ~/memex~ inside the container. This allows the agent to: 1. Read/Write to your Zettelkasten and GTD files. -2. Maintain its local state (Object Store, snapshots). +2. Maintain its local state (Memory, snapshots). * Troubleshooting ** signal-cli Identity diff --git a/docs/rca/rca-bouncer.org b/docs/rca/rca-bouncer.org index 3039dc6..11570d1 100644 --- a/docs/rca/rca-bouncer.org +++ b/docs/rca/rca-bouncer.org @@ -15,7 +15,7 @@ Architecture gap. The system lacked an authorization state between "Safe" and "E 2. **Asynchronous Event:** If flagged, the harness emits an `:approval-required` event. 3. **Flight Plan Skill:** Created `org-skill-bouncer.org` to: - Catch the event and create a serialized Org node with state `PLAN`. - - Monitor the Object Store for `APPROVED` states. + - Monitor the Memory for `APPROVED` states. - Re-inject approved actions with the `:approved t` bypass flag. * 2. Design Decision: Org-native Approval @@ -30,4 +30,4 @@ Ensures that the agent's "Flight Plans" are first-class citizens in the Memex, a * 3. Permanent Learnings - **Serial Bypass:** Always include a specific bypass flag (e.g., `:approved t`) when re-injecting intercepted actions to prevent infinite interception loops. -- **Heartbeat Listeners:** Periodic scanning of the Object Store for state transitions is an effective way to implement asynchronous authorization gates without blocking the harness. +- **Heartbeat Listeners:** Periodic scanning of the Memory for state transitions is an effective way to implement asynchronous authorization gates without blocking the harness. diff --git a/literate/context.org b/literate/context.org index bbb08b0..721063c 100644 --- a/literate/context.org +++ b/literate/context.org @@ -14,7 +14,7 @@ The ~org-agent~ harness implements a deterministic, tree-aware solution: the **F When the harness prepares a prompt for the Probabilistic Engine, it identifies a "Foveal Focus"—typically the specific Org headline or task the user is currently interacting with. This node, along with its immediate children and semantically relevant neighbors, is rendered at "High Resolution," meaning its full body text, properties, and metadata are included in the prompt. *** 2. The Peripheral Vision (Low Resolution) -To maintain global awareness without bloating the context window, the rest of the Memex is rendered at "Low Resolution." The harness recursively walks the Object Store and generates a skeletal outline consisting only of titles and IDs. This gives the LLM a "mental map" of the entire system, allowing it to reference other projects or skills without needing to see their full content until they are explicitly brought into focus. +To maintain global awareness without bloating the context window, the rest of the Memex is rendered at "Low Resolution." The harness recursively walks the Memory and generates a skeletal outline consisting only of titles and IDs. This gives the LLM a "mental map" of the entire system, allowing it to reference other projects or skills without needing to see their full content until they are explicitly brought into focus. *** 3. Deterministic Tree-Walking By leveraging Common Lisp's strengths in recursive tree manipulation, the harness can surgically prune the AST before it ever reaches the LLM. This ensures that the structural hierarchy of the Memex is preserved perfectly, even when the content is compressed. @@ -22,7 +22,7 @@ By leveraging Common Lisp's strengths in recursive tree manipulation, the harnes ** The Context Pipeline #+begin_src mermaid flowchart TD - Store[(Object Store)] --> Filter[Context Query Filter] + Store[(Memory)] --> Filter[Context Query Filter] Filter --> Identification{Identify Foveal ID} Identification --> Foveal[Render Focus: Full Content] Identification --> Peripheral[Render Outline: Titles Only] @@ -32,7 +32,7 @@ flowchart TD #+end_src * Context Assembly (context.lisp) -The ~context.lisp~ module provides the deterministic functional layer for querying the Object Store and transforming its internal pointers into the precise context strings required for neural reasoning. +The ~context.lisp~ module provides the deterministic functional layer for querying the Memory and transforming its internal pointers into the precise context strings required for neural reasoning. ** Package Context We begin by ensuring we are executing within the correct isolated package namespace. @@ -42,11 +42,11 @@ We begin by ensuring we are executing within the correct isolated package namesp #+end_src ** Querying the Store (context-query-store) -A generalized filter for the Object Store. This function allows skills to perform high-level semantic sweeps of the Memex based on tags, TODO states, or Org element types. It returns a list of ~org-object~ structures. +A generalized filter for the Memory. This function allows skills to perform high-level semantic sweeps of the Memex based on tags, TODO states, or Org element types. It returns a list of ~org-object~ structures. #+begin_src lisp :tangle ../src/context.lisp (defun context-query-store (&key tag todo-state type) - "Filters the Object Store based on tags, todo states, or types." + "Filters the Memory based on tags, todo states, or types." (let ((results nil)) (maphash (lambda (id obj) (declare (ignore id)) @@ -55,7 +55,7 @@ A generalized filter for the Object Store. This function allows skills to perfor (when tag (unless (search tag (format nil "~a" (getf attrs :TAGS)) :test #'string-equal) (setf match nil))) (when (and todo-state (not (equal state todo-state))) (setf match nil)) (when match (push obj results)))) - *object-store*) + *memory*) results)) #+end_src @@ -198,7 +198,7 @@ The primary entry point for context generation. This function identifies active #+begin_src lisp :tangle ../src/context.lisp (defun context-assemble-global-awareness (&optional signal) - "Produces a high-level skeletal outline of the current Object Store for the LLM." + "Produces a high-level skeletal outline of the current Memory for the LLM." (let* ((payload (when signal (getf signal :payload))) (foveal-id (when payload (getf payload :target-id))) (projects (context-get-active-projects)) @@ -227,7 +227,7 @@ Following the Engineering Standards, the peripheral vision extraction and render (test test-foveal-rendering "Verify that the foveal target is rendered with content, while siblings are skeletal." - (clrhash org-agent::*object-store*) + (clrhash org-agent::*memory*) (let* ((ast '(:type :HEADLINE :properties (:ID "proj-root" :TITLE "Project" :TAGS "project") :contents ((:type :HEADLINE :properties (:ID "node-foveal" :TITLE "Foveal Node") :raw-content "FOVEAL CONTENT" :contents nil) @@ -243,7 +243,7 @@ Following the Engineering Standards, the peripheral vision extraction and render (test test-awareness-budget "Verify that context-assemble-global-awareness handles multiple projects." - (clrhash org-agent::*object-store*) + (clrhash org-agent::*memory*) (ingest-ast '(:type :HEADLINE :properties (:ID "p1" :TITLE "Project 1" :TAGS "project") :contents nil)) (ingest-ast '(:type :HEADLINE :properties (:ID "p2" :TITLE "Project 2" :TAGS "project") :contents nil)) (let ((output (context-assemble-global-awareness))) diff --git a/literate/loop.org b/literate/loop.org index 34a4012..7c59cc3 100644 --- a/literate/loop.org +++ b/literate/loop.org @@ -33,7 +33,7 @@ The Metabolic Loop is the high-level coordinator of the Org-Agent. It orchestrat (setf current-signal (act-gate current-signal))) (error (c) (harness-log "METABOLISM CRASH: ~a - Initiating Micro-Rollback." c) - (rollback-object-store 0) + (rollback-memory 0) (let ((sensor (ignore-errors (getf (getf current-signal :payload) :sensor)))) (if (or (> depth 2) (member sensor '(:loop-error :tool-error))) (setf current-signal nil) diff --git a/literate/object-store.org b/literate/memory.org similarity index 76% rename from literate/object-store.org rename to literate/memory.org index 2770b48..4fe46e5 100644 --- a/literate/object-store.org +++ b/literate/memory.org @@ -1,22 +1,24 @@ -#+TITLE: The Object Store (object-store.lisp) +#+TITLE: The System Memory (memory.lisp) #+AUTHOR: Amr #+FILETAGS: :harness:memory: #+STARTUP: content -* The Object Store (object-store.lisp) -** Architectural Intent: The Single Address Space +* The System Memory (memory.lisp) +** Architectural Intent: The Single Address Space (Live Memory) -Traditional architectures rely on external databases (SQLite, Vector DBs) which introduce I/O latency and structural impedance. The org-agent architecture chooses a different path: the Single Address Space. +Yes, the Memory module is the cognitive bedrock of the PSF. It is not a database; it is the agent's live, active "brain" state. + +Traditional architectures rely on external databases (SQLite, Vector DBs) which introduce I/O latency and structural impedance. The org-agent architecture chooses a different path: the **Single Address Space**. By treating the entire knowledge base as a graph of Lisp pointers, we achieve microsecond recollection and total structural transparency. - **Pointer-Based Reasoning:** By loading the entire knowledge graph into a live Common Lisp hash table, we achieve microsecond recollection. The harness doesn't "search a file"; it traverses a memory pointer. - **Memory Imaging:** The ability to snapshot the Lisp image allows the agent to resume its entire cognitive state instantly, solving the "Cold Start" problem. -- **Merkle-Tree Integrity:** Every node in the Object Store is cryptographically hashed. By recursively hashing content and children, the root hash provides a single, immutable fingerprint of the entire system state. +- **Merkle-Tree Integrity:** Every node in the Memory is cryptographically hashed. By recursively hashing content and children, the root hash provides a single, immutable fingerprint of the entire system state. ** System Architecture #+begin_src mermaid flowchart TD subgraph LispMachine[Lisp Machine] - H[Harness Pipeline] --> OS[(Object Store)] + H[Harness Pipeline] --> OS[(Memory)] S1[Skill: Architect] --> OS S2[Skill: Analyst] --> OS S3[Skill: GTD] --> OS @@ -29,15 +31,15 @@ flowchart TD #+end_src ** Package Context -#+begin_src lisp :tangle ../src/object-store.lisp +#+begin_src lisp :tangle ../src/memory.lisp (in-package :org-agent) #+end_src ** The Object Repository -The `*object-store*` is the global hash table that holds every Org element by its unique ID. This is the "live RAM" of the agent's memory. +The `*memory*` is the global hash table that holds every Org element by its unique ID. This is the "live RAM" of the agent's memory. -#+begin_src lisp :tangle ../src/object-store.lisp -(defvar *object-store* (make-hash-table :test 'equal)) +#+begin_src lisp :tangle ../src/memory.lisp +(defvar *memory* (make-hash-table :test 'equal)) (defvar *history-store* (make-hash-table :test 'equal) "Immutable Merkle-Tree versioning store mapping hashes to objects.") @@ -46,7 +48,7 @@ The `*object-store*` is the global hash table that holds every Org element by it ** The Data Structure (org-object) Every element in the Memex (headlines, paragraphs, etc.) is represented by an `org-object` structure. It contains both semantic metadata (attributes, content) and structural metadata (parent/child pointers, Merkle hashes). -#+begin_src lisp :tangle ../src/object-store.lisp +#+begin_src lisp :tangle ../src/memory.lisp (defstruct org-object id type attributes content vector parent-id children version last-sync hash) #+end_src @@ -54,7 +56,7 @@ Every element in the Memex (headlines, paragraphs, etc.) is represented by an `o ** Merkle Tree Integrity (compute-merkle-hash) The `compute-merkle-hash` function ensures the cryptographic integrity of the knowledge graph. A node's hash depends on its own properties and the hashes of all its children. This creates a recursive fingerprint where any change to a single note propagates up to the root hash. -#+begin_src lisp :tangle ../src/object-store.lisp +#+begin_src lisp :tangle ../src/memory.lisp (defun compute-merkle-hash (id type attributes content child-hashes) "Computes a SHA-256 Merkle hash for a node based on its core properties and children's hashes." (let* ((alist (loop for (k v) on attributes by #'cddr collect (cons k v))) @@ -71,9 +73,9 @@ The `compute-merkle-hash` function ensures the cryptographic integrity of the kn ** Ingesting the AST (ingest-ast) The `ingest-ast` function is the primary bridge between the external world (Emacs/JSON) and the internal Lisp machine. It recursively parses an Org-mode Abstract Syntax Tree (AST) into `org-object` structures and registers them in the store. -#+begin_src lisp :tangle ../src/object-store.lisp +#+begin_src lisp :tangle ../src/memory.lisp (defun ingest-ast (ast &optional parent-id) - "Parses an Org AST into the recursive Lisp Object Store with Merkle hashing." + "Parses an Org AST into the recursive Lisp Memory with Merkle hashing." (let* ((type (getf ast :type)) (props (getf ast :properties)) (id (or (getf props :ID) (format nil "temp-~a" (get-universal-time)))) @@ -103,14 +105,14 @@ The `ingest-ast` function is the primary bridge between the external world (Emac :hash hash)))) (unless existing-obj (setf (gethash hash *history-store*) obj)) - (setf (gethash id *object-store*) obj) + (setf (gethash id *memory*) obj) id))) #+end_src -** Memory Snapshots (snapshot-object-store) -Because objects are stored immutably in the `*history-store*`, a snapshot is a lightweight shallow copy of the active `*object-store*` pointers. The system maintains a rolling buffer of 20 snapshots, allowing for near-instant, zero-cost rollback. +** Memory Snapshots (snapshot-memory) +Because objects are stored immutably in the `*history-store*`, a snapshot is a lightweight shallow copy of the active `*memory*` pointers. The system maintains a rolling buffer of 20 snapshots, allowing for near-instant, zero-cost rollback. -#+begin_src lisp :tangle ../src/object-store.lisp +#+begin_src lisp :tangle ../src/memory.lisp (defvar *object-store-snapshots* nil) (defun copy-hash-table (hash-table) @@ -120,47 +122,47 @@ Because objects are stored immutably in the `*history-store*`, a snapshot is a l (maphash (lambda (k v) (setf (gethash k new-table) v)) hash-table) new-table)) -(defun snapshot-object-store () +(defun snapshot-memory () "Creates a lightweight, Copy-on-Write snapshot using Merkle-Tree pointers." - (let ((snapshot (copy-hash-table *object-store*))) + (let ((snapshot (copy-hash-table *memory*))) (push (list :timestamp (get-universal-time) :data snapshot) *object-store-snapshots*) (when (> (length *object-store-snapshots*) 20) (setf *object-store-snapshots* (subseq *object-store-snapshots* 0 20))) - (harness-log "MEMORY - CoW Object Store snapshot created."))) + (harness-log "MEMORY - CoW Memory snapshot created."))) #+end_src -** Memory Rollback (rollback-object-store) +** Memory Rollback (rollback-memory) Restores the state of the Memex from one of the previous snapshots. -#+begin_src lisp :tangle ../src/object-store.lisp -(defun rollback-object-store (&optional (index 0)) - "Restores the Object Store to a previously captured snapshot using immutable history pointers." +#+begin_src lisp :tangle ../src/memory.lisp +(defun rollback-memory (&optional (index 0)) + "Restores the Memory to a previously captured snapshot using immutable history pointers." (let ((snapshot (nth index *object-store-snapshots*))) (if snapshot - (progn (setf *object-store* (copy-hash-table (getf snapshot :data))) - (harness-log "MEMORY - Object Store rolled back to snapshot ~a" index)) + (progn (setf *memory* (copy-hash-table (getf snapshot :data))) + (harness-log "MEMORY - Memory rolled back to snapshot ~a" index)) (harness-log "MEMORY ERROR - Snapshot ~a not found." index)))) #+end_src ** Lookup Utilities Basic functions for retrieving objects by ID or type. -#+begin_src lisp :tangle ../src/object-store.lisp +#+begin_src lisp :tangle ../src/memory.lisp (defun lookup-object (id) "Retrieves an object from the store by its unique ID." - (gethash id *object-store*)) + (gethash id *memory*)) (defun list-objects-by-type (type) "Returns a list of all objects matching a specific Org element type." (let ((results nil)) - (maphash (lambda (id obj) (declare (ignore id)) (when (eq (org-object-type obj) type) (push obj results))) *object-store*) + (maphash (lambda (id obj) (declare (ignore id)) (when (eq (org-object-type obj) type) (push obj results))) *memory*) results)) #+end_src ** Structural Helpers Utility functions for AST traversal and path resolution. -#+begin_src lisp :tangle ../src/object-store.lisp +#+begin_src lisp :tangle ../src/memory.lisp (defun find-headline-missing-id (ast) "Traverses an AST to find headlines that lack an :ID: property." (when (listp ast) @@ -174,27 +176,27 @@ Utility functions for AST traversal and path resolution. #+end_src * Phase E: Chaos (Verification) -Following the Engineering Standards, the Object Store must be empirically verified through automated testing. The following test suite ensures the mathematical integrity of the Merkle hashes and the behavioral correctness of the immutable versioning and rollback systems. +Following the Engineering Standards, the Memory must be empirically verified through automated testing. The following test suite ensures the mathematical integrity of the Merkle hashes and the behavioral correctness of the immutable versioning and rollback systems. -#+begin_src lisp :tangle ../tests/object-store-tests.lisp -(defpackage :org-agent-object-store-tests +#+begin_src lisp :tangle ../tests/memory-tests.lisp +(defpackage :org-agent-memory-tests (:use :cl :fiveam :org-agent) - (:export #:object-store-suite)) + (:export #:memory-suite)) -(in-package :org-agent-object-store-tests) +(in-package :org-agent-memory-tests) -(def-suite object-store-suite - :description "Tests for the Merkle-Tree Object Store.") +(def-suite memory-suite + :description "Tests for the Merkle-Tree Memory.") -(in-suite object-store-suite) +(in-suite memory-suite) (test merkle-hash-consistency (let* ((ast1 '(:type :HEADLINE :properties (:ID "test-1" :TITLE "Node 1") :contents nil)) (ast2 '(:type :HEADLINE :properties (:ID "test-1" :TITLE "Node 1") :contents nil))) - (clrhash *object-store*) + (clrhash *memory*) (let ((id1 (ingest-ast ast1))) (let ((hash1 (org-object-hash (lookup-object id1)))) - (clrhash *object-store*) + (clrhash *memory*) (let ((id2 (ingest-ast ast2))) (let ((hash2 (org-object-hash (lookup-object id2)))) (is (equal hash1 hash2)))))))) @@ -203,19 +205,19 @@ Following the Engineering Standards, the Object Store must be empirically verifi (let* ((ast-leaf '(:type :HEADLINE :properties (:ID "leaf" :TITLE "Leaf") :contents nil)) (ast-root-full '(:type :HEADLINE :properties (:ID "root" :TITLE "Root") :contents ((:type :HEADLINE :properties (:ID "leaf" :TITLE "Leaf") :contents nil)))) - (id-root (progn (clrhash *object-store*) (ingest-ast ast-root-full))) + (id-root (progn (clrhash *memory*) (ingest-ast ast-root-full))) (initial-root-hash (org-object-hash (lookup-object id-root)))) ;; Now ingest a modified version (title change) (let* ((ast-root-modified '(:type :HEADLINE :properties (:ID "root" :TITLE "Root") :contents ((:type :HEADLINE :properties (:ID "leaf" :TITLE "Leaf Modified") :contents nil)))) - (id-root-mod (progn (clrhash *object-store*) (ingest-ast ast-root-modified))) + (id-root-mod (progn (clrhash *memory*) (ingest-ast ast-root-modified))) (modified-root-hash (org-object-hash (lookup-object id-root-mod)))) (is (not (equal initial-root-hash modified-root-hash)))))) (test history-store-immutability - "Verify that *history-store* retains old versions even after *object-store* updates." - (clrhash *object-store*) + "Verify that *history-store* retains old versions even after *memory* updates." + (clrhash *memory*) (clrhash *history-store*) (let* ((ast-v1 '(:type :HEADLINE :properties (:ID "test-node" :TITLE "Version 1") :contents nil)) (id-v1 (ingest-ast ast-v1)) @@ -242,7 +244,7 @@ Following the Engineering Standards, the Object Store must be empirically verifi (test cow-snapshot-and-rollback "Verify that lightweight snapshots can accurately restore previous pointer states." - (clrhash *object-store*) + (clrhash *memory*) (clrhash *history-store*) (setf *object-store-snapshots* nil) @@ -251,7 +253,7 @@ Following the Engineering Standards, the Object Store must be empirically verifi (hash-v1 (org-object-hash (lookup-object id-v1)))) ;; Take a snapshot at State A - (snapshot-object-store) + (snapshot-memory) (let* ((ast-v2 '(:type :HEADLINE :properties (:ID "cow-node" :TITLE "State B") :contents nil)) (id-v2 (ingest-ast ast-v2)) @@ -261,7 +263,7 @@ Following the Engineering Standards, the Object Store must be empirically verifi (is (equal (org-object-hash (lookup-object "cow-node")) hash-v2)) ;; Rollback to State A (index 0 because we only took 1 snapshot) - (rollback-object-store 0) + (rollback-memory 0) ;; Verify we are back in State A (is (equal (org-object-hash (lookup-object "cow-node")) hash-v1)) diff --git a/literate/package.org b/literate/package.org index 6622974..7e87066 100644 --- a/literate/package.org +++ b/literate/package.org @@ -7,7 +7,7 @@ The ~package.lisp~ file defines the public API of the ~org-agent~ harness. It serves as the primary membrane between the deterministic core modules and the dynamic world of skills and actuators. ** Architectural Intent: The Package Membrane -By strictly defining the public interface, we ensure that skills remain decoupled from the harness implementation details. This allows for sovereign replacement of any component (e.g., swapping the Object Store or the Probabilistic Engine) without breaking existing skills. +By strictly defining the public interface, we ensure that skills remain decoupled from the harness implementation details. This allows for sovereign replacement of any component (e.g., swapping the Memory or the Probabilistic Engine) without breaking existing skills. #+begin_src mermaid flowchart TD @@ -34,11 +34,11 @@ flowchart TD #:harness-log #:main - ;; --- Object Store (CLOSOS) --- + ;; --- Memory (CLOSOS) --- #:ingest-ast #:lookup-object #:list-objects-by-type - #:*object-store* + #:*memory* #:*history-store* #:org-object #:org-object-id @@ -51,8 +51,8 @@ flowchart TD #:org-object-vector #:org-object-content #:org-object-hash - #:snapshot-object-store - #:rollback-object-store + #:snapshot-memory + #:rollback-memory ;; --- Context API (Peripheral Vision) --- #:context-query-store diff --git a/literate/perceive.org b/literate/perceive.org index 3ed12fd..9262ce4 100644 --- a/literate/perceive.org +++ b/literate/perceive.org @@ -5,7 +5,7 @@ * Stage 1: Perceive (perceive.lisp) ** Architectural Intent: Sensory Ingestion -The Perceive stage is responsible for data normalization and sensory intake. It takes raw stimuli (from TCP sockets, Signal, or Heartbeats) and updates the global Object Store graph. +The Perceive stage is responsible for data normalization and sensory intake. It takes raw stimuli (from TCP sockets, Signal, or Heartbeats) and updates the global Memory graph. #+begin_src lisp :tangle ../src/perceive.lisp (in-package :org-agent) @@ -34,7 +34,7 @@ The Perceive stage is responsible for data normalization and sensory intake. It (type (getf signal :type)) (sensor (getf payload :sensor))) (harness-log "GATE [Perceive]: ~a (~a)" type (or sensor "no-sensor")) - (snapshot-object-store) + (snapshot-memory) (cond ((eq type :EVENT) (case sensor (:buffer-update (let ((ast (getf payload :ast))) (when ast (ingest-ast ast)))) diff --git a/literate/system-definition.org b/literate/system-definition.org index 51f409d..fc7486f 100644 --- a/literate/system-definition.org +++ b/literate/system-definition.org @@ -44,7 +44,7 @@ This system defines the core "Thin Harness." It includes the protocol, the objec (:file "src/engineering-standards") (:file "src/communication-validator") (:file "src/communication") - (:file "src/object-store") + (:file "src/memory") (:file "src/embedding") (:file "src/embedding-logic") (:file "src/context") @@ -79,7 +79,7 @@ This system contains the empirical tests required by the Engineering Standards. (:file "tests/peripheral-vision-tests") (:file "tests/lisp-validator-tests") (:file "tests/boot-sequence-tests") - (:file "tests/object-store-tests") + (:file "tests/memory-tests") (:file "tests/immune-system-tests") (:file "tests/task-orchestrator-tests") (:file "tests/self-fix-tests") @@ -98,7 +98,7 @@ This system contains the empirical tests required by the Engineering Standards. (uiop:symbol-call :fiveam :run! (uiop:find-symbol* :vision-suite :org-agent-peripheral-vision-tests)) (uiop:symbol-call :fiveam :run! (uiop:find-symbol* :safety-suite :org-agent-safety-tests)) (uiop:symbol-call :fiveam :run! (uiop:find-symbol* :boot-suite :org-agent-boot-tests)) - (uiop:symbol-call :fiveam :run! (uiop:find-symbol* :object-store-suite :org-agent-object-store-tests)) + (uiop:symbol-call :fiveam :run! (uiop:find-symbol* :memory-suite :org-agent-memory-tests)) (uiop:symbol-call :fiveam :run! (uiop:find-symbol* :immune-suite :org-agent-immune-system-tests)) (uiop:symbol-call :fiveam :run! (uiop:find-symbol* :task-orchestrator-suite :org-agent-task-orchestrator-tests)) (uiop:symbol-call :fiveam :run! (uiop:find-symbol* :self-fix-suite :org-agent-self-fix-tests)) diff --git a/org-agent.asd b/org-agent.asd index f70e8b8..8c50bc5 100644 --- a/org-agent.asd +++ b/org-agent.asd @@ -12,7 +12,7 @@ (:file "src/engineering-standards") (:file "src/communication-validator") (:file "src/communication") - (:file "src/object-store") + (:file "src/memory") (:file "src/embedding") (:file "src/embedding-logic") (:file "src/context") @@ -42,7 +42,7 @@ (:file "tests/peripheral-vision-tests") (:file "tests/lisp-validator-tests") (:file "tests/boot-sequence-tests") - (:file "tests/object-store-tests") + (:file "tests/memory-tests") (:file "tests/immune-system-tests") (:file "tests/task-orchestrator-tests") (:file "tests/self-fix-tests") @@ -61,7 +61,7 @@ (uiop:symbol-call :fiveam :run! (uiop:find-symbol* :vision-suite :org-agent-peripheral-vision-tests)) (uiop:symbol-call :fiveam :run! (uiop:find-symbol* :safety-suite :org-agent-safety-tests)) (uiop:symbol-call :fiveam :run! (uiop:find-symbol* :boot-suite :org-agent-boot-tests)) - (uiop:symbol-call :fiveam :run! (uiop:find-symbol* :object-store-suite :org-agent-object-store-tests)) + (uiop:symbol-call :fiveam :run! (uiop:find-symbol* :memory-suite :org-agent-memory-tests)) (uiop:symbol-call :fiveam :run! (uiop:find-symbol* :immune-suite :org-agent-immune-system-tests)) (uiop:symbol-call :fiveam :run! (uiop:find-symbol* :task-orchestrator-suite :org-agent-task-orchestrator-tests)) (uiop:symbol-call :fiveam :run! (uiop:find-symbol* :self-fix-suite :org-agent-self-fix-tests)) diff --git a/skills/org-skill-chat.org b/skills/org-skill-chat.org index 7a2bf6d..6661693 100644 --- a/skills/org-skill-chat.org +++ b/skills/org-skill-chat.org @@ -53,7 +53,7 @@ Interfaces for conversational event handling and UI integration. Source of truth (in-package :org-agent) (defun chat-archive-message (text &key (role :user) channel chat-id) - "Archives a chat message into the persistent Object Store and triggers a snapshot." + "Archives a chat message into the persistent Memory and triggers a snapshot." (let* ((msg-id (org-id-new)) (obj (make-org-object :id msg-id @@ -61,9 +61,9 @@ Interfaces for conversational event handling and UI integration. Source of truth :attributes `(:role ,role :channel ,channel :chat-id ,chat-id :timestamp ,(get-universal-time)) :content text :version (get-universal-time)))) - (setf (gethash msg-id *object-store*) obj) + (setf (gethash msg-id *memory*) obj) (harness-log "CHAT - Message archived: ~a (~a)" msg-id role) - (snapshot-object-store) + (snapshot-memory) msg-id)) (defun trigger-skill-chat (context) diff --git a/skills/org-skill-credentials-vault.org b/skills/org-skill-credentials-vault.org index 4596257..852f31a 100644 --- a/skills/org-skill-credentials-vault.org +++ b/skills/org-skill-credentials-vault.org @@ -22,7 +22,7 @@ Securely manage all authentication tokens required for the PSF to operate. - *Unified Storage:* Single interface for API keys and Session Cookies. - *Masked Logging:* Ensure credentials never appear in plaintext in `harness-log`. - *Guided Onboarding:* Retain and improve the Google/Gemini cookie handshake. -- *Persistence:* Securely save credentials to the Object Store via Merkle-Tree snapshots. +- *Persistence:* Securely save credentials to the Memory via Merkle-Tree snapshots. * Phase B: Blueprint (PROTOCOL) :PROPERTIES: @@ -30,7 +30,7 @@ Securely manage all authentication tokens required for the PSF to operate. :END: ** 1. Architectural Intent -The vault provides a secure lookup table in RAM, backed by the persistent Object Store. Access is restricted to internal kernel requests and explicitly authorized deterministic gates. +The vault provides a secure lookup table in RAM, backed by the persistent Memory. Access is restricted to internal kernel requests and explicitly authorized deterministic gates. ** 2. Semantic Interfaces #+begin_src lisp @@ -48,7 +48,7 @@ The vault provides a secure lookup table in RAM, backed by the persistent Object ** 1. Success Criteria - [ ] *No Plaintext Leaks:* Log output must use `[REDACTED]` for sensitive values. -- [ ] *Merkle Integration:* Setting a secret must increment the Object Store version. +- [ ] *Merkle Integration:* Setting a secret must increment the Memory version. - [ ] *Dual-Path Auth:* Support both `:api-key` and `:session-cookies`. - [ ] *Onboarding Verification:* The cookie handshake successfully hydrates the vault. @@ -56,7 +56,7 @@ The vault provides a secure lookup table in RAM, backed by the persistent Object Tests in `tests/vault-tests.lisp` will verify: 1. Retrieval of keys from both `.env` (fallback) and Vault (primary). 2. Redaction of keys in log strings. -3. Successful version increment in the Object Store after `vault-set-secret`. +3. Successful version increment in the Memory after `vault-set-secret`. * Phase D: Build (Implementation) @@ -66,7 +66,7 @@ Tests in `tests/vault-tests.lisp` will verify: #+end_src ** Vault State -We maintain an in-memory hash table for secrets, which is hydrated from and persisted to the Object Store. +We maintain an in-memory hash table for secrets, which is hydrated from and persisted to the Memory. #+begin_src lisp :tangle ../src/credentials-vault.lisp (defvar *vault-memory* (make-hash-table :test 'equal) @@ -85,7 +85,7 @@ The `vault-mask-string` function ensures that diagnostic output never contains t #+end_src ** Retrieval (vault-get-secret) -This function is the secure getter for all system secrets. It prioritizes the Vault (Object Store) and falls back to environment variables for legacy compatibility. +This function is the secure getter for all system secrets. It prioritizes the Vault (Memory) and falls back to environment variables for legacy compatibility. #+begin_src lisp :tangle ../src/credentials-vault.lisp (defun vault-get-secret (provider &key (type :api-key)) @@ -111,7 +111,7 @@ This function is the secure getter for all system secrets. It prioritizes the Va #+end_src ** Persistence (vault-set-secret) -When a secret is updated, we immediately snapshot the Object Store to ensure the credential change is versioned and durable. +When a secret is updated, we immediately snapshot the Memory to ensure the credential change is versioned and durable. #+begin_src lisp :tangle ../src/credentials-vault.lisp (defun vault-set-secret (provider secret &key (type :api-key)) @@ -119,7 +119,7 @@ When a secret is updated, we immediately snapshot the Object Store to ensure the (let ((key (format nil "~a-~a" provider type))) (setf (gethash key *vault-memory*) secret) (harness-log "VAULT - Updated ~a for ~a. Triggering Merkle snapshot..." type provider) - (snapshot-object-store) + (snapshot-memory) t)) #+end_src @@ -166,14 +166,14 @@ Retained from the legacy Google skill, this provides the instructions for the so (test test-vault-persistence "Verify that setting a secret triggers a snapshot (mock check)." - (let ((old-version (org-agent::org-object-version (gethash "root" *object-store*)))) + (let ((old-version (org-agent::org-object-version (gethash "root" *memory*)))) (org-agent:vault-set-secret :test "secret-val") - (is (> (org-agent::org-object-version (gethash "root" *object-store*)) old-version)))) + (is (> (org-agent::org-object-version (gethash "root" *memory*)) old-version)))) #+end_src ** 2. Chaos Scenarios - *Scenario A (Vault Poisoning):* Inject a malformed session string and verify the `llm-gateway` detects the invalid format and returns a standardized error instead of crashing. -- *Scenario B (Memory Wipe):* Clear `*vault-memory*` during runtime and verify the vault successfully re-hydrates from the Object Store (or environment fallback). +- *Scenario B (Memory Wipe):* Clear `*vault-memory*` during runtime and verify the vault successfully re-hydrates from the Memory (or environment fallback). * Phase F: Memory (RCA) - *[2026-04-09 Thu]:* Consolidated `auth-api-key` and `auth-google-oauth` into this vault. Introduced mandatory masking for all credential-related logging. diff --git a/skills/org-skill-embedding.org b/skills/org-skill-embedding.org index 010d6ee..804423a 100644 --- a/skills/org-skill-embedding.org +++ b/skills/org-skill-embedding.org @@ -19,7 +19,7 @@ Provide a standardized interface for converting text into vector representations ** 2. User Needs - *Text Vectorization:* Convert Org-mode content into high-dimensional vectors. -- *Similarity Search:* Find semantically related nodes in the Object Store. +- *Similarity Search:* Find semantically related nodes in the Memory. - *Provider Agnosticism:* Support multiple embedding models (Gemini, OpenAI, etc.). ** 3. Success Criteria @@ -98,7 +98,7 @@ Move heavy neural and mathematical logic out of `core.lisp` and `probabilistic.l (let ((vec (org-object-vector obj))) (when vec (push (cons (cosine-similarity query-vector vec) obj) similarities)))) - *object-store*) + *memory*) (let ((sorted (sort similarities #'> :key #'car))) (subseq sorted 0 (min top-k (length sorted)))))) #+end_src diff --git a/skills/org-skill-environment-config.org b/skills/org-skill-environment-config.org index 62cb3c8..8008c86 100644 --- a/skills/org-skill-environment-config.org +++ b/skills/org-skill-environment-config.org @@ -8,7 +8,7 @@ #+FILETAGS: :system:config:sovereignty:psf: * Overview -The *Environment Configuration Manager* is the source of truth for user preferences. It persists settings (like LLM Model Fleets) into the harness's Object Store, allowing for dynamic runtime reconfiguration without environment variable bloat. +The *Environment Configuration Manager* is the source of truth for user preferences. It persists settings (like LLM Model Fleets) into the harness's Memory, allowing for dynamic runtime reconfiguration without environment variable bloat. * Phase A: Demand (PRD) :PROPERTIES: @@ -20,7 +20,7 @@ Provide a programmatic and literate interface for managing system-wide settings. ** 2. User Needs - *Fleet Management:* Define preferred models for each LLM provider. -- *Persistence:* Ensure settings survive kernel restarts via the Object Store. +- *Persistence:* Ensure settings survive kernel restarts via the Memory. - *Transparency:* Allow the user to audit current settings via the REPL or Org tables. * Phase B: Blueprint (PROTOCOL) @@ -29,7 +29,7 @@ Provide a programmatic and literate interface for managing system-wide settings. :END: ** 1. Architectural Intent -Define a standardized `CONFIG` object type in the Object Store. Provide getter/setter functions for the "LLM Fleet." +Define a standardized `CONFIG` object type in the Memory. Provide getter/setter functions for the "LLM Fleet." ** 2. Semantic Interfaces @@ -38,7 +38,7 @@ Define a standardized `CONFIG` object type in the Object Store. Provide getter/s (in-package :org-agent) (defun set-llm-model (provider model-id) - "Registers a preferred model for a provider in the Object Store." + "Registers a preferred model for a provider in the Memory." (let ((config-id (format nil "config-llm-~a" (string-downcase (string provider))))) (let ((obj (make-org-object :id config-id @@ -46,14 +46,14 @@ Define a standardized `CONFIG` object type in the Object Store. Provide getter/s :attributes `(:provider ,provider :model-id ,model-id) :content (format nil "Fleet preference for ~a set to ~a" provider model-id) :version (get-universal-time)))) - (setf (gethash config-id *object-store*) obj) + (setf (gethash config-id *memory*) obj) (harness-log "CONFIG - Fleet updated: ~a -> ~a" provider model-id) t))) (defun get-llm-model (provider &optional default) - "Retrieves the preferred model for a provider from the Object Store." + "Retrieves the preferred model for a provider from the Memory." (let* ((config-id (format nil "config-llm-~a" (string-downcase (string provider)))) - (obj (gethash config-id *object-store*))) + (obj (gethash config-id *memory*))) (if obj (getf (org-object-attributes obj) :model-id) default))) diff --git a/skills/org-skill-event-orchestrator.org b/skills/org-skill-event-orchestrator.org index 75c9f4d..6dc8a00 100644 --- a/skills/org-skill-event-orchestrator.org +++ b/skills/org-skill-event-orchestrator.org @@ -27,7 +27,7 @@ Provide a unified, high-integrity interface for background automation and stimul - *Predictable Scheduling:* Precise execution of tasks based on cron-strings or intervals. - *Reactive Extensions:* Ability to "hook" into system events (save, boot, ingest). - *Intelligent Dispatch:* Automated complexity tiering to prevent wasted compute. -- *Durable Registry:* All registered hooks and cron-jobs must be persisted to the Object Store. +- *Durable Registry:* All registered hooks and cron-jobs must be persisted to the Memory. * Phase B: Blueprint (PROTOCOL) :PROPERTIES: @@ -57,7 +57,7 @@ The orchestrator maintains three internal registries (Hooks, Cron, Routing Rules ** 1. Success Criteria - [ ] *Hook Latency:* Triggering a hook with 10 functions must complete in <1ms. - [ ] *Cron Precision:* Scheduled tasks must fire within 1s of their target window. -- [ ] *Merkle Persistence:* Adding a hook or cron-job must increment the Object Store version. +- [ ] *Merkle Persistence:* Adding a hook or cron-job must increment the Memory version. - [ ] *Classification Accuracy:* Routine system events must always be classified as `:REFLEX`. ** 2. TDD Plan @@ -89,7 +89,7 @@ Allows external skills to register logic at system lifecycle points. "Registers a function for a named hook. Triggers a Merkle snapshot." (pushnew fn (gethash hook-name *hook-registry*)) (harness-log "ORCHESTRATOR - Registered hook function for ~a" hook-name) - (snapshot-object-store) + (snapshot-memory) t) #+end_src @@ -113,7 +113,7 @@ Registers a recurring task to be executed during heartbeats. "Schedules a task for execution. Schedule can be an interval (integer seconds) or 'heartbeat'." (setf (gethash task-id *cron-registry*) (list :schedule schedule :fn fn :last-run 0)) (harness-log "ORCHESTRATOR - Scheduled task ~a (~a)" task-id schedule) - (snapshot-object-store) + (snapshot-memory) t) #+end_src diff --git a/skills/org-skill-homoiconic-memory.org b/skills/org-skill-homoiconic-memory.org index 6378d76..30d1b97 100644 --- a/skills/org-skill-homoiconic-memory.org +++ b/skills/org-skill-homoiconic-memory.org @@ -30,7 +30,7 @@ Unify the structural rules and programmatic manipulation of the Org-mode AST. :END: ** 1. Architectural Intent -The memory suite uses a "Functional Core" for AST manipulation. Every transformation (normalization, refactoring) returns a new AST version, which is then persisted to the Object Store. +The memory suite uses a "Functional Core" for AST manipulation. Every transformation (normalization, refactoring) returns a new AST version, which is then persisted to the Memory. ** 2. Semantic Interfaces #+begin_src lisp @@ -52,7 +52,7 @@ The memory suite uses a "Functional Core" for AST manipulation. Every transforma ** 1. Success Criteria - [ ] *Round-trip Fidelity:* Org -> JSON -> Org must result in identical text (modulo normalization). - [ ] *ID Uniqueness:* No two headlines may share an ID after normalization. -- [ ] *Merkle Integration:* AST modifications must trigger Object Store snapshots. +- [ ] *Merkle Integration:* AST modifications must trigger Memory snapshots. ** 2. TDD Plan Tests in `tests/memory-suite-tests.lisp` will verify the round-trip conversion and the recursive ID injection logic. diff --git a/skills/org-skill-lisp-validator.org b/skills/org-skill-lisp-validator.org index 341a228..7466175 100644 --- a/skills/org-skill-lisp-validator.org +++ b/skills/org-skill-lisp-validator.org @@ -54,8 +54,8 @@ Define a high-integrity, recursive security sandbox for Lisp execution. format concatenate string-downcase string-upcase search ;; Kernel specifics org-agent::harness-log - org-agent::snapshot-object-store - org-agent::rollback-object-store + org-agent::snapshot-memory + org-agent::rollback-memory org-agent::lookup-object org-agent::list-objects-by-type org-agent::ingest-ast diff --git a/skills/org-skill-peripheral-vision.org b/skills/org-skill-peripheral-vision.org index 571e26a..180f592 100644 --- a/skills/org-skill-peripheral-vision.org +++ b/skills/org-skill-peripheral-vision.org @@ -7,7 +7,7 @@ #+FILETAGS: :context:foveal:peripheral:pruning:psf: * Overview -The *Peripheral Vision* skill implements the Foveal-Peripheral Hybrid model for context pruning. It ensures that the LLM receives a semantically relevant and manageable view of the Object Store, preventing context window overflow. +The *Peripheral Vision* skill implements the Foveal-Peripheral Hybrid model for context pruning. It ensures that the LLM receives a semantically relevant and manageable view of the Memory, preventing context window overflow. * Phase A: Demand (PRD) :PROPERTIES: @@ -95,7 +95,7 @@ Move context pruning and rendering logic out of `context.lisp` to allow for more output)) (defun context-assemble-global-awareness (&optional signal) - "Produces a high-level skeletal outline of the current Object Store for the LLM." + "Produces a high-level skeletal outline of the current Memory for the LLM." (let* ((payload (when signal (getf signal :payload))) (foveal-id (when payload (getf payload :target-id))) (foveal-vector (when foveal-id (org-object-vector (lookup-object foveal-id)))) diff --git a/skills/org-skill-self-fix.org b/skills/org-skill-self-fix.org index 2354ebd..d9066e6 100644 --- a/skills/org-skill-self-fix.org +++ b/skills/org-skill-self-fix.org @@ -10,7 +10,7 @@ #+DEPENDS_ON: id:98576df2-c496-4e4a-9acb-0bca514a0305 * Overview -The *Self-Fix Agent* is the system's "Repair Mechanism." It takes failure hypotheses, applies surgical code modifications, and verifies them using the Object Store's rollback capabilities. +The *Self-Fix Agent* is the system's "Repair Mechanism." It takes failure hypotheses, applies surgical code modifications, and verifies them using the Memory's rollback capabilities. * Phase D: Build (Implementation) @@ -28,7 +28,7 @@ The *Self-Fix Agent* is the system's "Repair Mechanism." It takes failure hypoth (is-skill (and (stringp (namestring target-file)) (search "skills/" (namestring target-file))))) - (org-agent:snapshot-object-store) + (org-agent:snapshot-memory) (org-agent:harness-log "SELF-FIX - Attempting surgical fix on ~a..." target-file) (handler-case @@ -50,7 +50,7 @@ The *Self-Fix Agent* is the system's "Repair Mechanism." It takes failure hypoth (org-agent:harness-log "SELF-FIX FAILURE - Skill reload failed. Rolling back.") (with-open-file (out target-file :direction :output :if-exists :supersede) (write-string content out)) - (org-agent:rollback-object-store 0) + (org-agent:rollback-memory 0) nil))) (progn (org-agent:harness-log "SELF-FIX SUCCESS - Applied fix to file.") @@ -59,7 +59,7 @@ The *Self-Fix Agent* is the system's "Repair Mechanism." It takes failure hypoth (progn (org-agent:harness-log "SELF-FIX FAILURE - File not found.") nil)) (error (c) (org-agent:harness-log "SELF-FIX CRASH - ~a. Rolling back." c) - (org-agent:rollback-object-store 0) + (org-agent:rollback-memory 0) nil)))) #+end_src diff --git a/skills/org-skill-state-persistence.org b/skills/org-skill-state-persistence.org index 95ed7bf..f536f61 100644 --- a/skills/org-skill-state-persistence.org +++ b/skills/org-skill-state-persistence.org @@ -12,7 +12,7 @@ The *State Persistence Layer* ensures the durability and sovereignty of the agen ** Deep Reasoning: Protection Against External Tampering While the *Prover* and *Bouncer* protect against internal skill failures, the Merkle-Tree architecture within the State Layer protects against **External Threats** (e.g., a hacker or virus modifying your `.org` files directly on disk). -1. **Skill Hashing:** Every code block and headline in a skill file has a unique Merkle hash recorded in the Object Store. +1. **Skill Hashing:** Every code block and headline in a skill file has a unique Merkle hash recorded in the Memory. 2. **Integrity Verification:** Upon loading or reloading a skill, the harness re-calculates the hash and compares it against the "known good" state in the Merkle Tree. 3. **Automatic Lockdown:** If a file has been tampered with externally, the hash mismatch triggers an immediate lockdown. the harness refuses to execute the skill and alerts the Sovereign via Signal/Telegram. @@ -25,7 +25,7 @@ While the *Prover* and *Bouncer* protect against internal skill failures, the Me Define automated behaviors for knowledge graph serialization, local persistence, and decentralized archival. ** 2. User Needs -- *Instant Recall:* Rapid local loading of the Object Store from a persistent image. +- *Instant Recall:* Rapid local loading of the Memory from a persistent image. - *Decentralized Archival:* Pushing immutable snapshots to IPFS for cross-node sync and sovereignty. - *Merkle Integrity:* Every save operation must respect and record the Merkle-Tree history. - *Safety:* Sanitize and validate data during restoration to prevent code injection. @@ -36,7 +36,7 @@ Define automated behaviors for knowledge graph serialization, local persistence, :END: ** 1. Architectural Intent -The persistence layer acts as a bridge between the volatile RAM-resident Object Store and permanent storage backends. It provides two adapters: `LOCAL` (fast, SBCL-native) and `IPFS` (sovereign, content-addressed). +The persistence layer acts as a bridge between the volatile RAM-resident Memory and permanent storage backends. It provides two adapters: `LOCAL` (fast, SBCL-native) and `IPFS` (sovereign, content-addressed). ** 2. Semantic Interfaces #+begin_src lisp @@ -57,7 +57,7 @@ The persistence layer acts as a bridge between the volatile RAM-resident Object ** 1. Success Criteria - [ ] *Speed:* Local image load must be <500ms for a 10k node graph. -- [ ] *Fidelity:* IPFS round-trip must result in a bit-identical Object Store. +- [ ] *Fidelity:* IPFS round-trip must result in a bit-identical Memory. - [ ] *Validation:* Restoration must block any `read-eval` reader macros in content. ** 2. TDD Plan @@ -97,8 +97,8 @@ Serializes the Merkle history and current pointers to a Lisp file. *history-store*) ;; 2. Dump the current active pointers (maphash (lambda (id obj) - (print `(setf (gethash ,id *object-store*) (gethash ,(org-object-hash obj) *history-store*)) out)) - *object-store*)) + (print `(setf (gethash ,id *memory*) (gethash ,(org-object-hash obj) *history-store*)) out)) + *memory*)) t)) #+end_src @@ -120,7 +120,7 @@ Restores the state from the local disk. #+end_src ** IPFS Serialization (persistence-serialize-for-archival) -Converts the live `*object-store*` into a JSON-compatible list of alists. +Converts the live `*memory*` into a JSON-compatible list of alists. #+begin_src lisp :tangle ../src/state-persistence.lisp (defun persistence-serialize-for-archival () @@ -139,7 +139,7 @@ Converts the live `*object-store*` into a JSON-compatible list of alists. (:last-sync . ,(org-object-last-sync obj)) (:hash . ,(org-object-hash obj))) objects)) - *object-store*) + *memory*) objects)) #+end_src @@ -175,7 +175,7 @@ Restores the graph from IPFS, using a safe parser to prevent injection. (handler-case (let* ((response (dex:post ipfs-url)) (data (cl-json:decode-json-from-string response))) - (clrhash *object-store*) + (clrhash *memory*) (dolist (item data) (let* ((id (cdr (assoc :id item))) (obj (make-org-object @@ -189,7 +189,7 @@ Restores the graph from IPFS, using a safe parser to prevent injection. :version (cdr (assoc :version item)) :last-sync (cdr (assoc :last-sync item)) :hash (cdr (assoc :hash item))))) - (setf (gethash id *object-store*) obj))) + (setf (gethash id *memory*) obj))) (harness-log "PERSISTENCE - Restored from IPFS: ~a" cid) t) (error (c) @@ -246,11 +246,11 @@ Expose persistence capabilities to the neural Probabilistic Engine. (test test-local-roundtrip "Ensure RAM -> Disk -> RAM preserves data integrity." (let ((test-id "persist-test-1")) - (setf (gethash test-id *object-store*) (make-org-object :id test-id :content "Integrity Check")) + (setf (gethash test-id *memory*) (make-org-object :id test-id :content "Integrity Check")) (org-agent:persistence-dump-local) - (clrhash *object-store*) + (clrhash *memory*) (org-agent:persistence-load-local) - (is (equal "Integrity Check" (org-object-content (gethash test-id *object-store*)))))) + (is (equal "Integrity Check" (org-object-content (gethash test-id *memory*)))))) #+end_src ** 2. Chaos Scenarios diff --git a/src/chaos-logic.lisp b/src/chaos-logic.lisp index 7abe709..e3c7f9a 100644 --- a/src/chaos-logic.lisp +++ b/src/chaos-logic.lisp @@ -19,7 +19,7 @@ (mode (or (getf payload :mode) :random)) (intensity (or (getf payload :intensity) 3))) (harness-log "CHAOS - Commencing stress test (Mode: ~a, Intensity: ~a)" mode intensity) - (snapshot-object-store) + (snapshot-memory) (case mode (:random (dotimes (i intensity) (let ((failure-type (nth (random 3) '(:test-failure :shell-timeout :llm-error)))) @@ -27,7 +27,7 @@ `(:type :EVENT :payload (:sensor :chaos-injection :type ,failure-type)))))) (:shell (inject-stimulus `(:type :EVENT :payload (:sensor :shell-response :cmd "git push" :exit-code 128 :stderr "fatal: network unreachable"))))) - (snapshot-object-store) + (snapshot-memory) (format nil "SUCCESS - Chaos stress test initiated."))) (defun chaos-enable () diff --git a/src/chat-logic.lisp b/src/chat-logic.lisp index e00852e..ac540c2 100644 --- a/src/chat-logic.lisp +++ b/src/chat-logic.lisp @@ -1,7 +1,7 @@ (in-package :org-agent) (defun chat-archive-message (text &key (role :user) channel chat-id) - "Archives a chat message into the persistent Object Store and triggers a snapshot." + "Archives a chat message into the persistent Memory and triggers a snapshot." (let* ((msg-id (org-id-new)) (obj (make-org-object :id msg-id @@ -9,9 +9,9 @@ :attributes `(:role ,role :channel ,channel :chat-id ,chat-id :timestamp ,(get-universal-time)) :content text :version (get-universal-time)))) - (setf (gethash msg-id *object-store*) obj) + (setf (gethash msg-id *memory*) obj) (harness-log "CHAT - Message archived: ~a (~a)" msg-id role) - (snapshot-object-store) + (snapshot-memory) msg-id)) (defun trigger-skill-chat (context) diff --git a/src/config-logic.lisp b/src/config-logic.lisp index 5477ef0..ed3f8dc 100644 --- a/src/config-logic.lisp +++ b/src/config-logic.lisp @@ -1,7 +1,7 @@ (in-package :org-agent) (defun set-llm-model (provider model-id) - "Registers a preferred model for a provider in the Object Store." + "Registers a preferred model for a provider in the Memory." (let ((config-id (format nil "config-llm-~a" (string-downcase (string provider))))) (let ((obj (make-org-object :id config-id @@ -9,14 +9,14 @@ :attributes `(:provider ,provider :model-id ,model-id) :content (format nil "Fleet preference for ~a set to ~a" provider model-id) :version (get-universal-time)))) - (setf (gethash config-id *object-store*) obj) + (setf (gethash config-id *memory*) obj) (harness-log "CONFIG - Fleet updated: ~a -> ~a" provider model-id) t))) (defun get-llm-model (provider &optional default) - "Retrieves the preferred model for a provider from the Object Store." + "Retrieves the preferred model for a provider from the Memory." (let* ((config-id (format nil "config-llm-~a" (string-downcase (string provider)))) - (obj (gethash config-id *object-store*))) + (obj (gethash config-id *memory*))) (if obj (getf (org-object-attributes obj) :model-id) default))) diff --git a/src/context-logic.lisp b/src/context-logic.lisp index 8d7026b..99d9a53 100644 --- a/src/context-logic.lisp +++ b/src/context-logic.lisp @@ -44,7 +44,7 @@ output)) (defun context-assemble-global-awareness (&optional signal) - "Produces a high-level skeletal outline of the current Object Store for the LLM." + "Produces a high-level skeletal outline of the current Memory for the LLM." (let* ((payload (when signal (getf signal :payload))) (foveal-id (when payload (getf payload :target-id))) (foveal-vector (when foveal-id (org-object-vector (lookup-object foveal-id)))) diff --git a/src/context.lisp b/src/context.lisp index 3c6d0ee..790fcdc 100644 --- a/src/context.lisp +++ b/src/context.lisp @@ -1,7 +1,7 @@ (in-package :org-agent) (defun context-query-store (&key tag todo-state type) - "Filters the Object Store based on tags, todo states, or types." + "Filters the Memory based on tags, todo states, or types." (let ((results nil)) (maphash (lambda (id obj) (declare (ignore id)) @@ -10,7 +10,7 @@ (when tag (unless (search tag (format nil "~a" (getf attrs :TAGS)) :test #'string-equal) (setf match nil))) (when (and todo-state (not (equal state todo-state))) (setf match nil)) (when match (push obj results)))) - *object-store*) + *memory*) results)) (defun context-get-active-projects () @@ -102,7 +102,7 @@ path-string)) (defun context-assemble-global-awareness (&optional signal) - "Produces a high-level skeletal outline of the current Object Store for the LLM." + "Produces a high-level skeletal outline of the current Memory for the LLM." (let* ((payload (when signal (getf signal :payload))) (foveal-id (when payload (getf payload :target-id))) (projects (context-get-active-projects)) diff --git a/src/credentials-vault.lisp b/src/credentials-vault.lisp index b0c120e..77db07a 100644 --- a/src/credentials-vault.lisp +++ b/src/credentials-vault.lisp @@ -35,7 +35,7 @@ (let ((key (format nil "~a-~a" provider type))) (setf (gethash key *vault-memory*) secret) (harness-log "VAULT - Updated ~a for ~a. Triggering Merkle snapshot..." type provider) - (snapshot-object-store) + (snapshot-memory) t)) (defun vault-onboard-gemini-web () diff --git a/src/deterministic.lisp b/src/deterministic.lisp index 654e4d5..c2b7589 100644 --- a/src/deterministic.lisp +++ b/src/deterministic.lisp @@ -27,11 +27,11 @@ current-action)) (defun list-objects-with-attribute (attr-key attr-val) - "Filters the Object Store for nodes having a specific attribute value." + "Filters the Memory for nodes having a specific attribute value." (let ((results nil)) (maphash (lambda (id obj) (declare (ignore id)) (when (equal (getf (org-object-attributes obj) attr-key) attr-val) (push obj results))) - *object-store*) + *memory*) results)) diff --git a/src/embedding-logic.lisp b/src/embedding-logic.lisp index b7bdcde..1c7fe48 100644 --- a/src/embedding-logic.lisp +++ b/src/embedding-logic.lisp @@ -44,7 +44,7 @@ (let ((vec (org-object-vector obj))) (when vec (push (cons (cosine-similarity query-vector vec) obj) similarities)))) - *object-store*) + *memory*) (let ((sorted (sort similarities #'> :key #'car))) (subseq sorted 0 (min top-k (length sorted)))))) diff --git a/src/embedding.lisp b/src/embedding.lisp index 4945b02..441b6f9 100644 --- a/src/embedding.lisp +++ b/src/embedding.lisp @@ -27,5 +27,5 @@ (defun find-most-similar (query-vector top-k) "Identifies the top-k most semantically related objects in the store." (let ((similarities nil)) - (maphash (lambda (id obj) (let ((vec (org-object-vector obj))) (when vec (push (cons (cosine-similarity query-vector vec) obj) similarities)))) *object-store*) + (maphash (lambda (id obj) (let ((vec (org-object-vector obj))) (when vec (push (cons (cosine-similarity query-vector vec) obj) similarities)))) *memory*) (let ((sorted (sort similarities #'> :key #'car))) (subseq sorted 0 (min top-k (length sorted)))))) diff --git a/src/event-orchestrator.lisp b/src/event-orchestrator.lisp index 2fffdfc..6912cfb 100644 --- a/src/event-orchestrator.lisp +++ b/src/event-orchestrator.lisp @@ -10,7 +10,7 @@ "Registers a function for a named hook. Triggers a Merkle snapshot." (pushnew fn (gethash hook-name *hook-registry*)) (harness-log "ORCHESTRATOR - Registered hook function for ~a" hook-name) - (snapshot-object-store) + (snapshot-memory) t) (defun orchestrator-trigger-hook (hook-name &rest args) @@ -24,7 +24,7 @@ "Schedules a task for execution. Schedule can be an interval (integer seconds) or 'heartbeat'." (setf (gethash task-id *cron-registry*) (list :schedule schedule :fn fn :last-run 0)) (harness-log "ORCHESTRATOR - Scheduled task ~a (~a)" task-id schedule) - (snapshot-object-store) + (snapshot-memory) t) (defun orchestrator-process-cron () diff --git a/src/latent-reflection.lisp b/src/latent-reflection.lisp index 1adfc66..7a1c938 100644 --- a/src/latent-reflection.lisp +++ b/src/latent-reflection.lisp @@ -7,12 +7,12 @@ "Returns COUNT random objects from the object-store." (let ((keys nil) (selected nil)) - (maphash (lambda (k v) (declare (ignore v)) (push k keys)) *object-store*) + (maphash (lambda (k v) (declare (ignore v)) (push k keys)) *memory*) (let ((len (length keys))) (when (> len 0) (dotimes (i count) (let* ((random-key (nth (random len) keys)) - (obj (gethash random-key *object-store*))) + (obj (gethash random-key *memory*))) (when obj (push obj selected)))))) selected)) diff --git a/src/lisp-validator.lisp b/src/lisp-validator.lisp index fdaa164..9c1aa68 100644 --- a/src/lisp-validator.lisp +++ b/src/lisp-validator.lisp @@ -15,8 +15,8 @@ format concatenate string-downcase string-upcase search ;; Kernel specifics org-agent::harness-log - org-agent::snapshot-object-store - org-agent::rollback-object-store + org-agent::snapshot-memory + org-agent::rollback-memory org-agent::lookup-object org-agent::list-objects-by-type org-agent::ingest-ast diff --git a/src/loop.lisp b/src/loop.lisp index 4a82433..5e04701 100644 --- a/src/loop.lisp +++ b/src/loop.lisp @@ -20,7 +20,7 @@ (setf current-signal (act-gate current-signal))) (error (c) (harness-log "METABOLISM CRASH: ~a - Initiating Micro-Rollback." c) - (rollback-object-store 0) + (rollback-memory 0) (let ((sensor (ignore-errors (getf (getf current-signal :payload) :sensor)))) (if (or (> depth 2) (member sensor '(:loop-error :tool-error))) (setf current-signal nil) diff --git a/src/object-store.lisp b/src/memory.lisp similarity index 85% rename from src/object-store.lisp rename to src/memory.lisp index 26d0adf..f6d3fd9 100644 --- a/src/object-store.lisp +++ b/src/memory.lisp @@ -1,6 +1,6 @@ (in-package :org-agent) -(defvar *object-store* (make-hash-table :test 'equal)) +(defvar *memory* (make-hash-table :test 'equal)) (defvar *history-store* (make-hash-table :test 'equal) "Immutable Merkle-Tree versioning store mapping hashes to objects.") @@ -21,7 +21,7 @@ (ironclad:byte-array-to-hex-string (ironclad:produce-digest digester)))) (defun ingest-ast (ast &optional parent-id) - "Parses an Org AST into the recursive Lisp Object Store with Merkle hashing." + "Parses an Org AST into the recursive Lisp Memory with Merkle hashing." (let* ((type (getf ast :type)) (props (getf ast :properties)) (id (or (getf props :ID) (format nil "temp-~a" (get-universal-time)))) @@ -51,7 +51,7 @@ :hash hash)))) (unless existing-obj (setf (gethash hash *history-store*) obj)) - (setf (gethash id *object-store*) obj) + (setf (gethash id *memory*) obj) id))) (defvar *object-store-snapshots* nil) @@ -63,30 +63,30 @@ (maphash (lambda (k v) (setf (gethash k new-table) v)) hash-table) new-table)) -(defun snapshot-object-store () +(defun snapshot-memory () "Creates a lightweight, Copy-on-Write snapshot using Merkle-Tree pointers." - (let ((snapshot (copy-hash-table *object-store*))) + (let ((snapshot (copy-hash-table *memory*))) (push (list :timestamp (get-universal-time) :data snapshot) *object-store-snapshots*) (when (> (length *object-store-snapshots*) 20) (setf *object-store-snapshots* (subseq *object-store-snapshots* 0 20))) - (harness-log "MEMORY - CoW Object Store snapshot created."))) + (harness-log "MEMORY - CoW Memory snapshot created."))) -(defun rollback-object-store (&optional (index 0)) - "Restores the Object Store to a previously captured snapshot using immutable history pointers." +(defun rollback-memory (&optional (index 0)) + "Restores the Memory to a previously captured snapshot using immutable history pointers." (let ((snapshot (nth index *object-store-snapshots*))) (if snapshot - (progn (setf *object-store* (copy-hash-table (getf snapshot :data))) - (harness-log "MEMORY - Object Store rolled back to snapshot ~a" index)) + (progn (setf *memory* (copy-hash-table (getf snapshot :data))) + (harness-log "MEMORY - Memory rolled back to snapshot ~a" index)) (harness-log "MEMORY ERROR - Snapshot ~a not found." index)))) (defun lookup-object (id) "Retrieves an object from the store by its unique ID." - (gethash id *object-store*)) + (gethash id *memory*)) (defun list-objects-by-type (type) "Returns a list of all objects matching a specific Org element type." (let ((results nil)) - (maphash (lambda (id obj) (declare (ignore id)) (when (eq (org-object-type obj) type) (push obj results))) *object-store*) + (maphash (lambda (id obj) (declare (ignore id)) (when (eq (org-object-type obj) type) (push obj results))) *memory*) results)) (defun find-headline-missing-id (ast) diff --git a/src/package.lisp b/src/package.lisp index 75a159e..0b88c89 100644 --- a/src/package.lisp +++ b/src/package.lisp @@ -13,11 +13,11 @@ #:harness-log #:main - ;; --- Object Store (CLOSOS) --- + ;; --- Memory (CLOSOS) --- #:ingest-ast #:lookup-object #:list-objects-by-type - #:*object-store* + #:*memory* #:*history-store* #:org-object #:org-object-id @@ -30,8 +30,8 @@ #:org-object-vector #:org-object-content #:org-object-hash - #:snapshot-object-store - #:rollback-object-store + #:snapshot-memory + #:rollback-memory ;; --- Context API (Peripheral Vision) --- #:context-query-store diff --git a/src/perceive.lisp b/src/perceive.lisp index 5c47c70..bebf208 100644 --- a/src/perceive.lisp +++ b/src/perceive.lisp @@ -24,7 +24,7 @@ (type (getf signal :type)) (sensor (getf payload :sensor))) (harness-log "GATE [Perceive]: ~a (~a)" type (or sensor "no-sensor")) - (snapshot-object-store) + (snapshot-memory) (cond ((eq type :EVENT) (case sensor (:buffer-update (let ((ast (getf payload :ast))) (when ast (ingest-ast ast)))) diff --git a/src/self-fix.lisp b/src/self-fix.lisp index fdd5367..1b22ad1 100644 --- a/src/self-fix.lisp +++ b/src/self-fix.lisp @@ -10,7 +10,7 @@ (is-skill (and (stringp (namestring target-file)) (search "skills/" (namestring target-file))))) - (org-agent:snapshot-object-store) + (org-agent:snapshot-memory) (org-agent:harness-log "SELF-FIX - Attempting surgical fix on ~a..." target-file) (handler-case @@ -32,7 +32,7 @@ (org-agent:harness-log "SELF-FIX FAILURE - Skill reload failed. Rolling back.") (with-open-file (out target-file :direction :output :if-exists :supersede) (write-string content out)) - (org-agent:rollback-object-store 0) + (org-agent:rollback-memory 0) nil))) (progn (org-agent:harness-log "SELF-FIX SUCCESS - Applied fix to file.") @@ -41,7 +41,7 @@ (progn (org-agent:harness-log "SELF-FIX FAILURE - File not found.") nil)) (error (c) (org-agent:harness-log "SELF-FIX CRASH - ~a. Rolling back." c) - (org-agent:rollback-object-store 0) + (org-agent:rollback-memory 0) nil)))) (def-cognitive-tool :repair-file diff --git a/src/state-persistence.lisp b/src/state-persistence.lisp index 5e9a20f..91bac77 100644 --- a/src/state-persistence.lisp +++ b/src/state-persistence.lisp @@ -18,8 +18,8 @@ *history-store*) ;; 2. Dump the current active pointers (maphash (lambda (id obj) - (print `(setf (gethash ,id *object-store*) (gethash ,(org-object-hash obj) *history-store*)) out)) - *object-store*)) + (print `(setf (gethash ,id *memory*) (gethash ,(org-object-hash obj) *history-store*)) out)) + *memory*)) t)) (defun persistence-load-local () @@ -50,7 +50,7 @@ (:last-sync . ,(org-object-last-sync obj)) (:hash . ,(org-object-hash obj))) objects)) - *object-store*) + *memory*) objects)) (defun persistence-push-ipfs () @@ -76,7 +76,7 @@ (handler-case (let* ((response (dex:post ipfs-url)) (data (cl-json:decode-json-from-string response))) - (clrhash *object-store*) + (clrhash *memory*) (dolist (item data) (let* ((id (cdr (assoc :id item))) (obj (make-org-object @@ -90,7 +90,7 @@ :version (cdr (assoc :version item)) :last-sync (cdr (assoc :last-sync item)) :hash (cdr (assoc :hash item))))) - (setf (gethash id *object-store*) obj))) + (setf (gethash id *memory*) obj))) (harness-log "PERSISTENCE - Restored from IPFS: ~a" cid) t) (error (c) diff --git a/tests/bouncer-tests.lisp b/tests/bouncer-tests.lisp index 41be386..be8b15e 100644 --- a/tests/bouncer-tests.lisp +++ b/tests/bouncer-tests.lisp @@ -33,11 +33,11 @@ (test test-bouncer-approval-reaction "Verify that the bouncer skill re-injects an action when a plan node is APPROVED." - (clrhash org-agent::*object-store*) + (clrhash org-agent::*memory*) (let* ((action '(:type :REQUEST :target :telegram :payload (:text "hello"))) (node-id "plan-1")) ;; 1. Setup an APPROVED flight plan node - (setf (gethash node-id org-agent::*object-store*) + (setf (gethash node-id org-agent::*memory*) (org-agent::make-org-object :id node-id :attributes `(:TITLE "Flight Plan" :TODO "APPROVED" :TAGS ("FLIGHT_PLAN") :ACTION ,(format nil "~s" action)))) @@ -46,7 +46,7 @@ (let ((result (org-agent::bouncer-process-approvals))) (is (eq t result)) ;; The node should now be DONE - (let ((obj (gethash node-id org-agent::*object-store*))) + (let ((obj (gethash node-id org-agent::*memory*))) (is (equal "DONE" (getf (org-agent:org-object-attributes obj) :TODO))))))) (test test-bouncer-secret-exposure diff --git a/tests/chaos-qa.lisp b/tests/chaos-qa.lisp index deb6de4..bb9a41d 100644 --- a/tests/chaos-qa.lisp +++ b/tests/chaos-qa.lisp @@ -42,8 +42,8 @@ "Verify that hash is stable even if properties are sent in different order." (let* ((ast1 '(:type :HEADLINE :properties (:ID "collision" :A "1" :B "2") :contents nil)) (ast2 '(:type :HEADLINE :properties (:ID "collision" :B "2" :A "1") :contents nil))) - (clrhash org-agent::*object-store*) + (clrhash org-agent::*memory*) (let ((h1 (org-object-hash (lookup-object (ingest-ast ast1))))) - (clrhash org-agent::*object-store*) + (clrhash org-agent::*memory*) (let ((h2 (org-object-hash (lookup-object (ingest-ast ast2))))) (is (equal h1 h2)))))) diff --git a/tests/lisp-repair-tests.lisp b/tests/lisp-repair-tests.lisp index efc570d..c35b6ce 100644 --- a/tests/lisp-repair-tests.lisp +++ b/tests/lisp-repair-tests.lisp @@ -16,7 +16,7 @@ (test test-async-repair-flow "Verify that the pipeline correctly emits and reacts to syntax-error events." - (clrhash org-agent::*object-store*) + (clrhash org-agent::*memory*) (let* ((broken-code "(:type :REQUEST :target :tool") (error-msg "End of file") ;; 1. The Stimulus that caused the error diff --git a/tests/object-store-tests.lisp b/tests/memory-tests.lisp similarity index 85% rename from tests/object-store-tests.lisp rename to tests/memory-tests.lisp index e619ace..c209078 100644 --- a/tests/object-store-tests.lisp +++ b/tests/memory-tests.lisp @@ -1,21 +1,21 @@ -(defpackage :org-agent-object-store-tests +(defpackage :org-agent-memory-tests (:use :cl :fiveam :org-agent) - (:export #:object-store-suite)) + (:export #:memory-suite)) -(in-package :org-agent-object-store-tests) +(in-package :org-agent-memory-tests) -(def-suite object-store-suite - :description "Tests for the Merkle-Tree Object Store.") +(def-suite memory-suite + :description "Tests for the Merkle-Tree Memory.") -(in-suite object-store-suite) +(in-suite memory-suite) (test merkle-hash-consistency (let* ((ast1 '(:type :HEADLINE :properties (:ID "test-1" :TITLE "Node 1") :contents nil)) (ast2 '(:type :HEADLINE :properties (:ID "test-1" :TITLE "Node 1") :contents nil))) - (clrhash *object-store*) + (clrhash *memory*) (let ((id1 (ingest-ast ast1))) (let ((hash1 (org-object-hash (lookup-object id1)))) - (clrhash *object-store*) + (clrhash *memory*) (let ((id2 (ingest-ast ast2))) (let ((hash2 (org-object-hash (lookup-object id2)))) (is (equal hash1 hash2)))))))) @@ -24,19 +24,19 @@ (let* ((ast-leaf '(:type :HEADLINE :properties (:ID "leaf" :TITLE "Leaf") :contents nil)) (ast-root-full '(:type :HEADLINE :properties (:ID "root" :TITLE "Root") :contents ((:type :HEADLINE :properties (:ID "leaf" :TITLE "Leaf") :contents nil)))) - (id-root (progn (clrhash *object-store*) (ingest-ast ast-root-full))) + (id-root (progn (clrhash *memory*) (ingest-ast ast-root-full))) (initial-root-hash (org-object-hash (lookup-object id-root)))) ;; Now ingest a modified version (title change) (let* ((ast-root-modified '(:type :HEADLINE :properties (:ID "root" :TITLE "Root") :contents ((:type :HEADLINE :properties (:ID "leaf" :TITLE "Leaf Modified") :contents nil)))) - (id-root-mod (progn (clrhash *object-store*) (ingest-ast ast-root-modified))) + (id-root-mod (progn (clrhash *memory*) (ingest-ast ast-root-modified))) (modified-root-hash (org-object-hash (lookup-object id-root-mod)))) (is (not (equal initial-root-hash modified-root-hash)))))) (test history-store-immutability - "Verify that *history-store* retains old versions even after *object-store* updates." - (clrhash *object-store*) + "Verify that *history-store* retains old versions even after *memory* updates." + (clrhash *memory*) (clrhash *history-store*) (let* ((ast-v1 '(:type :HEADLINE :properties (:ID "test-node" :TITLE "Version 1") :contents nil)) (id-v1 (ingest-ast ast-v1)) @@ -63,7 +63,7 @@ (test cow-snapshot-and-rollback "Verify that lightweight snapshots can accurately restore previous pointer states." - (clrhash *object-store*) + (clrhash *memory*) (clrhash *history-store*) (setf *object-store-snapshots* nil) @@ -72,7 +72,7 @@ (hash-v1 (org-object-hash (lookup-object id-v1)))) ;; Take a snapshot at State A - (snapshot-object-store) + (snapshot-memory) (let* ((ast-v2 '(:type :HEADLINE :properties (:ID "cow-node" :TITLE "State B") :contents nil)) (id-v2 (ingest-ast ast-v2)) @@ -82,7 +82,7 @@ (is (equal (org-object-hash (lookup-object "cow-node")) hash-v2)) ;; Rollback to State A (index 0 because we only took 1 snapshot) - (rollback-object-store 0) + (rollback-memory 0) ;; Verify we are back in State A (is (equal (org-object-hash (lookup-object "cow-node")) hash-v1)) diff --git a/tests/peripheral-vision-tests.lisp b/tests/peripheral-vision-tests.lisp index 526ed70..70f262f 100644 --- a/tests/peripheral-vision-tests.lisp +++ b/tests/peripheral-vision-tests.lisp @@ -9,7 +9,7 @@ (test test-foveal-rendering "Verify that the foveal target is rendered with content, while siblings are skeletal." - (clrhash org-agent::*object-store*) + (clrhash org-agent::*memory*) (let* ((ast '(:type :HEADLINE :properties (:ID "proj-root" :TITLE "Project" :TAGS "project") :contents ((:type :HEADLINE :properties (:ID "node-foveal" :TITLE "Foveal Node") :raw-content "FOVEAL CONTENT" :contents nil) @@ -25,7 +25,7 @@ (test test-awareness-budget "Verify that context-assemble-global-awareness handles multiple projects." - (clrhash org-agent::*object-store*) + (clrhash org-agent::*memory*) (ingest-ast '(:type :HEADLINE :properties (:ID "p1" :TITLE "Project 1" :TAGS "project") :contents nil)) (ingest-ast '(:type :HEADLINE :properties (:ID "p2" :TITLE "Project 2" :TAGS "project") :contents nil)) (let ((output (context-assemble-global-awareness))) diff --git a/tests/persistence-tests.lisp b/tests/persistence-tests.lisp index 5660fd2..652bf11 100644 --- a/tests/persistence-tests.lisp +++ b/tests/persistence-tests.lisp @@ -8,8 +8,8 @@ (test test-local-roundtrip "Ensure RAM -> Disk -> RAM preserves data integrity." (let ((test-id "persist-test-1")) - (setf (gethash test-id *object-store*) (make-org-object :id test-id :content "Integrity Check")) + (setf (gethash test-id *memory*) (make-org-object :id test-id :content "Integrity Check")) (org-agent:persistence-dump-local) - (clrhash *object-store*) + (clrhash *memory*) (org-agent:persistence-load-local) - (is (equal "Integrity Check" (org-object-content (gethash test-id *object-store*)))))) + (is (equal "Integrity Check" (org-object-content (gethash test-id *memory*)))))) diff --git a/tests/pipeline-tests.lisp b/tests/pipeline-tests.lisp index 0b64d00..a60887e 100644 --- a/tests/pipeline-tests.lisp +++ b/tests/pipeline-tests.lisp @@ -26,11 +26,11 @@ (test test-perceive-gate "Perceive gate should update the object store and normalize signal." - (clrhash org-agent::*object-store*) + (clrhash org-agent::*memory*) (let* ((signal (list :type :EVENT :payload (list :sensor :buffer-update :ast (list :type :HEADLINE :properties (list :ID "test-node" :TITLE "Test") :contents nil)))) (result (perceive-gate signal))) (is (eq :perceived (getf result :status))) - (is (not (null (gethash "test-node" org-agent::*object-store*)))))) + (is (not (null (gethash "test-node" org-agent::*memory*)))))) (test test-decide-gate-safety "Decide gate should block unsafe LLM proposals." @@ -46,7 +46,7 @@ (test test-pipeline-flow-flat "Verify that process-signal correctly executes a signal through gates." (setup-mock-skills) - (clrhash org-agent::*object-store*) + (clrhash org-agent::*memory*) (let ((signal (list :type :EVENT :payload (list :sensor :buffer-update)))) (process-signal signal) (pass "Pipeline completed execution."))) @@ -90,15 +90,15 @@ (test test-global-awareness-assembly "Verify that context-assemble-global-awareness reports active projects." - (clrhash org-agent::*object-store*) + (clrhash org-agent::*memory*) (ingest-ast (list :type :HEADLINE :properties (list :ID "proj-1" :TITLE "Project Alpha" :TAGS "project") :contents nil)) (let ((awareness (context-assemble-global-awareness))) (is (search "Project Alpha" awareness)) (is (search "proj-1" awareness)))) (test test-micro-rollback - "Verify that a pipeline crash triggers an automatic Object Store rollback." - (clrhash org-agent::*object-store*) + "Verify that a pipeline crash triggers an automatic Memory rollback." + (clrhash org-agent::*memory*) (clrhash org-agent::*history-store*) (setf org-agent::*object-store-snapshots* nil) ;; State A diff --git a/tests/task-orchestrator-tests.lisp b/tests/task-orchestrator-tests.lisp index f001828..24966e8 100644 --- a/tests/task-orchestrator-tests.lisp +++ b/tests/task-orchestrator-tests.lisp @@ -20,10 +20,10 @@ (test test-task-integrity-parent-child "Verify that task-integrity-check rejects closing a parent with active children." ;; Mocking some objects in the store - (clrhash org-agent::*object-store*) - (setf (gethash "parent-1" org-agent::*object-store*) + (clrhash org-agent::*memory*) + (setf (gethash "parent-1" org-agent::*memory*) (org-agent::make-org-object :id "parent-1" :attributes '(:TITLE "Parent Task" :TODO "TODO"))) - (setf (gethash "child-1" org-agent::*object-store*) + (setf (gethash "child-1" org-agent::*memory*) (org-agent::make-org-object :id "child-1" :attributes '(:TITLE "Child Task" :TODO "TODO" :PARENT "parent-1"))) (let* ((action '(:type :REQUEST :target :emacs :action :update-node :id "parent-1" :attributes (:TODO "DONE"))) diff --git a/tests/vault-tests.lisp b/tests/vault-tests.lisp index f17d997..c3be95b 100644 --- a/tests/vault-tests.lisp +++ b/tests/vault-tests.lisp @@ -11,6 +11,6 @@ (test test-vault-persistence "Verify that setting a secret triggers a snapshot (mock check)." - (let ((old-version (org-agent::org-object-version (gethash "root" *object-store*)))) + (let ((old-version (org-agent::org-object-version (gethash "root" *memory*)))) (org-agent:vault-set-secret :test "secret-val") - (is (> (org-agent::org-object-version (gethash "root" *object-store*)) old-version)))) + (is (> (org-agent::org-object-version (gethash "root" *memory*)) old-version))))