Model escalation

From baekenough/oh-my-customcode · View interactive version

Model escalation is an AI agent skill from the GitHub repository baekenough/oh-my-customcode. Advisory model escalation based on task outcome tracking

How to use this skill

Skill file

Model Escalation Skill

Tracks task outcomes and advises model upgrades when failures are detected. Advisory-only — the orchestrator makes the final decision (R010).

Escalation Path

haiku → sonnet → opus

Trigger Conditions

| Condition | Action |

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

| 2+ recorded failures for the same agent type (any model; evaluated only for haiku/sonnet spawns) | Advise escalation |

| 3+ consecutive failures across any agent type | Advise escalation (per spawn, not global; only when the spawn's model parameter is haiku or sonnet) |

| Sustained consecutive successes (ledger rows carry model inherit, so "after escalation" cannot be distinguished) | Advise de-escalation (opt-in: OMCUSTOM_MODEL_DEESCALATION=on) |

Thresholds

Hard-coded in model-escalation-advisor.sh (not configurable via frontmatter or settings):

| Constant | Value | Description |

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

| FAILURE_THRESHOLD | 2 | Failures before escalation advisory |

| CONSECUTIVE_THRESHOLD | 3 | Consecutive failures for the per-spawn advisory |

| COOLDOWN | 5 | Successes before de-escalation advisory (opt-in only) |

Each distinct advisory is shown at most once per session (atomic per-key marker dir /tmp/.claude-model-advisory-shown-${PPID}.d/). De-escalation is off by default because, as wired (SubagentStop carries no failure signal), the ledger writer (task-outcome-recorder.sh) records success only, so consecutive successes carry no signal. The writer still contains an outcome="failure" branch (is_error == true) that this wiring never reaches.

Cost Guard

Architecture

SubagentStop → task-outcome-recorder.sh (the only wiring; not PostToolUse)
  Records: agent_type, model ("inherit"), outcome (as wired, the ledger writer records success only, so the escalation advisory is unreachable)
  Storage: /tmp/.claude-task-outcomes-$PPID (JSON lines, max 50)

PreToolUse (Task) → model-escalation-advisor.sh
  Reads outcomes → counts failures → advises escalation via additionalContext
  Advisory only — never blocks, never modifies tool input

Advisory Format

--- [Model Escalation Advisory] ---
  Agent type: {agent_type}
  Current model: {current_model}
  ⚡ Recommended: Escalate to {next_model}
  Cost impact: {multiplier} per task
  Reason: {reason}
------------------------------------

Probe Record (#1912)

Measured on CC 2.1.318 with claude -p and a haiku model:

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.