AI chat & cognition
Full description: Read the full narrative
The chat pipeline classifies a natural-language query into one of eight intents, routes it through a dual-process cognition layer (fast cached/templated answers vs deliberate multi-agent reasoning), executes tools (live data, analytical models, simulations, sandbox), and streams results over SSE. All LLM traffic passes through the Omninet provider router.
Intents & routing thresholds
| Decision point | Rule | Source |
|---|---|---|
| Intent classes | quick_scan · deep_analysis · fly_to · toggle_layer · weather_check · compute · panel_command · unknown | server/agent.ts:48-49 |
| System 1 fast path | similarity ≥ 0.92 → real tool for matched intent (6 mapped intents) | server/cognition/cognitiveOrchestrator.ts:251,47-72 |
| Verify band | 0.70 ≤ similarity < 0.92 → S1 answer + System 2 verification, 10 s timeout | server/cognition/cognitiveOrchestrator.ts:252,295 |
| Full System 2 | no match / anomaly / < 0.70 → HTN decomposition → 4-agent debate (Data Analyst, Domain Expert, Systems Thinker, Risk Assessor) + Verifier critic, 45 s hard cap, critic ≥ 0.7 to exit | server/cognition/cognitiveOrchestrator.ts:286,386-388 server/cognition/system2.ts:78-85,446-467 |
| LLM deep classification | only when keyword intent conf < 0.7; LLM verdict accepted at conf ≥ 0.4 | server/index.ts:9846-9851 server/agent.ts:795 |
| Tool loop | MAX_TOOL_ROUNDS = 3 with anti-prompt-injection synthesis prompt | server/index.ts:10966-10983 |
| Stream cap | hard 150 s run cap; 15 s heartbeats | server/index.ts:9801-9811 |
Omninet model router
| Property | Verified value | Source |
|---|---|---|
| Providers | 9: groq, gemini, bai, deepseek, claude, ollama, openrouter, huggingface, local-gguf (20 models, tiers 1–4) | server/ai-router/omninet.ts:70-84 |
| Complexity → tier | simple→1, medium→2, complex/reasoning→3 | server/ai-router/omninet.ts:103-121,300-307 |
| Ranking | health → |tier−target| → tier → lastLatency; skips circuit-open / keyless / token-starved | server/ai-router/omninet.ts:331-358 |
| Resilience | per-provider token buckets; circuit opens at 5 failures, half-open 30 s; retries backoff [1s,2s,4s] ≤ 2 extra; health ping every 2 min (429/402/403 count as alive) | server/ai-router/omninet.ts:281-296,563-568,337,585-589,225-250,270 |
| Local fallback | LFM2.5-2.6B-Q4_K_M GGUF via llama-server :11436, spawned at boot when file present; admin-panel downloader with resume | server/index.ts:789-817 server/apiMetadata.ts:gguf endpoints |
| Embeddings | local Xenova all-MiniLM-L6-v2 first; API fallbacks (Gemini/OAI/Ollama), 768-dim default | server/ai-router/omninet.ts:675-713,648 |
| Cost tiers | ModelRouter local/flash/pro + price table; /api/agent/tiers costPerQuery 0 / 0.0001 / 0.0008 | server/costOptimizer.ts:18-22,47-54 server/index.ts:11686-11695 |
Advanced agent safety rails
| Control | Detail | Source |
|---|---|---|
| Risk classes | 17 DESTRUCTIVE + 15 HIGH_RISK tool lists; arg regex promotes risk (delete|remove|reset|…|deploy|publish) | server/advancedAgent.ts:212-234 |
| Approval gate | actions at threshold “high” require user approval before execution | server/advancedAgent.ts:240-244 |
| Plan budget | LLM plan 1–5 steps (max 6), temp 0.3; sub-agents temp 0.4 | server/advancedAgent.ts:252-274,370 |
| MCTS | exploration constant 1.41, ≤100 iterations, depth 5, 30 s timeout (execution orchestrator over tools) | server/cognition/mctsEngine.ts:11-16,87-89 |
| Human override | explainability subsystem: pending override queue, evidence chains, bias audits | server/index.ts:explainability routes :917-918 + module |
Verification status
Startup of the cognitive services (orchestrator, omninet init, self-improver V2, feedback) was observed in server boot logs server/index.ts:787,834-845; thresholds and lists are traced to source as above. End-to-end LLM outcomes are provider/credential dependent and were not executed here.