Skip to content

armgit / kiln

Public Imported from GitHub
0

Build and revise procedural 3D assets with your coding agent. Local MCP server, CLI and TypeScript engine with rendered review, editable source and GLB export.

fix: support claude sonnet 5 thinking defaults

Matt Kissinger5318714dfb2d
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 92e9d0e3..dc4e8dbd 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,11 +5,18 @@ for the consuming app's lockfile + tarball provenance, not public npm releases.
## [Unreleased]
+## [0.1.1] — 2026-06-30
+
### Documentation
- Clarified that `@kiln/engine` remains private execution infrastructure. External developer access
is mediated by Studio `/v1`, private SDK/skills, and future AgentCore Gateway product tools rather
than direct engine, raw Forge, or composer harness exposure.
+### Changed
+- Treat native `claude-sonnet-5` as adaptive-only for Anthropic thinking controls: numeric
+ `KILN_THINKING` budgets are ignored for this model so the agent harness does not send
+ manual extended-thinking params that Sonnet 5 rejects.
+
### Added — scene composer (`@kiln/engine/composer`, `/composer/agent`)
A THREE-free scene-composition surface: a `PlacementModel` single-source-of-truth with a
small scene DSL (`scene()`/`asset()`), terrain-agnostic hierarchy-aware layout, an overlap
diff --git a/package.json b/package.json
index 3081c677..d6037171 100644
--- a/package.json
+++ b/package.json
@@ -1,7 +1,7 @@
{
"name": "@kiln/engine",
"private": true,
- "version": "0.1.0",
+ "version": "0.1.1",
"description": "Kiln 3D engine — text-to-GLB codegen agent loop, deterministic CPU render/rasterizer, primitive/CSG library, palette + instanceability grading, and pairwise ranking arena. Extracted from pixel-forge.",
"license": "MIT",
"author": "Matthew Kissinger",
diff --git a/src/agent/providers.test.ts b/src/agent/providers.test.ts
index 9673a283..c4702a50 100644
--- a/src/agent/providers.test.ts
+++ b/src/agent/providers.test.ts
@@ -148,6 +148,14 @@ describe('makeKilnModel', () => {
expect(cfg['betas']).toEqual(['interleaved-thinking-2025-05-14']);
});
+ test('Sonnet 5 ignores numeric thinking budgets because it is adaptive-only', () => {
+ const cfg = getCfg(
+ makeKilnModel({ provider: 'anthropic', model: 'claude-sonnet-5', thinking: 8000 }),
+ );
+ expect(cfg['params']).toBeUndefined();
+ expect(cfg['betas']).toBeUndefined();
+ });
+
test('env keyword/number applies (numbers floored to 1024); descriptor 0 forces default; google ignores it', () => {
const prev = process.env['KILN_THINKING'];
try {
diff --git a/src/agent/providers.ts b/src/agent/providers.ts
index d43001d5..fa17ee38 100644
--- a/src/agent/providers.ts
+++ b/src/agent/providers.ts
@@ -100,7 +100,12 @@ const trimmedEnv = (k: string): string | undefined => {
* minimum of 1024, interleaved beta added). Unset / 0 / '' → undefined, i.e.
* send nothing and take the API default.
*/
+function isAnthropicAdaptiveOnlyModel(model: string): boolean {
+ return /^claude-sonnet-5(?:-|$)/.test(model);
+}
+
function resolveAnthropicThinking(
+ model: string,
fromDesc?: string | number,
): { params: Record<string, unknown>; betas?: string[] } | undefined {
const raw = fromDesc ?? trimmedEnv('KILN_THINKING');
@@ -113,6 +118,10 @@ function resolveAnthropicThinking(
: undefined;
if (asNum !== undefined) {
if (!Number.isFinite(asNum) || asNum <= 0) return undefined;
+ // Sonnet 5 has adaptive thinking on by default and rejects manual
+ // extended-thinking budgets. Do not let a global KILN_THINKING number make
+ // this model fail before the first tool call.
+ if (isAnthropicAdaptiveOnlyModel(model)) return undefined;
return {
params: { thinking: { type: 'enabled', budget_tokens: Math.max(1024, Math.floor(asNum)) } },
betas: ['interleaved-thinking-2025-05-14'],
@@ -134,7 +143,7 @@ export function makeKilnModel(desc: KilnModelDescriptor, opts: MakeKilnModelOpti
const maxTokens = desc.maxTokens;
switch (desc.provider) {
case 'anthropic': {
- const thinking = resolveAnthropicThinking(desc.thinking);
+ const thinking = resolveAnthropicThinking(desc.model, desc.thinking);
return new AnthropicModel({
modelId: desc.model,
...(maxTokens != null ? { maxTokens } : {}),