Files
memex/system/skills/org-skill-workspace-manager.org

66 lines
3.2 KiB
Org Mode

#+TITLE: SKILL: Workspace Manager Agent (PARA/Memex Maintenance)
#+ID: skill-workspace-manager-agent
#+STARTUP: content
* Overview
The **Workspace Manager Agent** is responsible for the ongoing maintenance and organization of the Memex workspace. It automates the "housekeeping" aspects of the PARA/Zettelkasten workflow, such as archiving completed tasks and identifying inbox items that require structural attention.
* The Maintenance Mandate
1. **Clutter Reduction:** Automatically identify tasks marked as DONE and suggest archiving them to preserve the performance of active note files.
2. **Workflow Alignment:** Ensure that the workspace remains consistent with the user's PARA directory structure.
3. **Proactive Organization:** Triggers on both buffer saves and background heartbeats to ensure the workspace stays optimized without manual intervention.
* Symbolic Implementation (The Logic)
The implementation focuses on the efficient identification of "stale" or completed nodes within the object store.
** Architectural Intent: Dual Perception
Triggers on both direct user edits (buffer updates) and temporal pulses (heartbeats), ensuring that the manager can provide both real-time feedback and autonomous cleanup.
#+begin_src lisp
(defun trigger-skill-workspace-manager (context)
(let* ((payload (getf context :payload))
(sensor (getf payload :sensor)))
(or (eq sensor :buffer-update)
(eq sensor :heartbeat))))
#+end_src
** Architectural Intent: Stale Task Identification
This function audits the global object store for headlines in the `DONE` state. It returns a list of IDs to the cognitive layer, providing the "raw material" for an archiving suggestion.
#+begin_src lisp
(defun archive-completed-tasks ()
"Identify DONE tasks and suggest archiving."
(let ((done-tasks (org-agent:context-query-store :todo-state "DONE" :type :HEADLINE)))
(when done-tasks
(kernel-log "WORKSPACE - Found ~a tasks ready for archiving." (length done-tasks))
;; Return a list of IDs to move
(mapcar #'org-agent:org-object-id done-tasks))))
#+end_src
** Architectural Intent: Neuro-Cognitive Archive Drafting
The neural layer synthesizes the list of completed tasks into a polite archiving request, ensuring the user remains in control of significant workspace moves while reducing the cognitive load of routine maintenance.
#+begin_src lisp
(defun neuro-skill-workspace-manager (context)
(let ((ready-to-archive (archive-completed-tasks))
(archive-dir (org-agent::get-env "ARCHIVES_DIR" "/app/8_archives/")))
(if ready-to-archive
(format nil "
WORKSPACE UPDATE -
I found these tasks marked DONE in the Atomic Notes (Zettelkasten) - ~a
Suggest an Org-mode action to move them to the '~a' folder.
Return a Lisp plist - (:target :emacs :action :message :text \"I found completed tasks. Should I archive them?\")
" ready-to-archive archive-dir)
nil)))
#+end_src
* Registration
#+begin_src lisp
(defskill :skill-workspace-manager
:priority 40
:trigger #'trigger-skill-workspace-manager
:neuro #'neuro-skill-workspace-manager
:symbolic (lambda (action context) action))
#+end_src