Skip to content

remylovelogicai/aggressive-skill-router

v1.0.0Apache-2.0

Ultra-fast, aggressive System One skill and DAG router powered by Jev and Cloudflare Workers AI with 20 domain skills + router.

Aggressive Skill Router (ASR-1) ⚑

Sub-millisecond System One Decision & Multi-Skill DAG Router for Autonomous Agents
Powered by TypeSafe Jev and Cloudflare Workers AI (@cf/cloudflare/clef-flash / @cf/cloudflare/clef)

Tests Benchmark Latency License


🎯 Overview

Traditional agent architectures use heavy LLMs (System Two) to choose tools or subagents. This introduces 800ms – 2,500ms of latency, risks prompt hallucination, bloats context windows, and fails on composite workflows that require multiple coordinated skills.

ASR-1 replaces slow LLM tool selectors with System One decision models (typesafe/jev and Cloudflare's open-weights clef-flash). Instead of generating unstructured text, it evaluates an input state against typed questions (choice, score, noul) to return calibrated probability distributions, margin spreads, risk classifications, and structured execution DAGs in under 1 millisecond locally (and ~38ms on Cloudflare edge).


πŸ—οΈ 4-Tier Decision Cascade Architecture

flowchart TD
    UserPrompt["Incoming User Prompt"] --> L0Cache{"Tier 0: L0 Cache<br/>(LRU / KV < 0.1ms)"}
    L0Cache -- Hit --> ReturnL0["Instant Cached Route"]
    
    L0Cache -- Miss --> L1Gate{"Tier 1: Deterministic Fast Gate<br/>(Regex / Explicit @directives < 0.5ms)"}
    L1Gate -- Match --> ReturnL1["Deterministic Route (Conf: 0.95-0.99)"]
    
    L1Gate -- No Match --> L2Pruner["Tier 2: Dense-Sparse BM25 Pruner<br/>(Narrows catalog to Top-6 candidates)"]
    L2Pruner --> L3Jev["Tier 3: System One Multi-Head Decision Engine<br/>(@cf/cloudflare/clef-flash / typesafe/jev)"]
    
    L3Jev --> L4Arbiter{"Tier 4: Aggressive Margin & Ambiguity Arbiter"}
    
    L4Arbiter -- "Margin Ξ” < 0.15 or Conf < 0.65" --> Disambig["OH HAI Interactive Disambiguation"]
    L4Arbiter -- "Topology = Pipeline / Fanout" --> DAGSynth["Synthesize Multi-Stage Execution DAG"]
    L4Arbiter -- "Confident Single Skill" --> ReturnL3["Direct Autonomous Execution"]
    
    L4Arbiter -. "Destructive Flag = True" .-> RiskBarrier["Enforce Human Sign-Off / Approval"]

1. Tier 0: In-Memory / KV Cache (< 0.1ms)

Canonicalized intent hashes bypass inference entirely on repeat queries with a 5-minute TTL.

2. Tier 1: Deterministic Fast Gate (< 0.5ms)

Short-circuits explicit user directives (e.g. @security-auditor, /skill:chaos-engineer) and exact trigger patterns (e.g., CVE signatures, DCF valuation keywords).

3. Tier 2: Dense-Sparse BM25 Pruner (< 3ms)

Evaluates prompt tokens against catalog triggers, descriptions, and negative triggers, selecting the Top-6 candidates to maximize the softmax discrimination power of the decision model.

4. Tier 3: System One Jev / Clef-Flash Engine (< 40ms)

Evaluates 5 simultaneous typed questions in a single inference pass:

  • primary_skill: Discrete choice over candidates.
  • confidence: Calibrated score (0.0 to 1.0).
  • workflow_topology: atomic_single, sequential_pipeline, parallel_fanout, or consensus_swarm.
  • destructive_risk: Noul (boolean hazard detection).
  • requires_human_approval: Noul (human sign-off gate).

5. Tier 4: Aggressive Arbiter & DAG Synthesizer

  • Confidence Spread: Computes $\Delta = P(\text{Top}_1) - P(\text{Top}_2)$. If $\Delta < 0.15$, generates a ready-to-use OH HAI select command (oh-hai ask submit --mode select ...).
  • DAG Synthesis: Automatically structures multi-stage dependencies when multi-domain intent is detected.

πŸ“¦ Pre-Loaded 19 Workspace Skills

The router ships with all 19 domain skills pre-indexed and unpacked:

SkillCategoryRisk ProfileKey Triggers
academic-researcherResearchSafeLiterature reviews, citations, APA/IEEE, peer-reviewed sources
api-integratorEngineeringSafeOpenAPI, REST, GraphQL, Swagger, webhooks
brand-storytellerCreativeSafeNarrative design, brand voice, copywriting, hero journey
chaos-engineerSecurityDestructive / SignoffFault injection, chaos monkey, latency stress, resilience
cloud-bot-orchestratorOperationsDestructive / SignoffAWS, Azure, GCP, Terraform, Kubernetes, autoscaling
code-architectEngineeringSafeSystem design, clean architecture, tech stack, microservices
data-visualizerEngineeringSafeMatplotlib, Seaborn, Plotly, dashboards, chart generation
executive-assistantOperationsSafeMeeting minutes, scheduling, briefing memos, travel
financial-analystFinanceSafeBalance sheets, EBITDA, DCF modeling, valuation, burn rate
learning-path-designerResearchSafeCurricula, syllabi, study plans, educational roadmaps
market-researcherResearchSafeTAM/SAM/SOM, competitor analysis, SWOT, industry trends
omni-channel-strategistCommunicationSafeCross-platform journeys, touchpoints, customer lifecycle
project-managerOperationsSafeGantt charts, WBS, sprint planning, kanban tracking
quantum-state-engineOrchestrationModerateProbabilistic branching, state collapse, uncertainty planning
rick-and-morty-personaCreativeSafeHigh-personality chaotic genius, unconventional brainstorming
security-auditorSecurityModerateCVE audits, OWASP Top 10, penetration tests, code security
seo-strategistCommunicationSafeSERP analysis, keyword mapping, backlinks, meta tags
swarm-orchestratorOrchestrationModerateMulti-agent consensus, collective voting, deliberation
telegram-agent-01CommunicationSignoffTelegram bot automation, channel broadcast, webhooks

πŸš€ Quick Start & CLI Usage

Installation

cd skill-router-jev-cloudflare
bun install

Route a Natural Language Prompt

bun run cli/index.ts route "Perform a vulnerability scan on CVE-2024-4577 and OWASP Top 10"

Multi-Skill Composite Workflow (DAG Synthesis)

bun run cli/index.ts route "First research market trends for AI, and then draft an executive summary and financial valuation"

Output:

Status: PIPELINE_SYNTHESIZED
Primary Skill: financial-analyst
Topology: sequential_pipeline
Execution DAG Pipeline:
  Phase 1: step_1_market_researcher [market-researcher] (Root Stage)
  Phase 2: step_2_financial_analyst [financial-analyst] -> depends on [step_1_market_researcher]

Run Automated Benchmark Suite

bun run cli/index.ts benchmark

Run Unit Tests

bun test

🐍 Python Client & LangGraph Integration

from skill_router_client import SkillRouterClient

client = SkillRouterClient()

# Direct routing
decision = client.route("Review cash flow statement and burn rate")
print(f"Routed to: {decision.primary_skill} ({decision.confidence*100:.1f}%)")

# Seamless LangGraph Node
route_node = client.as_langgraph_node()
# Wire directly into your StateGraph:
# workflow.add_node("skill_router", route_node)

☁️ Cloudflare Workers Edge Deployment

ASR-1 can be deployed globally to Cloudflare Workers in 30 seconds:

# Configure Wrangler credentials
export CLOUDFLARE_API_TOKEN="your-token"
export CLOUDFLARE_ACCOUNT_ID="your-account-id"

# Deploy to Cloudflare edge worldwide
wrangler deploy

Workers REST API Endpoints:

  • POST /api/v1/route: Route a prompt and return candidate probabilities and risk.
  • POST /api/v1/pipeline: Synthesize execution DAG for multi-stage workflows.
  • GET /api/v1/skills: List all 19 registered skills and risk profiles.
  • GET /health: System health and latency monitor.

πŸ›‘οΈ License

Apache-2.0. Built for sovereign multi-agent runtimes by LoveLogicAI.