From 5068e4a2c5ea0c3f3d232f299c6b596e822717ae Mon Sep 17 00:00:00 2001 From: Amr Gharbeia Date: Tue, 28 Apr 2026 19:57:56 -0400 Subject: [PATCH] fix(skills): implement symbol exporting for dynamic loading --- harness/skills.org | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/harness/skills.org b/harness/skills.org index ce5bca5..659f837 100644 --- a/harness/skills.org +++ b/harness/skills.org @@ -185,6 +185,26 @@ The ~opencortex~ Skill Engine enables **Late-Binding Intelligence**, allowing th (let ((new-pkg (make-package pkg-name :use '(:cl)))) (use-package :opencortex new-pkg))) (let ((*read-eval* nil) (*package* (find-package pkg-name))) (eval (read-from-string (format nil "(progn ~a)" lisp-code)))) + + ;; Export symbols back to :OPENCORTEX for discoverability and testing + (let* ((target-pkg (find-package :opencortex)) + (raw-name (string-upcase skill-base-name)) + (short-name (if (uiop:string-prefix-p "ORG-SKILL-" raw-name) + (subseq raw-name 10) + raw-name))) + (do-symbols (sym (find-package pkg-name)) + (when (eq (symbol-package sym) (find-package pkg-name)) + (let ((sn (symbol-name sym))) + (when (or (uiop:string-prefix-p raw-name sn) + (uiop:string-prefix-p short-name sn)) + (harness-log "LOADER: Exporting ~a to :OPENCORTEX" sn) + ;; Resolve potential name conflicts by uninterning first + (let ((existing (find-symbol sn target-pkg))) + (when (and existing (not (eq existing sym))) + (unintern existing target-pkg))) + (import sym target-pkg) + (export sym target-pkg)))))) + (setf (skill-entry-status entry) :ready))) t) (error (c)