Skip to content

Commit 79d7117

Browse files
authored
Merge pull request #73 from TeigenZhang/feat/thinking-effort
feat: thinking effort setting for new sessions (with xhigh/max)
2 parents 996b096 + 3cf4867 commit 79d7117

5 files changed

Lines changed: 24 additions & 1 deletion

File tree

src/web/public/index.html

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1095,6 +1095,18 @@ <h3>App Settings</h3>
10951095
</label>
10961096
<span class="form-hint">Use 1M token context window (model: opus[1m]) for all new sessions</span>
10971097
</div>
1098+
<div class="form-row">
1099+
<label>Thinking Effort</label>
1100+
<select id="appSettingsThinkingEffort" class="form-select">
1101+
<option value="">Default</option>
1102+
<option value="low">Low</option>
1103+
<option value="medium">Medium</option>
1104+
<option value="high">High</option>
1105+
<option value="xhigh">XHigh</option>
1106+
<option value="max">Max</option>
1107+
</select>
1108+
<span class="form-hint">Set CLAUDE_CODE_EFFORT_LEVEL for all new sessions (default = no override)</span>
1109+
</div>
10981110
<!-- Nice Priority Section -->
10991111
<div class="form-section-header">Nice Priority</div>
11001112
<div class="form-row form-row-switch">

src/web/public/keyboard-accessory.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ const KeyboardAccessoryBar = {
9292
</button>
9393
<button class="accessory-btn" data-action="tab" title="Tab">Tab</button>
9494
<button class="accessory-btn" data-action="shift-tab" title="Shift+Tab">⇧Tab</button>
95+
<button class="accessory-btn" data-action="effort-max" title="/effort max">Max</button>
9596
<button class="accessory-btn" data-action="ctrl-o" title="Ctrl+O">⌃O</button>
9697
<button class="accessory-btn" data-action="opt-enter" title="Option+Enter (newline)">⌥Enter</button>
9798
<button class="accessory-btn" data-action="esc" title="Escape">Esc</button>
@@ -125,7 +126,7 @@ const KeyboardAccessoryBar = {
125126
this.handleAction(action, btn);
126127

127128
// Refocus terminal so keyboard stays open (tap blurs terminal → keyboard dismisses → toolbar shifts)
128-
const refocusActions = new Set(['scroll-up', 'scroll-down', 'arrow-left', 'arrow-right', 'tab', 'shift-tab', 'ctrl-o', 'opt-enter', 'esc']);
129+
const refocusActions = new Set(['scroll-up', 'scroll-down', 'arrow-left', 'arrow-right', 'tab', 'shift-tab', 'ctrl-o', 'opt-enter', 'esc', 'effort-max']);
129130
if (refocusActions.has(action) ||
130131
((action === 'clear' || action === 'compact') && this._confirmAction)) {
131132
if (typeof app !== 'undefined' && app.terminal) {
@@ -184,6 +185,9 @@ const KeyboardAccessoryBar = {
184185
case 'ctrl-o':
185186
this.sendKey('\x0f');
186187
break;
188+
case 'effort-max':
189+
this.sendCommand('/effort max');
190+
break;
187191
case 'init':
188192
this.sendCommand('/init');
189193
break;

src/web/public/session-ui.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,10 @@ Object.assign(CodemanApp.prototype, {
323323
if (caseSettings.agentTeams || globalSettings.agentTeamsEnabled) {
324324
envOverrides.CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS = '1';
325325
}
326+
const thinkingEffort = globalSettings.thinkingEffort;
327+
if (thinkingEffort) {
328+
envOverrides.CLAUDE_CODE_EFFORT_LEVEL = thinkingEffort;
329+
}
326330
const hasEnvOverrides = Object.keys(envOverrides).length > 0;
327331
const useOpus1m = caseSettings.opusContext1m || globalSettings.opusContext1mEnabled;
328332
const modelOverride = useOpus1m ? 'opus[1m]' : '';

src/web/public/settings-ui.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,7 @@ Object.assign(CodemanApp.prototype, {
334334
// Claude Permissions settings
335335
document.getElementById('appSettingsAgentTeams').checked = settings.agentTeamsEnabled ?? false;
336336
document.getElementById('appSettingsOpusContext1m').checked = settings.opusContext1mEnabled ?? false;
337+
document.getElementById('appSettingsThinkingEffort').value = settings.thinkingEffort ?? '';
337338
// CPU Priority settings
338339
const niceSettings = settings.nice || {};
339340
document.getElementById('appSettingsNiceEnabled').checked = niceSettings.enabled ?? false;
@@ -1134,6 +1135,7 @@ Object.assign(CodemanApp.prototype, {
11341135
// Claude Permissions settings
11351136
agentTeamsEnabled: document.getElementById('appSettingsAgentTeams').checked,
11361137
opusContext1mEnabled: document.getElementById('appSettingsOpusContext1m').checked,
1138+
thinkingEffort: document.getElementById('appSettingsThinkingEffort').value,
11371139
// CPU Priority settings
11381140
nice: {
11391141
enabled: document.getElementById('appSettingsNiceEnabled').checked,

src/web/schemas.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,7 @@ export const SettingsUpdateSchema = z
267267
tunnelEnabled: z.boolean().optional(),
268268
tabTwoRows: z.boolean().optional(),
269269
agentTeamsEnabled: z.boolean().optional(),
270+
thinkingEffort: z.string().max(20).optional(),
270271
// UI visibility
271272
showFontControls: z.boolean().optional(),
272273
showSystemStats: z.boolean().optional(),

0 commit comments

Comments
 (0)