Architectural Upgrade 2026-03-30: Modular Emacs, org-gtd v4.0, and PSF Phase 1
This commit is contained in:
100
system/skills/org-skill-cron.org
Normal file
100
system/skills/org-skill-cron.org
Normal file
@@ -0,0 +1,100 @@
|
||||
#+TITLE: SKILL: Cron Agent (Temporal Heartbeat)
|
||||
#+ID: skill-cron-agent
|
||||
#+STARTUP: content
|
||||
|
||||
* Overview
|
||||
The **Cron Agent** serves as the system's temporal conscience. By hooking into the background heartbeat, it provides the agent with autonomous, time-aware capabilities, allowing it to transition from a purely reactive tool to a proactive executive assistant.
|
||||
|
||||
* The Temporal Mandate
|
||||
1. **Punctuality:** The agent must monitor deadlines and alerts, ensuring nothing slips through the cracks.
|
||||
2. **Efficiency:** To conserve resources, the neural layer (System 1) should only be invoked if the symbolic layer (System 2) confirms that a temporal threshold has been crossed.
|
||||
3. **Multi-Channel Awareness:** Alerts should be routed to the most appropriate channel (Emacs or external delivery) based on the task's context.
|
||||
|
||||
* Symbolic Implementation (The Logic)
|
||||
The implementation below defines how the system perceives time and filters tasks for neural processing.
|
||||
|
||||
** Architectural Intent: Heartbeat Perception
|
||||
This trigger aligns the skill with the system's periodic heartbeat pulse, ensuring consistent temporal checks without excessive overhead.
|
||||
|
||||
#+begin_src lisp
|
||||
(defun trigger-skill-cron (context)
|
||||
(let ((type (getf context :type))
|
||||
(payload (getf context :payload)))
|
||||
(and (eq type :EVENT)
|
||||
(eq (getf payload :sensor) :heartbeat))))
|
||||
#+end_src
|
||||
|
||||
** Architectural Intent: Temporal Parsing
|
||||
This utility function translates human-readable Org-mode timestamps into a machine-comparable format, bridging the gap between notes and logic.
|
||||
|
||||
#+begin_src lisp
|
||||
(defun parse-org-timestamp (ts-str)
|
||||
"Extract year, month, and day from an Org timestamp (e.g. <2026-03-24 Tue>)
|
||||
and return its universal-time representation."
|
||||
(let ((match (nth-value 1 (cl-ppcre:scan-to-strings "<(\\d{4})-(\\d{2})-(\\d{2}).*>" ts-str))))
|
||||
(if match
|
||||
(encode-universal-time 0 0 0
|
||||
(parse-integer (aref match 2))
|
||||
(parse-integer (aref match 1))
|
||||
(parse-integer (aref match 0)))
|
||||
nil)))
|
||||
#+end_src
|
||||
|
||||
** Architectural Intent: Proactive Deadline Audit
|
||||
This function acts as the "System 2 Filter." It audits all active TODOs, compares them against the current time, and only wakes up the neural layer if it identifies overdue items that require an alert.
|
||||
|
||||
#+begin_src lisp
|
||||
(defun neuro-skill-cron (context)
|
||||
"Checks for deadlines and only wakes the LLM if action is needed."
|
||||
(let* ((all-tasks (org-agent:context-query-store :todo-state "TODO" :type :HEADLINE))
|
||||
(now (get-universal-time))
|
||||
(overdue-tasks nil))
|
||||
|
||||
(dolist (task all-tasks)
|
||||
(let* ((attrs (org-agent:org-object-attributes task))
|
||||
(deadline-str (getf attrs :DEADLINE))
|
||||
(title (getf attrs :TITLE)))
|
||||
(when deadline-str
|
||||
(let ((deadline-time (parse-org-timestamp deadline-str)))
|
||||
;; Only consider it overdue if the deadline has actually passed
|
||||
(when (and deadline-time (<= deadline-time now))
|
||||
(push (format nil "[~a] Was due - ~a" title deadline-str) overdue-tasks))))))
|
||||
|
||||
(if overdue-tasks
|
||||
(let* ((all-delivery (mapcar (lambda (task)
|
||||
(getf (org-agent:org-object-attributes task) :DELIVERY))
|
||||
all-tasks))
|
||||
;; Check if any overdue task specifically requested external delivery
|
||||
(target (if (cl:some (lambda (d) (not (null d))) all-delivery) :delivery :emacs)))
|
||||
|
||||
(format nil "
|
||||
You are the user's Executive Assistant.
|
||||
The heartbeat monitor just woke you up.
|
||||
|
||||
The following tasks are officially OVERDUE:
|
||||
~a
|
||||
|
||||
Draft a very short, polite alert message to the user warning them about these deadlines.
|
||||
|
||||
Return a Lisp plist - (:target ~a :action :message :text \"your alert\")
|
||||
If target is :delivery, make the message extra concise for a phone notification.
|
||||
" overdue-tasks (if (eq target :delivery) ":delivery" ":emacs")))
|
||||
nil)))
|
||||
#+end_src
|
||||
|
||||
** Architectural Intent: Symbolic Verification
|
||||
A standard pass-through to ensure the proposed alert reaches its intended actuator.
|
||||
|
||||
#+begin_src lisp
|
||||
(defun verify-skill-cron (proposed-action context)
|
||||
proposed-action)
|
||||
#+end_src
|
||||
|
||||
* Registration
|
||||
#+begin_src lisp
|
||||
(defskill :skill-cron
|
||||
:priority 60
|
||||
:trigger #'trigger-skill-cron
|
||||
:neuro #'neuro-skill-cron
|
||||
:symbolic #'verify-skill-cron)
|
||||
#+end_src
|
||||
Reference in New Issue
Block a user