94 lines
4.4 KiB
Org Mode
94 lines
4.4 KiB
Org Mode
#+TITLE: SKILL: Project Manager Agent (Executive Presence)
|
|
#+ID: skill-project-manager-agent
|
|
#+STARTUP: content
|
|
|
|
* Overview
|
|
The **Project Manager Agent** provides the "Executive Presence" required to maintain a high-functioning workspace. It leverages the structured metadata of the Memex (specifically the `:PROJECT_PATH:`) to monitor project health, track Git status, and assist the user in managing the project lifecycle.
|
|
|
|
* The Management Mandate
|
|
1. **Visibility:** The agent must always be able to resolve a project's physical location and gather "folder facts" (files, git state).
|
|
2. **Contextual Awareness:** Triggers should be sensitive both to explicit status requests and to implicit context (e.g., when the user is editing a project node).
|
|
3. **Lifecycle Support:** The agent assists in the transition between project states by suggesting commit messages and identifying uncommitted work.
|
|
|
|
* Symbolic Implementation (The Logic)
|
|
The implementation focuses on gathering telemetry from the filesystem and version control system.
|
|
|
|
** Architectural Intent: Contextual Trigger
|
|
This trigger monitors for direct status queries or for buffer updates involving the `:PROJECT_PATH:` property, ensuring the manager is active whenever the user is working on a specific project.
|
|
|
|
#+begin_src lisp
|
|
(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))))))
|
|
#+end_src
|
|
|
|
** Architectural Intent: Diagnostic Retrieval
|
|
These functions interface with the host OS to gather raw data about the project directory, providing the cognitive layer with the "facts" of the environment.
|
|
|
|
#+begin_src lisp
|
|
(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))))
|
|
#+end_src
|
|
|
|
** Architectural Intent: Neuro-Cognitive Status Report
|
|
The neural layer synthesizes the raw diagnostics and git diffs into a coherent executive summary, providing the user with actionable insights and commit suggestions.
|
|
|
|
#+begin_src lisp
|
|
(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)))
|
|
#+end_src
|
|
|
|
* Registration
|
|
#+begin_src lisp
|
|
(defskill :skill-project-manager
|
|
:priority 70
|
|
:trigger #'trigger-skill-project-manager
|
|
:neuro #'neuro-skill-project-manager
|
|
:symbolic (lambda (action context) action))
|
|
#+end_src
|