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

2.3 KiB

SKILL: Cron Agent (Universal Literate Note)

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)

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)

1. Architectural Intent

Interfaces for temporal perception and task auditing. Source of truth is the current system time and Org timestamps.

2. Semantic Interfaces

(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.")

Phase D: Build (Implementation)

Heartbeat Perception

(defun trigger-skill-cron (context)
  (let ((type (getf context :type))
        (payload (getf context :payload)))
    (and (eq type :EVENT)
         (eq (getf payload :sensor) :heartbeat))))

Temporal Parsing

(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)))

Registration

(defskill :skill-cron
  :priority 60
  :trigger #'trigger-skill-cron
  :neuro #'neuro-skill-cron
  :symbolic (lambda (action context) action))