fix(v0.2.0): finalize structural integrity and clean boot
Some checks failed
Deploy-Agent-V15-Stdin / JOB-V15-STDIN (push) Failing after 2s
Some checks failed
Deploy-Agent-V15-Stdin / JOB-V15-STDIN (push) Failing after 2s
- Fixed memory.org source blocks to ensure persistence functions are tangled. - Improved extract-tangle-target to handle complex Elisp expressions. - Corrected opencortex.sh initialization paths to prevent setup loops. - Reordered variable definitions in policy and standards skills to eliminate forward-reference warnings.
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
#+PROPERTY: header-args:lisp :tangle (expand-file-name "org-skill-engineering-standards.lisp" (concat (or (getenv "INSTALL_DIR") ".") "/skills"))
|
||||
:PROPERTIES:
|
||||
:ID: 37f2b59f-4537-4cca-ac7f-5c24b9e2e773
|
||||
:CREATED: [2026-03-30 Mon 21:16]
|
||||
@@ -105,16 +106,16 @@ You are forbidden from considering a task complete without updating ~gtd.org~. R
|
||||
|
||||
The engineering standards skill is a HARD BLOCK gate. Violations are rejected, not warned.
|
||||
|
||||
** Pre-Task Enforcement (Blocking)
|
||||
** Global Configuration
|
||||
|
||||
#+begin_src lisp :tangle (expand-file-name "org-skill-engineering-standards.lisp" (concat (or (getenv "INSTALL_DIR") ".") "/skills"))
|
||||
(in-package :opencortex)
|
||||
|
||||
(defvar *engineering-std-*project-root* nil
|
||||
(defvar *engineering-std-project-root* nil
|
||||
"Path to the project root for enforcement checks.")
|
||||
|
||||
(defun engineering-std-set-project-root (path)
|
||||
(setf *engineering-std-*project-root* (uiop:ensure-directory-pathname path)))
|
||||
(setf *engineering-std-project-root* (uiop:ensure-directory-pathname path)))
|
||||
|
||||
(defstruct engineering-violation
|
||||
(phase nil)
|
||||
@@ -133,12 +134,14 @@ The engineering standards skill is a HARD BLOCK gate. Violations are rejected, n
|
||||
(:post-task
|
||||
(:tests-pass "All tests must pass")
|
||||
(:no-artifacts "No orphaned .bak, .log, .tmp files"))))
|
||||
|
||||
(defvar *engineering-std-initialized* nil)
|
||||
#+end_src
|
||||
|
||||
** Git Clean Check (Blocking)
|
||||
|
||||
#+begin_src lisp :tangle (expand-file-name "org-skill-engineering-standards.lisp" (concat (or (getenv "INSTALL_DIR") ".") "/skills"))
|
||||
(defun verify-git-clean-p (&optional (dir *engineering-std-*project-root*))
|
||||
(defun verify-git-clean-p (&optional (dir *engineering-std-project-root*))
|
||||
"Returns T if the git repository at DIR has no uncommitted changes."
|
||||
(when dir
|
||||
(let ((status (uiop:run-program (list "git" "-C" (namestring dir) "status" "--porcelain")
|
||||
@@ -146,7 +149,7 @@ The engineering standards skill is a HARD BLOCK gate. Violations are rejected, n
|
||||
:ignore-error-status t)))
|
||||
(string= "" (string-trim '(#\Space #\Newline #\Tab) status)))))
|
||||
|
||||
(defun check-git-clean (&optional (dir *engineering-std-*project-root*))
|
||||
(defun check-git-clean (&optional (dir *engineering-std-project-root*))
|
||||
"Returns violation if git is dirty, nil if clean."
|
||||
(unless (verify-git-clean-p dir)
|
||||
(make-engineering-violation
|
||||
@@ -156,11 +159,69 @@ The engineering standards skill is a HARD BLOCK gate. Violations are rejected, n
|
||||
:severity :blocker)))
|
||||
#+end_src
|
||||
|
||||
** Blocking Gate (Hard Enforcement)
|
||||
|
||||
** Test Suite
|
||||
#+begin_src lisp :tangle (expand-file-name "org-skill-engineering-standards.lisp" (concat (or (getenv "INSTALL_DIR") ".") "/skills"))
|
||||
(defun engineering-standards-gate (action context)
|
||||
"The deterministic HARD BLOCK gate for Engineering Standards.
|
||||
|
||||
These tests verify the enforcement logic. Run with:
|
||||
~(fiveam:run! 'engineering-standards-suite)~
|
||||
BLOCKING checks (return :LOG on violation):
|
||||
- Git tree must be clean before file modifications
|
||||
|
||||
WARNING checks (log only):
|
||||
- Skill catalog should be queried first
|
||||
|
||||
Returns modified action, or :LOG/:EVENT on violation."
|
||||
(let* ((payload (getf action :payload))
|
||||
(tool (getf payload :tool))
|
||||
(file (getf payload :file))
|
||||
(code (getf payload :code))
|
||||
(modifies-files-p (or file code tool)))
|
||||
|
||||
;; BLOCKING: Git clean required for file modifications
|
||||
(when modifies-files-p
|
||||
(let ((git-check (check-git-clean *engineering-std-project-root*)))
|
||||
(when git-check
|
||||
(harness-log "~a" (engineering-violation-message git-check))
|
||||
(return-from engineering-standards-gate
|
||||
(list :type :log
|
||||
:payload (list :text (engineering-violation-message git-check)))))))
|
||||
|
||||
action))
|
||||
#+end_src
|
||||
|
||||
** Skill Registration
|
||||
|
||||
The skill runs at highest priority (1000) to block violations before any other skill.
|
||||
|
||||
#+begin_src lisp :tangle (expand-file-name "org-skill-engineering-standards.lisp" (concat (or (getenv "INSTALL_DIR") ".") "/skills"))
|
||||
(defskill :skill-engineering-standards
|
||||
:priority 1000
|
||||
:trigger (lambda (ctx)
|
||||
(declare (ignore ctx))
|
||||
t)
|
||||
:probabilistic nil
|
||||
:deterministic #'engineering-standards-gate)
|
||||
#+end_src
|
||||
|
||||
** Initialize Project Root
|
||||
|
||||
#+begin_src lisp :tangle (expand-file-name "org-skill-engineering-standards.lisp" (concat (or (getenv "INSTALL_DIR") ".") "/skills"))
|
||||
(defun engineering-std-init ()
|
||||
"Initialize the enforcement system with project root."
|
||||
(unless *engineering-std-initialized*
|
||||
(let ((env-root (or (uiop:getenv "OPENCORTEX_ROOT")
|
||||
(uiop:getenv "MEMEX_DIR")
|
||||
"/home/user/memex/projects/opencortex")))
|
||||
(engineering-std-set-project-root env-root)
|
||||
(setf *engineering-std-initialized* t)
|
||||
(harness-log "ENGINEERING STANDARDS: Initialized with root ~a" *engineering-std-project-root*))))
|
||||
|
||||
;; Auto-initialize on load
|
||||
(engineering-std-init)
|
||||
#+end_src
|
||||
|
||||
* Test Suite
|
||||
|
||||
#+begin_src lisp :tangle (expand-file-name "engineering-standards-tests.lisp" (concat (or (getenv "INSTALL_DIR") ".") "/tests"))
|
||||
(defpackage :opencortex-engineering-standards-tests
|
||||
@@ -227,70 +288,6 @@ These tests verify the enforcement logic. Run with:
|
||||
(is (eq :request (getf result :type))))))
|
||||
#+end_src
|
||||
|
||||
** Blocking Gate (Hard Enforcement)
|
||||
|
||||
#+begin_src lisp :tangle (expand-file-name "org-skill-engineering-standards.lisp" (concat (or (getenv "INSTALL_DIR") ".") "/skills"))
|
||||
(defun engineering-standards-gate (action context)
|
||||
"The deterministic HARD BLOCK gate for Engineering Standards.
|
||||
|
||||
BLOCKING checks (return :LOG on violation):
|
||||
- Git tree must be clean before file modifications
|
||||
|
||||
WARNING checks (log only):
|
||||
- Skill catalog should be queried first
|
||||
|
||||
Returns modified action, or :LOG/:EVENT on violation."
|
||||
(let* ((payload (getf action :payload))
|
||||
(tool (getf payload :tool))
|
||||
(file (getf payload :file))
|
||||
(code (getf payload :code))
|
||||
(modifies-files-p (or file code tool)))
|
||||
|
||||
;; BLOCKING: Git clean required for file modifications
|
||||
(when modifies-files-p
|
||||
(let ((git-check (check-git-clean *engineering-std-*project-root*)))
|
||||
(when git-check
|
||||
(harness-log "~a" (engineering-violation-message git-check))
|
||||
(return-from engineering-standards-gate
|
||||
(list :type :log
|
||||
:payload (list :text (engineering-violation-message git-check)))))))
|
||||
|
||||
action))
|
||||
#+end_src
|
||||
|
||||
** Skill Registration
|
||||
|
||||
The skill runs at highest priority (1000) to block violations before any other skill.
|
||||
|
||||
#+begin_src lisp :tangle (expand-file-name "org-skill-engineering-standards.lisp" (concat (or (getenv "INSTALL_DIR") ".") "/skills"))
|
||||
(defskill :skill-engineering-standards
|
||||
:priority 1000
|
||||
:trigger (lambda (ctx)
|
||||
(declare (ignore ctx))
|
||||
t)
|
||||
:probabilistic nil
|
||||
:deterministic #'engineering-standards-gate)
|
||||
#+end_src
|
||||
|
||||
** Initialize Project Root
|
||||
|
||||
#+begin_src lisp :tangle (expand-file-name "org-skill-engineering-standards.lisp" (concat (or (getenv "INSTALL_DIR") ".") "/skills"))
|
||||
(defvar *engineering-std-initialized* nil)
|
||||
|
||||
(defun engineering-std-init ()
|
||||
"Initialize the enforcement system with project root."
|
||||
(unless *engineering-std-initialized*
|
||||
(let ((env-root (or (uiop:getenv "OPENCORTEX_ROOT")
|
||||
(uiop:getenv "MEMEX_DIR")
|
||||
"/home/user/memex/projects/opencortex")))
|
||||
(engineering-std-set-project-root env-root)
|
||||
(setf *engineering-std-initialized* t)
|
||||
(harness-log "ENGINEERING STANDARDS: Initialized with root ~a" *engineering-std-*project-root*))))
|
||||
|
||||
;; Auto-initialize on load
|
||||
(engineering-std-init)
|
||||
#+end_src
|
||||
|
||||
* See Also
|
||||
- [[file:org-skill-literate-programming.org][Literate Programming Skill]] - Structural validation and tangle rules
|
||||
- [[file:org-skill-policy.org][Policy Skill]] - Constitutional constraints
|
||||
|
||||
Reference in New Issue
Block a user