# Round 11 — Tower Floors J01-J04 · Reception Quartet

**Date**: 2026-04-30
**Time**: 60 min (of 1.5h)
**Status**: ✅ COMPLETE
**Round Type**: Tower Stations (קו B starts)

---

## 🏛️ The Master Jason Tower — General Layout

המגדל גייסון הוא מטאפורה ארכיטקטונית. **44 קומות עליונות** (J01-J44) = pipeline סוכנים, **קומות 50-99** = ניהול, archive, admin. **Lobby** (קומה קרקע) = ה-UI הראשי שבו User מקבל press release. **Floor X** (קומה אבודה) = self-healing composer.

```
┌─────────────────────────────────────────┐
│ Floor 99 — CEO Suite (Tenant Admin)     │
│ Floors 70-98 — Warehouse + Mall         │
│ Floor 50 — Audit + Logging              │
├─────────────────────────────────────────┤
│ Floor X — Self-Healing Composer         │
├─────────────────────────────────────────┤
│ Floors J39-J44 — Distribution Wing      │
│ Floor J38 — Supervisor + QA             │
│ Floors J32-J37 — Enrichment Wing        │
│ Floors J27-J31 — Animation + Games      │
│ Floors J23-J26 — Sound + Visual         │
│ Floors J18-J22 — Digital Distribution   │
│ Floors J13-J17 — Writers Wing           │
│ Floors J10-J12 — Quality Wing           │
│ Floors J05-J09 — 5W Parallel Wing       │
│ Floors J01-J04 — Reception Wing  ⭐ THIS│
├─────────────────────────────────────────┤
│ Lobby — UI / User                       │
└─────────────────────────────────────────┘
```

ה-Reception Wing הוא הצוואר של המגדל. כל press release נכנסת דרך 4 הקומות הללו, **לפי הסדר**, לפני שהיא מתפזרת לאגפים מקבילים.

---

## 🛎️ J01 · Reception (Pipeline Start)

### תפקיד
**שער הכניסה**. מקבל press release text, מבצע sanity checks, ויוצר Jason envelope ראשוני.

### Input
```json
{
  "text": "string (press release text, 100-50000 chars)",
  "tenant_id": "int",
  "desk_hint": "optional — string",
  "language_hint": "optional — 'he' | 'en' | 'ar' | 'auto'",
  "metadata": { "source": "email/web/api", "user_id": "int" }
}
```

### Output (Jason envelope skeleton)
```json
{
  "envelope_id": "uuid v4",
  "version": "v0.9",
  "tenant": { "id": 1, "slug": "maariv", "theme": {...} },
  "input": { "text": "...", "length": 1247, "received_at": "ISO" },
  "lifecycle": { "phase": "reception", "started_at": "ISO" },
  "events": []
}
```

### LLM Prompt (system)
```
You are J01-Reception, the receptionist of the Jason Tower.
Your job:
1. Sanity-check the press text (length, language, format).
2. Reject if obvious spam/empty/abuse.
3. Initialize the Jason envelope.
4. Pass to J02-Language for next step.

Constraints:
- ZERO content modification.
- ZERO opinions or summaries.
- MAX 200 tokens output.
- Output: structured JSON envelope only.
```

### Fallbacks
- **Empty input** → reject with `error.code: "EMPTY_INPUT"`
- **Too long (>50K chars)** → truncate with warning
- **Binary/non-UTF8** → reject with `BINARY_INPUT`
- **Spam pattern (>10 URLs in <500 chars)** → reject

### Cost (estimated)
- LLM: 0 (pure rule-based, no LLM call)
- DB: 1 INSERT to press_flows
- **Total: ~5ms**

### A2UI emission
```json
{"version":"v0.9","createSurface":{"surfaceId":"press-flow-{flow_id}","catalogId":"...","theme":{...}}}
```

---

## 🌐 J02 · Language Detector

### תפקיד
זיהוי שפה ראשי + secondary (mixed Hebrew/English common).

### Input
טקסט מ-J01.

### Output
```json
{
  "language_primary": "he",
  "language_secondary": "en",
  "confidence": 0.97,
  "rtl": true,
  "script": "hebrew"
}
```

