@warmdrift/kgauto-compiler 2.0.0-alpha.8 → 2.0.0-alpha.80

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/README.md +176 -46
  2. package/dist/brain-proxy.d.mts +113 -0
  3. package/dist/brain-proxy.d.ts +113 -0
  4. package/dist/brain-proxy.js +193 -0
  5. package/dist/brain-proxy.mjs +6 -0
  6. package/dist/chunk-65ZMX5OT.mjs +169 -0
  7. package/dist/{chunk-5TI6PNSK.mjs → chunk-BVEXV5KC.mjs} +11 -0
  8. package/dist/chunk-CIBHU67M.mjs +203 -0
  9. package/dist/chunk-NBO4R5PC.mjs +313 -0
  10. package/dist/chunk-P3TOAEG4.mjs +56 -0
  11. package/dist/chunk-PMTT4H5W.mjs +825 -0
  12. package/dist/chunk-RO22VFIF.mjs +29 -0
  13. package/dist/chunk-VVRDFE6T.mjs +1707 -0
  14. package/dist/dialect.d.mts +41 -3
  15. package/dist/dialect.d.ts +41 -3
  16. package/dist/dialect.js +14 -2
  17. package/dist/dialect.mjs +5 -3
  18. package/dist/glassbox/index.d.mts +59 -0
  19. package/dist/glassbox/index.d.ts +59 -0
  20. package/dist/glassbox/index.js +312 -0
  21. package/dist/glassbox/index.mjs +12 -0
  22. package/dist/glassbox-routes/format.d.mts +24 -0
  23. package/dist/glassbox-routes/format.d.ts +24 -0
  24. package/dist/glassbox-routes/format.js +86 -0
  25. package/dist/glassbox-routes/format.mjs +18 -0
  26. package/dist/glassbox-routes/index.d.mts +191 -0
  27. package/dist/glassbox-routes/index.d.ts +191 -0
  28. package/dist/glassbox-routes/index.js +3057 -0
  29. package/dist/glassbox-routes/index.mjs +668 -0
  30. package/dist/glassbox-routes/react/index.d.mts +74 -0
  31. package/dist/glassbox-routes/react/index.d.ts +74 -0
  32. package/dist/glassbox-routes/react/index.js +819 -0
  33. package/dist/glassbox-routes/react/index.mjs +754 -0
  34. package/dist/index.d.mts +3449 -21
  35. package/dist/index.d.ts +3449 -21
  36. package/dist/index.js +10208 -1681
  37. package/dist/index.mjs +5891 -186
  38. package/dist/ir-BFwWhj2s.d.mts +1707 -0
  39. package/dist/ir-DZKS1tI7.d.ts +1707 -0
  40. package/dist/key-health.d.mts +131 -0
  41. package/dist/key-health.d.ts +131 -0
  42. package/dist/key-health.js +228 -0
  43. package/dist/key-health.mjs +6 -0
  44. package/dist/profiles.d.mts +302 -2
  45. package/dist/profiles.d.ts +302 -2
  46. package/dist/profiles.js +1320 -18
  47. package/dist/profiles.mjs +9 -1
  48. package/dist/types-B4kz3Vs0.d.ts +131 -0
  49. package/dist/types-D_fLt_Xv.d.ts +142 -0
  50. package/dist/types-DpcAMmk-.d.mts +131 -0
  51. package/dist/types-hjzSWxtv.d.mts +142 -0
  52. package/package.json +54 -8
  53. package/dist/chunk-MBEI5UOM.mjs +0 -409
  54. package/dist/profiles-B3eNQ2py.d.ts +0 -619
  55. package/dist/profiles-Py8c7zjJ.d.mts +0 -619
