3.2 Pi-Orchestrator Pi-Orchestrator The Pi-Orchestrator ( ~/system/kernel/pi-orchestrator.js ) is the central brain of the ALAI system. It's a daemon that runs 24/7. What It Does Every 30 seconds , the orchestrator: Polls MC for the next eligible task ( mc.js next-task ) Skips tasks matching safety patterns (CEO decisions, regulated services) Checks retry cap — max 3 attempts per task (prevents infinite loops) Classifies the task (complexity 1-5, domain, type) using Ollama Selects model based on classification tier Checks capacity — worker pool limits per host Claims the task (assigns to pi-orchestrator, sets status to started) Builds prompt — injects company soul, blueprints, task context Executes via the selected pipeline (ollama-tool → simple fallback → llama-server) Quality gate — checks response length, detects placeholders, escalates if needed Creates proof-of-work — writes GOTCHA file + verify dir Completes — marks task done in MC, posts to Slack, feeds HiveMind Advances pipeline — triggers next pipeline stage if applicable Configuration ~/system/config/pi-orchestrator-config.json : Concurrency: FORGE: 2, ANVIL: 3, Claude: 2 (total max: 6 parallel workers) Timeouts: Tier 1: 60s, Tier 2: 120s, Tier 3: 300s, Tier 4: 600s Quality gate: Min response lengths, placeholder detection, max 1 escalation Safety patterns: CEO, DECISION, BankID, Vipps, Finanstilsynet, TENDER Execution Pipelines Pipeline How It Works ollama-tool Ollama with tool-use (read/write files, run commands) — preferred ollama-simple Ollama text-only (fallback when tool agent fails) llama-tool Kimi K2.5 via llama-server with tool-use wrapper llama-server Kimi K2.5 raw text completion (fallback) claude-cli Claude Code CLI for client-facing/critical work human-queue Queued for human — Alem reviews manually