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

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