PSF: Standardize core gates and refine skill loading mechanism

- Improved decide-gate to normalize candidates (wrap strings in RESPONSE)
- Refined load-skill-from-org to skip tangled blocks and Org properties
- Updated system definition and test suites for v1.0
This commit is contained in:
2026-04-12 13:38:29 -04:00
parent 397fcc5e8c
commit 04df131f63
13 changed files with 234 additions and 62 deletions

View File

@@ -124,3 +124,60 @@ The `package.lisp` file defines the public API of the `org-agent` kernel. It exp
#:set-llm-model
#:get-llm-model))
#+end_src
** Package Implementation
#+begin_src lisp :tangle ../src/package.lisp
(in-package :org-agent)
#+end_src
** Kernel Logging State
#+begin_src lisp :tangle ../src/package.lisp
(defvar *system-logs* nil)
(defvar *logs-lock* (bt:make-lock "kernel-logs-lock"))
(defvar *max-log-history* 100)
#+end_src
** Skills Registry
#+begin_src lisp :tangle ../src/package.lisp
(defvar *skills-registry* (make-hash-table :test 'equal)
"Global registry of all loaded skills.")
#+end_src
** Skill Telemetry State
#+begin_src lisp :tangle ../src/package.lisp
(defvar *skill-telemetry* (make-hash-table :test 'equal))
(defvar *telemetry-lock* (bt:make-lock "kernel-telemetry-lock"))
#+end_src
** Cognitive Tool Registry
#+begin_src lisp :tangle ../src/package.lisp
(defvar *cognitive-tools* (make-hash-table :test 'equal))
(defstruct cognitive-tool
name
description
parameters
guard
body)
(defmacro def-cognitive-tool (name description parameters &key guard body)
`(setf (gethash (string-downcase (string ',name)) *cognitive-tools*)
(make-cognitive-tool :name (string-downcase (string ',name))
:description ,description
:parameters ',parameters
:guard ,guard
:body ,body)))
#+end_src
** Kernel Logging Implementation
#+begin_src lisp :tangle ../src/package.lisp
(defun kernel-log (msg &rest args)
"Centralized logging for the kernel."
(let ((formatted-msg (apply #'format nil msg args)))
(bt:with-lock-held (*logs-lock*)
(push formatted-msg *system-logs*)
(when (> (length *system-logs*) *max-log-history*)
(setq *system-logs* (subseq *system-logs* 0 *max-log-history*))))
(format t "~a~%" formatted-msg)
(finish-output)))
#+end_src