@@ -0,0 +1,1707 @@
1
+ // src/profiles.ts
2
+ var LATENCY_TIER_MS = {
3
+ fast: 4e3,
4
+ medium: 11e3,
5
+ slow: 24e3
6
+ };
7
+ function latencyTierOf(profile) {
8
+ if (profile.latencyTier) return profile.latencyTier;
9
+ if (profile.weaknesses.includes("latency")) return "slow";
10
+ if (profile.strengths.includes("speed")) return "fast";
11
+ return "medium";
12
+ }
13
+ var ANTHROPIC_LOWERING_BASE = {
14
+ system: { mode: "inline" },
15
+ cache: {
16
+ strategy: "cache_control",
17
+ minTokens: 1024,
18
+ discount: 0.1,
19
+ ttlSeconds: 300
20
+ },
21
+ tools: { format: "anthropic" }
22
+ };
23
+ var GOOGLE_LOWERING_BASE = {
24
+ system: { mode: "separate", field: "systemInstruction" },
25
+ cache: {
26
+ strategy: "cachedContent",
27
+ minTokens: 4096,
28
+ discount: 0.25,
29
+ ttlSeconds: 3600
30
+ },
31
+ tools: { format: "google" }
32
+ };
33
+ var PROFILES_RAW = [
34
+ // ── Anthropic ──
35
+ {
36
+ // VERIFIED 2026-06-21 against the claude-api reference. Claude Fable 5 is
37
+ // Anthropic's most capable model — a NEW tier ABOVE the opus/sonnet/haiku
38
+ // line (the id has no MAJOR-MINOR version, just `-5`) at 2× Opus pricing
39
+ // ($10/$50 vs $5/$25). Hand-authored, not cloned: the onboarder regex can't
40
+ // match this shape (new family + single-segment version), AND a clone would
41
+ // carry the wrong (opus) pricing. status:'preview' — no brain evidence yet;
42
+ // it earns per-archetype placement through the machinery like any model, and
43
+ // at 2× Opus the quality-floor + cost gates do real work before it leads.
44
+ // API quirk (claude-api ref): an explicit `thinking:{type:"disabled"}` 400s
45
+ // on Fable 5 (omit instead) — MOOT here: ANTHROPIC_LOWERING_BASE carries no
46
+ // `thinking` field, so kgauto never sends the param. (L-049/L-081.)
47
+ id: "claude-fable-5",
48
+ verifiedAgainstDocs: "2026-06-21",
49
+ provider: "anthropic",
50
+ status: "current",
51
+ // s76 2026-07-25: GA since 2026-06-09 per docs; was preview.
52
+ maxContextTokens: 1e6,
53
+ maxOutputTokens: 128e3,
54
+ maxTools: 64,
55
+ parallelToolCalls: true,
56
+ structuredOutput: "grammar",
57
+ systemPromptMode: "inline",
58
+ streaming: true,
59
+ cliffs: [],
60
+ costInputPer1m: 10,
61
+ costOutputPer1m: 50,
62
+ lowering: ANTHROPIC_LOWERING_BASE,
63
+ recovery: [
64
+ {
65
+ signal: "rate_limit",
66
+ action: "escalate",
67
+ reason: "429 from Anthropic \u2014 escalate to fallback chain"
68
+ },
69
+ {
70
+ signal: "model_not_found",
71
+ action: "escalate",
72
+ reason: "Model deprecated/renamed \u2014 escalate (L-061)"
73
+ }
74
+ ],
75
+ strengths: ["reasoning", "agentic_coding", "long_context", "reliable_tool_use", "structured_output"],
76
+ weaknesses: ["cost", "latency"],
77
+ notes: "Most capable Anthropic model (2026-06); a new tier ABOVE Opus at 2\xD7 pricing ($10/$50). 1M ctx, 128k out. Verified 2026-06-21 against the claude-api reference. status:preview \u2014 no brain evidence yet; earns placement via the machinery (cost + quality-floor gates govern). latencyTier derives `slow` (weaknesses includes latency \u2014 minutes-long turns on hard tasks). The thinking-disabled-400 API quirk is moot for kgauto (Anthropic lowering emits no thinking param).",
78
+ // archetypePerf cloned from claude-opus-4-8 as a conservative estimate
79
+ // (Fable >= Opus in capability, but unmeasured — no fabricated superiority).
80
+ // Re-rank once brain rows exist.
81
+ archetypePerf: {
82
+ critique: 10,
83
+ plan: 10,
84
+ generate: 9,
85
+ ask: 9,
86
+ extract: 9,
87
+ transform: 9,
88
+ hunt: 8,
89
+ summarize: 8,
90
+ classify: 8
91
+ }
92
+ },
93
+ {
94
+ // Auto-onboarded 2026-06-04 from `claude-opus-4-7`; VERIFIED 2026-06-21
95
+ // against the claude-api reference. Opus 4.8 shares 4.7's surface exactly —
96
+ // 1M ctx, 128k out, $5/$25, no new breaking changes — so the clone's
97
+ // capability data was accurate (confirmed field-by-field). archetypePerf is
98
+ // still cloned from 4.7 (a sound estimate: 4.8 >= 4.7) — re-rank once brain
99
+ // rows exist. Promoted to status:'current' 2026-06-21 (Sacha: "include Claude
100
+ // Opus 4.8") — now live-selectable. Ties with the still-current claude-opus-4-7
101
+ // (identical $5/$25 + cloned perf) resolve to 4-8 by array order. (L-049/L-081.)
102
+ id: "claude-opus-4-8",
103
+ verifiedAgainstDocs: "2026-06-21",
104
+ provider: "anthropic",
105
+ status: "legacy",
106
+ // s76 2026-07-25: docs list as LEGACY (Opus 5 generation is current).
107
+ maxContextTokens: 1e6,
108
+ maxOutputTokens: 128e3,
109
+ maxTools: 64,
110
+ parallelToolCalls: true,
111
+ structuredOutput: "grammar",
112
+ systemPromptMode: "inline",
113
+ streaming: true,
114
+ cliffs: [],
115
+ costInputPer1m: 5,
116
+ costOutputPer1m: 25,
117
+ lowering: ANTHROPIC_LOWERING_BASE,
118
+ recovery: [
119
+ {
120
+ signal: "rate_limit",
121
+ action: "escalate",
122
+ reason: "429 from Anthropic \u2014 escalate to fallback chain"
123
+ },
124
+ {
125
+ signal: "model_not_found",
126
+ action: "escalate",
127
+ reason: "Model deprecated/renamed \u2014 escalate (L-061)"
128
+ }
129
+ ],
130
+ strengths: ["reasoning", "agentic_coding", "long_context", "reliable_tool_use", "structured_output"],
131
+ weaknesses: ["cost", "latency"],
132
+ notes: "Frontier Opus (2026-06), the current recommended Opus-tier default. Verified 2026-06-21 against the claude-api reference: 1M ctx, 128k out, $5/$25 \u2014 identical surface to 4.7, no new breaking changes. Promoted to status:current 2026-06-21 (live-selectable); coexists with claude-opus-4-7 (still current).",
133
+ // Cloned archetypePerf from claude-opus-4-7 — re-evaluate once brain rows exist.
134
+ archetypePerf: {
135
+ critique: 10,
136
+ plan: 10,
137
+ generate: 9,
138
+ ask: 9,
139
+ extract: 9,
140
+ transform: 9,
141
+ hunt: 8,
142
+ summarize: 8,
143
+ classify: 8
144
+ }
145
+ },
146
+ {
147
+ // ── Claude Opus 5 — added s76 (2026-07-25, alpha.72) ──────────────────
148
+ // The model every seat in the portfolio actually runs, absent from the
149
+ // roster until now. Found by a catalog QA, not by the release watcher:
150
+ // the watcher detects unknown IDs on a provider's /models endpoint, but
151
+ // detection was never wired to ingestion, so the gap sat open. (That is
152
+ // what `scripts/catalog-sync.mjs` exists to close.)
153
+ //
154
+ // PROVENANCE — doc-verified 2026-07-25 against
155
+ // platform.claude.com/docs/en/docs/about-claude/models/overview:
156
+ // 1M context · 128k max output · $5/$25 per MTok · adaptive thinking YES
157
+ // · extended thinking NO · `effort` defaults to 'high' on the Claude API
158
+ // · reliable knowledge cutoff May 2026.
159
+ //
160
+ // FAMILY-INHERITED (not doc-read): maxTools, parallelToolCalls,
161
+ // structuredOutput, systemPromptMode, streaming. These are identical
162
+ // across opus-4-6 / 4-7 / 4-8 / sonnet-5 / fable-5 — five consecutive
163
+ // models — so they are a structural provider constant rather than a
164
+ // per-model value. Deliberately distinguished from the gemini-3.1-flash-lite
165
+ // failure, where a template-clone of PRICE (the field that actually varies,
166
+ // there by 2.5-3.75x) went unverified for 65 days.
167
+ id: "claude-opus-5",
168
+ verifiedAgainstDocs: "2026-07-25",
169
+ provider: "anthropic",
170
+ status: "current",
171
+ maxContextTokens: 1e6,
172
+ maxOutputTokens: 128e3,
173
+ maxTools: 64,
174
+ parallelToolCalls: true,
175
+ structuredOutput: "grammar",
176
+ systemPromptMode: "inline",
177
+ streaming: true,
178
+ cliffs: [],
179
+ costInputPer1m: 5,
180
+ costOutputPer1m: 25,
181
+ lowering: ANTHROPIC_LOWERING_BASE,
182
+ recovery: [
183
+ {
184
+ signal: "rate_limit",
185
+ action: "escalate",
186
+ reason: "429 from Anthropic \u2014 escalate to fallback chain"
187
+ },
188
+ {
189
+ signal: "model_not_found",
190
+ action: "escalate",
191
+ reason: "Model deprecated/renamed \u2014 escalate (L-061)"
192
+ }
193
+ ],
194
+ strengths: ["reasoning", "agentic_coding", "long_context", "reliable_tool_use", "structured_output"],
195
+ weaknesses: ["cost", "latency"],
196
+ notes: "Anthropic frontier for complex agentic coding + enterprise work; the Opus-tier current default as of 2026-07-25, superseding 4.8/4.7/4.6 (all now legacy). Doc-verified 2026-07-25: 1M ctx, 128k out, $5/$25, adaptive thinking (extended thinking NOT supported \u2014 that is Haiku 4.5 only in this generation), `effort` defaults to high on the Claude API. Price is unchanged from 4.5 through 5 \u2014 the tier moved without a cost change.",
197
+ // COLD-START PRIOR cloned from claude-opus-4-8. Self-labelling: below
198
+ // MEASURED_GROUNDING_MIN_N (10) brain rows these resolve as
199
+ // grounding:'judgment', so nothing reads them as measured until they are.
200
+ archetypePerf: {
201
+ critique: 10,
202
+ plan: 10,
203
+ generate: 9,
204
+ ask: 9,
205
+ extract: 9,
206
+ transform: 9,
207
+ hunt: 8,
208
+ summarize: 8,
209
+ classify: 8
210
+ }
211
+ },
212
+ {
213
+ id: "claude-opus-4-7",
214
+ verifiedAgainstDocs: "2026-05-08",
215
+ provider: "anthropic",
216
+ status: "legacy",
217
+ // s76 2026-07-25: docs list as LEGACY (Opus 5 is current). Bundle said current while the brain already said legacy — the two disagreed.
218
+ maxContextTokens: 1e6,
219
+ maxOutputTokens: 128e3,
220
+ maxTools: 64,
221
+ parallelToolCalls: true,
222
+ structuredOutput: "grammar",
223
+ systemPromptMode: "inline",
224
+ streaming: true,
225
+ cliffs: [],
226
+ costInputPer1m: 5,
227
+ costOutputPer1m: 25,
228
+ lowering: ANTHROPIC_LOWERING_BASE,
229
+ recovery: [
230
+ {
231
+ signal: "rate_limit",
232
+ action: "escalate",
233
+ reason: "429 from Anthropic \u2014 escalate to fallback chain"
234
+ },
235
+ {
236
+ signal: "model_not_found",
237
+ action: "escalate",
238
+ reason: "Model deprecated/renamed \u2014 escalate (L-061)"
239
+ }
240
+ ],
241
+ strengths: ["reasoning", "agentic_coding", "long_context", "reliable_tool_use", "structured_output"],
242
+ weaknesses: ["cost", "latency"],
243
+ notes: "Frontier (2026-05). Step-change improvement over 4.6 in agentic coding. Adaptive thinking only \u2014 no extended-thinking toggle. 1M context, 128k max output.",
244
+ // Frontier perf. Drops on archetypes where parallel-tool throughput
245
+ // (hunt) or low-budget cost-sensitivity (classify/summarize) matters
246
+ // more than reasoning depth.
247
+ archetypePerf: {
248
+ critique: 10,
249
+ plan: 10,
250
+ generate: 9,
251
+ ask: 9,
252
+ extract: 9,
253
+ transform: 9,
254
+ hunt: 8,
255
+ // strong but Flash dominates parallel tool throughput
256
+ summarize: 8,
257
+ // overkill for tolerant archetype; cost-out of frontier
258
+ classify: 8
259
+ // overkill; brain-validated cheaper models cover this
260
+ }
261
+ },
262
+ {
263
+ id: "claude-opus-4-6",
264
+ verifiedAgainstDocs: "2026-05-08",
265
+ provider: "anthropic",
266
+ status: "legacy",
267
+ maxContextTokens: 1e6,
268
+ maxOutputTokens: 128e3,
269
+ maxTools: 64,
270
+ parallelToolCalls: true,
271
+ structuredOutput: "grammar",
272
+ systemPromptMode: "inline",
273
+ streaming: true,
274
+ cliffs: [],
275
+ costInputPer1m: 5,
276
+ costOutputPer1m: 25,
277
+ lowering: ANTHROPIC_LOWERING_BASE,
278
+ recovery: [
279
+ {
280
+ signal: "rate_limit",
281
+ action: "escalate",
282
+ reason: "429 from Anthropic \u2014 escalate to fallback chain"
283
+ },
284
+ {
285
+ signal: "model_not_found",
286
+ action: "escalate",
287
+ reason: "Model deprecated/renamed \u2014 escalate (L-061)"
288
+ }
289
+ ],
290
+ strengths: ["reasoning", "long_context", "reliable_tool_use", "structured_output", "extended_thinking"],
291
+ weaknesses: ["cost", "latency"],
292
+ notes: "Predecessor to 4.7. Still current in Anthropic legacy table. Same pricing as 4.7 \u2014 choose 4.7 unless you need extended-thinking budget control (4.7 is adaptive-only).",
293
+ // One notch below 4.7 across the board — extended-thinking edge does
294
+ // not flip any archetype ranking. Legacy: chains should prefer 4.7.
295
+ archetypePerf: {
296
+ critique: 9,
297
+ plan: 9,
298
+ generate: 9,
299
+ ask: 9,
300
+ extract: 9,
301
+ transform: 9,
302
+ hunt: 7,
303
+ summarize: 8,
304
+ classify: 8
305
+ }
306
+ },
307
+ {
308
+ id: "claude-sonnet-4-6",
309
+ verifiedAgainstDocs: "2026-05-08",
310
+ provider: "anthropic",
311
+ status: "legacy",
312
+ // s76 2026-07-25: docs list as LEGACY (Sonnet 5 is current).
313
+ maxContextTokens: 1e6,
314
+ maxOutputTokens: 64e3,
315
+ maxTools: 64,
316
+ parallelToolCalls: true,
317
+ structuredOutput: "grammar",
318
+ systemPromptMode: "inline",
319
+ streaming: true,
320
+ cliffs: [],
321
+ costInputPer1m: 3,
322
+ costOutputPer1m: 15,
323
+ lowering: ANTHROPIC_LOWERING_BASE,
324
+ recovery: [
325
+ { signal: "rate_limit", action: "escalate", reason: "429 \u2014 escalate" },
326
+ { signal: "model_not_found", action: "escalate", reason: "Deprecated \u2014 escalate (L-061)" }
327
+ ],
328
+ strengths: ["quality", "tool_use", "long_context", "cache_friendly", "extended_thinking"],
329
+ weaknesses: [],
330
+ notes: "Workhorse. Best price/quality for most multi-turn agentic work. 1M context, 64k max output.",
331
+ // Master plan §6.2 anchor. Tier 0 for plan/generate/ask/extract/transform
332
+ // in starter chains; tier 1 cross-provider for hunt/summarize/classify.
333
+ archetypePerf: {
334
+ ask: 9,
335
+ generate: 9,
336
+ plan: 9,
337
+ critique: 9,
338
+ extract: 9,
339
+ transform: 9,
340
+ hunt: 7,
341
+ // strong but Flash beats on parallel tool throughput
342
+ summarize: 8,
343
+ // overkill for tolerant archetype
344
+ classify: 8
345
+ // overkill
346
+ }
347
+ },
348
+ {
349
+ id: "claude-haiku-4-5",
350
+ verifiedAgainstDocs: "2026-05-08",
351
+ provider: "anthropic",
352
+ status: "current",
353
+ maxContextTokens: 2e5,
354
+ maxOutputTokens: 64e3,
355
+ maxTools: 32,
356
+ parallelToolCalls: true,
357
+ structuredOutput: "grammar",
358
+ systemPromptMode: "inline",
359
+ streaming: true,
360
+ cliffs: [
361
+ {
362
+ metric: "tool_count",
363
+ threshold: 16,
364
+ action: "drop_to_top_relevant",
365
+ reason: "Haiku reliability degrades above ~16 tools"
366
+ },
367
+ {
368
+ // alpha.78 — the declared `structuredOutput: 'grammar'` does NOT
369
+ // hold on long-input summarize. MEASURED (brain, playbacksam):
370
+ // 21 disambiguated `structured_output_parse_failed` fallover rows
371
+ // 2026-07-22..27, tokens_in 12,280–31,450; PB's gate counted 20/20
372
+ // in-window failures. Clean traffic p50 sits at ~9K tokens_in, so
373
+ // 12K gates the failing band without touching the working one.
374
+ // Short-input summarize carries no failure evidence and stays
375
+ // ungated — this is why it's a cliff, not an archetype-wide
376
+ // `structuredOutputHint: 'avoid'`.
377
+ metric: "input_tokens",
378
+ threshold: 12e3,
379
+ action: "quality_gate_structured",
380
+ whenIntent: "summarize",
381
+ reason: "Structured-output parse failures at 100% in-window on long-input summarize (measured on playbacksam, 2026-07-25..27; haiku only led when input size made price dominate, then failed every time)."
382
+ }
383
+ ],
384
+ costInputPer1m: 1,
385
+ costOutputPer1m: 5,
386
+ lowering: ANTHROPIC_LOWERING_BASE,
387
+ recovery: [
388
+ { signal: "rate_limit", action: "escalate", reason: "429 \u2014 escalate to Sonnet" }
389
+ ],
390
+ strengths: ["speed", "cost", "classification", "cache_friendly", "extended_thinking"],
391
+ weaknesses: ["complex_reasoning", "large_tool_sets"],
392
+ notes: "Cheapest Anthropic. Great for classify, summarize, ask shapes. 200k context, 64k max output. API alias `claude-haiku-4-5` resolves to dated snapshot `claude-haiku-4-5-20251001`.",
393
+ // Tier 1 cross-provider anchor for short-output chains (classify/
394
+ // summarize/extract/transform). Falls off on plan/critique where
395
+ // reasoning depth matters; competes with Pro on cost+latency.
396
+ archetypePerf: {
397
+ classify: 8,
398
+ summarize: 8,
399
+ ask: 7,
400
+ transform: 7,
401
+ extract: 7,
402
+ hunt: 6,
403
+ // tool reliability drops at 16 — cliff guard fires
404
+ generate: 6,
405
+ plan: 5,
406
+ critique: 4
407
+ // reasoning depth gap vs Sonnet/Opus
408
+ }
409
+ },
410
+ // ── Google ──
411
+ {
412
+ id: "gemini-2.5-flash",
413
+ verifiedAgainstDocs: "2026-05-08",
414
+ provider: "google",
415
+ status: "current",
416
+ maxContextTokens: 1048576,
417
+ maxOutputTokens: 65535,
418
+ maxTools: 128,
419
+ parallelToolCalls: true,
420
+ structuredOutput: "native",
421
+ systemPromptMode: "separate",
422
+ streaming: true,
423
+ cliffs: [
424
+ {
425
+ metric: "input_tokens",
426
+ threshold: 8e3,
427
+ action: "downgrade_quality_warning",
428
+ reason: "Quality degrades significantly above ~8K context tokens"
429
+ },
430
+ {
431
+ metric: "tool_count",
432
+ threshold: 20,
433
+ action: "drop_to_top_relevant",
434
+ reason: "Tool reliability drops above ~20 tools (despite 128 hard limit)"
435
+ },
436
+ {
437
+ metric: "thinking_with_short_output",
438
+ threshold: 1,
439
+ action: "force_thinking_budget_zero",
440
+ reason: "Thinking tokens consume maxOutputTokens \u2014 empty response if drained"
441
+ },
442
+ {
443
+ // s11 trust artifact (2026-05-02): brain showed 5/5 empty rate on
444
+ // tt-intelligence/summarize/gemini-2.5-flash with tools offered.
445
+ // v1's disable_thinking_for_short_output already fired and didn't
446
+ // help — disabling thinking is necessary but not sufficient. Tools
447
+ // present + summarize intent confuses Flash into a no-output state
448
+ // (likely tool-decision purgatory). Strip tools entirely for this
449
+ // archetype on this model.
450
+ metric: "tool_count",
451
+ threshold: 1,
452
+ whenIntent: "summarize",
453
+ action: "strip_tools",
454
+ reason: "Gemini Flash returns empty when summarize intent has tools offered (5/5 empty rate observed in v1 prod 2026-04-19, replayed into v2 brain 2026-04-29)"
455
+ }
456
+ ],
457
+ costInputPer1m: 0.3,
458
+ costOutputPer1m: 2.5,
459
+ lowering: {
460
+ ...GOOGLE_LOWERING_BASE,
461
+ thinking: { field: "generationConfig.thinkingConfig.thinkingBudget", default: "auto" }
462
+ },
463
+ recovery: [
464
+ {
465
+ signal: "empty_response_after_tool",
466
+ action: "retry_with_params",
467
+ retryParams: { "generationConfig.thinkingConfig.thinkingBudget": 0 },
468
+ maxRetries: 1,
469
+ reason: "Known: empty after tool result \u2014 retry with thinking off"
470
+ },
471
+ {
472
+ signal: "empty_response",
473
+ action: "retry_with_params",
474
+ retryParams: { "generationConfig.thinkingConfig.thinkingBudget": 0 },
475
+ maxRetries: 1,
476
+ reason: "Empty response \u2014 try with thinking off"
477
+ },
478
+ {
479
+ signal: "malformed_function_call",
480
+ action: "escalate",
481
+ reason: "MALFORMED_FUNCTION_CALL maps to stop \u2014 escalate to next target"
482
+ }
483
+ ],
484
+ strengths: ["speed", "volume", "classification", "1m_context", "cost"],
485
+ weaknesses: ["complex_schemas", "large_tool_sets", "high_context_quality"],
486
+ notes: "Fast and cheap with 1M context. Quality cliffs at 8K context and 20 tools \u2014 guard with cliffs.",
487
+ // Master plan §6.2 anchor. Tier 0 for hunt (parallel tool throughput
488
+ // 15-75 calls/step beats Sonnet — L-040), summarize, classify.
489
+ archetypePerf: {
490
+ hunt: 9,
491
+ // L-040: parallel tool throughput 15-75/step
492
+ classify: 7,
493
+ // brain-validated, 218 rows
494
+ summarize: 7,
495
+ // brain-validated; cliff strips tools when present
496
+ transform: 7,
497
+ ask: 7,
498
+ generate: 6,
499
+ plan: 5,
500
+ extract: 6,
501
+ // alpha.8 MAX_TOKENS history on structured output
502
+ critique: 4
503
+ // reasoning shallower than Sonnet/Opus
504
+ }
505
+ },
506
+ {
507
+ // ── Gemini 2.5 Flash-Lite ──
508
+ // Onboarded 2026-05-13 (s22) after the model-release watcher surfaced
509
+ // it as a UNREGISTERED + NEW candidate. Released by Google July 2025,
510
+ // stable. Positioned BELOW Flash on the cost/perf frontier:
511
+ // input $0.10/M (Flash $0.30/M) — 3× cheaper
512
+ // output $0.40/M (Flash $2.50/M) — 6× cheaper
513
+ // cache $0.01/M — 1/10 of input (vs Flash 0.25 discount)
514
+ // Cliffs are HYPOTHESIZED from Flash's known failure modes — Flash-Lite
515
+ // is a smaller sibling, so we inherit Flash's cliffs at equal-or-tighter
516
+ // thresholds. The brain will validate/relax these as evidence accumulates
517
+ // per (archetype, model) tuple. Currently ZERO brain rows for this model.
518
+ id: "gemini-2.5-flash-lite",
519
+ verifiedAgainstDocs: "2026-05-13",
520
+ provider: "google",
521
+ status: "current",
522
+ maxContextTokens: 1048576,
523
+ maxOutputTokens: 65536,
524
+ maxTools: 128,
525
+ parallelToolCalls: true,
526
+ structuredOutput: "native",
527
+ systemPromptMode: "separate",
528
+ streaming: true,
529
+ cliffs: [
530
+ {
531
+ metric: "input_tokens",
532
+ threshold: 8e3,
533
+ action: "downgrade_quality_warning",
534
+ reason: "Inherited from Flash: quality degrades above ~8K. Smaller model \u2014 likely degrades faster. Re-tune from brain after n\u226520."
535
+ },
536
+ {
537
+ metric: "tool_count",
538
+ threshold: 10,
539
+ action: "drop_to_top_relevant",
540
+ reason: "Conservative: Flash drops at 20, Flash-Lite is smaller \u2014 assume tighter ceiling until brain proves otherwise."
541
+ },
542
+ {
543
+ metric: "thinking_with_short_output",
544
+ threshold: 1,
545
+ action: "force_thinking_budget_zero",
546
+ reason: "Thinking enabled per Google API (thinking: true). Same drain risk as Flash \u2014 thinking tokens consume maxOutputTokens."
547
+ },
548
+ {
549
+ // Strong prior: Flash hit 5/5 empty rate on summarize+tools (s11
550
+ // trust artifact, kgauto commit 3872832). Flash-Lite shares the
551
+ // same architectural family — almost certainly inherits this cliff.
552
+ // Ship the guard preemptively; brain telemetry confirms or relaxes.
553
+ metric: "tool_count",
554
+ threshold: 1,
555
+ whenIntent: "summarize",
556
+ action: "strip_tools",
557
+ reason: "Inherited from Flash s11 cliff: summarize+tools \u2192 empty response. Preemptive guard until brain evidence on Flash-Lite specifically."
558
+ }
559
+ ],
560
+ costInputPer1m: 0.1,
561
+ costOutputPer1m: 0.4,
562
+ lowering: {
563
+ ...GOOGLE_LOWERING_BASE,
564
+ // Cache discount 10× (vs Flash 4×) — Google's spec is $0.01/M cache vs
565
+ // $0.10/M input. Material for repeat-prompt workloads (classify shape).
566
+ cache: { ...GOOGLE_LOWERING_BASE.cache, discount: 0.1 },
567
+ thinking: { field: "generationConfig.thinkingConfig.thinkingBudget", default: "auto" }
568
+ },
569
+ recovery: [
570
+ {
571
+ signal: "empty_response_after_tool",
572
+ action: "retry_with_params",
573
+ retryParams: { "generationConfig.thinkingConfig.thinkingBudget": 0 },
574
+ maxRetries: 1,
575
+ reason: "Known on Flash family: empty after tool result \u2014 retry with thinking off."
576
+ },
577
+ {
578
+ signal: "empty_response",
579
+ action: "retry_with_params",
580
+ retryParams: { "generationConfig.thinkingConfig.thinkingBudget": 0 },
581
+ maxRetries: 1,
582
+ reason: "Empty response \u2014 try with thinking off."
583
+ },
584
+ {
585
+ signal: "malformed_function_call",
586
+ action: "escalate",
587
+ reason: "MALFORMED_FUNCTION_CALL maps to stop \u2014 escalate to next target."
588
+ }
589
+ ],
590
+ strengths: ["lowest_cost", "speed", "volume", "classification", "summarize", "1m_context", "cache_friendly"],
591
+ weaknesses: ["complex_reasoning", "large_tool_sets", "complex_schemas", "structured_output_unproven", "long_context_quality"],
592
+ notes: "Bottom-frontier anchor on cost: $0.10/$0.40 per 1M tokens, 1M context, 65K max output. Released July 2025 (stable). Positioned for classify / summarize / transform archetypes where quality bar is forgiving. Cliffs inherited from Flash at equal-or-tighter thresholds \u2014 re-tune per (archetype) once brain has n\u226520 rows. Alpha.8 contract layer handles MAX_TOKENS-on-structured-output via fallback chain, so structuredOutput=native is safe to declare even though Flash had alpha.8 history. Cache discount in spec: $0.01/M = 1/10 of input (richer than Flash 25%) \u2014 meaningful for repeat-prompt workloads.",
593
+ // Tier 3 emergency floor for summarize/classify chains. ZERO brain
594
+ // rows — all values are starter hypotheses anchored to "smaller
595
+ // sibling of Flash, at-or-below Flash perf on every archetype." The
596
+ // first 50 brain rows per archetype will validate or relax these.
597
+ archetypePerf: {
598
+ classify: 6,
599
+ // starter hypothesis — verify (Flash is 7, lite likely ≤)
600
+ summarize: 6,
601
+ // starter hypothesis — verify; cliff strips tools
602
+ transform: 6,
603
+ // starter hypothesis — verify
604
+ ask: 5,
605
+ hunt: 5,
606
+ generate: 4,
607
+ extract: 4,
608
+ plan: 3,
609
+ critique: 3
610
+ }
611
+ },
612
+ {
613
+ id: "gemini-2.5-pro",
614
+ verifiedAgainstDocs: "2026-05-08",
615
+ provider: "google",
616
+ status: "current",
617
+ maxContextTokens: 1048576,
618
+ maxOutputTokens: 65535,
619
+ maxTools: 128,
620
+ parallelToolCalls: true,
621
+ structuredOutput: "native",
622
+ systemPromptMode: "separate",
623
+ streaming: true,
624
+ cliffs: [
625
+ {
626
+ metric: "input_tokens",
627
+ threshold: 2e5,
628
+ action: "downgrade_quality_warning",
629
+ reason: "Pricing doubles above 200K: input $1.25\u2192$2.50/M, output $10\u2192$15/M"
630
+ }
631
+ ],
632
+ costInputPer1m: 1.25,
633
+ costOutputPer1m: 10,
634
+ lowering: {
635
+ ...GOOGLE_LOWERING_BASE,
636
+ thinking: { field: "generationConfig.thinkingConfig.thinkingBudget", default: "auto" }
637
+ },
638
+ recovery: [
639
+ {
640
+ signal: "malformed_function_call",
641
+ action: "escalate",
642
+ reason: "MALFORMED_FUNCTION_CALL \u2014 escalate"
643
+ }
644
+ ],
645
+ strengths: ["reasoning", "1m_context", "structured_output", "tool_use"],
646
+ weaknesses: ["pricing_above_200k"],
647
+ // Master plan §3.3 anchor: tier-2 cross-provider in almost every chain.
648
+ // Sits on the frontier at perf-9 — close to Sonnet but cheaper input.
649
+ archetypePerf: {
650
+ critique: 9,
651
+ plan: 9,
652
+ ask: 8,
653
+ generate: 8,
654
+ extract: 8,
655
+ transform: 8,
656
+ hunt: 8,
657
+ // tier 1 cross-provider for hunt chain
658
+ summarize: 7,
659
+ classify: 7
660
+ }
661
+ },
662
+ {
663
+ id: "gemini-3.1-pro-preview",
664
+ verifiedAgainstDocs: "2026-05-08",
665
+ provider: "google",
666
+ status: "preview",
667
+ maxContextTokens: 1048576,
668
+ maxOutputTokens: 65535,
669
+ maxTools: 128,
670
+ parallelToolCalls: true,
671
+ structuredOutput: "native",
672
+ systemPromptMode: "separate",
673
+ streaming: true,
674
+ cliffs: [
675
+ {
676
+ metric: "input_tokens",
677
+ threshold: 2e5,
678
+ action: "downgrade_quality_warning",
679
+ reason: "Pricing doubles above 200K: input $2\u2192$4/M, output $12\u2192$18/M"
680
+ }
681
+ ],
682
+ costInputPer1m: 2,
683
+ costOutputPer1m: 12,
684
+ lowering: {
685
+ ...GOOGLE_LOWERING_BASE,
686
+ cache: { ...GOOGLE_LOWERING_BASE.cache, discount: 0.1 },
687
+ thinking: { field: "generationConfig.thinkingConfig.thinkingBudget", default: "auto" }
688
+ },
689
+ recovery: [
690
+ {
691
+ signal: "malformed_function_call",
692
+ action: "escalate",
693
+ reason: "MALFORMED_FUNCTION_CALL \u2014 escalate"
694
+ }
695
+ ],
696
+ strengths: ["reasoning", "1m_context", "agentic_coding", "structured_output", "tool_use"],
697
+ weaknesses: ["cost", "preview_status", "pricing_above_200k"],
698
+ notes: "Frontier Gemini (preview, 2026-Q2). Step-change agentic coding per Google. Cache discount 10\xD7 (vs 4\xD7 for 2.5 Pro). Use status=preview to flag rollback path until GA.",
699
+ // Frontier-Gemini preview — bumped one notch over 2.5 Pro on agentic
700
+ // coding / reasoning per Google's release notes. Preview status:
701
+ // chains should stay on 2.5 Pro until GA. Starter hypothesis.
702
+ archetypePerf: {
703
+ critique: 10,
704
+ // Google claims step-change on reasoning
705
+ plan: 10,
706
+ ask: 9,
707
+ generate: 9,
708
+ extract: 9,
709
+ transform: 8,
710
+ hunt: 9,
711
+ // step-change agentic per Google
712
+ summarize: 8,
713
+ classify: 7
714
+ }
715
+ },
716
+ // ── DeepSeek ──
717
+ // 2026-05-08 audit (L-073): DeepSeek's `deepseek-chat` was silently aliased
718
+ // to `deepseek-v4-flash` non-thinking mode. Old kgauto profile claimed 64k
719
+ // context + $0.27/$1.10 — actual is 1M context + $0.14/$0.28. Now modeled
720
+ // as: V4-Flash + V4-Pro as canonical profiles; deepseek-chat and
721
+ // deepseek-reasoner registered as aliases (see ALIASES below).
722
+ {
723
+ id: "deepseek-v4-flash",
724
+ verifiedAgainstDocs: "2026-05-08",
725
+ provider: "deepseek",
726
+ status: "current",
727
+ maxContextTokens: 1e6,
728
+ maxOutputTokens: 384e3,
729
+ maxTools: 16,
730
+ parallelToolCalls: false,
731
+ structuredOutput: "native",
732
+ systemPromptMode: "inline",
733
+ streaming: true,
734
+ cliffs: [
735
+ {
736
+ metric: "tool_count",
737
+ threshold: 1,
738
+ action: "drop_to_top_relevant",
739
+ reason: "Sequential tool calls only \u2014 L-040"
740
+ }
741
+ ],
742
+ costInputPer1m: 0.14,
743
+ costOutputPer1m: 0.28,
744
+ lowering: {
745
+ system: { mode: "inline" },
746
+ cache: { strategy: "unsupported" },
747
+ tools: { format: "deepseek" }
748
+ },
749
+ recovery: [
750
+ { signal: "rate_limit", action: "escalate", reason: "429 \u2014 escalate" }
751
+ ],
752
+ strengths: ["cost", "1m_context", "json_output", "code", "reasoning"],
753
+ weaknesses: ["parallel_tools", "large_tool_sets"],
754
+ // alpha.47 — explicit slow override. Tag derivation would say 'medium'
755
+ // (no 'latency' weakness, no 'speed' strength), but the alpha.46 shadow
756
+ // probe MEASURED deepseek-v4-flash at 20485ms served (2026-06-03) — ~2.3×
757
+ // gemini-2.5-flash on PB's synchronous /api/analyze path. The 'flash' name
758
+ // is DeepSeek's, not a speed promise. This is the row that, scoring 0.85
759
+ // baseQuality (it carries 'reasoning') with no latency counterweight,
760
+ // leapfrogged gemini-2.5-flash as PB's summarize leader once reachable.
761
+ latencyTier: "slow",
762
+ notes: "Cheap workhorse. 1M context, 384k max output. Cache-hit input $0.0028/M (1/50\xD7 of miss). Aliased as `deepseek-chat` (non-thinking) and `deepseek-reasoner` (thinking) \u2014 see ALIASES.",
763
+ // Master plan §6.2 anchor. Brain-validated tier 1 cross-provider for
764
+ // classify (169 rows, 0% empty). Tier 0 for summarize-with-no-tools.
765
+ // Falls off on hunt (sequential tools — L-040) and reasoning depth.
766
+ archetypePerf: {
767
+ classify: 7,
768
+ // brain-validated, 169 rows
769
+ summarize: 7,
770
+ // archetype-tolerant, no brain evidence yet
771
+ ask: 6,
772
+ transform: 6,
773
+ generate: 5,
774
+ plan: 5,
775
+ extract: 5,
776
+ critique: 4,
777
+ hunt: 4
778
+ // sequential tool calls only — L-040
779
+ },
780
+ // alpha.43 — family-level conventions for the `deepseek-chat` family
781
+ // (V4-Flash + future non-thinking-mode members). V4-Flash struggles
782
+ // with summarize-archetype + structured-output: 3 of 4 schema-attempted
783
+ // PB calls (2026-05-18 + 2026-05-22) hit `structured_output_parse_failed`.
784
+ // Surface the friction at compile time so consumers either drop the
785
+ // schema or route to a more schema-reliable family.
786
+ archetypeConventions: [
787
+ {
788
+ archetype: "summarize",
789
+ structuredOutputHint: "avoid",
790
+ cliffWarning: "deepseek-chat family schema compliance on summarize is weak (3 of 4 schema-attempted PB calls hit structured_output_parse_failed). Consider routing summarize+structured-output to a different family (claude-sonnet, gemini-pro, openai-gpt-5.4) or dropping the schema for free-text summaries.",
791
+ reason: "Brain evidence: PB compile_outcomes 2026-05-18 + 2026-05-22, error_type=structured_output_parse_failed on deepseek-v4-flash + summarize archetype."
792
+ }
793
+ ]
794
+ },
795
+ {
796
+ id: "deepseek-v4-pro",
797
+ verifiedAgainstDocs: "2026-06-22",
798
+ provider: "deepseek",
799
+ status: "current",
800
+ maxContextTokens: 1e6,
801
+ maxOutputTokens: 384e3,
802
+ maxTools: 16,
803
+ parallelToolCalls: false,
804
+ structuredOutput: "native",
805
+ systemPromptMode: "inline",
806
+ streaming: true,
807
+ cliffs: [
808
+ {
809
+ metric: "tool_count",
810
+ threshold: 1,
811
+ action: "drop_to_top_relevant",
812
+ reason: "Sequential tool calls only \u2014 L-040"
813
+ }
814
+ ],
815
+ // Verified against the live DeepSeek pricing page 2026-06-22: the 75%-off
816
+ // launch "promo" ($0.435/$0.87) did NOT revert on 2026-05-31 — it became the
817
+ // standing price (docs show $0.435 in / $0.87 out cache-miss, $0.003625
818
+ // cache-hit in; no promo caveat). The old $1.74/$3.48 "regular post-promo"
819
+ // was a projected revert that never happened (L-073/L-081) — it 4×-overstated
820
+ // cost and suppressed V4-Pro in cost-aware ranking.
821
+ costInputPer1m: 0.435,
822
+ costOutputPer1m: 0.87,
823
+ lowering: {
824
+ system: { mode: "inline" },
825
+ cache: { strategy: "unsupported" },
826
+ tools: { format: "deepseek" }
827
+ },
828
+ recovery: [
829
+ { signal: "rate_limit", action: "escalate", reason: "429 \u2014 escalate" }
830
+ ],
831
+ strengths: ["quality", "reasoning", "1m_context", "json_output", "code", "extended_thinking"],
832
+ weaknesses: ["parallel_tools", "large_tool_sets"],
833
+ // alpha.47 — explicit slow override. Measured 47722ms on the alpha.46
834
+ // shadow probe (2026-06-03) — it's an extended-thinking reasoner, slowest
835
+ // of the served set. Tag derivation would say 'medium'; the measurement says
836
+ // otherwise.
837
+ latencyTier: "slow",
838
+ notes: "Pro tier. 1M context, 384k max output. $0.435/$0.87 per 1M (cache-hit in $0.003625) \u2014 verified live 2026-06-22; the launch promo became the standing price (no revert). Default mode = thinking.",
839
+ // Master plan §3.3: tier 3 cross-provider for plan chain. Reasoning
840
+ // bumped one notch over V4-Flash; same parallel-tool ceiling.
841
+ archetypePerf: {
842
+ plan: 7,
843
+ // §3.3 tier 3 for plan
844
+ critique: 6,
845
+ ask: 7,
846
+ generate: 6,
847
+ classify: 7,
848
+ summarize: 7,
849
+ extract: 6,
850
+ transform: 6,
851
+ hunt: 4
852
+ // sequential tools — same as V4-Flash
853
+ },
854
+ // alpha.43 — family-level conventions for the `deepseek-reasoner` family
855
+ // (V4-Pro is the family rep; future thinking-mode members inherit).
856
+ //
857
+ // The decisive-archetype suffix is the load-bearing piece: 2026-05-28
858
+ // first real V4-Pro probe on tt-intel/classify (exclusion-finding ID 20)
859
+ // showed 8/10 judge rationales citing "candidate hedges and fails to
860
+ // commit to a single classification" or "candidate refuses to pick
861
+ // among the labels." Without the forcing-function suffix, every
862
+ // reasoner probe on classify/extract/ask verdicts stay-excluded for
863
+ // model-behavior reasons (epistemic humility is reasoner-shaped),
864
+ // NOT quality reasons. The suffix re-shapes the contract so the model
865
+ // is asked for what it's actually being measured on.
866
+ //
867
+ // The hunt-archetype cliffWarning is the L-040 architectural reading
868
+ // surfaced at compile time. Reasoners produce sequential reasoning
869
+ // chains by design; hunt archetypes with 3+ parallel tools lose
870
+ // substantial throughput (L-040 + L-041). The L-040 cliff in the
871
+ // `cliffs` array already trims to top-relevant tools; this warning
872
+ // tells the consumer the family is wrong for the shape so they can
873
+ // route to gemini-flash (parallel-strong) instead of accepting trimmed
874
+ // throughput silently.
875
+ archetypeConventions: [
876
+ {
877
+ archetype: "classify",
878
+ promptSuffix: "\n\nOutput exactly one classification label. Do not hedge, do not add preamble, do not explain your reasoning. If uncertain, pick the most likely label and commit to it.",
879
+ reason: "Reasoners (deepseek-reasoner family) hedge on decisive-output archetypes by design. Evidence: 2026-05-28 V4-Pro probe on tt-intel/classify (exclusion-finding ID 20, brain probe_outcomes); 8 of 10 judge rationales cited hedging or refusal-to-commit. Forcing-function suffix converts reasoner output to decisive labels."
880
+ },
881
+ {
882
+ archetype: "extract",
883
+ promptSuffix: "\n\nOutput exactly the requested structured fields. Do not hedge, do not add preamble, do not explain your reasoning. If a field is unknown, emit the field with a null/empty value and commit to that \u2014 do not refuse to extract.",
884
+ reason: "Reasoners (deepseek-reasoner family) hedge on decisive-output archetypes by design. Evidence: same family failure shape as classify (exclusion-finding ID 20, 2026-05-28). Forcing-function suffix asks for commitment instead of epistemic-humility hedging."
885
+ },
886
+ {
887
+ archetype: "ask",
888
+ promptSuffix: "\n\nAnswer the question directly. Do not hedge, do not add preamble, do not explain your reasoning unless explicitly asked. If uncertain, give your best answer and commit to it.",
889
+ reason: "Reasoners (deepseek-reasoner family) hedge on decisive-output archetypes by design. Evidence: same family failure shape as classify (exclusion-finding ID 20, 2026-05-28). Forcing-function suffix asks for commitment instead of epistemic-humility hedging."
890
+ },
891
+ {
892
+ archetype: "hunt",
893
+ whenToolCountAtLeast: 3,
894
+ cliffWarning: "Reasoners (deepseek-reasoner family) produce sequential reasoning chains by design; hunt archetypes with 3+ parallel tools lose substantial throughput. Consider gemini-flash family (parallel-strong) instead \u2014 see L-040 / L-041.",
895
+ reason: "L-040 + L-041 architectural reading; 2026-05-28 V4-Pro probe evidence (exclusion-finding ID 20) confirms reasoner-family hunt fit is structurally weak."
896
+ }
897
+ ]
898
+ },
899
+ // ── OpenAI ──
900
+ // alpha.16 (2026-05-17): close the half-supported provider gap. env.ts
901
+ // already registered OPENAI_API_KEY + executeOpenAI + normalizeOpenAILike
902
+ // + lowerOpenAI all existed; profile entries were missing, so the
903
+ // alpha.10 auto-filter would mark openai-keyed models reachable but
904
+ // there were no profiles to filter IN. Half-supported is now fully
905
+ // supported. PB request `openai-provider-profiles` (2026-05-16).
906
+ //
907
+ // Profile data verified against developers.openai.com/api/docs/pricing
908
+ // + per-model pages 2026-05-17. L-049/L-081 step-zero: no AI-trained
909
+ // numbers — fetched live from OpenAI's docs. As of 2026-05, OpenAI's
910
+ // current flagship is gpt-5.5 (2025-12 cutoff); gpt-5.4-{base,mini,nano}
911
+ // are the workhorse family. gpt-4.1 + gpt-4o are legacy.
912
+ //
913
+ // Both 5.5 and 5.4 carry a 272K input-token pricing cliff (2x input,
914
+ // 1.5x output beyond that). Modeled as a `downgrade_quality_warning`
915
+ // cliff because it ranks the model down at large-context shapes — the
916
+ // semantics of "this model is now 2x more expensive" map onto the
917
+ // existing penalty mechanism. Cost-watcher will catch high-context
918
+ // spikes empirically; the cliff prevents naive routing into the doubled
919
+ // pricing zone.
920
+ {
921
+ id: "gpt-5.5",
922
+ verifiedAgainstDocs: "2026-05-17",
923
+ provider: "openai",
924
+ status: "current",
925
+ maxContextTokens: 105e4,
926
+ maxOutputTokens: 128e3,
927
+ maxTools: 64,
928
+ parallelToolCalls: true,
929
+ structuredOutput: "native",
930
+ systemPromptMode: "inline",
931
+ streaming: true,
932
+ cliffs: [
933
+ {
934
+ metric: "input_tokens",
935
+ threshold: 272e3,
936
+ action: "downgrade_quality_warning",
937
+ reason: "OpenAI pricing tier shift: >272K input tokens billed at 2x input + 1.5x output rates"
938
+ }
939
+ ],
940
+ costInputPer1m: 5,
941
+ costOutputPer1m: 30,
942
+ lowering: {
943
+ system: { mode: "inline" },
944
+ // OpenAI caching is implicit (auto-applied to repeated prefixes
945
+ // ≥1024 tokens for prompt_tokens_details.cached_tokens). No
946
+ // wire-format marker. Discount: 10x for cached input ($0.50/$5.00).
947
+ cache: { strategy: "unsupported", minTokens: 1024, discount: 0.1 },
948
+ tools: { format: "openai" }
949
+ },
950
+ recovery: [
951
+ { signal: "rate_limit", action: "escalate", reason: "429 \u2014 escalate to fallback chain" },
952
+ { signal: "model_not_found", action: "escalate", reason: "Model deprecated/renamed \u2014 escalate (L-061)" }
953
+ ],
954
+ strengths: ["reasoning", "agentic_coding", "long_context", "structured_output", "reliable_tool_use", "reasoning_effort_knob"],
955
+ weaknesses: ["cost", "pricing_cliff_at_272k"],
956
+ notes: "OpenAI frontier (2026-05). 1M context (1.05M total), 128K max output, 2025-12 cutoff. Reasoning effort knob (none/low/medium/high/xhigh). Pricing cliff at 272K input.",
957
+ // Frontier-tier perf hypothesis. Anchored to Opus 4.7 row (similar
958
+ // price/positioning). Brain evidence will refine; no telemetry yet.
959
+ archetypePerf: {
960
+ critique: 9,
961
+ plan: 9,
962
+ generate: 9,
963
+ ask: 9,
964
+ extract: 9,
965
+ transform: 9,
966
+ hunt: 8,
967
+ // parallel tool support good but cliff at 272K hurts deep multi-step
968
+ summarize: 7,
969
+ // overkill for tolerant archetype
970
+ classify: 7
971
+ // overkill; cheaper models cover this
972
+ }
973
+ },
974
+ {
975
+ id: "gpt-5.4",
976
+ verifiedAgainstDocs: "2026-05-17",
977
+ provider: "openai",
978
+ status: "current",
979
+ maxContextTokens: 105e4,
980
+ maxOutputTokens: 128e3,
981
+ maxTools: 64,
982
+ parallelToolCalls: true,
983
+ structuredOutput: "native",
984
+ systemPromptMode: "inline",
985
+ streaming: true,
986
+ cliffs: [
987
+ {
988
+ metric: "input_tokens",
989
+ threshold: 272e3,
990
+ action: "downgrade_quality_warning",
991
+ reason: "OpenAI pricing tier shift: >272K input tokens billed at 2x input + 1.5x output rates"
992
+ }
993
+ ],
994
+ costInputPer1m: 2.5,
995
+ costOutputPer1m: 15,
996
+ lowering: {
997
+ system: { mode: "inline" },
998
+ cache: { strategy: "unsupported", minTokens: 1024, discount: 0.1 },
999
+ tools: { format: "openai" }
1000
+ },
1001
+ recovery: [
1002
+ { signal: "rate_limit", action: "escalate", reason: "429 \u2014 escalate to fallback chain" },
1003
+ { signal: "model_not_found", action: "escalate", reason: "Model deprecated/renamed \u2014 escalate (L-061)" }
1004
+ ],
1005
+ strengths: ["reasoning", "long_context", "structured_output", "reliable_tool_use"],
1006
+ weaknesses: ["pricing_cliff_at_272k"],
1007
+ notes: "OpenAI workhorse (2026-05). 1M context (1.05M total), 128K max output, 2025-08 cutoff. Pricing cliff at 272K input. Pairs cleanly with Sonnet 4.6 on cost ($2.50/$15.00 vs $3.00/$15.00).",
1008
+ // Anchored to Sonnet 4.6 row (similar price/positioning). Slight
1009
+ // anthropic-side edge on agentic coding per master plan vibe.
1010
+ archetypePerf: {
1011
+ critique: 8,
1012
+ plan: 8,
1013
+ generate: 8,
1014
+ ask: 8,
1015
+ extract: 8,
1016
+ transform: 8,
1017
+ hunt: 7,
1018
+ summarize: 7,
1019
+ classify: 7
1020
+ }
1021
+ },
1022
+ {
1023
+ id: "gpt-5.4-mini",
1024
+ verifiedAgainstDocs: "2026-05-17",
1025
+ provider: "openai",
1026
+ status: "current",
1027
+ maxContextTokens: 4e5,
1028
+ maxOutputTokens: 128e3,
1029
+ maxTools: 64,
1030
+ parallelToolCalls: true,
1031
+ structuredOutput: "native",
1032
+ systemPromptMode: "inline",
1033
+ streaming: true,
1034
+ cliffs: [],
1035
+ costInputPer1m: 0.75,
1036
+ costOutputPer1m: 4.5,
1037
+ lowering: {
1038
+ system: { mode: "inline" },
1039
+ cache: { strategy: "unsupported", minTokens: 1024, discount: 0.1 },
1040
+ tools: { format: "openai" }
1041
+ },
1042
+ recovery: [
1043
+ { signal: "rate_limit", action: "escalate", reason: "429 \u2014 escalate to fallback chain" },
1044
+ { signal: "model_not_found", action: "escalate", reason: "Model deprecated/renamed \u2014 escalate (L-061)" }
1045
+ ],
1046
+ strengths: ["cost", "speed", "agentic_coding", "structured_output", "reliable_tool_use"],
1047
+ weaknesses: ["reasoning_depth"],
1048
+ notes: "OpenAI mini-tier (2026-05). 400K context, 128K max output, 2025-08 cutoff. OpenAI describes as 'strongest mini model for coding, computer use, subagents.' Cache discount 10x ($0.075 input).",
1049
+ // Mini-tier hypothesis. Anchored to Haiku 4.5 + Flash row pricing.
1050
+ // Cost is slightly higher than Haiku ($0.75 vs $0.50 input) but
1051
+ // OpenAI claims strong coding/subagent perf.
1052
+ archetypePerf: {
1053
+ ask: 7,
1054
+ generate: 7,
1055
+ extract: 7,
1056
+ transform: 7,
1057
+ classify: 7,
1058
+ summarize: 7,
1059
+ hunt: 7,
1060
+ plan: 6,
1061
+ critique: 5
1062
+ // reasoning depth gap — frontier models handle this
1063
+ }
1064
+ },
1065
+ {
1066
+ id: "gpt-5.4-nano",
1067
+ verifiedAgainstDocs: "2026-05-17",
1068
+ provider: "openai",
1069
+ status: "current",
1070
+ maxContextTokens: 4e5,
1071
+ maxOutputTokens: 128e3,
1072
+ maxTools: 64,
1073
+ parallelToolCalls: true,
1074
+ structuredOutput: "native",
1075
+ systemPromptMode: "inline",
1076
+ streaming: true,
1077
+ cliffs: [],
1078
+ costInputPer1m: 0.2,
1079
+ costOutputPer1m: 1.25,
1080
+ lowering: {
1081
+ system: { mode: "inline" },
1082
+ cache: { strategy: "unsupported", minTokens: 1024, discount: 0.1 },
1083
+ tools: { format: "openai" }
1084
+ },
1085
+ recovery: [
1086
+ { signal: "rate_limit", action: "escalate", reason: "429 \u2014 escalate to fallback chain" },
1087
+ { signal: "model_not_found", action: "escalate", reason: "Model deprecated/renamed \u2014 escalate (L-061)" }
1088
+ ],
1089
+ strengths: ["cost", "speed", "volume", "structured_output"],
1090
+ weaknesses: ["reasoning_depth", "no_computer_use"],
1091
+ notes: "OpenAI nano-tier (2026-05). 400K context, 128K max output, 2025-08 cutoff. 'Cheapest GPT-5.4-class for simple high-volume tasks.' No fine-tuning, no computer-use tools. Cache discount 10x.",
1092
+ // Nano-tier. Anchored to Flash-Lite row ($0.10/$0.40 vs nano's
1093
+ // $0.20/$1.25). Slightly more expensive than Flash-Lite but with
1094
+ // OpenAI brand reliability. Good fit for classify/summarize floor.
1095
+ archetypePerf: {
1096
+ classify: 7,
1097
+ summarize: 6,
1098
+ ask: 6,
1099
+ transform: 6,
1100
+ extract: 6,
1101
+ generate: 5,
1102
+ hunt: 5,
1103
+ plan: 4,
1104
+ critique: 3
1105
+ // not for reasoning archetypes
1106
+ }
1107
+ },
1108
+ // ── Auto-onboarded (UNVERIFIED) ──
1109
+ // Cloned by scripts/auto-onboard-models.mjs from a same-family template.
1110
+ // Each entry's pricing/context/cliffs/lowering reflects the template, NOT
1111
+ // provider docs. Verify before promoting status to 'current' (L-049/L-081).
1112
+ {
1113
+ // s37 (2026-05-21): UNVERIFIED-AUTO-ONBOARD → verified against
1114
+ // ai.google.dev/gemini-api/docs/models/gemini-3-flash-preview +
1115
+ // ai.google.dev/gemini-api/docs/pricing. L-081 catches:
1116
+ // maxOutputTokens 65_535 → 65_536 (off-by-one)
1117
+ // costInputPer1m 0.30 → 0.50 (template-cloned from 2.5-flash; actual is 1.67× more expensive)
1118
+ // costOutputPer1m 2.50 → 3.00 (template-cloned; actual 1.2× more expensive)
1119
+ // cache discount default 0.25 → 0.10 (10× discount, $0.05/$0.50 per docs)
1120
+ // Cliffs inherited from 2.5-flash conservatively. The 8K-context-quality
1121
+ // cliff was a 2.5-Flash observation — Google positions Gemini 3 as
1122
+ // sustained-frontier-on-long-context; brain evidence will validate/relax.
1123
+ // Kept as guard for now.
1124
+ id: "gemini-3-flash-preview",
1125
+ verifiedAgainstDocs: "2026-05-21",
1126
+ provider: "google",
1127
+ status: "preview",
1128
+ maxContextTokens: 1048576,
1129
+ maxOutputTokens: 65536,
1130
+ maxTools: 128,
1131
+ parallelToolCalls: true,
1132
+ structuredOutput: "native",
1133
+ systemPromptMode: "separate",
1134
+ streaming: true,
1135
+ cliffs: [
1136
+ {
1137
+ metric: "input_tokens",
1138
+ threshold: 8e3,
1139
+ action: "downgrade_quality_warning",
1140
+ reason: "Inherited from 2.5-flash guard; brain evidence on Gemini 3 long-context quality will validate/relax"
1141
+ },
1142
+ {
1143
+ metric: "tool_count",
1144
+ threshold: 20,
1145
+ action: "drop_to_top_relevant",
1146
+ reason: "Tool reliability drops above ~20 tools (despite 128 hard limit) \u2014 inherited from Flash family"
1147
+ },
1148
+ {
1149
+ metric: "thinking_with_short_output",
1150
+ threshold: 1,
1151
+ action: "force_thinking_budget_zero",
1152
+ reason: "Thinking tokens consume maxOutputTokens \u2014 empty response if drained"
1153
+ },
1154
+ {
1155
+ // Inherited from gemini-2.5-flash s11 trust artifact. Family-likely
1156
+ // failure mode for Flash architecture. Keep preemptively until brain
1157
+ // evidence on Gemini 3 specifically.
1158
+ metric: "tool_count",
1159
+ threshold: 1,
1160
+ whenIntent: "summarize",
1161
+ action: "strip_tools",
1162
+ reason: "Inherited from 2.5-flash s11 cliff: summarize+tools \u2192 empty response. Preemptive guard until brain evidence on 3-flash-preview specifically."
1163
+ }
1164
+ ],
1165
+ costInputPer1m: 0.5,
1166
+ costOutputPer1m: 3,
1167
+ lowering: {
1168
+ ...GOOGLE_LOWERING_BASE,
1169
+ // 10× cache discount per Google pricing: $0.05/M cached vs $0.50/M input.
1170
+ cache: { ...GOOGLE_LOWERING_BASE.cache, discount: 0.1 },
1171
+ thinking: { field: "generationConfig.thinkingConfig.thinkingBudget", default: "auto" }
1172
+ },
1173
+ recovery: [
1174
+ {
1175
+ signal: "empty_response_after_tool",
1176
+ action: "retry_with_params",
1177
+ retryParams: { "generationConfig.thinkingConfig.thinkingBudget": 0 },
1178
+ maxRetries: 1,
1179
+ reason: "Known: empty after tool result \u2014 retry with thinking off"
1180
+ },
1181
+ {
1182
+ signal: "empty_response",
1183
+ action: "retry_with_params",
1184
+ retryParams: { "generationConfig.thinkingConfig.thinkingBudget": 0 },
1185
+ maxRetries: 1,
1186
+ reason: "Empty response \u2014 try with thinking off"
1187
+ },
1188
+ {
1189
+ signal: "malformed_function_call",
1190
+ action: "escalate",
1191
+ reason: "MALFORMED_FUNCTION_CALL maps to stop \u2014 escalate to next target"
1192
+ }
1193
+ ],
1194
+ strengths: ["speed", "volume", "classification", "1m_context", "cost"],
1195
+ weaknesses: ["complex_schemas", "large_tool_sets", "high_context_quality"],
1196
+ notes: "Verified s37 (2026-05-21) against Google docs. Step-change positioning vs 2.5-flash on agentic loops per Google's release notes (Dec 2025). Pricing 1.67\xD7/1.2\xD7 higher than 2.5-flash; cache discount 10\xD7 (vs 4\xD7 for 2.5). Status=preview until brain evidence accumulates.",
1197
+ // Anchored to 2.5-flash archetypePerf as starter, with judgment adjustments
1198
+ // for Google's "step-change on agentic" positioning. Brain evidence (zero
1199
+ // rows today) will replace these starter values.
1200
+ archetypePerf: {
1201
+ hunt: 9,
1202
+ // Inherits 2.5-flash L-040 parallel-tool tier; Google positions 3 as agentic-loop upgrade
1203
+ classify: 7,
1204
+ // Inherits 2.5-flash brain-validated tier (218 rows on 2.5)
1205
+ summarize: 7,
1206
+ // Inherits 2.5-flash; cliff strips tools when present
1207
+ transform: 7,
1208
+ ask: 8,
1209
+ // +1 vs 2.5-flash — sustained-frontier positioning
1210
+ generate: 7,
1211
+ // +1 vs 2.5-flash — agentic coding upgrade per Google
1212
+ plan: 6,
1213
+ // +1 vs 2.5-flash — complex iterations per positioning
1214
+ extract: 6,
1215
+ critique: 5
1216
+ // +1 vs 2.5-flash — but still below Sonnet/Opus reasoning floor
1217
+ }
1218
+ },
1219
+ {
1220
+ // ── Gemini 3.1 Flash-Lite ──
1221
+ // Onboarded 2026-05-16 by auto-onboarder; s37 (2026-05-21) verified
1222
+ // against ai.google.dev/gemini-api/docs/pricing.
1223
+ //
1224
+ // L-081 CATCHES (template clone from 2.5-flash-lite was 2.5-3.75× too cheap):
1225
+ // costInputPer1m 0.10 → 0.25 (template clone undervalued by 2.5×)
1226
+ // costOutputPer1m 0.40 → 1.50 (template clone undervalued by 3.75×)
1227
+ //
1228
+ // Real 3.1-flash-lite is NOT a cost-equivalent successor to 2.5-flash-lite —
1229
+ // it sits between 2.5-flash-lite ($0.10/$0.40) and 2.5-flash ($0.30/$2.50).
1230
+ // Cache discount 10× verified ($0.025/M cached vs $0.25/M input).
1231
+ //
1232
+ // Cliffs are HYPOTHESIZED from 2.5-flash family; brain evidence pending.
1233
+ id: "gemini-3.1-flash-lite",
1234
+ verifiedAgainstDocs: "2026-05-21",
1235
+ provider: "google",
1236
+ status: "preview",
1237
+ maxContextTokens: 1048576,
1238
+ maxOutputTokens: 65536,
1239
+ maxTools: 128,
1240
+ parallelToolCalls: true,
1241
+ structuredOutput: "native",
1242
+ systemPromptMode: "separate",
1243
+ streaming: true,
1244
+ cliffs: [
1245
+ {
1246
+ metric: "input_tokens",
1247
+ threshold: 8e3,
1248
+ action: "downgrade_quality_warning",
1249
+ reason: "Inherited from Flash: quality degrades above ~8K. Smaller model \u2014 likely degrades faster. Re-tune from brain after n\u226520."
1250
+ },
1251
+ {
1252
+ metric: "tool_count",
1253
+ threshold: 10,
1254
+ action: "drop_to_top_relevant",
1255
+ reason: "Conservative: Flash drops at 20, Flash-Lite is smaller \u2014 assume tighter ceiling until brain proves otherwise."
1256
+ },
1257
+ {
1258
+ metric: "thinking_with_short_output",
1259
+ threshold: 1,
1260
+ action: "force_thinking_budget_zero",
1261
+ reason: "Thinking enabled per Google API (thinking: true). Same drain risk as Flash \u2014 thinking tokens consume maxOutputTokens."
1262
+ },
1263
+ {
1264
+ // Strong prior: Flash hit 5/5 empty rate on summarize+tools (s11
1265
+ // trust artifact, kgauto commit 3872832). Flash-Lite shares the
1266
+ // same architectural family — almost certainly inherits this cliff.
1267
+ // Ship the guard preemptively; brain telemetry confirms or relaxes.
1268
+ metric: "tool_count",
1269
+ threshold: 1,
1270
+ whenIntent: "summarize",
1271
+ action: "strip_tools",
1272
+ reason: "Inherited from Flash s11 cliff: summarize+tools \u2192 empty response. Preemptive guard until brain evidence on Flash-Lite specifically."
1273
+ }
1274
+ ],
1275
+ costInputPer1m: 0.25,
1276
+ costOutputPer1m: 1.5,
1277
+ lowering: {
1278
+ ...GOOGLE_LOWERING_BASE,
1279
+ // Cache discount 10× (vs Flash 4×) — Google docs s37: $0.025/M cached vs
1280
+ // $0.25/M input. Material for repeat-prompt workloads (classify shape).
1281
+ cache: { ...GOOGLE_LOWERING_BASE.cache, discount: 0.1 },
1282
+ thinking: { field: "generationConfig.thinkingConfig.thinkingBudget", default: "auto" }
1283
+ },
1284
+ recovery: [
1285
+ {
1286
+ signal: "empty_response_after_tool",
1287
+ action: "retry_with_params",
1288
+ retryParams: { "generationConfig.thinkingConfig.thinkingBudget": 0 },
1289
+ maxRetries: 1,
1290
+ reason: "Known on Flash family: empty after tool result \u2014 retry with thinking off."
1291
+ },
1292
+ {
1293
+ signal: "empty_response",
1294
+ action: "retry_with_params",
1295
+ retryParams: { "generationConfig.thinkingConfig.thinkingBudget": 0 },
1296
+ maxRetries: 1,
1297
+ reason: "Empty response \u2014 try with thinking off."
1298
+ },
1299
+ {
1300
+ signal: "malformed_function_call",
1301
+ action: "escalate",
1302
+ reason: "MALFORMED_FUNCTION_CALL maps to stop \u2014 escalate to next target."
1303
+ }
1304
+ ],
1305
+ strengths: ["low_cost", "speed", "volume", "classification", "summarize", "1m_context", "cache_friendly"],
1306
+ weaknesses: ["complex_reasoning", "large_tool_sets", "complex_schemas", "structured_output_unproven", "long_context_quality"],
1307
+ notes: "Verified s37 (2026-05-21) against Google docs. Sits between 2.5-flash-lite (cheaper) and 2.5-flash (more expensive) on cost frontier; 2.5\xD7 more expensive than initial template-clone. Cliffs hypothesized from Flash family \u2014 brain evidence pending.",
1308
+ // Tier 2-3 floor for summarize/classify chains at the new (verified) price
1309
+ // point. ZERO brain rows — values are starter hypotheses anchored to
1310
+ // "smaller sibling of Flash at higher cost than 2.5-flash-lite." The first
1311
+ // 50 brain rows per archetype will validate or relax these.
1312
+ archetypePerf: {
1313
+ classify: 6,
1314
+ // starter hypothesis — verify (Flash is 7, lite likely ≤)
1315
+ summarize: 6,
1316
+ // starter hypothesis — verify; cliff strips tools
1317
+ transform: 6,
1318
+ // starter hypothesis — verify
1319
+ ask: 5,
1320
+ hunt: 5,
1321
+ generate: 4,
1322
+ extract: 4,
1323
+ plan: 3,
1324
+ critique: 3
1325
+ }
1326
+ },
1327
+ // ─────────────────────────────────────────────────────────────────────────
1328
+ // Gemini 3.5 Flash — hand-onboarded s37 (2026-05-21)
1329
+ //
1330
+ // Google positioning ("Most intelligent for sustained frontier performance
1331
+ // on agentic and coding tasks" / "particularly effective for rapid agentic
1332
+ // loops involving complex coding cycles and iterations") suggests this is
1333
+ // the Flash-family upgrade specifically aimed at hunt-shape workloads.
1334
+ // Pricing 5× input / 3.6× output vs 2.5-flash — material cost premium.
1335
+ // archetypePerf adjusted +1 vs 2.5-flash on ask/generate/plan/critique
1336
+ // (sustained-frontier positioning); hunt held at 9 inherited from L-040
1337
+ // family parallel-tool tier; brain evidence will validate within 50 rows.
1338
+ //
1339
+ // Cliffs inherited conservatively from 2.5-flash. Google's "sustained
1340
+ // frontier on long-context" positioning suggests the 8K cliff may not
1341
+ // apply to 3.5 — keep as guard until brain evidence shows otherwise.
1342
+ //
1343
+ // Specs verified against:
1344
+ // ai.google.dev/gemini-api/docs/models/gemini-3.5-flash
1345
+ // ai.google.dev/gemini-api/docs/pricing (Standard tier)
1346
+ // ─────────────────────────────────────────────────────────────────────────
1347
+ {
1348
+ id: "gemini-3.5-flash",
1349
+ verifiedAgainstDocs: "2026-05-21",
1350
+ provider: "google",
1351
+ status: "current",
1352
+ maxContextTokens: 1048576,
1353
+ maxOutputTokens: 65536,
1354
+ maxTools: 128,
1355
+ parallelToolCalls: true,
1356
+ structuredOutput: "native",
1357
+ systemPromptMode: "separate",
1358
+ streaming: true,
1359
+ cliffs: [
1360
+ {
1361
+ metric: "input_tokens",
1362
+ threshold: 8e3,
1363
+ action: "downgrade_quality_warning",
1364
+ reason: "Inherited from 2.5-flash guard; Google positions 3.5 as sustained-frontier-on-long-context but brain evidence pending"
1365
+ },
1366
+ {
1367
+ metric: "tool_count",
1368
+ threshold: 20,
1369
+ action: "drop_to_top_relevant",
1370
+ reason: "Inherited from Flash family: tool reliability drops above ~20 (despite 128 hard limit). Validate per (archetype, model) after n\u226520."
1371
+ },
1372
+ {
1373
+ metric: "thinking_with_short_output",
1374
+ threshold: 1,
1375
+ action: "force_thinking_budget_zero",
1376
+ reason: "Thinking mode supported per Google docs; same drain risk as 2.5-flash \u2014 thinking tokens consume maxOutputTokens"
1377
+ },
1378
+ {
1379
+ // Inherited from 2.5-flash s11 trust artifact (5/5 empty rate on
1380
+ // tt-intelligence/summarize/gemini-2.5-flash with tools offered).
1381
+ // Family-likely failure mode for Flash architecture across versions.
1382
+ // Keep preemptively until brain evidence on 3.5-flash specifically.
1383
+ metric: "tool_count",
1384
+ threshold: 1,
1385
+ whenIntent: "summarize",
1386
+ action: "strip_tools",
1387
+ reason: "Inherited from 2.5-flash s11 cliff (kgauto commit 3872832): summarize+tools \u2192 empty response. Preemptive guard until brain evidence on 3.5-flash specifically."
1388
+ }
1389
+ ],
1390
+ costInputPer1m: 1.5,
1391
+ costOutputPer1m: 9,
1392
+ lowering: {
1393
+ ...GOOGLE_LOWERING_BASE,
1394
+ // 10× cache discount per Google pricing: $0.15/M cached vs $1.50/M input.
1395
+ cache: { ...GOOGLE_LOWERING_BASE.cache, discount: 0.1 },
1396
+ thinking: { field: "generationConfig.thinkingConfig.thinkingBudget", default: "auto" }
1397
+ },
1398
+ recovery: [
1399
+ {
1400
+ signal: "empty_response_after_tool",
1401
+ action: "retry_with_params",
1402
+ retryParams: { "generationConfig.thinkingConfig.thinkingBudget": 0 },
1403
+ maxRetries: 1,
1404
+ reason: "Inherited Flash-family pattern: empty after tool result \u2014 retry with thinking off"
1405
+ },
1406
+ {
1407
+ signal: "empty_response",
1408
+ action: "retry_with_params",
1409
+ retryParams: { "generationConfig.thinkingConfig.thinkingBudget": 0 },
1410
+ maxRetries: 1,
1411
+ reason: "Empty response \u2014 try with thinking off"
1412
+ },
1413
+ {
1414
+ signal: "malformed_function_call",
1415
+ action: "escalate",
1416
+ reason: "MALFORMED_FUNCTION_CALL maps to stop \u2014 escalate to next target"
1417
+ }
1418
+ ],
1419
+ strengths: ["agentic_loops", "coding", "1m_context", "parallel_tools", "thinking_mode", "sustained_frontier"],
1420
+ weaknesses: ["cost_vs_2_5_flash", "no_brain_evidence_yet"],
1421
+ notes: "Hand-onboarded s37 (2026-05-21) verified against Google docs. Stable status; positioned as Flash-family upgrade for agentic loops and coding. 5\xD7/3.6\xD7 more expensive than 2.5-flash but Google claims step-change on sustained frontier work. archetypePerf adjustments are judgment-grounded starter hypotheses \u2014 brain evidence will validate within ~50 rows per archetype.",
1422
+ // Starter hypothesis: anchored to 2.5-flash archetypePerf with +1
1423
+ // adjustments where Google's positioning explicitly supports
1424
+ // (agentic/coding/sustained). Hunt held at 9 inherited from L-040 family
1425
+ // parallel-tool tier. Brain evidence will replace.
1426
+ archetypePerf: {
1427
+ hunt: 9,
1428
+ // Inherited from 2.5-flash L-040 parallel-tool tier; Google positions 3.5 as agentic-loop champion
1429
+ classify: 7,
1430
+ // Inherited from 2.5-flash brain-validated tier (218 rows on 2.5)
1431
+ summarize: 7,
1432
+ // Inherited from 2.5-flash; cliff strips tools when present
1433
+ transform: 7,
1434
+ ask: 8,
1435
+ // +1 vs 2.5-flash — sustained-frontier positioning
1436
+ generate: 8,
1437
+ // +1 vs 2.5-flash (6→8) — Google: "complex coding cycles and iterations"
1438
+ plan: 7,
1439
+ // +1 vs 2.5-flash (5→7) — "complex iterations" positioning
1440
+ extract: 7,
1441
+ // +1 vs 2.5-flash — sustained-frontier on structured tasks
1442
+ critique: 5
1443
+ // +1 vs 2.5-flash — but still below Sonnet/Opus reasoning floor
1444
+ }
1445
+ },
1446
+ {
1447
+ // Auto-onboarded 2026-07-01 from `claude-sonnet-4-6`; VERIFIED 2026-07-02
1448
+ // against the claude-api reference (cc-portfolio ratification pass). The
1449
+ // clone got context right (1M) and pricing right at sticker ($3/$15 —
1450
+ // NOTE an introductory $2/$10 per MTok runs through 2026-08-31; sticker
1451
+ // encoded here per the time-bounded-pricing convention, intro belongs in
1452
+ // brain kgauto_pricing if worth capturing). The clone got max output WRONG:
1453
+ // Sonnet 5 is 128k, not 4-6's 64k — corrected. New tokenizer (~30% more
1454
+ // tokens for the same text vs 4-6): byte-budget consumers should re-baseline.
1455
+ // API quirks (claude-api ref): (a) NON-DEFAULT temperature/top_p/top_k
1456
+ // return 400 — moot for kgauto's own call() path (ANTHROPIC_LOWERING_BASE
1457
+ // emits no sampling params) but a REAL hazard for compileForAISDKv6
1458
+ // consumers that pass temperature themselves (tt-intel scoring uses temp:0
1459
+ // for determinism — that 400s on this model; noted to consumers via the
1460
+ // contract). (b) Omitting `thinking` runs ADAPTIVE by default (4-6 ran
1461
+ // thinking-off) — output spend shifts. (c) Supports effort xhigh. status:
1462
+ // 'preview' per the Fable precedent — no brain evidence yet; promotion to
1463
+ // 'current' is an explicit call. (L-049/L-081.)
1464
+ id: "claude-sonnet-5",
1465
+ verifiedAgainstDocs: "2026-07-02",
1466
+ provider: "anthropic",
1467
+ status: "current",
1468
+ // s76 2026-07-25: GA per docs; was preview.
1469
+ maxContextTokens: 1e6,
1470
+ maxOutputTokens: 128e3,
1471
+ maxTools: 64,
1472
+ parallelToolCalls: true,
1473
+ structuredOutput: "grammar",
1474
+ systemPromptMode: "inline",
1475
+ streaming: true,
1476
+ cliffs: [],
1477
+ costInputPer1m: 3,
1478
+ costOutputPer1m: 15,
1479
+ lowering: ANTHROPIC_LOWERING_BASE,
1480
+ recovery: [
1481
+ { signal: "rate_limit", action: "escalate", reason: "429 \u2014 escalate" },
1482
+ { signal: "model_not_found", action: "escalate", reason: "Deprecated \u2014 escalate (L-061)" }
1483
+ ],
1484
+ strengths: ["quality", "tool_use", "long_context", "cache_friendly", "extended_thinking"],
1485
+ weaknesses: [],
1486
+ notes: "Sonnet 5 (2026-06): near-Opus quality on coding/agentic work at Sonnet cost. Verified 2026-07-02 against the claude-api reference: 1M ctx, 128k out (clone's 64k corrected), $3/$15 sticker (intro $2/$10 through 2026-08-31). New tokenizer ~30% more tokens vs sonnet-4-6. Consumer hazards: non-default temperature/top_p/top_k 400 (temp:0 rejected \u2014 deterministic-scoring consumers must omit); thinking defaults to adaptive when omitted. status:preview \u2014 no brain evidence yet; earns placement via the machinery.",
1487
+ // Master plan §6.2 anchor. Tier 0 for plan/generate/ask/extract/transform
1488
+ // in starter chains; tier 1 cross-provider for hunt/summarize/classify.
1489
+ archetypePerf: {
1490
+ ask: 9,
1491
+ generate: 9,
1492
+ plan: 9,
1493
+ critique: 9,
1494
+ extract: 9,
1495
+ transform: 9,
1496
+ hunt: 7,
1497
+ // strong but Flash beats on parallel tool throughput
1498
+ summarize: 8,
1499
+ // overkill for tolerant archetype
1500
+ classify: 8
1501
+ // overkill
1502
+ }
1503
+ },
1504
+ // ── Z.ai (GLM) ──
1505
+ // alpha.65 (2026-07-18): first Z.ai profile, provider `zai` added same
1506
+ // release. Step-zero sources (L-049/L-081, all fetched 2026-07-18):
1507
+ // docs.z.ai/guides/llm/glm-5.2 (capabilities), docs.z.ai api-reference
1508
+ // chat-completion (wire params: thinking.type enabled|disabled default
1509
+ // enabled, reasoning_effort max..none, tool_stream, max output 131072),
1510
+ // docs.z.ai/guides/overview/pricing ($1.4 in / $4.4 out, cached input
1511
+ // $0.26, cache storage limited-time free), vLLM recipe (native ctx
1512
+ // 1,048,576). NO AI-trained numbers.
1513
+ {
1514
+ id: "glm-5.2",
1515
+ verifiedAgainstDocs: "2026-07-18",
1516
+ provider: "zai",
1517
+ status: "preview",
1518
+ maxContextTokens: 1048576,
1519
+ maxOutputTokens: 131072,
1520
+ // No documented tool-count cap — conservative default pending measured
1521
+ // evidence; matches the deepseek posture, not a doc number.
1522
+ maxTools: 16,
1523
+ // Hosted-API docs document tools + tool_choice + tool_stream but say
1524
+ // NOTHING about multiple tool_calls per response. Conservative false so
1525
+ // hunt-shaped ranking doesn't over-promise; flip on doc or probe
1526
+ // evidence (L-081: undocumented ≠ true).
1527
+ parallelToolCalls: false,
1528
+ structuredOutput: "native",
1529
+ systemPromptMode: "inline",
1530
+ streaming: true,
1531
+ cliffs: [],
1532
+ costInputPer1m: 1.4,
1533
+ costOutputPer1m: 4.4,
1534
+ lowering: {
1535
+ system: { mode: "inline" },
1536
+ // Automatic prefix caching ("intelligent caching mechanism") — no wire
1537
+ // marker to emit, DeepSeek-style. Cache-hit input $0.26/M (~0.19× of
1538
+ // miss) tracked in notes; storage limited-time free as of 2026-07-18.
1539
+ cache: { strategy: "unsupported" },
1540
+ tools: { format: "openai" },
1541
+ // thinking.type: 'enabled' (server default) | 'disabled'. lowerZai
1542
+ // emits an explicit disable only on forceThinkingZero cliffs.
1543
+ thinking: { field: "thinking.type", default: "auto" }
1544
+ },
1545
+ recovery: [
1546
+ { signal: "rate_limit", action: "escalate", reason: "429 \u2014 escalate" },
1547
+ { signal: "model_not_found", action: "escalate", reason: "Deprecated \u2014 escalate (L-061)" }
1548
+ ],
1549
+ strengths: ["cost", "1m_context", "code", "tool_use", "json_output", "reasoning"],
1550
+ weaknesses: ["parallel_tools"],
1551
+ notes: "GLM-5.2 (Z.ai, 2026-06): agentic-coding flagship. 1,048,576 ctx / 131,072 max out. $1.40/$4.40 per 1M; cached input $0.26/M (automatic caching, no marker; storage limited-time free as of 2026-07-18). Thinking on by default (`thinking.type`), `reasoning_effort` max..none. Parallel tool calls UNDOCUMENTED on the hosted API \u2014 profile says false until doc or probe evidence. status:preview \u2014 no brain evidence yet; earns placement via the machinery.",
1552
+ // Starter hypotheses — verify with telemetry/probes; NO brain evidence
1553
+ // yet. Anchored on the vendor's agentic-coding positioning at a
1554
+ // mid-cost tier, discounted for the unproven parallel-tool story.
1555
+ archetypePerf: {
1556
+ generate: 7,
1557
+ // agentic-coding positioning — starter hypothesis
1558
+ transform: 7,
1559
+ // starter hypothesis
1560
+ plan: 7,
1561
+ // starter hypothesis
1562
+ summarize: 7,
1563
+ // tolerant archetype — starter hypothesis
1564
+ ask: 6,
1565
+ extract: 6,
1566
+ critique: 6,
1567
+ classify: 6,
1568
+ hunt: 5
1569
+ // tools work; parallel unproven → discounted
1570
+ }
1571
+ },
1572
+ // ── Moonshot (Kimi) ──
1573
+ // alpha.65 (2026-07-18): first Moonshot profile, provider `moonshot` added
1574
+ // same release. Step-zero sources (all fetched 2026-07-18):
1575
+ // platform.kimi.ai/docs/pricing/chat-k3 ($3.00 cache-miss in / $0.30
1576
+ // cache-hit in / $15.00 out; 1,048,576 ctx; ToolCalls + JSON Mode +
1577
+ // Partial Mode), kimi-k3-quickstart (max_completion_tokens default
1578
+ // 131072, up to 1,048,576; base https://api.moonshot.ai/v1; vision via
1579
+ // base64 or ms://file-id, NO public image URLs), models-overview
1580
+ // (temperature FIXED 1.0, top_p FIXED 0.95, n FIXED 1, always reasons,
1581
+ // reasoning_effort 'max' only), tool-calls guide ("can choose to call
1582
+ // multiple tools at once … will tend to call them in parallel").
1583
+ {
1584
+ id: "kimi-k3",
1585
+ verifiedAgainstDocs: "2026-07-18",
1586
+ provider: "moonshot",
1587
+ status: "preview",
1588
+ maxContextTokens: 1048576,
1589
+ // Documented ceiling; default is 131,072 when unset.
1590
+ maxOutputTokens: 1048576,
1591
+ // No hard doc cap; docs recommend dynamic tool loading at "dozens or
1592
+ // hundreds" — 64 matches the frontier-agentic posture (sonnet-5 tier).
1593
+ maxTools: 64,
1594
+ parallelToolCalls: true,
1595
+ structuredOutput: "native",
1596
+ systemPromptMode: "inline",
1597
+ streaming: true,
1598
+ cliffs: [],
1599
+ costInputPer1m: 3,
1600
+ costOutputPer1m: 15,
1601
+ lowering: {
1602
+ system: { mode: "inline" },
1603
+ // Automatic context caching — no wire marker. Cache-hit input $0.30/M
1604
+ // (0.1× of miss) tracked in notes.
1605
+ cache: { strategy: "unsupported" },
1606
+ tools: { format: "openai" }
1607
+ // No thinking knob: reasoning is always-on and reasoning_effort
1608
+ // accepts only 'max' (= the server default). Nothing to lower.
1609
+ },
1610
+ recovery: [
1611
+ { signal: "rate_limit", action: "escalate", reason: "429 \u2014 escalate" },
1612
+ { signal: "model_not_found", action: "escalate", reason: "Deprecated \u2014 escalate (L-061)" }
1613
+ ],
1614
+ strengths: ["quality", "reasoning", "1m_context", "parallel_tools", "tool_use", "code", "vision"],
1615
+ // 'latency' → latencyTierOf derives 'slow': always-on max-effort
1616
+ // reasoner with no off switch; no measured p50 yet, the tag is the
1617
+ // honest prior (reasoner family precedent: deepseek-v4-pro ~48s).
1618
+ weaknesses: ["cost", "latency"],
1619
+ notes: "Kimi K3 (Moonshot, API live 2026-07-16): 2.8T-param open-weight flagship, native vision. 1,048,576 ctx; max_completion_tokens default 131,072, ceiling 1,048,576. $3.00/$15.00 per 1M, cache-hit input $0.30/M (automatic caching). Reasoning ALWAYS ON (reasoning_effort max only, cannot disable; responses may carry reasoning_content). Wire quirks: temperature fixed 1.0 / top_p 0.95 / n 1 (kgauto never emits those); vision input must be base64 or ms://file-id \u2014 public image URLs rejected. status:preview \u2014 earns placement via the machinery.",
1620
+ // Starter hypotheses — verify with telemetry/probes; NO brain evidence
1621
+ // yet. Anchored on documented long-horizon-agentic + parallel-tool
1622
+ // strengths; discounted on terse archetypes where always-on reasoning
1623
+ // bills $15/M output for thinking the archetype doesn't need.
1624
+ archetypePerf: {
1625
+ hunt: 8,
1626
+ // parallel tools + long-horizon agentic — starter hypothesis
1627
+ plan: 8,
1628
+ // starter hypothesis
1629
+ generate: 8,
1630
+ // starter hypothesis
1631
+ critique: 7,
1632
+ ask: 7,
1633
+ extract: 7,
1634
+ transform: 7,
1635
+ summarize: 6,
1636
+ // works, but $15/M output reasoning tax on a tolerant archetype
1637
+ classify: 5
1638
+ // always-on reasoning cost + reasoner hedge risk
1639
+ },
1640
+ // Diagnostics-only (no prompt rewrite): reasoner-family hedge risk on
1641
+ // decisive archetypes, carried as a warning until K3-specific probe
1642
+ // evidence exists. The deepseek-reasoner family showed 8/10 judge
1643
+ // rationales citing hedging on classify (exclusion-finding ID 20,
1644
+ // 2026-05-28); K3 is an always-on reasoner and inherits the risk class,
1645
+ // not the conviction.
1646
+ archetypeConventions: [
1647
+ {
1648
+ archetype: "classify",
1649
+ cliffWarning: "kimi-k3 is an always-on reasoner: decisive archetypes (classify) may hedge, and reasoning tokens bill at $15/M output. Family-prior risk (deepseek-reasoner precedent), not K3-measured \u2014 probe before relying on it for classify.",
1650
+ reason: "Reasoner-family prior (exclusion-finding ID 20, 2026-05-28, deepseek-v4-pro on tt-intel/classify). No K3-specific evidence yet \u2014 warning only, no prompt rewrite."
1651
+ }
1652
+ ]
1653
+ }
1654
+ ];
1655
+ var ALIASES = {
1656
+ // DeepSeek's own model routing — both names served by V4-Flash.
1657
+ "deepseek-chat": "deepseek-v4-flash",
1658
+ "deepseek-reasoner": "deepseek-v4-flash",
1659
+ // Legacy kgauto typo — actual API alias is dash-form (alpha.1 had dot).
1660
+ "claude-haiku-4.5": "claude-haiku-4-5"
1661
+ };
1662
+ var brainHook = {};
1663
+ function _setProfileBrainHook(hook) {
1664
+ brainHook = hook;
1665
+ }
1666
+ function canonicalId(id) {
1667
+ return brainHook.resolveAlias?.(id) ?? ALIASES[id] ?? id;
1668
+ }
1669
+ var PROFILE_INDEX = new Map(
1670
+ PROFILES_RAW.map((p) => [p.id, p])
1671
+ );
1672
+ function getProfile(id) {
1673
+ const canonical = canonicalId(id);
1674
+ const fromBrain = brainHook.getProfile?.(canonical);
1675
+ if (fromBrain) return fromBrain;
1676
+ const p = PROFILE_INDEX.get(canonical);
1677
+ if (!p) {
1678
+ const known = [...PROFILE_INDEX.keys(), ...Object.keys(ALIASES)].join(", ");
1679
+ throw new Error(`Unknown model id: "${id}". Known: ${known}`);
1680
+ }
1681
+ return p;
1682
+ }
1683
+ function tryGetProfile(id) {
1684
+ const canonical = canonicalId(id);
1685
+ return brainHook.getProfile?.(canonical) ?? PROFILE_INDEX.get(canonical);
1686
+ }
1687
+ function allProfiles() {
1688
+ return PROFILES_RAW;
1689
+ }
1690
+ function allProfilesRaw() {
1691
+ return PROFILES_RAW;
1692
+ }
1693
+ function profilesByProvider(provider) {
1694
+ return PROFILES_RAW.filter((p) => p.provider === provider);
1695
+ }
1696
+
1697
+ export {
1698
+ LATENCY_TIER_MS,
1699
+ latencyTierOf,
1700
+ ALIASES,
1701
+ _setProfileBrainHook,
1702
+ getProfile,
1703
+ tryGetProfile,
1704
+ allProfiles,
1705
+ allProfilesRaw,
1706
+ profilesByProvider
1707
+ };