feat(arch): finalize Universal Literate Note transition for all projects and skills
This commit is contained in:
@@ -44,16 +44,76 @@ Interfaces for blueprint actuation and requirement perception. Source of truth i
|
||||
|
||||
* Phase D: Build (Implementation)
|
||||
|
||||
** PRD Perception
|
||||
#+begin_src lisp :tangle projects/org-skill-architect/src/architect-logic.lisp
|
||||
(defun architect-perceive-frozen-prd (note-path)
|
||||
"Checks if a master note has a FROZEN PRD and lacks a Phase B section."
|
||||
(let ((content (uiop:read-file-string note-path)))
|
||||
(when (and (search "* Phase A: Demand (PRD)" content)
|
||||
(search ":STATUS: FROZEN" content)
|
||||
(not (search "* Phase B: Blueprint (PROTOCOL)" content)))
|
||||
`(:note-path ,note-path :content ,content))))
|
||||
|
||||
(defun architect-scan-all-notes ()
|
||||
"Scans all org-skill-*.org notes for demands ready for blueprinting."
|
||||
(let ((notes-dir (or (uiop:getenv "MEMEX_NOTES") "notes/"))
|
||||
(ready-notes '()))
|
||||
(dolist (file (uiop:directory-files notes-dir "org-skill-*.org"))
|
||||
(let ((status (architect-perceive-frozen-prd file)))
|
||||
(when status (push status ready-notes))))
|
||||
ready-notes))
|
||||
#+end_src
|
||||
|
||||
** Cognitive Trigger
|
||||
#+begin_src lisp :tangle projects/org-skill-architect/src/architect-logic.lisp
|
||||
(defun trigger-skill-architect (context)
|
||||
"Triggers on heartbeat if any master note is in a FROZEN PRD state."
|
||||
(let ((type (getf context :type))
|
||||
(payload (getf context :payload)))
|
||||
(when (and (eq type :EVENT) (eq (getf payload :sensor) :heartbeat))
|
||||
(let ((ready (architect-scan-all-notes)))
|
||||
(when ready
|
||||
(setf (getf (getf context :payload) :ready-notes) ready)
|
||||
t)))))
|
||||
#+end_src
|
||||
|
||||
** Neuro-Cognitive Prompt
|
||||
#+begin_src lisp :tangle projects/org-skill-architect/src/architect-logic.lisp
|
||||
(defun neuro-skill-architect (context)
|
||||
(let* ((payload (getf context :payload))
|
||||
(note (car (getf payload :ready-notes)))
|
||||
(note-path (getf note :note-path))
|
||||
(prd-content (getf note :content)))
|
||||
(format nil "
|
||||
You are the PSF Architect.
|
||||
The Master Note '~a' has a FROZEN PRD and needs a PROTOCOL.
|
||||
|
||||
NOTE CONTENT:
|
||||
---
|
||||
~a
|
||||
---
|
||||
|
||||
TASK:
|
||||
Draft the '* Phase B: Blueprint (PROTOCOL)' section.
|
||||
1. Define Architectural Intent.
|
||||
2. Define Semantic Interfaces using Lisp signatures.
|
||||
|
||||
Return a Lisp plist: (:target :architect :action :actuate :path \"~a\" :content \"...blueprint section...\")
|
||||
" note-path prd-content note-path)))
|
||||
#+end_src
|
||||
|
||||
** Blueprint Actuation
|
||||
#+begin_src lisp :tangle projects/org-skill-architect/src/architect-logic.lisp
|
||||
(defun architect-actuate (project-name blueprint-content)
|
||||
(let* ((projects-dir (or (uiop:getenv "PROJECTS_DIR") "projects/"))
|
||||
(project-dir (format nil "~a/~a/" projects-dir project-name))
|
||||
(protocol-path (format nil "~aPROTOCOL.org" project-dir)))
|
||||
(with-open-file (out protocol-path :direction :output :if-exists :supersede)
|
||||
(format out "#+TITLE: PROTOCOL: ~a~%#+AUTHOR: Architect-Agent~%#+STATUS: DRAFT~%~%~a"
|
||||
project-name blueprint-content))
|
||||
(format nil "SUCCESS - Architect established PROTOCOL for ~a" project-name)))
|
||||
(defun architect-actuate (action context)
|
||||
(let* ((payload (getf action :payload))
|
||||
(note-path (getf payload :path))
|
||||
(blueprint-content (getf payload :content)))
|
||||
|
||||
(kernel-log "ARCHITECT - Appending PROTOCOL to ~a" note-path)
|
||||
(with-open-file (out note-path :direction :output :if-exists :append)
|
||||
(format out "~%* Phase B: Blueprint (PROTOCOL)~%:PROPERTIES:~%:STATUS: SIGNED~%:END:~%~%~a"
|
||||
blueprint-content))
|
||||
(format nil "SUCCESS - Architect established PROTOCOL in ~a" note-path)))
|
||||
#+end_src
|
||||
|
||||
* Registration
|
||||
|
||||
Reference in New Issue
Block a user