PSF: Mass-regeneration complete. 53/53 high-fidelity blueprints and TDD suites established. Zero-cost Pro bridge active.

This commit is contained in:
2026-04-07 08:58:08 -04:00
parent f4a91ae747
commit 77c0dac025
58 changed files with 2154 additions and 1671 deletions

View File

@@ -9,7 +9,7 @@ The *Economist Agent* manages the PSF's compute resources. It predicts the "Cost
* Phase A: Demand (PRD)
:PROPERTIES:
:STATUS: FROZEN
:STATUS: SIGNED
:END:
** 1. Purpose
@@ -20,36 +20,61 @@ Optimize token usage and compute overhead without sacrificing architectural inte
- *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
* Phase B: Blueprint (PROTOCOL)
:PROPERTIES:
:STATUS: SIGNED
:END:
** 1. Architectural IntentnEstablish functional interfaces.\n\n** 2. Semantic Interfaces\n(defun trigger-skill-org-skill-economist (context))\n(defun neuro-skill-org-skill-economist (context))
** 1. Architectural Intent
The *Economist Agent* provides cost-governance for the Neural Engine. It intercepts `think` requests and determines the optimal Model/Provider based on task complexity, priority, and current budget constraints.
** 2. Semantic Interfaces
*** Routing Logic (2026 Fleet)
#+begin_src lisp :tangle ../projects/org-skill-economist/src/economist-logic.lisp
(in-package :org-agent)
(defun economist-route-task (context)
"Analyzes the stimulus context and returns a prioritized list of providers.
High-priority or complex tasks (e.g., :architect) get powerful models.
Routine tasks (e.g., :heartbeat, :persistence) get cheap/flash models."
(let* ((payload (getf context :payload))
(sensor (getf payload :sensor))
(complexity (ignore-errors (uiop:symbol-call :org-agent.skills.org-skill-router :router-classify-complexity context))))
(cond
;; Explicit user interaction or Reasoning tasks
((or (member sensor '(:user-command)) (eq complexity :REASONING)) '(:openrouter))
;; Cognitive or Reflexive tasks
(t '(:openrouter))))) ; Route through OpenRouter to avoid direct Google 429s
(defun economist-get-model-for-provider (provider &optional context)
"Returns the specific model ID recommended for the given provider/complexity.
Updated for April 2026 SOTA. Prefers Gemini 3.0/2.5 Flash for reflexes."
(let ((complexity (ignore-errors (uiop:symbol-call :org-agent.skills.org-skill-router :router-classify-complexity context))))
(case provider
(:openrouter
(case complexity
(:REASONING "anthropic/claude-3.5-sonnet")
(:COGNITION "moonshotai/kimi-k2.5")
(t "google/gemini-3-flash-preview")))
(t nil))))
#+end_src
* Phase D: Build (Implementation)
** Integration with Kernel
#+begin_src lisp :tangle ../projects/org-skill-economist/src/economist-logic.lisp
(defun economist-patch-kernel ()
"Hot-patches the kernel's *provider-cascade* to use economist logic."
(setf org-agent:*provider-cascade* #'economist-route-task))
#+end_src
* Registration
#+begin_src lisp
(defskill :skill-economist
:priority 100 ; High priority to ensure cost-checks happen first
:trigger (lambda (context) (eq (getf (getf context :payload) :sensor) :cost-audit))
:neuro (lambda (context) nil)
:symbolic (lambda (action context) (economist-route-task context)))
#+end_src