### LLM Prompt
```
You are J02-Language. Identify language(s) of the press release.
- Primary: dominant language code (ISO 639-1).
- Secondary: if 5%+ of text is in another language.
- RTL: true if primary is Arabic/Hebrew/Persian.

Output JSON only.
```

### Tools
- **Tool 1**: `langdetect` Python lib (fast, deterministic)
- **Tool 2**: Gemini 2.5 Flash for ambiguous cases (>2 langs detected)

### Fallbacks
- langdetect fails → Gemini Flash
- Both fail → default `he` (Maariv-biased)

### Cost
- langdetect only: 0$ · 5ms
- With Gemini: 0.0001$ · 200ms

### A2UI emission
```json
{"version":"v0.9","updateDataModel":{"surfaceId":"press-flow-{id}","path":"/input/language","value":{...}}}
```

---

## 🔍 J03 · Triage Classifier

### תפקיד
סיווג ראשי של press release לקטגוריות:
- **type**: news / opinion / press_release / interview / live_blog
- **urgency**: breaking / regular / scheduled
- **sensitivity**: public / sensitive / restricted

### Input
טקסט + שפה מ-J02.

### Output
```json
{
  "type": "news",
  "urgency": "breaking",
  "sensitivity": "sensitive",
  "confidence": 0.89,
  "reasoning": "כותרת מכילה 'דחוף', מועד 22:00 הערב, 3 הזכרות של 'ביטחון'",
  "breaking_indicators": ["urgency_words", "time_constraint", "high_entity_density"]
}
```

### LLM Prompt
```
You are J03-Triage. Classify this press release on 3 axes:

TYPE (one of):
- news: factual reporting of events
- opinion: editorial/op-ed
- press_release: corporate/government announcement
- interview: Q&A format
- live_blog: ongoing event coverage

URGENCY (one of):
- breaking: requires immediate publish (security, deaths, market shocks)
- regular: standard news cycle
- scheduled: has explicit publish time in future

SENSITIVITY (one of):
- public: no restrictions
- sensitive: requires editor review (legal, privacy, security)
- restricted: do NOT auto-publish (gag order, embargo, confidential)

Output JSON only. Provide reasoning in Hebrew.
```

### Tools
- Gemini 2.5 Flash (fast, cheap)
- Optional: pgvector lookup of similar past press releases for context

### Fallbacks
- LLM timeout → default `{type: "news", urgency: "regular", sensitivity: "sensitive"}` (safe fallback)
- Confidence < 0.6 → flag for editor

### Cost
- Gemini Flash: 0.0002$ · 400ms
- Average tokens: 800 in / 200 out

### A2UI emission (multi-step)
```json
{"updateDataModel":{"path":"/classify/type","value":"news"}}
{"updateDataModel":{"path":"/classify/urgency","value":"breaking"}}
{"updateDataModel":{"path":"/classify/sensitivity","value":"sensitive"}}
{"updateComponents":{"components":[{"id":"urgency-badge","component":"Badge","color":"breaking","text":"דחוף"}]}}
```

---

## 🚪 J04 · Desk Router

### תפקיד
החלטה לאן ב-tower העבודה הולכת. מנתב ל-1 מ-11 desks:
1. **breaking** — דחוף (red)
2. **security** — ביטחון (amber)
3. **politics** — פוליטי (blue)
4. **economy** — כלכלה (green)
5. **sports** — ספורט (orange)
6. **tech** — טכנולוגיה (purple)
7. **entertainment** — בידור (pink)
8. **health** — בריאות (cyan)
9. **social** — חברה (teal)
10. **gallery** — גלריה (gold)
11. **archive** — ארכיון (gray)

### Input
טקסט + classification מ-J03.

### Output
```json
{
  "desk": "security",
  "confidence": 0.94,
  "secondary_desks": ["politics", "breaking"],
  "desk_color": "#F59E0B",
  "writer_assignment": "J14",
  "reasoning": "כותרת מזכירה 'משרד הביטחון', 8 הזכרות של 'IDF', תאריך אירוע = היום"
}
```

