build: dynamically tangle to INSTALL_DIR without copying .org files
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
- Updated all 150+ :tangle headers across harness/ and skills/ to use elisp (expand-file-name) to target INSTALL_DIR dynamically. - Cleaned up environment/ directory depth by moving memory-image.lisp to state/. - Moved test scripts to tests/ and deleted redundant chat scripts.
This commit is contained in:
@@ -61,7 +61,7 @@ flowchart LR
|
||||
|
||||
** Global Skill Registry
|
||||
|
||||
#+begin_src lisp :tangle ./skills.lisp
|
||||
#+begin_src lisp :tangle (expand-file-name "skills.lisp" (concat (or (getenv "INSTALL_DIR") ".") "/harness"))
|
||||
(in-package :opencortex)
|
||||
|
||||
(defun COSINE-SIMILARITY (v1 v2)
|
||||
@@ -137,7 +137,7 @@ flowchart LR
|
||||
#+end_src
|
||||
|
||||
** Skill File Analysis (parse-skill-metadata)
|
||||
#+begin_src lisp :tangle ./skills.lisp
|
||||
#+begin_src lisp :tangle (expand-file-name "skills.lisp" (concat (or (getenv "INSTALL_DIR") ".") "/harness"))
|
||||
(defun parse-skill-metadata (filepath)
|
||||
"Extracts ID and DEPENDS_ON tags from org file."
|
||||
(let ((dependencies nil)
|
||||
@@ -160,7 +160,7 @@ flowchart LR
|
||||
#+end_src
|
||||
|
||||
** Dependency Resolution (topological-sort-skills)
|
||||
#+begin_src lisp :tangle ./skills.lisp
|
||||
#+begin_src lisp :tangle (expand-file-name "skills.lisp" (concat (or (getenv "INSTALL_DIR") ".") "/harness"))
|
||||
(defun topological-sort-skills (skills-dir)
|
||||
"Returns a list of skill filepaths sorted by dependency (dependencies first)."
|
||||
(let ((files (uiop:directory-files skills-dir "org-skill-*.org"))
|
||||
@@ -204,7 +204,7 @@ flowchart LR
|
||||
#+end_src
|
||||
|
||||
** Jailed Loading (load-skill-from-org)
|
||||
#+begin_src lisp :tangle ./skills.lisp
|
||||
#+begin_src lisp :tangle (expand-file-name "skills.lisp" (concat (or (getenv "INSTALL_DIR") ".") "/harness"))
|
||||
(defun validate-lisp-syntax (code-string)
|
||||
"Checks if a string contains valid, readable Common Lisp forms.
|
||||
Delegates to the Lisp Validator skill when available; falls back to a basic
|
||||
@@ -224,7 +224,7 @@ reader check during early boot before the validator skill is loaded."
|
||||
(values nil (or (getf result :reason) "Lisp Validator rejected code.")))))
|
||||
|
||||
(defun load-skill-from-org (filepath)
|
||||
"Parses and evaluates Lisp blocks with :tangle directives from an Org file.
|
||||
"Parses and evaluates Lisp blocks with :tangle (expand-file-name "directives" (concat (or (getenv "INSTALL_DIR") ".") "/harness")) from an Org file.
|
||||
Only loads blocks that specify a .lisp tangle target, ignoring tests and examples."
|
||||
(let* ((skill-base-name (pathname-name filepath))
|
||||
(entry (or (gethash skill-base-name *skill-catalog*) (make-skill-entry :filename skill-base-name))))
|
||||
@@ -243,12 +243,12 @@ Only loads blocks that specify a .lisp tangle target, ignoring tests and example
|
||||
(let ((clean-line (string-trim '(#\Space #\Tab #\Return) line)))
|
||||
(cond ((uiop:string-prefix-p "#+begin_src lisp" (string-downcase clean-line))
|
||||
(setf in-lisp-block t)
|
||||
;; Only collect blocks with a :tangle directive pointing to a
|
||||
;; Only collect blocks with a :tangle (expand-file-name "directive" (concat (or (getenv "INSTALL_DIR") ".") "/harness")) pointing to a
|
||||
;; runtime .lisp file (exclude tests and :tangle no)
|
||||
(let ((tl (string-downcase clean-line)))
|
||||
(setf collect-this-block
|
||||
(and (search ":tangle" tl)
|
||||
(not (search ":tangle no" tl))
|
||||
(not (search ":tangle (expand-file-name "no"" (concat (or (getenv "INSTALL_DIR") ".") "/harness")) tl))
|
||||
(search ".lisp" tl)
|
||||
(not (search "tests/" tl))
|
||||
(not (search "test/" tl))))))
|
||||
@@ -303,7 +303,7 @@ Only loads blocks that specify a .lisp tangle target, ignoring tests and example
|
||||
#+end_src
|
||||
|
||||
** Initializing All Skills (initialize-all-skills)
|
||||
#+begin_src lisp :tangle ./skills.lisp
|
||||
#+begin_src lisp :tangle (expand-file-name "skills.lisp" (concat (or (getenv "INSTALL_DIR") ".") "/harness"))
|
||||
(defun initialize-all-skills ()
|
||||
"Scans the directory defined by SKILLS_DIR and hot-loads skills using topological order."
|
||||
(let* ((env-path (uiop:getenv "SKILLS_DIR"))
|
||||
@@ -349,7 +349,7 @@ Only loads blocks that specify a .lisp tangle target, ignoring tests and example
|
||||
#+end_src
|
||||
|
||||
** Toolbelt Prompt Generation (generate-tool-belt-prompt)
|
||||
#+begin_src lisp :tangle ./skills.lisp
|
||||
#+begin_src lisp :tangle (expand-file-name "skills.lisp" (concat (or (getenv "INSTALL_DIR") ".") "/harness"))
|
||||
(defun generate-tool-belt-prompt ()
|
||||
"Aggregates all registered cognitive tools into a descriptive prompt."
|
||||
(let ((output (format nil "AVAILABLE TOOLS:
|
||||
@@ -374,7 +374,7 @@ EXAMPLES:
|
||||
|
||||
** The Default Tool Belt
|
||||
*** The Eval Tool (Internal Inspection)
|
||||
#+begin_src lisp :tangle ./skills.lisp
|
||||
#+begin_src lisp :tangle (expand-file-name "skills.lisp" (concat (or (getenv "INSTALL_DIR") ".") "/harness"))
|
||||
(def-cognitive-tool :eval "Evaluates raw Common Lisp code in the harness image. Use this for complex calculations or internal state inspection."
|
||||
((:code :type :string :description "The Lisp code to evaluate"))
|
||||
:guard (lambda (args context)
|
||||
@@ -392,7 +392,7 @@ EXAMPLES:
|
||||
#+end_src
|
||||
|
||||
*** The Grep Tool (File Discovery)
|
||||
#+begin_src lisp :tangle ./skills.lisp
|
||||
#+begin_src lisp :tangle (expand-file-name "skills.lisp" (concat (or (getenv "INSTALL_DIR") ".") "/harness"))
|
||||
(def-cognitive-tool :grep-search "Searches for a pattern in the project files."
|
||||
((:pattern :type :string :description "The regex pattern to search for")
|
||||
(:dir :type :string :description "Directory to search in (default is project root)"))
|
||||
@@ -404,7 +404,7 @@ EXAMPLES:
|
||||
#+end_src
|
||||
|
||||
*** The Shell Tool (Machine Actuation)
|
||||
#+begin_src lisp :tangle ./skills.lisp
|
||||
#+begin_src lisp :tangle (expand-file-name "skills.lisp" (concat (or (getenv "INSTALL_DIR") ".") "/harness"))
|
||||
(def-cognitive-tool :shell "Executes a shell command on the local machine. Use this for file operations, system checks, or running tests."
|
||||
((:cmd :type :string :description "The full bash command to execute"))
|
||||
:guard (lambda (args context)
|
||||
@@ -419,7 +419,7 @@ EXAMPLES:
|
||||
#+end_src
|
||||
|
||||
*** The Reload-Skill Tool (Hot Reload)
|
||||
#+begin_src lisp :tangle ./skills.lisp
|
||||
#+begin_src lisp :tangle (expand-file-name "skills.lisp" (concat (or (getenv "INSTALL_DIR") ".") "/harness"))
|
||||
(def-cognitive-tool :reload-skill "Reloads a skill from its Org-mode source file, recompiling into the live image without restarting the daemon."
|
||||
((:skill :type :string :description "The skill name (e.g., \"org-skill-policy\") or full path to the .org file"))
|
||||
:guard (lambda (args context)
|
||||
@@ -455,7 +455,7 @@ EXAMPLES:
|
||||
#+end_src
|
||||
|
||||
*** The File Read Tool (V 0.2.0 File I/O)
|
||||
#+begin_src lisp :tangle ./skills.lisp
|
||||
#+begin_src lisp :tangle (expand-file-name "skills.lisp" (concat (or (getenv "INSTALL_DIR") ".") "/harness"))
|
||||
(def-cognitive-tool :read-file "Reads the contents of a file as a string."
|
||||
((:file :type :string :description "The path to the file to read"))
|
||||
:guard (lambda (args context)
|
||||
@@ -474,7 +474,7 @@ EXAMPLES:
|
||||
#+end_src
|
||||
|
||||
*** The File Write Tool (V 0.2.0 File I/O)
|
||||
#+begin_src lisp :tangle ./skills.lisp
|
||||
#+begin_src lisp :tangle (expand-file-name "skills.lisp" (concat (or (getenv "INSTALL_DIR") ".") "/harness"))
|
||||
(def-cognitive-tool :write-file "Writes content to a file, creating it if it doesn't exist."
|
||||
((:file :type :string :description "The path to the file to write")
|
||||
(:content :type :string :description "The content to write")
|
||||
@@ -506,7 +506,7 @@ EXAMPLES:
|
||||
#+end_src
|
||||
|
||||
*** The String Replace Tool (V 0.2.0 File I/O)
|
||||
#+begin_src lisp :tangle ./skills.lisp
|
||||
#+begin_src lisp :tangle (expand-file-name "skills.lisp" (concat (or (getenv "INSTALL_DIR") ".") "/harness"))
|
||||
(def-cognitive-tool :replace-string "Replaces occurrences of old-string with new-string in a file."
|
||||
((:file :type :string :description "The path to the file")
|
||||
(:old :type :string :description "The substring to find and replace")
|
||||
@@ -541,7 +541,7 @@ EXAMPLES:
|
||||
These tests verify the Skill Engine and loader. Run with:
|
||||
~(fiveam:run! 'boot-suite)~
|
||||
|
||||
#+begin_src lisp :tangle ./tests/boot-sequence-tests.lisp
|
||||
#+begin_src lisp :tangle (expand-file-name "tests/boot-sequence-tests.lisp" (concat (or (getenv "INSTALL_DIR") ".") "/harness"))
|
||||
(defpackage :opencortex-boot-tests
|
||||
(:use :cl :fiveam :opencortex)
|
||||
(:export #:boot-suite))
|
||||
@@ -583,7 +583,7 @@ These tests verify the Skill Engine and loader. Run with:
|
||||
"Verify that skills are loaded into their own packages."
|
||||
(let ((tmp-skill "/tmp/org-skill-jail-test.org"))
|
||||
(with-open-file (out tmp-skill :direction :output :if-exists :supersede)
|
||||
(format out ":PROPERTIES:~%:ID: jail-test-id~%:END:~%#+TITLE: Jail Test Skill~%#+begin_src lisp :tangle no~(defun jail-test-fn () t)~#+end_src"))
|
||||
(format out ":PROPERTIES:~%:ID: jail-test-id~%:END:~%#+TITLE: Jail Test Skill~%#+begin_src lisp :tangle (expand-file-name "no~(defun" (concat (or (getenv "INSTALL_DIR") ".") "/harness")) jail-test-fn () t)~#+end_src"))
|
||||
(unwind-protect
|
||||
(progn
|
||||
(opencortex::load-skill-from-org tmp-skill)
|
||||
|
||||
Reference in New Issue
Block a user