CHORE: Prepare for lisp-repair implementation
This commit is contained in:
@@ -157,7 +157,7 @@ Normalizes raw stimuli and updates the Object Store knowledge graph.
|
||||
#+end_src
|
||||
|
||||
*** Neuro Gate
|
||||
Invokes the neural System 1 engine to generate intuition-based proposals.
|
||||
Invokes the neural System 1 engine to generate intuition-based proposals. If parallel consensus is enabled, this gate returns a list of proposals.
|
||||
|
||||
#+begin_src lisp :tangle ../src/core.lisp
|
||||
(defun neuro-gate (signal)
|
||||
@@ -165,20 +165,44 @@ Invokes the neural System 1 engine to generate intuition-based proposals.
|
||||
(unless (eq (getf signal :type) :EVENT)
|
||||
(return-from neuro-gate signal))
|
||||
(kernel-log "GATE [Neuro]: Consulting System 1...")
|
||||
(let ((thought (think signal)))
|
||||
(setf (getf signal :proposals) (if thought (list thought) nil))
|
||||
(let ((thoughts (think signal)))
|
||||
(setf (getf signal :proposals) (if (and thoughts (listp thoughts) (listp (car thoughts)))
|
||||
thoughts
|
||||
(if thoughts (list thoughts) nil)))
|
||||
(setf (getf signal :status) :thought)
|
||||
signal))
|
||||
#+end_src
|
||||
|
||||
*** Consensus Gate
|
||||
Compares multiple proposals (from parallel backends) and selects the most consistent one. Currently acts as a pass-through for the primary proposal.
|
||||
Compares multiple proposals (from parallel backends) and selects the most consistent one.
|
||||
|
||||
#+begin_src lisp :tangle ../src/core.lisp
|
||||
(defun resolve-consensus (proposals signal)
|
||||
"Resolves diverging proposals by voting or selecting the safest one."
|
||||
(declare (ignore signal))
|
||||
(kernel-log "CONSENSUS: ~a proposals found. Resolving..." (length proposals))
|
||||
;; Simplified consensus: Majority vote or first safe one
|
||||
;; For now, we'll select the proposal that appears most frequently.
|
||||
(let ((counts (make-hash-table :test 'equal)))
|
||||
(dolist (p proposals)
|
||||
(incf (gethash p counts 0)))
|
||||
(let ((winner (first proposals))
|
||||
(max-count 0))
|
||||
(maphash (lambda (p count)
|
||||
(when (> count max-count)
|
||||
(setq max-count count
|
||||
winner p)))
|
||||
counts)
|
||||
(kernel-log "CONSENSUS: Winner selected with ~a votes." max-count)
|
||||
winner)))
|
||||
|
||||
(defun consensus-gate (signal)
|
||||
"Resolves multiple proposals into a single candidate action."
|
||||
(let ((proposals (getf signal :proposals)))
|
||||
(setf (getf signal :candidate) (first proposals))
|
||||
(if (and proposals (cdr proposals))
|
||||
(let ((winner (resolve-consensus proposals signal)))
|
||||
(setf (getf signal :candidate) winner))
|
||||
(setf (getf signal :candidate) (first proposals)))
|
||||
(setf (getf signal :status) :consensus)
|
||||
signal))
|
||||
#+end_src
|
||||
@@ -273,6 +297,20 @@ Moves a signal through the gates in a flat loop, handling feedback signals witho
|
||||
:payload (list :sensor :loop-error :message (format nil "~a" c) :depth depth)))))))))))
|
||||
#+end_src
|
||||
|
||||
** Delegation Mechanisms
|
||||
Allows the core to hand off tasks to specialized background agents or processes.
|
||||
|
||||
#+begin_src lisp :tangle ../src/core.lisp
|
||||
(defun delegate-task (task-id recipient &key context)
|
||||
"Enqueues a task for another agent or background process."
|
||||
(kernel-log "ORCHESTRATOR: Delegating task ~a to ~a" task-id recipient)
|
||||
(inject-stimulus (list :type :EVENT
|
||||
:payload (list :sensor :delegation
|
||||
:task-id task-id
|
||||
:recipient recipient
|
||||
:context context))))
|
||||
#+end_src
|
||||
|
||||
** Heartbeat Mechanism
|
||||
Periodically injects a "pulse" into the system to trigger temporal skills (like cron jobs or reminders).
|
||||
|
||||
|
||||
Reference in New Issue
Block a user