### LLM Prompt
```
You are J04-DeskRouter. Read the press release and decide which desk handles it.

11 DESKS (one of):
- breaking, security, politics, economy, sports, tech,
  entertainment, health, social, gallery, archive

Each desk has its own writer-team:
- breaking → J14 (urgent writer)
- security → J14
- politics → J15
- economy → J15
- sports → J16
- tech → J16
- entertainment → J17
- health → J17
- social → J17
- gallery → J17
- archive → J13 (light editing only)

Rules:
- If urgency=breaking AND sensitivity=public → ALWAYS desk=breaking
- If multi-desk applicable → pick PRIMARY, list secondary

Output JSON.
```

### Tools
- Gemini 2.5 Flash
- Optional: ML classifier trained on past 50K Maariv articles (pgvector cosine on jason_items)

### Fallbacks
- Confidence < 0.7 → editor review required
- Urgency=breaking + LLM unsure → **always breaking desk** (safety bias)

### Cost
- Gemini: 0.0002$
- pgvector lookup: 0.00001$ · 50ms

### A2UI emission
```json
{
  "updateComponents": {
    "components": [
      {
        "id": "desk-badge",
        "component": "Badge",
        "color": "var(--desk-security)",
        "text": "ביטחון",
        "icon": "solar/shield"
      }
    ]
  },
  "updateDataModel": { "path": "/classify/desk", "value": "security" }
}
```

ה-`Badge` component יודע על 11 desk colors דרך CSS data-attribute:
```css
.badge[data-desk="security"]      { background: var(--desk-security); }
.badge[data-desk="politics"]      { background: var(--desk-politics); }
/* ... 11 desks */
```

---

## 🔗 הקשר הקריטי בין הקומות

```
J01 (Reception)  →  J02 (Language)  →  J03 (Triage)  →  J04 (Desk Router)
   │                  │                   │                   │
   ▼                  ▼                   ▼                   ▼
envelope_id       language_he         urgency=breaking      desk=security
(uuid)            rtl=true            sensitivity=sensitive  writer=J14
```

כל קומה **מוסיפה למעטפת** (envelope), לא מחליפה. בסוף J04 ה-envelope מכיל:
```json
{
  "envelope_id": "uuid",
  "tenant": { "slug": "maariv" },
  "input": { "text": "...", "length": 1247 },
  "language": { "primary": "he", "rtl": true },
  "classify": { "type": "news", "urgency": "breaking", "sensitivity": "sensitive" },
  "routing": { "desk": "security", "writer": "J14", "secondary": ["politics"] },
  "lifecycle": { "phase": "routed", "next": "J05-J09 5W parallel" }
}
```

ה-envelope **נשלח במקביל ל-J05-J09** (5 agents של 5W). זה ה-fork הראשון של pipeline.

---

## ⏱️ Timing מצטבר

| Floor | זמן ממוצע | זמן p99 | LLM cost |
|---|---|---|---|
| J01 Reception | 5ms | 20ms | 0$ |
| J02 Language | 50ms | 300ms | 0.0001$ |
| J03 Triage | 400ms | 1200ms | 0.0002$ |
| J04 Desk Router | 250ms | 800ms | 0.0002$ |
| **Reception Wing total** | **~700ms** | **~2.3s** | **0.0005$** |

זה הקצה הקדמי של pipeline. **<1 שנייה ממוצעת** מ-paste ל-routed.

---

## 🎨 UI Components מעורבים

| Floor | A2UI components used |
|---|---|
| J01 | Surface (root), PressLayout, PasteArea |
| J02 | Badge (language flag), Toggle (RTL indicator) |
| J03 | Badge (×3: type/urgency/sensitivity), Card (reasoning expandable) |
| J04 | Badge (desk, color-coded), DeskIndicator (animated transition) |

ה-`DeskIndicator` הוא רכיב domain-specific חדש שצריך להוסיף לcatalog: animated badge עם desk-color שמופיע אחרי routing.

---

## ✅ Closure

- [x] J01 spec (Reception) — input/output/prompt/fallback/cost
- [x] J02 spec (Language)
- [x] J03 spec (Triage)
- [x] J04 spec (Desk Router)
- [x] envelope evolution mapped
- [x] timing budget calculated (~700ms)
- [x] A2UI components identified

✅ **Round 11 closed.**

---

## 🛣️ Next: Round 12 — J05-J09 (5W Parallel Wing)

5 agents במקביל לכל field של 5W. ההכי תורן של ה-tower כי זה streaming live.
