#+TITLE: SKILL: Cognitive Router Agent (Universal Literate Note) #+ID: skill-router #+STARTUP: content #+FILETAGS: :routing:cognition:dispatch:psf: * Overview The *Cognitive Router* is the kernel's traffic controller. it classifies incoming stimuli into complexity tiers, enabling the Economist to make sovereign compute-allocation decisions. * Phase A: Demand (PRD) :PROPERTIES: :STATUS: SIGNED :END: ** 1. Purpose Classify tasks by complexity to optimize neural resource allocation. ** 2. User Needs - *Tier Identification:* Differentiate between routine grooming and deep architectural work. - *Dynamic Dispatch:* Route complex requests to high-fidelity backends. * Phase B: Blueprint (PROTOCOL) :PROPERTIES: :STATUS: SIGNED :END: ** 1. Architectural Intent Implement a deterministic classifier for known sensors and a neural fallback for ambiguous user commands. ** 2. Semantic Interfaces *** Complexity Tiers - =:REFLEX=: System maintenance (heartbeats, persistence, cleanup). - =:COGNITION=: Conversational tasks (chat, summarization, metadata extraction). - =:REASONING=: Generative tasks (coding, blueprinting, debugging). *** Routing Logic #+begin_src lisp :tangle ../projects/org-skill-router/src/router-logic.lisp (in-package :org-agent) (defun router-classify-complexity (context) "Returns the complexity tier for a given stimulus context." (let* ((payload (getf context :payload)) (sensor (getf payload :sensor)) (skill (find-triggered-skill context)) (skill-name (when skill (skill-name skill)))) (cond ;; reasoning: generative or architectural ((member skill-name '("skill-architect" "skill-tech-analyst" "skill-scientist" "skill-self-fix") :test #'string-equal) :REASONING) ((member sensor '(:user-command)) :REASONING) ;; cognition: human interaction or semantic data ((member sensor '(:chat-message :delegation)) :COGNITION) ((member skill-name '("skill-scribe" "skill-web-research") :test #'string-equal) :COGNITION) ;; reflex: system infrastructure (t :REFLEX)))) #+end_src * Registration #+begin_src lisp (defskill :skill-router :priority 110 :trigger (lambda (context) nil) ; Passive classifier :neuro (lambda (context) nil) :symbolic (lambda (action context) (router-classify-complexity context))) #+end_src