Files
memex/notes/org-skill-cron.org

78 lines
2.3 KiB
Org Mode

#+TITLE: SKILL: Cron Agent (Universal Literate Note)
#+ID: skill-cron
#+STARTUP: content
#+FILETAGS: :cron:temporal:heartbeat:psf:
* Overview
The **Cron Agent** serves as the system's temporal conscience. It provides autonomous, time-aware capabilities by hooking into the background heartbeat, enabling proactive executive assistance.
* Phase A: Demand (PRD)
:PROPERTIES:
:STATUS: FROZEN
:END:
** 1. Purpose
Define automated behaviors for deadline monitoring and temporal alerting.
** 2. User Needs
- **Punctuality:** Monitor deadlines and alerts across the Memex.
- **Efficiency:** Symbolic filtering (System 2) to minimize LLM calls.
- **Multi-Channel Awareness:** Routing alerts to Emacs or external delivery.
** 3. Success Criteria
*** TODO Heartbeat Trigger Verification
*** TODO Timestamp Parsing Accuracy
*** TODO Overdue Task Detection
* Phase B: Blueprint (PROTOCOL)
:PROPERTIES:
:STATUS: SIGNED
:END:
** 1. Architectural Intent
Interfaces for temporal perception and task auditing. Source of truth is the current system time and Org timestamps.
** 2. Semantic Interfaces
#+begin_src lisp
(defun trigger-skill-cron (context)
"Triggers on :sensor :heartbeat.")
(defun parse-org-timestamp (ts-str)
"Converts Org timestamp string to machine-comparable format.")
(defun neuro-skill-cron (context)
"Neural drafting of alerts for overdue tasks.")
#+end_src
* Phase D: Build (Implementation)
** Heartbeat Perception
#+begin_src lisp :tangle projects/org-skill-cron/src/cron-logic.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
** Temporal Parsing
#+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))))
(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
* Registration
#+begin_src lisp
(defskill :skill-cron
:priority 60
:trigger #'trigger-skill-cron
:neuro #'neuro-skill-cron
:symbolic (lambda (action context) action))
#+end_src