feat(psf): transition to Order 2 (Sovereign Architect) with advanced skill graph and philosophical alignment

This commit is contained in:
2026-03-31 20:28:06 -04:00
parent ec3a572bbb
commit ce39227327
581 changed files with 165563 additions and 25735 deletions

View File

@@ -44,6 +44,10 @@ Interfaces for external sensory perception. Source of truth is the external API
(defun gateway-verify-sender (sender-id channel)
"Ensures the message is from an authorized recipient.")
(defun gateway-process-inbound (message-event)
"Routes the normalized message through the Economist for cheap classification,
then places it in the 'Holding Pen' (inbox.org).")
#+end_src
* Phase D: Build (Implementation)
@@ -63,13 +67,31 @@ Interfaces for external sensory perception. Source of truth is the external API
(progn
(kernel-log "GATEWAY - Rejected message from unauthorized sender: ~a" sender)
nil))))
(defun gateway-process-inbound (message-event)
"The Holding Pen logic. It uses a low-cost model to classify the message
and appends it to inbox.org."
(let* ((text (getf (getf message-event :payload) :text))
;; Route through Economist for cheap classification
(backend (org-agent:economist-route-task 2)) ; Low complexity
(classification (org-agent:ask-neuro
(format nil "Classify this text into one tag (e.g., :idea:, :todo:, :link:): ~a" text)
:system-prompt "You are a fast, cheap triage agent. Return ONLY the tag."
:cascade (list backend)))
(inbox-path (or (uiop:getenv "INBOX_FILE") "inbox.org"))
(timestamp (local-time:format-timestring nil (local-time:now) :format '("[" :year "-" :month "-" :day " " :weekday "]"))))
(with-open-file (out inbox-path :direction :output :if-exists :append :if-does-not-exist :create)
(format out "* INBOX ~a ~a~% Captured via ~a at ~a~% ~a~%~%"
classification text (getf (getf message-event :payload) :channel) timestamp text))
(kernel-log "GATEWAY - Message routed to Holding Pen (~a)." inbox-path)))
#+end_src
* Registration
#+begin_src lisp
(defskill :skill-inbound-gateway
:priority 100 ; High-priority sensory input
:trigger (lambda (context) nil) ; Triggered by external sensors (Signal/Web)
:priority 100
:trigger (lambda (context) (eq (getf (getf context :payload) :sensor) :inbound-message))
:neuro (lambda (context) nil)
:symbolic (lambda (action context) action))
:symbolic (lambda (action context) (gateway-process-inbound context) nil)) ; Side-effect only
#+end_src