⚔  Order Samurai  ·  Feedback Loop Architecture

Five interlocking governance loops  ·  agentica core

① Collection
② Ronin Auto
③ Reflex
④ Governance
⑤ Learning
AUTO-REMEDIATION LAYER CORE PROCESSING PIPELINE ALERT · ACTION LAYER BEHAVIOR EFFECT ZONE DOJO_STATE.json pillar scores · baselines AutoRemedy dojo.ts · check() bin/ronin <pillar> script Sessions telemetry Scouts metric collectors aggregate.py 22+ live metrics wid_payload.json annotated · scored Dashboard UI React · WebSocket Skills Library ~/.claude/skills/ Verifiers 4 check modules insights.py METRIC_CONFIG · _health() annotate() Nudge Catalog CLAUDE.md violations Reflexes reflexes.py · σ-anomaly /ronin-remediate orchestrator skill ✦ new CLAUDE.md OS rules · policies behavior change Improved next session metrics Security Posture verified · hardened Skill Quality optimized · consolidated ① COLLECTION LOOP — behavior change feeds next session cycle ② RONIN AUTO LOOP — pillar regression triggers auto-remediation metric improves ③ REFLEX LOOP σ-anomaly → skill → next metric ④ GOVERNANCE LOOP ⑤ LEARNING LOOP 3σ=CRIT · 2σ=HIGH · 1σ=MED 43 remediation commands _nudge_command() 18 keywords /canary-fault-diagnosis → /security-gate → refresh canary ⚔ SWORD 🏹 BOW 🖌 BRUSH 🎭 ARTS auto: pillar regression timeout: 5 min one-at-a-time queue ⚠ runs bin/ronin, NOT skill commands → /ronin-remediate closes this gap order-samurai · feedback-loops · 2026-06-07
① Collection Loop Scouts harvest session telemetry → aggregate.py computes 22+ metrics → insights.py scores health (0–100) and annotates mitigation commands → wid_payload.json written → Dashboard reads it → user (or ronin) executes a skill → behavior changes → next session measured differently.
Cadence: per session + on-demand refresh
② Ronin Auto Loop dojo.ts watches DOJO_STATE.json for live_current < live_baseline on any pillar → AutoRemediationEngine queues that pillar → spawns bin/ronin <pillar> (shell script) → probes run → DOJO_STATE updated. Single-concurrency — one pillar at a time, 5-min timeout.
Gap: runs pillar script, not per-metric skill commands → /ronin-remediate skill closes this
③ Reflex Loop reflexes.py fires when metric value deviates ≥1σ from rolling history (needs ≥4 points) OR grade falls below threshold → Dashboard shows reflex card with mitigation command → user clicks ⚡ → WebSocket → spawnExec() → skill streams output → next payload shows improved metric.
New: /ronin-remediate orchestrates de-dup + priority ordering across simultaneous reflexes
④ Governance Loop 4 verifier modules (root_hygiene, path_authority, archive_boundaries, runtime_contract) return OK/FAIL/WARN per check → aggregate.py counts FAILs to compute Governance_Pass_Rate → /verifier-repair maps each failure type to a concrete fix → verifiers re-run → pass rate rises.
Key gotcha: verifiers use "OK" not "PASS" — fixed in _governance_pass_rate reducer
⑤ Learning Loop CLAUDE.md principle violations accumulate in the Nudge Catalog → reflexes.py wraps them as armed alerts via _nudge_command() → user runs /improve-system or /ce-compound → lessons written to CLAUDE.md and docs/solutions/ → OS rules improve → future sessions generate fewer violations.
Gap partially closed: _nudge_command() now routes to all 5 new skills
Cross-Loop Shared State wid_payload.json is the single fan-out point — all loops read from it. DOJO_STATE.json is the pillar-level truth. METRIC_CONFIG (insights.py) is the single source of truth for skill→metric mappings. Loop ①③ share the annotated metric envelope (mitigation_command). Loop ② reads DOJO_STATE scores, not individual metric commands.