From f26b6ccec763e4ed2d15e0af063c1ead840914ab Mon Sep 17 00:00:00 2001 From: Amr Gharbeia Date: Mon, 13 Apr 2026 16:38:59 -0400 Subject: [PATCH] ARCH: Rename system manifest and decouple all behavioral skills --- .../{system-definition.org => manifest.org} | 7 ++--- org-agent.asd | 3 +- skills/org-skill-engineering-standards.org | 12 +------- skills/org-skill-policy.org | 19 +++++++++--- src/engineering-standards.lisp | 30 ------------------- src/policy.lisp | 24 +++++++++++++++ src/system-invariants.lisp | 13 -------- 7 files changed, 44 insertions(+), 64 deletions(-) rename literate/{system-definition.org => manifest.org} (95%) delete mode 100644 src/engineering-standards.lisp create mode 100644 src/policy.lisp delete mode 100644 src/system-invariants.lisp diff --git a/literate/system-definition.org b/literate/manifest.org similarity index 95% rename from literate/system-definition.org rename to literate/manifest.org index b8176f3..5710532 100644 --- a/literate/system-definition.org +++ b/literate/manifest.org @@ -1,9 +1,9 @@ -#+TITLE: System Definition (org-agent.asd) +#+TITLE: Manifest (org-agent.asd) #+AUTHOR: Amr #+FILETAGS: :harness:system: #+STARTUP: content -* System Definition (org-agent.asd) +* Manifest (org-agent.asd) ** Architectural Intent: The ASDF Skeleton The ~org-agent.asd~ file is the physical blueprint of the Lisp Machine. It uses **Another System Definition Facility (ASDF)** to orchestrate the compilation and loading of all harness modules. @@ -40,8 +40,7 @@ This system defines the core "Thin Harness." It includes the protocol, the objec :serial t :components ((:file "src/package") (:file "src/skills") - (:file "src/system-invariants") - (:file "src/engineering-standards") + (:file "src/policy") (:file "src/communication-validator") (:file "src/communication") (:file "src/memory") diff --git a/org-agent.asd b/org-agent.asd index 2850c6d..7564074 100644 --- a/org-agent.asd +++ b/org-agent.asd @@ -8,8 +8,7 @@ :serial t :components ((:file "src/package") (:file "src/skills") - (:file "src/system-invariants") - (:file "src/engineering-standards") + (:file "src/policy") (:file "src/communication-validator") (:file "src/communication") (:file "src/memory") diff --git a/skills/org-skill-engineering-standards.org b/skills/org-skill-engineering-standards.org index 5b3e9d4..a6f8e7e 100644 --- a/skills/org-skill-engineering-standards.org +++ b/skills/org-skill-engineering-standards.org @@ -50,8 +50,7 @@ The Engineering Standards skill provides the deterministic enforcement of the wo * Phase D: Build (Implementation) ** Git Status Enforcement -#+begin_src lisp :tangle ../src/engineering-standards.lisp -(in-package :org-agent) +#+begin_src lisp (defun verify-git-clean-p (dir) "Returns T if the git repository at DIR has no uncommitted changes." @@ -77,15 +76,6 @@ The Engineering Standards skill provides the deterministic enforcement of the wo action)) #+end_src -** Skill Definition -#+begin_src lisp :tangle ../src/engineering-standards.lisp -(org-agent:defskill :skill-engineering-standards - :priority 900 ; High priority, runs before most skills - :trigger (lambda (ctx) t) ; Always active - :probabilistic nil - :deterministic #'engineering-standards-gate) -#+end_src - * See Also - [[file:org-skill-system-invariants.org][System Policy]] - [[file:../README.org][org-agent README]] diff --git a/skills/org-skill-policy.org b/skills/org-skill-policy.org index a5a3e57..7420c6f 100644 --- a/skills/org-skill-policy.org +++ b/skills/org-skill-policy.org @@ -10,7 +10,7 @@ * Overview The *Org-Agent* is a probabilistic-deterministic harness for a personal operating system. It uses Org-mode as its native memory and Common Lisp as its deterministic reasoning engine. -#+begin_src lisp :tangle ../src/system-invariants.lisp +#+begin_src lisp :tangle ../src/policy.lisp (in-package :org-agent) #+end_src @@ -23,12 +23,23 @@ The Deterministic Engine uses these headlines as a "Moral Compass" during the de ** 1. Sovereignty Above All Every action must increase the user's independence from centralized, proprietary platforms. If a tool or library introduces a dependency on a non-sovereign entity, it must be flagged for replacement. -#+begin_src lisp :tangle ../src/system-invariants.lisp +#+begin_src lisp :tangle ../src/policy.lisp (defun policy-check-sovereignty (action context) "Ensures the action does not violate the Sovereignty invariant." (declare (ignore context)) ;; Implementation placeholder action) + +(defun policy-deterministic-gate (action context) + "The main policy gate. Sub-calls engineering standards if available." + (let ((current-action (policy-check-sovereignty action context))) + (when current-action + (let ((eng-pkg (find-package :org-agent.skills.org-skill-engineering-standards))) + (when eng-pkg + (let ((eng-gate (find-symbol "ENGINEERING-STANDARDS-GATE" eng-pkg))) + (when (and eng-gate (fboundp eng-gate)) + (setf current-action (funcall (symbol-function eng-gate) current-action context))))))) + current-action)) #+end_src ** 2. Technical Mastery & Mentorship @@ -46,10 +57,10 @@ Prioritize local, energy-efficient, and offline-first architectures. The "Memex" * Operational Mandates Every action performed by an agent in this environment must also adhere to the [[file:../../org-agent-contrib/org-skill-engineering-standards.org][Engineering Standards]]. -#+begin_src lisp :tangle ../src/system-invariants.lisp +#+begin_src lisp :tangle ../src/policy.lisp (defskill :skill-policy :priority 100 :trigger (lambda (ctx) t) :probabilistic nil - :deterministic #'policy-check-sovereignty) + :deterministic #'policy-deterministic-gate) #+end_src diff --git a/src/engineering-standards.lisp b/src/engineering-standards.lisp deleted file mode 100644 index f4da36e..0000000 --- a/src/engineering-standards.lisp +++ /dev/null @@ -1,30 +0,0 @@ -(in-package :org-agent) - -(defun verify-git-clean-p (dir) - "Returns T if the git repository at DIR has no uncommitted changes." - (let ((status (uiop:run-program (list "git" "-C" (namestring dir) "status" "--porcelain") - :output :string - :ignore-error-status t))) - (string= "" (string-trim '(#\Space #\Newline #\Tab) status)))) - -(defun engineering-standards-gate (action context) - "Physically enforces the 'Commit Before Modify' rule." - (let* ((payload (getf action :payload)) - (act (or (getf payload :action) (getf action :action))) - (target-file (getf payload :file))) - - ;; If the action involves modifying files, check git status - (when (member act '(:modify-file :write-file :replace :rename-file :delete-file)) - (let ((proj-root (asdf:system-source-directory :org-agent))) - (unless (verify-git-clean-p proj-root) - (harness-log "DETERMINISTIC [Standards]: BLOCKING ACTION. Working tree is dirty. Commit changes before modification.") - (return-from engineering-standards-gate - (list :type :LOG :payload (list :text "Engineering Standard Violation: Working tree dirty. You MUST commit before modifying files.")))))) - - action)) - -(org-agent:defskill :skill-engineering-standards - :priority 900 ; High priority, runs before most skills - :trigger (lambda (ctx) t) ; Always active - :probabilistic nil - :deterministic #'engineering-standards-gate) diff --git a/src/policy.lisp b/src/policy.lisp new file mode 100644 index 0000000..7b0f359 --- /dev/null +++ b/src/policy.lisp @@ -0,0 +1,24 @@ +(in-package :org-agent) + +(defun policy-check-sovereignty (action context) + "Ensures the action does not violate the Sovereignty invariant." + (declare (ignore context)) + ;; Implementation placeholder + action) + +(defun policy-deterministic-gate (action context) + "The main policy gate. Sub-calls engineering standards if available." + (let ((current-action (policy-check-sovereignty action context))) + (when current-action + (let ((eng-pkg (find-package :org-agent.skills.org-skill-engineering-standards))) + (when eng-pkg + (let ((eng-gate (find-symbol "ENGINEERING-STANDARDS-GATE" eng-pkg))) + (when (and eng-gate (fboundp eng-gate)) + (setf current-action (funcall (symbol-function eng-gate) current-action context))))))) + current-action)) + +(defskill :skill-policy + :priority 100 + :trigger (lambda (ctx) t) + :probabilistic nil + :deterministic #'policy-deterministic-gate) diff --git a/src/system-invariants.lisp b/src/system-invariants.lisp deleted file mode 100644 index 8c4affc..0000000 --- a/src/system-invariants.lisp +++ /dev/null @@ -1,13 +0,0 @@ -(in-package :org-agent) - -(defun policy-check-sovereignty (action context) - "Ensures the action does not violate the Sovereignty invariant." - (declare (ignore context)) - ;; Implementation placeholder - action) - -(defskill :skill-policy - :priority 100 - :trigger (lambda (ctx) t) - :probabilistic nil - :deterministic #'policy-check-sovereignty)