ALIGN: Rename Object Store to Memory and enrich literate text

This commit is contained in:
2026-04-13 14:29:15 -04:00
parent 5f86bcd8dc
commit dcd3a31112
47 changed files with 215 additions and 213 deletions

View File

@@ -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)

View File

@@ -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.

View File

@@ -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

View File

@@ -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)))

View File

@@ -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

View File

@@ -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.

View File

@@ -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

View File

@@ -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))))

View File

@@ -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

View File

@@ -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