#+TITLE: SKILL: The Economist Agent (Universal Literate Note) #+ID: skill-economist #+STARTUP: content #+FILETAGS: :economics:optimization:budget:psf: #+DEPENDS_ON: skill-router skill-performance-auditor * Overview The **Economist Agent** manages the PSF's compute resources. It predicts the "Cost of Thought" for a task and autonomously selects the most cost-effective LLM provider or local model based on complexity and remaining budget. * Phase A: Demand (PRD) :PROPERTIES: :STATUS: FROZEN :END: ** 1. Purpose Optimize token usage and compute overhead without sacrificing architectural integrity. ** 2. User Needs - **Predictive Budgeting:** Estimate token cost before triggering SOTA models. - **Provider Switching:** Dynamically route tasks between local (Ollama) and cloud (Gemini) models. - **Audit Reports:** Provide transparency on compute consumption. * Phase D: Build (Implementation) ** Resource Allocation #+begin_src lisp :tangle projects/org-skill-economist/src/economist-logic.lisp (defun economist-route-task (complexity) "Selects the optimal model backend based on task complexity (1-10)." (let ((budget (get-current-token-budget))) (cond ((> complexity 8) :gemini-1.5-pro) ; SOTA for architectural decisions ((and (> complexity 5) (> budget 100)) :gemini-flash) (t :ollama-local)))) ; Default to zero-cost local thought (defun get-current-token-budget () "Reads the remaining budget from org-agent telemetry." ;; Placeholder for actual telemetry lookup 1000) #+end_src * Registration #+begin_src lisp (defskill :skill-economist :priority 95 :trigger (lambda (context) (eq (getf (getf context :payload) :sensor) :budget-audit)) :neuro (lambda (context) "Analyze current compute efficiency and propose routing updates.") :symbolic (lambda (action context) action)) #+end_src