diff --git a/lisp/core-context.lisp b/lisp/core-context.lisp index 25d7a6a..b5ce71a 100644 --- a/lisp/core-context.lisp +++ b/lisp/core-context.lisp @@ -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)))) - *memory*) + *memory-store*) results)) (defun context-active-projects () @@ -28,7 +28,7 @@ (maphash (lambda (name skill) (declare (ignore name)) (push (list :name (skill-name skill) :priority (skill-priority skill) :dependencies (skill-dependencies skill)) results)) - *skills-registry*) + *skill-registry*) (sort results #'> :key (lambda (x) (getf x :priority))))) (defun context-skill-source (skill-name) @@ -53,9 +53,9 @@ or nil if the heading is not found." (defun context-logs (&optional limit) "Retrieves the most recent lines from the harness's internal log." (let ((log-limit (or limit (ignore-errors (parse-integer (uiop:getenv "CONTEXT_LOG_LIMIT"))) 20))) - (bt:with-lock-held (*logs-lock*) - (let ((count (min log-limit (length *system-logs*)))) - (subseq *system-logs* 0 count))))) + (bt:with-lock-held (*log-lock*) + (let ((count (min log-limit (length *log-buffer*)))) + (subseq *log-buffer* 0 count))))) (defun context-object-render (obj &key (depth 1) (foveal-id nil) semantic-threshold (foveal-vector nil)) "Recursively renders an org-object and its children to an Org string using a Foveal-Peripheral Hybrid model." @@ -153,7 +153,7 @@ Privacy-filtered objects (matching bouncer-privacy-tags) are excluded." (in-suite vision-suite) (test test-foveal-rendering - (clrhash passepartout::*memory*) + (clrhash passepartout::*memory-store*) (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) @@ -166,7 +166,7 @@ Privacy-filtered objects (matching bouncer-privacy-tags) are excluded." (is (not (search "PERIPHERAL CONTENT" output)))))) (test test-awareness-budget - (clrhash passepartout::*memory*) + (clrhash passepartout::*memory-store*) (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-awareness-assemble))) diff --git a/lisp/core-defpackage.lisp b/lisp/core-defpackage.lisp index 539b13d..244583b 100644 --- a/lisp/core-defpackage.lisp +++ b/lisp/core-defpackage.lisp @@ -29,7 +29,7 @@ #:lookup-object #:list-objects-by-type #:org-id-new - #:*memory* + #:*memory-store* #:*history-store* #:org-object #:make-org-object diff --git a/lisp/core-loop-act.lisp b/lisp/core-loop-act.lisp index d73c8da..af152ac 100644 --- a/lisp/core-loop-act.lisp +++ b/lisp/core-loop-act.lisp @@ -67,7 +67,7 @@ (depth (getf context :depth 0)) (meta (getf context :meta)) (source (getf meta :source)) - (tool (gethash (string-downcase (string tool-name)) *cognitive-tools*))) + (tool (gethash (string-downcase (string tool-name)) *cognitive-tool-registry*))) (if tool (handler-case (let* ((clean-args (if (and (listp tool-args) (listp (car tool-args))) (car tool-args) tool-args)) @@ -105,7 +105,7 @@ (feedback nil)) (when approved (let* ((original-type (getf approved :type)) - (verified (deterministic-verify approved signal))) + (verified (cognitive-verify approved signal))) (if (and (listp verified) (member (getf verified :type) '(:LOG :EVENT)) (not (member original-type '(:LOG :EVENT)))) (progn (log-message "ACT BLOCKED: Action failed last-mile deterministic check.") diff --git a/lisp/core-loop-perceive.lisp b/lisp/core-loop-perceive.lisp index d1f3238..1fa7881 100644 --- a/lisp/core-loop-perceive.lisp +++ b/lisp/core-loop-perceive.lisp @@ -85,11 +85,11 @@ (in-suite pipeline-perceive-suite) (test test-loop-gate-perceive - (clrhash passepartout::*memory*) + (clrhash passepartout::*memory-store*) (let* ((signal (list :type :EVENT :payload (list :sensor :buffer-update :ast (list :type :HEADLINE :properties (list :ID "test-node" :TITLE "Test") :contents nil)))) (result (loop-gate-perceive signal))) (is (eq :perceived (getf result :status))) - (is (not (null (gethash "test-node" passepartout::*memory*)))))) + (is (not (null (gethash "test-node" passepartout::*memory-store*)))))) (test test-depth-limiting (let ((runaway-signal (list :type :EVENT :depth 11 :payload (list :sensor :heartbeat)))) diff --git a/lisp/core-loop-reason.lisp b/lisp/core-loop-reason.lisp index e25f82a..ec2aa95 100644 --- a/lisp/core-loop-reason.lisp +++ b/lisp/core-loop-reason.lisp @@ -75,7 +75,7 @@ (let ((aug-text (ignore-errors (funcall aug-fn context)))) (when (and aug-text (stringp aug-text) (> (length aug-text) 0)) (setf augments (concatenate 'string augments aug-text (string #\Newline)))))))) - *skills-registry*) + *skill-registry*) (when (> (length augments) 0) augments))) (system-prompt (format nil "IDENTITY: ~a~a~%~%TOOLS:~%~a~%~%CONTEXT:~%~a~%~%LOGS:~%~a~%~a" assistant-name reflection-feedback tool-belt global-context system-logs @@ -98,7 +98,7 @@ (declare (ignore name)) (when (skill-deterministic-fn skill) (push skill skills))) - *skills-registry*) + *skill-registry*) (setf skills (sort skills #'> :key #'skill-priority)) (dolist (skill skills) (let ((trigger (skill-trigger-fn skill)) @@ -155,7 +155,7 @@ (in-suite pipeline-reason-suite) (test test-decide-gate-safety - (clrhash passepartout::*skills-registry*) + (clrhash passepartout::*skill-registry*) (passepartout::defskill :mock-safety :priority 50 :trigger (lambda (ctx) (declare (ignore ctx)) t) diff --git a/org/core-context.org b/org/core-context.org index d969ffc..b8e2111 100644 --- a/org/core-context.org +++ b/org/core-context.org @@ -46,7 +46,7 @@ Filters the Memory store by tag, TODO state, or object type. This is the primary (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)))) - *memory*) + *memory-store*) results)) #+end_src @@ -82,7 +82,7 @@ Provides a sorted overview of currently loaded system capabilities. Each entry i (maphash (lambda (name skill) (declare (ignore name)) (push (list :name (skill-name skill) :priority (skill-priority skill) :dependencies (skill-dependencies skill)) results)) - *skills-registry*) + *skill-registry*) (sort results #'> :key (lambda (x) (getf x :priority))))) #+end_src @@ -126,9 +126,9 @@ Retrieves the most recent lines from the harness's internal log buffer. The log (defun context-logs (&optional limit) "Retrieves the most recent lines from the harness's internal log." (let ((log-limit (or limit (ignore-errors (parse-integer (uiop:getenv "CONTEXT_LOG_LIMIT"))) 20))) - (bt:with-lock-held (*logs-lock*) - (let ((count (min log-limit (length *system-logs*)))) - (subseq *system-logs* 0 count))))) + (bt:with-lock-held (*log-lock*) + (let ((count (min log-limit (length *log-buffer*)))) + (subseq *log-buffer* 0 count))))) #+end_src ** AST to Org Rendering (context-object-render) @@ -263,7 +263,7 @@ Verifies that the Foveal-Peripheral rendering correctly distinguishes between fo (in-suite vision-suite) (test test-foveal-rendering - (clrhash passepartout::*memory*) + (clrhash passepartout::*memory-store*) (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) @@ -276,7 +276,7 @@ Verifies that the Foveal-Peripheral rendering correctly distinguishes between fo (is (not (search "PERIPHERAL CONTENT" output)))))) (test test-awareness-budget - (clrhash passepartout::*memory*) + (clrhash passepartout::*memory-store*) (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-awareness-assemble))) diff --git a/org/core-defpackage.org b/org/core-defpackage.org index 0a48418..b4a2ed2 100644 --- a/org/core-defpackage.org +++ b/org/core-defpackage.org @@ -54,7 +54,7 @@ The package definition. All public symbols are exported here. #:lookup-object #:list-objects-by-type #:org-id-new - #:*memory* + #:*memory-store* #:*history-store* #:org-object #:make-org-object diff --git a/org/core-loop-act.org b/org/core-loop-act.org index 4bc8b97..46a9707 100644 --- a/org/core-loop-act.org +++ b/org/core-loop-act.org @@ -18,7 +18,7 @@ The key architectural choice: **actuators are not privileged**. The same dispatc ** Why Dispatch-Action Verifies Again? -The Reason stage already ran every proposed action through the deterministic engine. So why does ~loop-gate-act~ call ~deterministic-verify~ again? +The Reason stage already ran every proposed action through the deterministic engine. So why does ~loop-gate-act~ call ~cognitive-verify~ again? Because a skill's deterministic gate runs during Reason, but between Reason and Act, the action might have been transformed by the pipeline (metadata added, format normalized). The last-mile verification catches any transformation that might have introduced an unsafe property. It's the same philosophy as "trust but verify" — the second check is cheap and catches a class of bugs that would otherwise be silent data corruption. @@ -135,7 +135,7 @@ The tool's return value is packed into a ~:tool-output~ event and fed back into (depth (getf context :depth 0)) (meta (getf context :meta)) (source (getf meta :source)) - (tool (gethash (string-downcase (string tool-name)) *cognitive-tools*))) + (tool (gethash (string-downcase (string tool-name)) *cognitive-tool-registry*))) (if tool (handler-case (let* ((clean-args (if (and (listp tool-args) (listp (car tool-args))) (car tool-args) tool-args)) @@ -189,7 +189,7 @@ After dispatch, the gate captures any feedback produced by the actuation (tool o (feedback nil)) (when approved (let* ((original-type (getf approved :type)) - (verified (deterministic-verify approved signal))) + (verified (cognitive-verify approved signal))) (if (and (listp verified) (member (getf verified :type) '(:LOG :EVENT)) (not (member original-type '(:LOG :EVENT)))) (progn (log-message "ACT BLOCKED: Action failed last-mile deterministic check.") diff --git a/org/core-loop-perceive.org b/org/core-loop-perceive.org index a4856e2..941b142 100644 --- a/org/core-loop-perceive.org +++ b/org/core-loop-perceive.org @@ -157,11 +157,11 @@ Verifies that the perceive gate correctly ingests AST nodes into memory and that (in-suite pipeline-perceive-suite) (test test-loop-gate-perceive - (clrhash passepartout::*memory*) + (clrhash passepartout::*memory-store*) (let* ((signal (list :type :EVENT :payload (list :sensor :buffer-update :ast (list :type :HEADLINE :properties (list :ID "test-node" :TITLE "Test") :contents nil)))) (result (loop-gate-perceive signal))) (is (eq :perceived (getf result :status))) - (is (not (null (gethash "test-node" passepartout::*memory*)))))) + (is (not (null (gethash "test-node" passepartout::*memory-store*)))))) (test test-depth-limiting (let ((runaway-signal (list :type :EVENT :depth 11 :payload (list :sensor :heartbeat)))) diff --git a/org/core-loop-reason.org b/org/core-loop-reason.org index 7659a8a..550ed7a 100644 --- a/org/core-loop-reason.org +++ b/org/core-loop-reason.org @@ -194,7 +194,7 @@ The system prompt assembly order — identity, tools, context, logs, mandates (let ((aug-text (ignore-errors (funcall aug-fn context)))) (when (and aug-text (stringp aug-text) (> (length aug-text) 0)) (setf augments (concatenate 'string augments aug-text (string #\Newline)))))))) - *skills-registry*) + *skill-registry*) (when (> (length augments) 0) augments))) (system-prompt (format nil "IDENTITY: ~a~a~%~%TOOLS:~%~a~%~%CONTEXT:~%~a~%~%LOGS:~%~a~%~a" assistant-name reflection-feedback tool-belt global-context system-logs @@ -231,7 +231,7 @@ This architecture makes safety compositional: each skill adds one constraint. Th (declare (ignore name)) (when (skill-deterministic-fn skill) (push skill skills))) - *skills-registry*) + *skill-registry*) (setf skills (sort skills #'> :key #'skill-priority)) (dolist (skill skills) (let ((trigger (skill-trigger-fn skill)) @@ -302,7 +302,7 @@ Verifies that the deterministic engine correctly rejects unsafe actions (like ~r (in-suite pipeline-reason-suite) (test test-decide-gate-safety - (clrhash passepartout::*skills-registry*) + (clrhash passepartout::*skill-registry*) (passepartout::defskill :mock-safety :priority 50 :trigger (lambda (ctx) (declare (ignore ctx)) t)