feat(arch): finalize Universal Literate Note transition for all projects and skills
This commit is contained in:
@@ -1,34 +0,0 @@
|
||||
#+TITLE: PRD: Skill - Project Foundry Agent
|
||||
#+STATUS: FROZEN
|
||||
#+AUTHOR: Agent
|
||||
#+CREATED: [2026-03-31 Tue 14:15]
|
||||
|
||||
* 1. Purpose
|
||||
Define the automated project instantiation behaviors for the PSF. The Project Foundry skill transforms a natural language project request (Demand) into a physically scaffolded, high-integrity project structure (Blueprint).
|
||||
|
||||
* 2. User Needs
|
||||
|
||||
** 2.1 Workspace Scaffolding
|
||||
As a user (Amr), I need a consistent environment for every new project.
|
||||
- The Foundry MUST create the standard PSF directory layout (`src/`, `tests/`, `docs/`).
|
||||
- It MUST generate boilerplate literate files: `README.org`, `PRD.org`, and `PROTOCOL.org`.
|
||||
|
||||
** 2.2 Version Control Initialization
|
||||
I need every project to be a Git repository from day one.
|
||||
- The Foundry MUST run `git init` in the new project directory.
|
||||
|
||||
** 2.3 GTD Integration
|
||||
I need new projects to be automatically tracked in my task management system.
|
||||
- The Foundry MUST append the project and its initial tasks (`Draft PRD`, `Draft PROTOCOL`) to `gtd.org`.
|
||||
- It MUST use `org-edna` or sibling-based triggers to maintain sequential integrity.
|
||||
|
||||
** 2.4 Idempotency and Safety
|
||||
I need to prevent accidental data loss.
|
||||
- The Foundry MUST NOT overwrite an existing project directory.
|
||||
- It MUST log all physical actions to the kernel log.
|
||||
|
||||
* 3. Success Criteria
|
||||
- [ ] **Structural Compliance:** Scaffolded project contains all required directories and files.
|
||||
- [ ] **GTD Linkage:** New project appears in `gtd.org` with correct properties (`:PROJECT-PATH:`, `:PSF-STATE:`).
|
||||
- [ ] **Literate Boilerplate:** Generated `PRD.org` and `PROTOCOL.org` contain the standard PSF templates.
|
||||
- [ ] **Error Handling:** Foundry returns a clean error message if the project directory already exists.
|
||||
@@ -1,33 +0,0 @@
|
||||
#+TITLE: PROTOCOL: Skill - Project Foundry Agent
|
||||
#+STATUS: SIGNED
|
||||
#+AUTHOR: Architect-Agent
|
||||
#+CREATED: [2026-03-31 Tue 14:20]
|
||||
|
||||
* 1. Architectural Intent
|
||||
This protocol defines the shared Lisp interfaces for the Project Foundry skill. It ensures that every project in the Memex is instantiated with high structural and semantic integrity.
|
||||
|
||||
* 2. Semantic Interfaces
|
||||
|
||||
** 2.1 Project Scaffolding
|
||||
#+begin_src lisp
|
||||
(defun scaffold-project (name type)
|
||||
"Physically creates the PSF project structure on disk and links it to GTD."
|
||||
)
|
||||
#+end_src
|
||||
|
||||
** 2.2 Trigger Perception
|
||||
#+begin_src lisp
|
||||
(defun trigger-skill-project-foundry (context)
|
||||
"Determines if the current context warrants a project instantiation."
|
||||
)
|
||||
#+end_src
|
||||
|
||||
** 2.3 Proposal Verification
|
||||
#+begin_src lisp
|
||||
(defun verify-skill-project-foundry (proposed-action context)
|
||||
"Validates the Neuro-cognitive proposal before physical actuation."
|
||||
)
|
||||
#+end_src
|
||||
|
||||
* 3. Integration with GTD
|
||||
The Foundry MUST append a new project entry to `gtd.org` using the standard PSF template, including `:PSF-STATE: A: DEMAND` and `:TRIGGER: next-sibling!`.
|
||||
57
projects/org-skill-project-foundry/src/foundry-logic.lisp
Normal file
57
projects/org-skill-project-foundry/src/foundry-logic.lisp
Normal file
@@ -0,0 +1,57 @@
|
||||
;;;; foundry-logic.lisp --- Universal project scaffolding.
|
||||
;;;; This file is TANGLED from notes/org-skill-project-foundry.org. DO NOT EDIT MANUALLY.
|
||||
|
||||
(defpackage :org-skill-project-foundry
|
||||
(:use :cl :uiop :local-time)
|
||||
(:export #:scaffold-project
|
||||
#:trigger-skill-project-foundry
|
||||
#:verify-skill-project-foundry))
|
||||
|
||||
(in-package :org-skill-project-foundry)
|
||||
|
||||
(defun kernel-log (message &rest args)
|
||||
(format t "~&[FOUNDRY] ~?" message args))
|
||||
|
||||
(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))))
|
||||
|
||||
(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 " " :hour ":" :min "]"))))
|
||||
|
||||
(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 "Scaffolding Universal PSF project: ~a" name)
|
||||
(ensure-directories-exist (format nil "~asrc/" project-dir))
|
||||
(ensure-directories-exist (format nil "~atests/" project-dir))
|
||||
(ensure-directories-exist (format nil "~adocs/" project-dir))
|
||||
(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))
|
||||
(uiop:run-program (list "ln" "-sf" note-path skill-link))
|
||||
(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)))))
|
||||
|
||||
(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)))
|
||||
Reference in New Issue
Block a user