#+TITLE: SKILL: Project Foundry Agent (Universal Literate Note) #+ID: skill-project-foundry #+STARTUP: content #+FILETAGS: :foundry:scaffolding:system:psf: * Overview The *Project Foundry Agent* is responsible for the physical instantiation of new projects. It automates directory creation, version control initialization, and GTD integration, ensuring every new project adheres to PSF mandates. * Phase A: Demand (PRD) :PROPERTIES: :STATUS: FROZEN :END: ** 1. Purpose Define automated project instantiation behaviors for the PSF. ** 2. User Needs - *Workspace Scaffolding:* Create standard `src/`, `tests/`, `docs/` layout and boilerplate files. - *Version Control:* Initialize Git in new project directories. - *GTD Integration:* Automatically append projects and initial tasks to `gtd.org`. - *Safety:* Prevent overwriting existing projects and log all actions. ** 3. Success Criteria *** TODO Structural Compliance *** TODO GTD Linkage Verification *** TODO Idempotency Check * Phase B: Blueprint (PROTOCOL) :PROPERTIES: :STATUS: SIGNED :END: ** 1. Architectural Intent Interfaces for project scaffolding and triggering. Source of truth is the filesystem and `gtd.org`. ** 2. Semantic Interfaces #+begin_src lisp (defun scaffold-project (name type) "Physically creates the PSF project structure and links it to GTD.") (defun trigger-skill-project-foundry (context) "Triggers on :sensor :delegation :target-skill :foundry.") #+end_src * Phase D: Build (Implementation) ** Workspace Scaffolding #+begin_src lisp :tangle projects/org-skill-project-foundry/src/foundry-logic.lisp (defun scaffold-project (name type) "Physically creates the material PSF project and the Universal Literate Note." (let* ((projects-dir (or (uiop:getenv "PROJECTS_DIR") "projects/")) (notes-dir (or (uiop:getenv "MEMEX_NOTES") "notes/")) (skills-dir (or (uiop:getenv "SKILLS_DIR") "system/skills/")) (project-dir (format nil "~aorg-skill-~a/" projects-dir name)) (note-path (format nil "~aorg-skill-~a.org" notes-dir name)) (skill-link (format nil "~aorg-skill-~a.org" skills-dir name)) (gtd-file (or (uiop:getenv "GTD_FILE") "gtd.org")) (timestamp (local-time:format-timestring nil (local-time:now) :format '("[" :year "-" :month "-" :day " " :weekday "]")))) (if (or (uiop:directory-exists-p project-dir) (uiop:file-exists-p note-path)) (format nil "ERROR - Project or Note for ~a already exists." name) (progn (kernel-log "FOUNDRY - Scaffolding Universal PSF project: ~a" name) ;; 1. Create Material Project Structure (ensure-directories-exist (format nil "~asrc/" project-dir)) (ensure-directories-exist (format nil "~atests/" project-dir)) (ensure-directories-exist (format nil "~adocs/" project-dir)) ;; 2. Create Universal Literate Note (with-open-file (out note-path :direction :output :if-exists :supersede) (format out "#+TITLE: SKILL: ~a (Universal Literate Note)~%#+ID: skill-~a~%#+STARTUP: content~%#+FILETAGS: :~a:psf:~%~%* Overview~%Automatically scaffolded ~a project.~%~%* Phase A: Demand (PRD)~%:PROPERTIES:~%:STATUS: DRAFT~%:END:~%~%** 1. Purpose~%Define the 'Why' and 'What' for ~a.~%" name name type name name)) ;; 3. Establish System Actuator Link (uiop:run-program (list "ln" "-sf" note-path skill-link)) ;; 4. Link to GTD.org (with-open-file (out gtd-file :direction :output :if-exists :append) (format out "~%** NEXT org-skill-~a~% :PROPERTIES:~% :ID: proj-~a~% :CREATED: ~a~% :PROJECT-PATH: ~a~% :PSF-STATE: A: DEMAND~% :END:~% Drafted by Project Foundry.~%" name name timestamp project-dir)) (format nil "SUCCESS - Universal PSF Project ~a scaffolded." name))))) #+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