Files
memex/notes/skill-project-manager.org

3.0 KiB

#+TITLE - Project Manager Skill #+AUTHOR - org-agent #+SKILL_NAME - skill-project-manager

This skill provides the "Executive Presence" for project management. It uses the dynamic PROJECT_PATH to monitor project health and handle the lifecycle.

Trigger

Triggers on explicit project status requests or when a project heading is saved.

(defun trigger-skill-project-manager (context)
  (let* ((payload (getf context :payload))
         (text (or (getf payload :text) ""))
         (ast (getf payload :ast)))
    (or (search "project status" text :test #'string-equal)
        (and (eq (getf payload :sensor) :buffer-update)
             (search "PROJECT_PATH" (format nil "~a" ast))))))

Project Logic

(defun get-project-diagnostics (raw-path)
  "Resolves the path and gathers folder facts (git status, file list)."
  (let* ((resolved-path (org-agent:context-resolve-path raw-path))
         (ls-cmd (format nil "ls -F ~a" resolved-path))
         (git-cmd (format nil "git -C ~a status --short" resolved-path)))
    (if (uiop:directory-exists-p resolved-path)
        (let ((files (ignore-errors (uiop:run-program ls-cmd :output :string :ignore-error-status t)))
              (git (ignore-errors (uiop:run-program git-cmd :output :string :ignore-error-status t))))
          (format nil "FILES -~%~a~%GIT STATUS -~%~a" files (or git "Not a git repo or clean.")))
        "ERROR - Project directory not found at resolved path.")))

(defun get-git-diff (raw-path)
  "Returns the current uncommitted changes in the project."
  (let ((resolved (org-agent:context-resolve-path raw-path)))
    (handler-case
        (uiop:run-program (format nil "git -C ~a diff" resolved) :output :string)
      (error () nil))))

Neuro Prompt

(defun neuro-skill-project-manager (context)
  (let* ((payload (getf context :payload))
         (ast (getf payload :ast))
         ;; Extract the PROJECT_PATH from the current AST
         (path-match (nth-value 1 (cl-ppcre:scan-to-strings ":PROJECT_PATH: (\\$\\w+/[^\\s%]+)" (format nil "~a" ast)))))
    
    (if path-match
        (let* ((raw-path (aref path-match 0))
               (diagnostics (get-project-diagnostics raw-path))
               (diff (get-git-diff raw-path)))
          (format nil "
            You are the Project Manager.
            The user is looking at a project with path - ~a
            
            DIAGNOSTICS -
            ~a
            
            UNCOMMITTED CHANGES (Diff) -
            ---
            ~a
            ---
            
            TASK -
            1. Summarize the project status.
            2. If there are changes, suggest a 'git commit' message.
            3. Return a Lisp plist - (:target :emacs :action :message :text \"your report and commit suggestion\")
          " raw-path diagnostics (or diff "None.")))
        nil)))

Registration

(defskill :skill-project-manager
  :priority 70
  :trigger #'trigger-skill-project-manager
  :neuro #'neuro-skill-project-manager
  :symbolic (lambda (action context) action))