Files
passepartout/org/system-model.org
Amr Gharbeia 908936d4d3 rename gateway-* → system-model-* + gateway-messaging, de-ollama, add system-model-explorer
- Rename gateway-provider → system-model-provider (generic :local provider, no hardcoded ollama)
- Rename gateway-llm → system-model (model-request dispatcher)
- Rename system-embedding-gateway → system-model-embedding
- Rename gateway-manager → gateway-messaging (public api renamed to messaging-*)
- Add system-model-explorer (model discovery via OpenRouter API, cached, per-slot recommendations)
- Fix skill loader export: replace prefix-matching with fbound/boundp-based export (20 skills now export)
- Add model-router to skill-loader exclusion list (loaded via CLI)
- De-ollama: remove hardcoded assumed-available patterns from provider pipeline
- Default cascade: cloud-only (openrouter, openai, groq, gemini, deepseek, nvidia, anthropic)
- Env example: add LOCAL_BASE_URL, fix cascade order
- All org files updated with architectural prose (literate programming)
2026-05-04 09:58:59 -04:00

2.1 KiB

SKILL: Model Dispatch (org-skill-model.org)

Architectural Intent

system-model is the dispatcher. It sits between the reason pipeline and the provider backends registered in *probabilistic-backends*. The reason pipeline calls model-request with a provider keyword and a model name; model-request looks up that provider's handler function, calls it, and returns the result.

This is intentionally thin. All the provider-specific logic (URL construction, API key headers, JSON parsing) lives in system-model-provider. All the routing logic (which model for which task) lives in system-model-router. This skill is the seam — it decouples "who to call" from "how to call them" and "why to call them."

When every provider fails (not registered, or all return errors), model-request returns an error plist with :status :error. The reason pipeline's backend-cascade-call catches this and falls through to the next provider in the cascade. If no provider can serve the request, the cascade returns the "Neural Cascade Failure" signal.

model-request replaces the old gateway-llm-request with the same contract but renamed for consistency with the system-model-* family.

Implementation

Request execution

(in-package :passepartout)

(defun model-request (&key prompt system-prompt (provider :openrouter) model)
  "Central dispatcher for LLM requests."
  (let ((backend (gethash provider *probabilistic-backends*)))
    (if backend
        (handler-case
            (funcall backend prompt system-prompt :model model)
          (error (c)
            (list :status :error :message (format nil "~a Failure: ~a" provider c))))
        (list :status :error :message (format nil "Provider ~a not registered" provider)))))

Skill registration

(defskill :passepartout-system-model
  :priority 100
  :trigger (lambda (ctx) (getf ctx :user-input))
  :deterministic (lambda (action ctx) (declare (ignore ctx)) action))