1 Commits

Author SHA1 Message Date
root
6507dff26d g5 cutover: first 5-loop end-to-end through Bun frontend
Companion to c522ace (cutover slice live). That commit proved
infrastructure (Bun /_go/* → Go gateway). This commit proves the
SUBSTRATE'S CORE LEARNING BEHAVIOR through the same path.

Two tests against persistent Go stack on :4110 with the 200-worker
corpus, all traffic via Bun frontend on :3700:

TEST 1: same-role boost fires with exact math
  Q1: Need 3 Forklift Operators in Aurora IL for Parallel Machining
  query_role: "Forklift Operator"

  cold (use_playbook=false):
    rank=0 id=w-43  dist=0.4449  Brian Ramirez, Springfield IL

  POST /_go/v1/matrix/playbooks/record:
    query_text=Q1, role=Forklift Operator, answer_id=w-43, score=1.0
    → playbook_id=pb-1126c52bd106df6b

  warm (use_playbook=true):
    rank=0 id=w-43  dist=0.2224  ← halved
    boosted=1, injected=0

  Math check: BoostFactor = 1 - 0.5*score = 0.5 (for score=1.0).
  Expected warm_dist = 0.4449 * 0.5 = 0.22245.
  Observed: 0.2224. 4-decimal exact through 3 HTTP hops.

TEST 2: cross-role gate prevents bleed
  Q2: Need 1 CNC Operator in Detroit MI for Beacon Freight
  query_role: "CNC Operator"
  use_playbook: true (Forklift recording from Test 1 in playbook corpus)

  result:
    rank=0 id=w-175  Kevin Ruiz       (Machine Operator, Detroit MI)
    rank=2 id=w-102  Laura Long       (Forklift Operator, Cleveland OH)
    boosted=0, injected=0  ← role gate fired correctly

  w-102 (Forklift Operator) appears at rank 2 organically via
  cosine retrieval — but boosted=0 confirms the Forklift PLAYBOOK
  did NOT influence this query. Surgical: gate suppresses
  playbook-driven boosts from cross-role recordings, leaves
  organic retrieval untouched.

What this confirms about the substrate:
1. Learning works — single recording → measurable, math-exact boost
2. Bleed protection works — role gate (real_001 fix) holds through
   cutover slice
3. Math holds across HTTP hops — Bun → gateway → matrixd → vectord
   with no drift
4. Substrate works through real production-shape framing — CORS,
   content-type, body forwarding, all transparent

The substrate's reason-for-being (5-loop learning) is now
demonstrably executing on persistent daemons under
production-shape frontend traffic.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-01 04:14:21 -05:00