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, orconsensus_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:
| Skill | Category | Risk Profile | Key Triggers |
|---|---|---|---|
academic-researcher | Research | Safe | Literature reviews, citations, APA/IEEE, peer-reviewed sources |
api-integrator | Engineering | Safe | OpenAPI, REST, GraphQL, Swagger, webhooks |
brand-storyteller | Creative | Safe | Narrative design, brand voice, copywriting, hero journey |
chaos-engineer | Security | Destructive / Signoff | Fault injection, chaos monkey, latency stress, resilience |
cloud-bot-orchestrator | Operations | Destructive / Signoff | AWS, Azure, GCP, Terraform, Kubernetes, autoscaling |
code-architect | Engineering | Safe | System design, clean architecture, tech stack, microservices |
data-visualizer | Engineering | Safe | Matplotlib, Seaborn, Plotly, dashboards, chart generation |
executive-assistant | Operations | Safe | Meeting minutes, scheduling, briefing memos, travel |
financial-analyst | Finance | Safe | Balance sheets, EBITDA, DCF modeling, valuation, burn rate |
learning-path-designer | Research | Safe | Curricula, syllabi, study plans, educational roadmaps |
market-researcher | Research | Safe | TAM/SAM/SOM, competitor analysis, SWOT, industry trends |
omni-channel-strategist | Communication | Safe | Cross-platform journeys, touchpoints, customer lifecycle |
project-manager | Operations | Safe | Gantt charts, WBS, sprint planning, kanban tracking |
quantum-state-engine | Orchestration | Moderate | Probabilistic branching, state collapse, uncertainty planning |
rick-and-morty-persona | Creative | Safe | High-personality chaotic genius, unconventional brainstorming |
security-auditor | Security | Moderate | CVE audits, OWASP Top 10, penetration tests, code security |
seo-strategist | Communication | Safe | SERP analysis, keyword mapping, backlinks, meta tags |
swarm-orchestrator | Orchestration | Moderate | Multi-agent consensus, collective voting, deliberation |
telegram-agent-01 | Communication | Signoff | Telegram 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.