#+TITLE - Project Foundry Skill #+AUTHOR - org-agent #+SKILL_NAME - skill-project-foundry This skill allows the agent to scaffold new projects within the Memex workspace. It automates directory creation, git initialization, and links the project to the user's GTD system. * Trigger Triggers only when delegated to by the Router. #+begin_src lisp (defun trigger-skill-project-foundry (context) (let ((type (getf context :type)) (payload (getf context :payload))) (and (eq type :EVENT) (eq (getf payload :sensor) :delegation) (eq (getf payload :target-skill) :foundry)))) #+end_src * Scaffolding Logic #+begin_src lisp (defun scaffold-project (name type) "Physically creates the project structure on disk and links it to GTD." (let* ((projects-dir (org-agent::get-env "PROJECTS_DIR" "/app/5_projects/")) (project-dir (format nil "~a/~a/" projects-dir name)) (readme-path (format nil "~aREADME.org" project-dir)) (memex-dir (org-agent::get-env "MEMEX_DIR" "/app/")) (gtd-file (format nil "~a/gtd.org" (string-right-trim "/" memex-dir)))) (if (uiop:directory-exists-p project-dir) (format nil "ERROR - Project ~a already exists." name) (progn (kernel-log "FOUNDRY - Scaffolding ~a project: ~a" type name) ;; 1. Create directory (ensure-directories-exist project-dir) ;; 2. Initialize Git (via shell delegation) (org-agent:inject-stimulus `(:type :EVENT :payload (:action :run-command :target :shell :cmd ,(format nil "git init ~a" project-dir)))) ;; 3. Create Boilerplate README (with-open-file (out readme-path :direction :output :if-exists :supersede) (format out "#+TITLE - ~a~%#+AUTHOR - User~%#+DATE - ~a~%~%* Overview~%Automatically scaffolded ~a project.~%" name (get-universal-time) type)) ;; 4. Link to GTD.org (Homoiconic Connection) (with-open-file (out gtd-file :direction :output :if-exists :append) (format out "~%* PROJ ~a~% :PROPERTIES:~% :PROJECT_PATH: $PROJECTS_DIR/~a~% :ID: proj-~a~% :END:~% Drafted by Project Foundry.~%" name name (get-universal-time))) (format nil "SUCCESS - Project ~a scaffolded and linked to GTD.org" name))))) #+end_src * Neuro Prompt #+begin_src lisp (defun neuro-skill-project-foundry (context) (let* ((payload (getf context :payload)) (query (getf payload :query))) (format nil " You are the Project Foundry. The user wants to start a new project - '~a' Extract the PROJECT NAME and the PROJECT TYPE. Return a Lisp plist - (:target :foundry :action :scaffold :name \"extracted-name\" :type \"extracted-type\") " query))) #+end_src * Symbolic Verification & Actuation #+begin_src lisp (defun verify-skill-project-foundry (proposed-action context) (let* ((payload (getf proposed-action :payload)) (action (getf proposed-action :action)) (name (getf payload :name)) (type (getf payload :type))) (if (eq action :scaffold) (let ((result (scaffold-project name type))) `(:target :emacs :action :message :text ,result)) nil))) #+end_src * Registration #+begin_src lisp (defskill :skill-project-foundry :priority 80 :trigger #'trigger-skill-project-foundry :neuro #'neuro-skill-project-foundry :symbolic #'verify-skill-project-foundry) #+end_src