Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript
27.3 KB
Raw Blame

Key files: Core Decide (System One)

Subsystem index. Read only the entries relevant to your change. Current behavior and load-bearing invariants; history belongs in Git and CHANGELOG. The capability contract (API, providers, egress, extension points) is docs/architecture/decide.md.

  • src/core/ai/decide/types.ts — The request/answer contract: DECIDE_SLOTS, DecideMode (off/on, advanced shadow), EvidenceItem (text + class + provenance), the question union (noul, choice with options, score with levels), answers mirroring the wire, DecideRequest/DecideResult, DecideError with a catalogued reason, and thresholdValue (noul p, the chosen label's probability, normalized score).

  • src/core/ai/decide/outcomes.ts — The ONE vocabulary: per-slot receipt outcomes (plus error/skipped everywhere), SKIP_REASONS, REFUSAL_CATALOG (problem, cause, exact fix, docs anchor) and plain slot names. recordReceipts throws on an unknown outcome; the database has no CHECK constraint. test/decide/docs-sync.test.ts pins the table in docs/architecture/decide.md.

  • src/core/ai/decide/slots.ts — SLOT_SPECS: lane, question kind, harmful direction (needs the action-precision gate), thresholded, call sites, egress classes, default min_keep, shadow sample, what-if reproducibility, question version, fail direction and wired (the delivery gate: unwired slots are refused with slot_unavailable).

  • src/core/ai/decide/config.ts — Every decide.* key with its validator (validateDecideConfigValue, called by gbrain config set), and readDecideConfig(snapshot) (invalid stored values fall back to defaults; all default off). pickDecideConfig gives search the decide subset of the one config snapshot so all-off does no work. enableDecideEvalOverride is the only door for GBRAIN_DECIDE_SLOTS. isValidProvider accepts none, llm:<provider:model> and any typesafe:<id> of [a-z0-9._@/-] starting alphanumeric (#5980: gateway-published ids such as typesafe:oc/jev-1.13-free; no whitespace, no second colon); the snapshot's pricing.overrides is parsed into DecideConfig.pricingOverrides so the runner can price an id gbrain ships no tariff for.

  • src/core/ai/decide/pack.ts — Planner (64k per request, 32k state + longest question, 2x estimate with a digit floor, split before send, never truncate, rank-then-id order), packShape, and runBatches (≤16 in flight, one deadline, a 429 retry only when retry-after fits, background lanes drop to one worker after a 429, first failure stops queueing while started requests settle).

  • src/core/ai/decide/providers/typesafe.ts — Pure System One wire adapter: buildTypeSafeRequest, parseTypeSafeResponse (every requested id, numeric and in range, and a resolved model, or the batch fails malformed_response), classifyTypeSafeHttpError (status only; Unknown model → pinned_model_unavailable).

  • src/core/ai/decide/providers/llm-structured.ts — llm:<provider:model>: prompt + JSON schema through chat(), same parser, llmCapability (structured only for openai-compatible recipes that declare structured outputs), model identity from the provider snapshot or an endpoint fingerprint.

  • src/core/ai/decide/index.ts — runDecide(req, ctx) (also gateway.decide): provider selection, egress gate, egress fallback as its own sub-decision, daily cap and remote share before sending, BudgetTracker reserve/record (kind decide, or rerank for S1 on), bounded batches, mixed-model rejection, one decide_spend row per request (failed and timed-out requests charged their estimate). [R18]: before the daily-cap check, an id whose price resolves to nothing (usageCostUsd(..., cfg.pricingOverrides) null: no shipped tariff, no pricing.overrides entry) is refused unpriced_model with nothing sent and no spend row, so the ledger never records $0 for an unknown cost and no outer BudgetTracker is needed to protect the daily and remote-share budgets. provider_base_urls.typesafe (gateway base_urls) is the request origin, /systemone appended. Pinned by test/decide/provider-ids-5980.test.ts.

  • src/core/ai/decide/egress.ts — checkEgress: consent per data class (or the reranker selection for S1 on), denied sources on every provider, private pages by one batched privatePagesFilterFragment query (with the #5525 derived-origin rule), facts by visibility (default private), conversation text private, missing provenance refused.

  • src/core/ai/decide/policy.ts — resolveSlotPolicy: requested vs effective mode with a catalogued inactive cause, threshold precedence (override > adopted > newest local > reference), alias lookup via the last resolved model, margin max(floor, 2*max(retest_sd, repack_sd)), min_keep precedence, the action-precision gate and force_on, policyFingerprint; driftReason after a response; readiness strings.

  • src/core/ai/decide/protection.ts — The canonical protection predicate for slots that remove or demote results (alias hit, exact lookup, exact title match, relational pin). Autocut keeps its own narrower preserve predicate so all-off output is unchanged.

  • src/core/ai/decide/evidence.ts — S3's question and its one reducer (reduceEvidence, shared by production, qualify and what-if): protected and unjudged stay, below-threshold prune, the margin band holds, best-ranked pruned items return until min_keep; never reorders. whatIfEvidence replays receipts.

  • src/core/ai/decide/rerank-adapter.ts — S1 transport for search.reranker.model typesafe:* (#5178 contract on the decide core): four-level score questions, normalized scores, stable ties, topN after all batches, status-only RerankErrors, reported usage settled even when validation fails, mixed resolved models fail the call, onMeta reports the resolved model and rubric semantics.

  • src/core/ai/decide/store.ts — executeRaw storage (no engine method): buffered receipts and spend rows with a background-work drainer (500 ms exit bound), decide_state (internal keys: receipt salt, S1 ownership), receiptSalt (insert-if-absent) + hmacRef, the 60 s cached daily spend, calibrations CRUD, aggregate receipt reads, retention pruning for the purge phase.

  • src/core/ai/decide/receipts.ts — buildReceiptRows/writeReceipts: one row per question with HMAC hashes only, the thresholded value, outcome, reason, policy fingerprint, calibration ref and replay fields; fire-and-forget. An error row with no result takes partial (DecideError.partial: the answers settled batches returned before the decision failed, model_resolved null when they disagree), so outcome: error with answer_value set means returned but never applied; replay and calibration read only acted outcomes.

  • src/core/ai/decide/runtime.ts — Per-query decide budget (createQueryBudget, stageDeadlineMs), shadow sampling, and detached shadow work under its own BudgetTracker with a bounded queue and a drainer.

  • src/core/ai/decide/recall-needed.ts — S6 know-to-ask: the question (state = the user prompt, head-capped at 6,000 characters, plus the previous turn, tail-capped at 2,000, both conversation class), recallReflex (reflex fired; alias or exact-title identity hit) and the ONE reducer reduceRecallNeeded (fire only when the reflex was silent and p ≥ threshold; suppress only below suppress_below minus the margin and never over an identity hit; the band below suppress_below holds), plus the dataset adapter (harmful action = suppress) and the lazy know-to-ask builder registration. suppress_below joins the policy fingerprint.

  • src/core/ai/decide/unpacked.ts — runDecideUnpacked: one logical decision whose questions each go in their own request (S7 windows, S8 claim units), one decision id and deadline, a process-wide background-lane semaphore at decide.background_concurrency (one per decision after a 429), per-question failed reasons instead of throwing (so slots can tell complete from partial coverage; stopOnFailure stops early), mixed resolved models fail every answer. Calibrate uses it for adapters that declare unpacked.

  • src/core/ai/decide/calibrate.ts, dataset.ts, reference-calibrations.ts (REFERENCE_CALIBRATIONS, recommendedSlots, and newerReference(policy, refs): the decide status hint newer_reference, #6497: the newest row matching the policy's slot, call site, provider and resolved model that differs from the calibration in use, else null; gbrain decide calibrations adopt ref:<id> stores a matching shipped id verbatim in decide.slots.<slot>.calibration; test/decide/newer-ref-hint-6497.serial.test.ts), schema.ts — Threshold search, reliability/ECE, retest/repack sd, Wilson bound, requiredN, family-level qualifyActions; the dataset JSONL schema, frozen family split and split_hash, per-slot adapters (choice slots add positive(item, answer) for the calibration label; items with state.call_site belong to that call site only, filtered by --call-site) and --from builders (S3: longmemeval, jsonl; S2/S4/S5 in their slot modules; S6: know-to-ask, registered from recall-needed.ts; S7/S8/S9: cat35, grounding-labels, facts-fixtures); adapters may override the thresholded value (calibrationValue) and calibrate extra knobs into the row's notes (calibrateExtra; S9's proposal floor on supersede labels, read back by policy.ts notesProposalFloor and the sweep); shipped reference rows (S7 triage and S9 conflict for jev-1.13.0, the only slots with a recorded win, docs/eval/system-one/README.md); the canonical DDL used by migrations 184-186 and the fresh-install fragment.

  • src/core/search/decide-stage.ts — The search side of S1/S3 (and the S3-shaped request S5 rides, with or without S3 on): resolveDecideSearchContext (undefined when every slot is off), applyEvidenceGate (inside sizeReturnPool and the keyword-only path), recordRerankReceipts, startRerankShadow (Jev beside a non-Jev reranker, rank agreement), decideKnobsPart (search cache key), the S5 co-pack registry and the meta block (meta.decide). resolveAndLaunchDecide resolves the context and launches S2 at hybridSearch entry; S4 on the query op starts inside applyEvidenceGate, concurrent with the S3/S5 request. calibrationState (60 s cached calibrations and last resolved models) is shared with think and S6.

  • src/core/ai/decide/intent.ts — S2: the search (QueryIntent) and think (temporal | knowledge_update | other) choice questions and reduceIntent (override only above threshold, on a known label that differs from the regex label and does not tie it; regex is the default and tie source), the intent dataset adapter (items carry state.call_site, never sent) and the longmemeval (question_type) and brainbench (relational) builders.

  • src/core/ai/decide/answerable.ts — S4: one probability question over the top-k evidence (answerableK: k = min(10, n), shrunk to fit 32k, 0 = fail open), reduceAnswerable (pass, incomplete coverage, margin_hold, deterministic identity/strong-grade signal → pass, else abstain), the dataset adapter/harmful-action reducer and the longmemeval abstention builder.

  • src/core/ai/decide/injection.ts — S5: the per-candidate question, reduceInjection (flag at threshold, never protected or unjudged) and demoteFlagged (flagged below clean items of the same evidence class, top cut and the rest reordered separately, nothing dropped), the co-packed dataset adapter and the injection-fixtures builder (#5178 known cases in test/fixtures/decide/injection-cases.jsonl).

  • src/core/search/decide-retrieval.ts — Search-path wiring for S2 (launchSearchIntent/applySearchIntent: wait bound decide.slots.intent.wait_ms, late answers keep the regex label and land as late receipts; askIntent/settleIntent shared with think), S4 on the query op (startQueryAnswerability, meta.answerability), the S5 co-pack handler, candidateItem, and rerankEgressDenied (the Jev reranker skips a query with a candidate from decide.egress.deny_sources). Imports decide-stage for types only.

  • src/core/think/decide.ts — Think wiring: startThinkDecide (undefined when S2 and S4 are off) launches the S2 think and search questions before gather; trajectoryIntent awaits the think answer at most wait_ms after gather; answerability asks S4 over final pages and sendable takes (private takes and trajectory make coverage incomplete) and returns an abstention only on abstain; thinkAbstainResult lists the nearest pages and skips synthesis.

  • src/core/cycle/decide-slot.ts — resolveCycleDecideSlot(engine, 'triage' | 'grounding'): undefined when the slot is off (all-off cycles do no decide work); otherwise the slot policy (unpacked pack shape, calibrations, last resolved models, key presence).

  • src/core/cycle/triage-decide.ts — S7: splitTurnWindows (whole turns from speaker anchors, [role] lines or role headings, else paragraphs; ~1,500 chars; a turn over 24,000 chars splits at paragraphs, marked), one noul per window through runDecideUnpacked, transcript score = max window p, reduceTriage (pass / margin_hold / reject; null = incomplete) shared with qualify and whatIfTriage. Complete pass/reject verdicts are cached with model decide:<provider>@<resolved>#<fingerprint8> (the S7-only cache identity; TRIAGE_VERSION unchanged), segments = top windows' first 300 chars cut at a turn boundary, entities from extractEntities, content type from one extra choice request; margin_hold and every incomplete decision return no verdict so runTriagePass runs today's LLM triage (no judge → pass). #7307: before any request, a scored row at the current TRIAGE_VERSION (and not older than staleBefore) from either judge (the decide identity, or llmModel, today's triage model that runTriagePass passes) is a cache hit; a margin hold writes a marker row (score NULL, content_type decide_margin_hold, never over an LLM backoff marker) that keeps the transcript off the provider for DECIDE_MARGIN_HOLD_TTL_MS (24 h), and an active LLM backoff also holds it (both counted in stats.held). Shadow/inactive: receipts only, observed only for transcripts today's triage judged this pass (never a cache hit). estimateTriageDecideUsd prices retriage.

  • src/core/cycle/grounding-decide.ts — S8: GroundingPass for both verify call sites; per unit up to three source windows (selectSourceWindows: normalized 4-gram substring hits, best keyword overlap, nearest embedding when an embedding provider is configured), coverage weak when no window reaches the 0.25 keyword floor; one noul per unit; reduceGrounding (pass / margin_hold / insufficient_context on weak coverage / quarantine) shared with qualify and whatIfGrounding (receipt protected = weak coverage). Only quarantines when on; timeout (30 s per page, 10 min per phase), 429, 5xx, budget, egress and drift keep the mechanical result. Coverage is judged over the distinct content words of the selected windows together (a substring window still counts), against the same 25% floor.

  • src/core/cycle/decide-datasets.ts — S7/S8 dataset adapters (unpacked; S7 aggregates windows by max; harmful actions = reject / quarantine) and builders cat35 (gold/*.json expected_triage + transcripts-txt) and grounding-labels (JSONL claim units; stores the production window selection and weak-coverage protection).

  • src/commands/decide/eval-lane.ts + src/commands/decide/judge-agreement.ts + src/core/ai/decide/judge-agreement.ts — the eval-only judge harness: gbrain decide judge-agreement --suite <longmemeval|grounding> --input <file> [--limit N] [--provider <id>] [--threshold 0.5] [--dry-run] [--json] [--out FILE] (registered by loadDecideLanes(); src/cli/commands/decide.ts dispatches it without opening a brain). One Jev probability question per item on the background lane (LongMemEval --judge rows: hypothesis vs question and reference answer, judge errors/budget skips/unjudged skipped; grounding labels: S8's production question, transcripts through the production window selection), consent implied as for calibrate, no runtime substitution. The pure module holds the 2x2 confusion matrix, raw agreement, Cohen's kappa with the large-sample 95% CI (null when undefined), per-slice results and nearest-rank percentiles. Reference labels are LLM verdicts (label_source counted in the report). Tests: test/decide/judge-agreement.test.ts, test/decide/judge-agreement-cli.serial.test.ts.

  • src/eval/decide-eval-flags.ts — the --decide <slot>=<off|on|shadow> / --decide-provider / --decide-calibration <file|ref:id> / --decide-threshold <slot>=<x> / --decide-force-on <slot> / --decide-dataset <jsonl> plumbing shared by eval longmemeval, eval brainbench and eval retrieval-quality: prepareDecideEval merges flags over an inherited GBRAIN_DECIDE_SLOTS (flags win), sets it and calls enableDecideEvalOverride(), imports calibrations (decide calibrate --json / calibrations list --json output or REFERENCE_CALIBRATIONS ids) and refuses a split_hash differing from the frozen dataset or calibrate_only false (DecideEvalRefusal, split_mismatch); null when no slot is on or shadow (all-off byte-identical). configureDecideBrain writes provider, consent, decide.egress.private allow, awaited shadow, thresholds, force_on into throwaway benchmark brains and inserts/qualifies/adopts the calibrations; operatorBrainRefusal guards connected brains (never written); decideRowReceipt / summarizeDecideReceipts build per-row receipts from DecideSlotMeta plus the brain's decide_spend delta (S2 late, S1 rerank tokens). Tests: test/decide/eval-flags.serial.test.ts, test/eval-longmemeval-decide.serial.test.ts, test/eval-brainbench-decide.serial.test.ts, test/eval-retrieval-quality-decide.serial.test.ts.

  • src/commands/decide/writepath.ts — write-path lane registrations (what-if reducers for triage and grounding, dataset adapters; S9 subcommands), loaded by loadDecideLanes() in src/commands/decide.ts before any subcommand or help.

  • src/core/ai/decide/conflict.ts — S9's question (duplicate | supersede | independent, state = the new fact, one choice per candidate), the ONE pair reducer reduceConflict (chosen duplicate at or above threshold → duplicate; else P(supersede) at or above decide.slots.conflict.proposal_floor → proposal; else independent), candidate eligibility (the decideSingleFact guards, self-exclusion, cosine ≥ 0.80), unordered pair keys, proposal direction, chronology (isOlderFact: valid_from, then created_at, then id; datedConflictState/datedConflictQuestion add fact_time/candidate_time evidence for a reordered pair) and sweepWindow (stops at the first fact younger than 60 s).

  • src/core/ai/decide/sweep.ts (+ proposals-store.ts) — runConflictSweep: per-source watermark in decide_state (first run records the max fact id unless since), deferred retries first (attempt cap 5, oldest due first so a relinked backlog never starves a transient retry), neighbours filtered BEFORE the k=5 limit by one executeRaw query, pairs deduped within the sweep and across sweeps (answered receipts by hashed pair subject, existing proposals), one background-lane request per fact for its older neighbours plus one per neighbour newer than the fact (that neighbour is presented as the new claim with both timestamps, so a proposal always retires the older fact), drift and inactive policy run with off behavior, pending decide_proposals rows in on mode only; never supersedes. conflictSweepTail is the extract_facts phase tail: undefined when the slot is off. proposals-store.ts holds the watermark, deferred, dedup and proposal SQL, and enqueueRelinked(engine, sourceId, factIds) (the gbrain facts relink handoff: attempts 0, due now, reason relinked, ON CONFLICT DO NOTHING, run on the caller's transaction engine). Tests: test/decide/conflict-sweep.serial.test.ts, test/decide/conflict-relink-handoff.serial.test.ts. When decide.slots.conflict.review_withdraw is on, each swept fact re-queues up to two withdrawn claims it may restate (requeueWithdrawnAnchorsNear), and conflictSweepTail runs runReviewLanes after the sweep (output key review).

  • src/core/ai/decide/review-lane.ts (+ src/core/facts/proposal-review.ts) — the ambiguous-band review lane on the conflict slot's provider, egress and spend. Kinds withdraw (active facts close to a withdrawn fact; conflict question unchanged, duplicate = same claim), duplicate_page and duplicate_entity (page pairs other subsystems queue with enqueueReviewCandidate; same | different question, candidates class). Each kind has a switch (decide.slots.conflict.review_<kind>, off by default), a call site (review_<kind>, listed in SLOT_SPECS.conflict.callSites) and its own calibration; reviewGate lets a kind propose only with a calibration qualified for action precision (action_precision_lb >= min_action_precision, fingerprint match; an operator threshold override never qualifies) and otherwise skips the provider entirely; shadow mode writes receipts only. Work lives in decide_review_queue (written in the event's own transaction: recordFactWithdrawal for withdraws; no timestamp cursor), at most REVIEW_BUDGET_PER_RUN (50) per kind per run, with attempt/backoff deferral and permanent-failure clearing. Pair subjects review:<kind>:<source>:<a>:<b> are hashed into receipts, so supersede receipts never suppress a review judgment and judged pairs are not re-asked. A forgotten private fact is skipped unless decide.egress.private is allow. Proposals go to decide_review_proposals (unique per kind/source/a/b/subject; separate table so older binaries never read them). proposalReviewRates feeds gbrain decide status (pending, oldest pending age, 30-day accepted/rejected per kind). Owner actions (proposal-review.ts): withdraw accept first claims the proposal (pending -> accepting, so a concurrent reject refuses and an accepting row from a concurrent or crashed accept resumes; one accept records the outcome), re-checks anchor still withdrawn and candidate active with unchanged text (candidate_hash), then calls the forget operation with a proposal-derived request id and semantic_review: false (finishing an interrupted accept when the fact already carries the (review r<id>) marker); a changed candidate goes stale; undo refuses with withdrawal_is_durable and a fix; duplicate kinds run the (idempotent) handler registered with registerReviewAcceptHandler, else accepted_no_action. CLI in commands/decide/proposals.ts: r<id> ids, --yes required to accept a withdraw, --all-from excludes withdraws unless --include-withdrawals. Pinned by test/decide/review-withdraw.serial.test.ts and test/decide/review-duplicate-kinds.serial.test.ts.

  • src/core/ai/decide/datasets-conflict.ts — registerConflictDatasets() (called by src/commands/decide/writepath.ts): the conflict dataset adapter (production request shape, no harmful-action reducer) and the facts-fixtures builder (labelled fact-pair JSONL; label true exactly for duplicate, the calibrated threshold). Calibration thresholds the reducer-consistent duplicateValue (P(chosen) only when duplicate is chosen) and calibrateProposalFloor picks the F1-best P(supersede) floor on the choice label kept in slice (≥ 10 supersede labels), stored in the row's notes. Tests: test/decide/conflict-calibration.test.ts.

  • src/core/facts/proposal-supersede.ts — S9 accept/undo as a CHECKED supersede: old fact expired_at/valid_until/superseded_by, the struck ## Facts row (file and DB body) and the proposal status apply as one unit with before/after state; a failed fence write leaves the proposal pending. Unmanaged brains: source-filesystem + page lock, one transaction that publishes the file last and restores it on a failed commit. Managed brains: coordinator mutation decide_proposal (dispatched by persistence/service.ts). Stale pairs are marked stale; undo refuses when either fact or the fence row changed. Tests: test/decide/conflict-proposals.serial.test.ts, conflict-proposals-managed.test.ts. #8060: the managed decide_proposal preparer reads the fact page through wholeBodySnapshot, so a segmented page within PAGE_MAX_BYTES is accepted or undone like an inline one (test/trust-supersede-segmented-8060.test.ts).

  • src/commands/decide/proposals.ts (registered in src/commands/decide/writepath.ts) — gbrain decide sweep --slot conflict [--since] [--source] [--json] and gbrain decide proposals list|accept|reject|undo (--all-from <sweep id> for accept/reject, --json everywhere); list shows both facts' text locally.

  • src/core/context/recall-needed.ts — S6 at the turn-context call site: startRecallNeeded runs concurrently with the reflex arms (config, policy, one decide call under an absolute 250 ms deadline from turn start; null when off, so all-off does one config read and nothing else); applyRecallNeeded runs after the reflex block is rendered and waits only until that deadline; on mode fires one keyword-only hybridSearch (limit 3, decide off, world-only safe chunks, the hook's source) only with ≥150 ms of TURN_CONTEXT_SERVER_BUDGET_MS left and must finish 40 ms before it, adding hits as recall-arm pointers, or suppresses the reflex window (hot facts stay). Every failure leaves the reflex result unchanged; receipts hash the session ref, never prompt text. GBRAIN_DEBUG=1 prints the per-turn explain line. Tests: test/decide/recall-needed.test.ts, test/decide/turn-context-s6.serial.test.ts.

  • src/eval/brainbench/know-to-ask-dataset.ts — gbrain decide dataset --slot recall_needed --from know-to-ask <dir> (fixtures/ + gold/): one item per gold user turn, label should_retrieve, the reflex state replayed through the shipped path on a seeded in-memory brain (slice reflex:fired/silent, protected = identity hit), split by fixture, holdouts skipped.

  • src/commands/decide.ts (+ src/commands/decide/{calibrate,receipts,probe-query}.ts, dispatch src/cli/commands/decide.ts) — gbrain decide status/probe/enable/disable/calibrate/qualify/calibrations/dataset/receipts; status carries the conflict slot's 7-day share of no_entity skip receipts (no_entity_7d, from conflictNoEntityShare in store.ts) and, when non-zero, a gbrain facts relink --dry-run hint line (test/decide/status-no-entity.serial.test.ts); help and the key-only probe run without a brain; enable refuses unless the effective mode would be the requested one, writes the pinned id and consent, and owns S1's reranker keys so disable restores only what it still owns; registerDecideSubcommand for slot lanes; enable --recommended pins the default provider on a brain with none, and calibrate/qualify send the production request (productionRequest: S3 co-packs S5's questions when injection rides the S3 request, so the recorded pack_shape is the one sent; test/decide/evidence-copack-calibration.serial.test.ts). Tests: test/decide/cli.serial.test.ts; the operator guide's quickstart (docs/guides/system-one.md) is executed against a fixture transport by test/decide/quickstart-doc.serial.test.ts, and test/decide/docs-sync.test.ts pins its troubleshooting anchors to REFUSAL_CATALOG.

  • src/commands/doctor/checks/decide.ts — decide_health: key, alias, inactive slots with cause and fix, drift, alias rollouts, 24 h error rate over 5%, exhausted budget, retired pinned model, force_on. Tests: test/doctor-decide-health.test.ts.