Files
passepartout/skills/org-skill-inbox-processor.org

3.5 KiB

SKILL: Enriched Inbox Processor Agent (Universal Literate Note)

Overview

The Enriched Inbox Processor Agent is responsible for the daily migration of captured nodes from inbox.org to the daily/ archive. It enforces a strict privacy wall for @personal content while providing deep semantic enrichment for public research.

Phase A: Demand (PRD)

1. Purpose

Automate the sorting and enrichment of inbox captures.

2. User Needs

  • Privacy Wall: Headlines tagged @personal are moved symbolically only. No LLM processing allowed.
  • Semantic Enrichment: For public items (non-@personal), generate:

    1. A Summary sub-heading (1 sentence).
    2. A Significance paragraph explaining the PSF use-case.
    3. A Full Text extraction for items tagged !archive.
  • Archive-First: ALL originals are moved to daily/YYYY-MM-DD.org based on the :CREATED: property.

Phase B: Blueprint (PROTOCOL)

1. Architectural Intent

Iterate through the inbox. Use System 2 (Symbolic) to identify the tag. If @personal, perform a direct move. If not, trigger System 1 (Neuro) for enrichment.

Phase D: Build (Implementation)

Helper: Privacy & Archive Checks

(defun inbox-is-private-p (tags)
  (member "@personal" tags :test #'string-equal))

(defun inbox-is-archive-p (tags)
  (member "!archive" tags :test #'string-equal))

Neural Stage (Enrichment)

(defun neuro-skill-inbox-processor (context)
  (let* ((payload (getf context :payload))
         (content (getf payload :content))
         (tags (getf payload :tags))
         (is-archive (inbox-is-archive-p tags)))
    (ask-neuro content :system-prompt
      (format nil "You are the PSF Librarian. Your goal is to ENRICH this Org-mode capture.
RULES:
1. Create a '** Summary' sub-heading with a 1-sentence summary.
2. Create a '** Significance' sub-heading with a paragraph explaining why this matters to a Sovereign Lisp Machine and how it can be used.
3. ~:[~;~* ARCHIVE MODE: Extract the full text of the item into a '** Full Text' sub-heading, preserving Org-mode structure.~]
4. Return ONLY a Lisp plist with :summary :significance :full-text.
5. NO conversational filler." is-archive))))

Symbolic Stage (The Physical Move)

(defun inbox-process-logic (action context)
  (declare (ignore action))
  (let* ((payload (getf context :payload))
         (sensor (getf payload :sensor)))
    (when (eq sensor :heartbeat)
      (let* ((base-dir (or (uiop:getenv "MEMEX_DIR") "/home/user/memex/"))
             (inbox-path (merge-pathnames "inbox.org" base-dir)))
        (org-agent:kernel-log "INBOX - Scanning ~a for migration..." (uiop:native-namestring inbox-path))
        ;; Physical move logic would go here using Org AST parsing
        '(:target :system :payload (:action :message :text "Inbox processing complete (Simulation)."))))))

Registration

(defskill :skill-inbox-processor
  :priority 100
  :trigger (lambda (context) (eq (getf (getf context :payload) :sensor) :heartbeat))
  :neuro #'neuro-skill-inbox-processor
  :symbolic #'inbox-process-logic)