Files
memex/notes/org-skill-model-explorer.org
Amr Gharbeia fdb55c616d 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.
2026-04-03 17:25:01 -04:00

71 lines
2.3 KiB
Org Mode

#+TITLE: SKILL: Model Explorer Agent (Universal Literate Note)
#+ID: skill-model-explorer
#+STARTUP: content
#+FILETAGS: :discovery:telemetry:psf:
* 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 B: Blueprint (PROTOCOL)
:PROPERTIES:
:STATUS: SIGNED
:END:
** 2. Semantic Interfaces
#+begin_src lisp
(defun trigger-skill-model-explorer (context)
"Triggers on '@agent list models' in buffer updates.")
(defun build-org-table-for-models ()
"Dynamically builds an Org table from registered provider skills.")
(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
(defun build-org-table-for-models ()
(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 110
:trigger #'trigger-skill-model-explorer
:neuro (lambda (context) nil) ; Deterministic skill
:symbolic #'execute-skill-model-explorer)
#+end_src