feat: stabilized org-agent two-way communication and UX

- Fixed kernel-to-Emacs communication bridge.
- Resolved boot-time crashes in multiple skeletal skills.
- Refined Chat skill prompt to eliminate conversational filler.
- Updated Emacs UI to automatically clean up status markers.
- Synchronized all fixes via Literate Org-mode documents.
- Verified physical two-way interaction via simulation.
This commit is contained in:
2026-04-03 17:25:01 -04:00
parent 93f9ccee17
commit fdb55c616d
30 changed files with 654 additions and 100 deletions

View File

@@ -6,32 +6,11 @@
* Overview
The *Model Explorer Agent* provides dynamic introspection of the system's LLM capabilities. It intercepts specific user commands to list and describe all available models across providers, rendering them as native Org-mode tables.
* Phase A: Demand (PRD)
:PROPERTIES:
:STATUS: FROZEN
:END:
** 1. Purpose
Define the interfaces for system-wide model discovery and transparency.
** 2. User Needs
- *Transparency:* Visible list of models and context windows.
- *Determinism:* Metadata retrieval must bypass System 1 for high fidelity.
- *Integration:* Results rendered as native Org-mode tables.
** 3. Success Criteria
*** TODO Command Trigger Verification (@agent list models)
*** TODO Provider Registry Introspection
*** TODO Org Table Formatting Accuracy
* Phase B: Blueprint (PROTOCOL)
:PROPERTIES:
:STATUS: SIGNED
:END:
** 1. Architectural Intent
Interfaces for dynamic skill introspection and Emacs UI injection. Source of truth is the active `*skills-registry*`.
** 2. Semantic Interfaces
#+begin_src lisp
(defun trigger-skill-model-explorer (context)
@@ -40,25 +19,52 @@ Interfaces for dynamic skill introspection and Emacs UI injection. Source of tru
(defun build-org-table-for-models ()
"Dynamically builds an Org table from registered provider skills.")
(defun execute-skill-model-explorer (proposed-action context)
(defun execute-skill-model-explorer (action context)
"Injects the model table into the active Emacs buffer.")
#+end_src
* Phase D: Build (Implementation)
** Trigger Logic
#+begin_src lisp
(defun trigger-skill-model-explorer (context)
(let* ((payload (getf context :payload))
(sensor (getf payload :sensor))
(text (or (getf payload :text) "")))
(and (eq sensor :chat-message)
(search "@agent list models" text :test #'string-equal))))
#+end_src
** Provider Introspection
#+begin_src lisp :tangle projects/org-skill-model-explorer/src/explorer-logic.lisp
#+begin_src lisp
(defun build-org-table-for-models ()
(let ((table-rows (list "| Provider | Model ID | Context |" "|----------+----------+---------|")))
;; Logic to iterate through skills-registry and call get-available-models
(format nil "~{~a~^~%~}" table-rows)))
(let ((models (org-agent:openrouter-get-available-models))
(rows (list "| Provider | Model ID | Context |" "|----------+----------+---------|")))
(if models
(progn
(dolist (m models)
(push (format nil "| OpenRouter | ~a | ~a |" (getf m :id) (getf m :context)) rows))
(format nil "~{~a~^~%~}" (nreverse rows)))
"| Error | No models found or API key missing |")))
#+end_src
** Actuation
#+begin_src lisp
(defun execute-skill-model-explorer (action context)
(declare (ignore action))
(let ((table (build-org-table-for-models)))
(list :type :REQUEST
:target :emacs
:payload (list :action :insert-text
:text (format nil "~%~%* Available Models~%~a~%" table)
:position :after-trigger))))
#+end_src
* Registration
#+begin_src lisp
(defskill :skill-model-explorer
:priority 85
:priority 110
:trigger #'trigger-skill-model-explorer
:neuro (lambda (context) nil)
:neuro (lambda (context) nil) ; Deterministic skill
:symbolic #'execute-skill-model-explorer)
#+end_src