Skip to content

Commit 2d01b5d

Browse files
oratistclaude
authored
fix(cli): derive /effort table from core EFFORT_PARAMS (single source of truth) (#147)
The /effort picker hardcoded a maxTokens/temperature table (low=1024 … max=32768, temps 0.0–0.7) that diverged from EFFORT_PARAMS in @deepcode/core — the values the REPL and headless paths actually send to DeepSeek (low=1500 … max=8192, temps 0.2–0.8). Users running /effort saw "max = 32768 tokens, temp 0.7" while the provider really capped at 8192 tokens, temp 0.8 — pure misinformation. Derive the picker rows from EFFORT_PARAMS so there is one source of truth; keep only the human-readable use-case hint CLI-local. Adds a regression test asserting the rendered table matches EFFORT_PARAMS and never shows the stale numbers. Co-authored-by: t <t@t> Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 91817ae commit 2d01b5d

2 files changed

Lines changed: 45 additions & 10 deletions

File tree

apps/cli/src/commands.test.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,20 @@ describe('built-in command behavior', () => {
117117
expect(ctx.effort).toBe('high');
118118
});
119119

120+
it('/effort table reflects core EFFORT_PARAMS (single source of truth)', async () => {
121+
const { EFFORT_PARAMS } = await import('@deepcode/core');
122+
const reg = new CommandRegistry();
123+
const out = (await reg.match('/effort')!.cmd.run([], makeContext())).join('\n');
124+
// Every tier renders the maxTokens/temperature the provider actually uses.
125+
for (const tier of ['low', 'medium', 'high', 'xhigh', 'max'] as const) {
126+
expect(out).toContain(String(EFFORT_PARAMS[tier].maxTokens));
127+
expect(out).toContain(EFFORT_PARAMS[tier].temperature.toFixed(1));
128+
}
129+
// The old divergent hardcoded numbers must never resurface.
130+
expect(out).not.toContain('32768');
131+
expect(out).not.toContain('16384');
132+
});
133+
120134
it('/status emits session info', async () => {
121135
const reg = new CommandRegistry();
122136
const ctx = makeContext({ sessions: new SessionManager({ root: sessRoot }) });

apps/cli/src/commands.ts

Lines changed: 31 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,13 @@ import type {
99
SessionMeta,
1010
StoredMessage,
1111
} from '@deepcode/core';
12-
import { contextWindowFor, redact, type Credentials } from '@deepcode/core';
12+
import {
13+
contextWindowFor,
14+
redact,
15+
EFFORT_PARAMS,
16+
type Credentials,
17+
type Effort,
18+
} from '@deepcode/core';
1319

1420
export interface SessionContext {
1521
cwd: string;
@@ -147,19 +153,34 @@ export const ModeCommand: SlashCommand = {
147153
},
148154
};
149155

150-
// Effort tier UI metadata — surfaced by `/effort` with no args.
156+
// Effort tier UI metadata surfaced by `/effort` with no args.
157+
// why: the maxTokens/temperature numbers are NOT defined here — they are read
158+
// from EFFORT_PARAMS in @deepcode/core, the single source of truth the REPL and
159+
// headless paths actually send to the provider. A divergent hardcoded table
160+
// here previously told users "max = 32768 tokens, temp 0.7" while the provider
161+
// sent max_tokens=8192, temp=0.8 — pure misinformation. Only the human-readable
162+
// use-case hint is CLI-local; everything quantitative is derived.
163+
const EFFORT_ORDER: Effort[] = ['low', 'medium', 'high', 'xhigh', 'max'];
164+
165+
const EFFORT_USE: Record<Effort, string> = {
166+
low: 'Quick targeted fixes. Cheap.',
167+
medium: 'Default. Most tasks.',
168+
high: 'Multi-step refactors.',
169+
xhigh: 'Plans, architecture decisions.',
170+
max: 'Open-ended exploration. Burns tokens.',
171+
};
172+
151173
const EFFORT_TIERS: Array<{
152-
name: string;
174+
name: Effort;
153175
maxTokens: number;
154176
temperature: number;
155177
use: string;
156-
}> = [
157-
{ name: 'low', maxTokens: 1024, temperature: 0.0, use: 'Quick targeted fixes. Cheap.' },
158-
{ name: 'medium', maxTokens: 4096, temperature: 0.3, use: 'Default. Most tasks.' },
159-
{ name: 'high', maxTokens: 8192, temperature: 0.5, use: 'Multi-step refactors.' },
160-
{ name: 'xhigh', maxTokens: 16384, temperature: 0.6, use: 'Plans, architecture decisions.' },
161-
{ name: 'max', maxTokens: 32768, temperature: 0.7, use: 'Open-ended exploration. Burns tokens.' },
162-
];
178+
}> = EFFORT_ORDER.map((name) => ({
179+
name,
180+
maxTokens: EFFORT_PARAMS[name].maxTokens,
181+
temperature: EFFORT_PARAMS[name].temperature,
182+
use: EFFORT_USE[name],
183+
}));
163184

164185
export const EffortCommand: SlashCommand = {
165186
name: '/effort',

0 commit comments

Comments
 (0)