REFAC: Consolidate LLM providers into Unified Gateway

This commit is contained in:
2026-04-09 20:25:13 -04:00
parent 2a99517dc8
commit 3b21ae6f6c
19 changed files with 494 additions and 760 deletions

View File

@@ -34,6 +34,9 @@ The agent's "Thought Stream" must be fully auditable. Hidden reasoning or obfusc
** 5. Long-Term Sustainability
Prioritize local, energy-efficient, and offline-first architectures. The "Memex" should be functional in a 100-year horizon.
** 6. Literate Granularity (One Function per Block)
To maintain the highest quality of literate programming, every Lisp function or macro must reside in its own dedicated `#+begin_src lisp` block. This ensures that each piece of logic can be surrounded by rich narrative explaining the "Why" and "How" of its specific implementation.
* Phase A: Demand (PRD)
:PROPERTIES:
:STATUS: FROZEN
@@ -79,12 +82,68 @@ The kernel is transport-agnostic and business-logic-agnostic. It communicates wi
#+end_src
* Phase D: Build (Implementation)
The core implementation is distributed across `projects/org-agent/src/`.
** Initialization
The executive soul provides the high-level orchestration for the OODA loop.
** Cognitive Tools
We register tools for kernel introspection and state management.
#+begin_src lisp
;; Kernel bootstrap logic
(org-agent:def-cognitive-tool :kernel-status "Returns the current operational status of the Org-Agent kernel, including loaded skills and telemetry."
:parameters nil
:body (lambda (args)
(declare (ignore args))
(format nil "KERNEL STATUS:
- Active Skills: ~a
- Uptime: ~a seconds
- Memory Usage: ~a
- Providers: ~a"
(hash-table-count org-agent:*skills-registry*)
(get-universal-time) ; Placeholder for actual uptime
"Not implemented"
org-agent:*provider-cascade*)))
(org-agent:def-cognitive-tool :list-skills "Lists all currently loaded skills and their metadata."
:parameters nil
:body (lambda (args)
(declare (ignore args))
(let ((output "LOADED SKILLS:
"))
(maphash (lambda (name skill)
(setf output (concatenate 'string output
(format nil "- ~a (Priority: ~a, Deps: ~s)~%"
name
(org-agent:skill-priority skill)
(org-agent:skill-dependencies skill)))))
org-agent:*skills-registry*)
output)))
#+end_src
** The Executive Soul Skill
This skill acts as the default "Moral Compass" for the agent.
#+begin_src lisp
(org-agent:defskill :skill-agent
:priority 1000 ; Absolute highest priority
:trigger (lambda (context) t) ; Always active as a fallback
:neuro (lambda (context)
"You are the Org-Agent Executive Soul. Your goal is to empower the user through the Lisp Machine.
Follow the Core Invariants:
1. Sovereignty: Avoid proprietary traps.
2. Technical Mastery: Explain your logic.
3. Zero-Bloat: Keep it minimal.
4. Transparency: Your thoughts are auditable.
5. Sustainability: Think long-term.")
:symbolic (lambda (action context)
;; Basic invariant check: Block actions that appear to violate sovereignty
(let ((payload (getf action :payload)))
(if (and payload (search "proprietary" (format nil "~s" payload)))
(progn
(org-agent:kernel-log "SYSTEM 2 [Agent]: Sovereignty violation suspected. Blocking action.")
nil)
action))))
#+end_src
* Phase E: Chaos (Verification)
Verification logic is contained in `projects/org-agent/tests/`.