fix(reason): Mandate strict sexp output and implement cognitive extraction safety
Some checks failed
Deploy-Agent-V15-Stdin / JOB-V15-STDIN (push) Failing after 3s

This commit is contained in:
2026-04-19 20:51:48 -04:00
parent 6be28ba790
commit 5a164363b8
8 changed files with 798 additions and 103 deletions

View File

@@ -42,15 +42,17 @@
assistant-name global-context tool-belt system-logs)))
(let* ((thought (probabilistic-call raw-prompt :system-prompt system-prompt :context context))
(cleaned (if (stringp thought) (string-trim '(#\Space #\Newline #\Tab) thought) thought)))
(if (stringp cleaned)
(if (and cleaned (stringp cleaned))
(let ((*read-eval* nil))
(handler-case
(let ((parsed (read-from-string cleaned)))
(if (and (listp parsed) (getf parsed :response))
(list :TYPE :CHAT :TEXT (getf parsed :response))
parsed))
(error (c) (list :type :EVENT :payload (list :sensor :syntax-error :code cleaned :error (format nil "~a" c))))))
cleaned)))))
(if (and (> (length cleaned) 0) (char= (char cleaned 0) #\())
(handler-case
(let ((parsed (read-from-string cleaned)))
(if (and (listp parsed) (member (proto-get parsed :TYPE) '(:CHAT :REQUEST :EVENT :STATUS :RESPONSE)))
parsed
(list :TYPE :CHAT :TEXT cleaned)))
(error (c) (list :TYPE :CHAT :TEXT cleaned)))
(list :TYPE :CHAT :TEXT cleaned)))
thought)))))
(defun deterministic-verify (proposed-action context)
"Iterates through all skill deterministic-gates sorted by priority."