Emergency handling

From leopu00/job-hunter-team · View interactive version

Emergency handling is an AI agent skill from the GitHub repository leopu00/job-hunter-team. How to handle rate-limit emergencies and the FATAL cascade when the bridge goes blind. Includes the cooldown-bypass triggers, the L4-SOFT/L5-HARD recovery path, and the RESET SESSIONE handling on a >30-point usage drop.

How to use this skill

Skill file

Skill β€” Gestione emergenze e cascata FATAL

🚨 Bypass cooldown emergenza (manda subito)

Una di queste condizioni β†’ manda ordine immediato senza aspettare cooldown:

In questi casi, PRIMA della notifica esegui freeze_team.py:

python3 /app/shared/skills/freeze_team.py

Manda Esc x2 a tutti gli operativi (esclude CAPITANO/ASSISTENTE/SENTINELLA/SENTINELLA-WORKER). Il consumo si ferma anche se il messaggio al Capitano si perde.

Imposta freeze_active = True.

Reset-edge guard (last 30 minutes)

When the tick has reset_edge_guard=true, projection is diagnostic only: do

not freeze, throttle, kill, or update emergency_proj_history because of

proj, including persistent proj > 150%. Keep suggested_throttle_s=0.

Independent hard signals (usage >= 90%, bridge FATAL) remain active.

πŸ“Š Trigger during the emergency zone (proj > 100%, guard inactive)

Mantieni emergency_proj_history (ultimi 5) e emergency_proj_min. Tre trigger:

RECOVERY TRACKING (info ogni 3 tick)

SE recovery_tracking_cooldown == 0 AND len(history) >= 3:
    delta_3 = history[-3] - history[-1]
    SE delta_3 > 0:    manda RECOVERY TRACKING (calo)
    SE delta_3 β‰ˆ 0:    β†’ vedi STAGNAZIONE
    SE delta_3 < -5:   β†’ vedi PEGGIORAMENTO
    recovery_tracking_cooldown = 3

STAGNAZIONE CRITICA

SE len(history) >= 5 AND proj > 150% AND (max(history) - min(history)) < 10:
    manda STAGNAZIONE CRITICA β†’ "kill altri agenti, throttle non basta"
    cooldown 5 tick prima di rimandarla

PEGGIORAMENTO POST-FREEZE

SE proj > emergency_proj_min + 10:
    manda PEGGIORAMENTO POST-FREEZE β†’ "secondo freeze + kill totale"
    no cooldown: scatta subito

πŸ›‘οΈ Cascata FATAL (bridge totalmente cieco)

Quando il bridge non riesce a leggere usage e ricevi [BRIDGE FAILURE]:

L1 β€” fetch HTTP rapido (vedi skill `check-usage-http`)
     β€’ OK β†’ continua normalmente
     β€’ FAIL β†’ ↓
L2 β€” TUI worker manuale (vedi skill `check-usage-tui`)
     β€’ OK β†’ continua normalmente
     β€’ FAIL β†’ ↓
L3 β€” FATAL: niente dato dal bridge per N cicli consecutivi

L4-SOFT β€” primo FATAL (`fatal_streak == 0 β†’ 1`)

python3 /app/shared/skills/soft_pause_team.py

La skill manda 2 messaggi differenziati via jht-tmux-send:

Imposta fatal_streak = 1. Taci finchΓ© non arriva BRIDGE TICK valido o INFO.

L5-HARD β€” secondo FATAL consecutivo (`fatal_streak == 1 β†’ 2`)

python3 /app/shared/skills/freeze_team.py

Manda Esc x2 a tutti gli operativi (piΓΉ aggressivo). Inoltre manda al Capitano l'ordine HARD FREEZE (vedi skill order-formats).

Imposta fatal_streak = 2.

RIPRENDI (recupero dopo FATAL)

Quando arriva un [BRIDGE TICK] valido o [BRIDGE INFO] con fatal_streak >= 1:

  1. Reset fatal_streak = 0, freeze_active = False
  2. Calcola subito throttle dal sample
  3. Manda al Capitano l'ordine RIPRENDI con dati freschi (vedi skill order-formats)
  4. Il Capitano si occupa di ridistribuire [RIPRENDI] ai suoi operativi

Tabella riassuntiva FATAL

| fatal_streak | Trigger | Azione |

|---|---|---|

| 0 β†’ 1 | primo L1+L2 ko | soft_pause_team.py + PAUSA TEAM al Capitano |

| 1 β†’ 2 | secondo L1+L2 ko consecutivo | freeze_team.py + HARD FREEZE al Capitano |

| β‰₯ 1 β†’ 0 | [BRIDGE TICK] valido o [BRIDGE INFO] | [RIPRENDI] al Capitano |

πŸ” RESET SESSIONE

Se in un tick rilevi usage sceso di > 30 punti rispetto al sample precedente, Γ¨ un reset finestra:

  1. Azzera tutto lo storico (vedi skill memory-state)
  2. Manda RESET SESSIONE al Capitano (vedi skill order-formats)
  3. Tratta il prossimo tick come "primo check" (baseline, no ordine)
Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.