feat(psf): transition to Order 2 (Sovereign Architect) with advanced skill graph and philosophical alignment
This commit is contained in:
@@ -51,11 +51,13 @@ Interfaces for temporal perception and task auditing. Source of truth is the cur
|
||||
(defun trigger-skill-cron (context)
|
||||
(let ((type (getf context :type))
|
||||
(payload (getf context :payload)))
|
||||
(and (eq type :EVENT)
|
||||
(eq (getf payload :sensor) :heartbeat))))
|
||||
(when (and (eq type :EVENT) (eq (getf payload :sensor) :heartbeat))
|
||||
;; Side-effect: Check if it's time for the nightly grooming cycle
|
||||
(trigger-nightly-grooming)
|
||||
t))) ; Return T to trigger the skill
|
||||
#+end_src
|
||||
|
||||
** Temporal Parsing
|
||||
** Temporal Parsing & Nightly Cycle
|
||||
#+begin_src lisp :tangle projects/org-skill-cron/src/cron-logic.lisp
|
||||
(defun parse-org-timestamp (ts-str)
|
||||
(let ((match (nth-value 1 (cl-ppcre:scan-to-strings "<(\\d{4})-(\\d{2})-(\\d{2}).*>" ts-str))))
|
||||
@@ -65,6 +67,75 @@ Interfaces for temporal perception and task auditing. Source of truth is the cur
|
||||
(parse-integer (aref match 1))
|
||||
(parse-integer (aref match 0)))
|
||||
nil)))
|
||||
|
||||
(defun trigger-nightly-grooming ()
|
||||
"Checks if the current time is within the nightly grooming window (e.g., 3:00 AM - 4:00 AM).
|
||||
If so, and it hasn't run today, it injects a grooming stimulus."
|
||||
(let* ((now (local-time:now))
|
||||
(hour (local-time:timestamp-hour now)))
|
||||
(when (= hour 3) ; 3 AM
|
||||
(kernel-log "CRON - Initiating Nightly Grooming Cycle...")
|
||||
(org-agent:inject-stimulus `(:type :EVENT :payload (:sensor :grooming-cycle))))))
|
||||
#+end_src
|
||||
|
||||
** Context Injection
|
||||
#+begin_src lisp :tangle projects/org-skill-cron/src/cron-logic.lisp
|
||||
"Retrieves all headlines with DEADLINE timestamps in the next N days.
|
||||
Enables Temporal Context Injection for System 1."
|
||||
(let* ((now (get-universal-time))
|
||||
(future-limit (+ now (* days 24 60 60)))
|
||||
(all-headlines (org-agent:list-objects-by-type :HEADLINE))
|
||||
(upcoming nil))
|
||||
(dolist (obj all-headlines)
|
||||
(let* ((attrs (org-agent:org-object-attributes obj))
|
||||
(deadline-str (getf attrs :DEADLINE))
|
||||
(deadline-time (when deadline-str (parse-org-timestamp deadline-str))))
|
||||
(when (and deadline-time (< deadline-time future-limit) (> deadline-time (- now 86400)))
|
||||
(push (list :title (getf attrs :TITLE) :deadline deadline-str) upcoming))))
|
||||
upcoming))
|
||||
|
||||
(defun context-get-stalled-waiting-items (&optional (days 3))
|
||||
"Finds items marked WAITING that have not been updated in N days."
|
||||
(let* ((now (get-universal-time))
|
||||
(past-limit (- now (* days 24 60 60)))
|
||||
(all-headlines (org-agent:list-objects-by-type :HEADLINE))
|
||||
(stalled nil))
|
||||
(dolist (obj all-headlines)
|
||||
(let* ((attrs (org-agent:org-object-attributes obj))
|
||||
(state (getf attrs :TODO-STATE))
|
||||
(last-sync (org-agent:org-object-last-sync obj)))
|
||||
(when (and (equal state "WAITING") (< last-sync past-limit))
|
||||
(push (list :title (getf attrs :TITLE)) stalled))))
|
||||
stalled))
|
||||
#+end_src
|
||||
|
||||
** Neuro-Cognitive Intelligence
|
||||
#+begin_src lisp :tangle projects/org-skill-cron/src/cron-logic.lisp
|
||||
(defun neuro-skill-cron (context)
|
||||
"Neural stage for temporal awareness.
|
||||
Injects upcoming calendar events and stalled items into the cognitive loop."
|
||||
(let* ((upcoming (context-get-upcoming-deadlines 3)) ; Look 3 days ahead
|
||||
(stalled (context-get-stalled-waiting-items 3)) ; Look 3 days back
|
||||
(now-str (local-time:format-timestring nil (local-time:now))))
|
||||
(format nil "
|
||||
CURRENT TIME: ~a
|
||||
|
||||
UPCOMING DEADLINES (Next 3 Days):
|
||||
---
|
||||
~{~a: ~a~%~}
|
||||
---
|
||||
|
||||
STALLED WAITING ITEMS (> 3 days old):
|
||||
---
|
||||
~{~a~%~}
|
||||
---
|
||||
|
||||
TASK:
|
||||
If any deadline is CRITICAL or OVERDUE, propose a proactive alert or plan adjustment.
|
||||
If there are stalled WAITING items, propose a follow-up action to unblock them.
|
||||
" now-str
|
||||
(loop for item in upcoming append (list (getf item :deadline) (getf item :title)))
|
||||
(loop for item in stalled collect (getf item :title)))))
|
||||
#+end_src
|
||||
|
||||
* Registration
|
||||
|
||||
Reference in New Issue
Block a user