@warmdrift/kgauto-compiler 2.0.0-alpha.7 → 2.0.0-alpha.70

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