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