A self-improving RLM agent for coding workflows and long-running autonomous tasks.
Rust
add /effort to set the thinking level (#228)
kt2736266e5d2c
diff --git a/packages/coding-agent/CHANGELOG.md b/packages/coding-agent/CHANGELOG.mdindex 50e26ec885..04fab41401 100644--- a/packages/coding-agent/CHANGELOG.md+++ b/packages/coding-agent/CHANGELOG.md@@ -7,6 +7,11 @@- Added a `max` thinking level to the thinking selector, `--thinking` flag, and settings, exposing the top reasoning effort on Claude models that support it (e.g. Opus 4.6+/Sonnet 4.6).- Added opt-in Prime Agent trace sharing with `/traces` and background uploads of persisted session JSONL files.- Added a first draft of daemon-backed cron jobs for scheduling prompts against long-running sessions without using `/goal`.+- Added `/effort` (alias `/thinking`) to set the reasoning/thinking level, with argument autocomplete listing the levels the current model supports.++### Changed++- Replaced the `Shift+Tab` thinking-level cycle with the `/effort` command.## [0.1.3] - 2026-06-12diff --git a/packages/coding-agent/README.md b/packages/coding-agent/README.mdindex 84505c9504..d7f9489e45 100644--- a/packages/coding-agent/README.md+++ b/packages/coding-agent/README.md@@ -140,6 +140,7 @@ Type `/` in the editor to trigger commands. [Extensions](#extensions) can regist|---------|-------------|| `/login`, `/logout` | OAuth authentication || `/model` | Switch models |+| `/effort` | Set reasoning/thinking level || `/scoped-models` | Enable/disable models for Ctrl+P cycling || `/settings` | Thinking level, theme, message delivery, transport || `/resume` | Pick from previous sessions |@@ -174,7 +175,6 @@ See `/hotkeys` for the full list. Customize via `~/.prime/agent/keybindings.json| Escape twice | Open `/tree` || Ctrl+L | Open model selector || Ctrl+P / Shift+Ctrl+P | Cycle scoped models forward/backward |-| Shift+Tab | Cycle thinking level || Ctrl+O | Collapse/expand tool output || Ctrl+T | Collapse/expand thinking blocks |diff --git a/packages/coding-agent/docs/keybindings.md b/packages/coding-agent/docs/keybindings.mdindex 486ebb86af..505e4520bd 100644--- a/packages/coding-agent/docs/keybindings.md+++ b/packages/coding-agent/docs/keybindings.md@@ -111,7 +111,6 @@ Modifier combinations: `ctrl+shift+x`, `alt+ctrl+x`, `ctrl+shift+alt+x`, `ctrl+1|--------|---------|-------------|| `app.model.select` | `ctrl+l` | Open model selector || `app.provider.add` | `ctrl+p` | Add provider from the model selector |-| `app.thinking.cycle` | `shift+tab` | Cycle thinking level || `app.thinking.toggle` | `ctrl+t` | Collapse or expand thinking blocks |### Display and Message Queuediff --git a/packages/coding-agent/docs/quickstart.md b/packages/coding-agent/docs/quickstart.mdindex de48ff0e6d..98579f8fd3 100644--- a/packages/coding-agent/docs/quickstart.md+++ b/packages/coding-agent/docs/quickstart.md@@ -102,7 +102,7 @@ The command output is sent to the model. Use `!!command` to run a command withou### Switch models-Use `/model` or Ctrl+L to choose a model. Use Shift+Tab to cycle thinking level. Use Ctrl+P / Shift+Ctrl+P to cycle through scoped models.+Use `/model` or Ctrl+L to choose a model. Use `/effort` to set the reasoning/thinking level. Use Ctrl+P / Shift+Ctrl+P to cycle through scoped models.### Continue laterdiff --git a/packages/coding-agent/src/core/extensions/runner.ts b/packages/coding-agent/src/core/extensions/runner.tsindex 20b6f0106f..c087f0d22d 100644--- a/packages/coding-agent/src/core/extensions/runner.ts+++ b/packages/coding-agent/src/core/extensions/runner.ts@@ -64,7 +64,6 @@ const RESERVED_KEYBINDINGS_FOR_EXTENSION_CONFLICTS = ["app.clear","app.exit","app.suspend",- "app.thinking.cycle","app.model.select","app.tools.expand","app.thinking.toggle",diff --git a/packages/coding-agent/src/core/keybindings.ts b/packages/coding-agent/src/core/keybindings.tsindex 3647350444..8eab1332a0 100644--- a/packages/coding-agent/src/core/keybindings.ts+++ b/packages/coding-agent/src/core/keybindings.ts@@ -16,7 +16,6 @@ export interface AppKeybindings {"app.input.clear": true;"app.exit": true;"app.suspend": true;- "app.thinking.cycle": true;"app.model.select": true;"app.provider.add": true;"app.tools.expand": true;@@ -76,10 +75,6 @@ export const KEYBINDINGS = {defaultKeys: process.platform === "win32" ? [] : "ctrl+z",description: "Suspend to background",},- "app.thinking.cycle": {- defaultKeys: "shift+tab",- description: "Cycle thinking level",- },"app.model.select": { defaultKeys: "ctrl+l", description: "Open model selector" },"app.provider.add": { defaultKeys: "ctrl+p", description: "Add provider" },"app.tools.expand": { defaultKeys: "ctrl+o", description: "Toggle tool output" },@@ -247,7 +242,6 @@ const KEYBINDING_NAME_MIGRATIONS = {clearInput: "app.input.clear",exit: "app.exit",suspend: "app.suspend",- cycleThinkingLevel: "app.thinking.cycle",selectModel: "app.model.select",expandTools: "app.tools.expand",toggleThinking: "app.thinking.toggle",diff --git a/packages/coding-agent/src/core/slash-commands.ts b/packages/coding-agent/src/core/slash-commands.tsindex ddd48981e8..fc8ec6bf8d 100644--- a/packages/coding-agent/src/core/slash-commands.ts+++ b/packages/coding-agent/src/core/slash-commands.ts@@ -37,6 +37,7 @@ interface BuiltinSlashCommandAlias {const CANONICAL_BUILTIN_SLASH_COMMANDS: ReadonlyArray<BuiltinSlashCommand> = [{ name: "settings", description: "Open settings menu" },{ name: "model", description: "Select model (opens selector UI)" },+ { name: "effort", description: "Set reasoning/thinking level", argumentHint: "[level]" },{ name: "scoped-models", description: "Enable/disable models for Ctrl+P cycling" },{ name: "export", description: "Export session (HTML default, or specify path: .html/.jsonl)" },{ name: "import", description: "Import and resume a session from a JSONL file" },@@ -79,6 +80,7 @@ const CANONICAL_BUILTIN_SLASH_COMMANDS: ReadonlyArray<BuiltinSlashCommand> = [const BUILTIN_SLASH_COMMAND_ALIASES: ReadonlyArray<BuiltinSlashCommandAlias> = [{ name: "clear", aliasFor: "new" },{ name: "usage", aliasFor: "context" },+ { name: "thinking", aliasFor: "effort" },{ name: "rename", aliasFor: "name" },];diff --git a/packages/coding-agent/src/modes/agent-connection/deferred-agent-connection.ts b/packages/coding-agent/src/modes/agent-connection/deferred-agent-connection.tsindex 37e102c4c7..0b8363fc17 100644--- a/packages/coding-agent/src/modes/agent-connection/deferred-agent-connection.ts+++ b/packages/coding-agent/src/modes/agent-connection/deferred-agent-connection.ts@@ -1,5 +1,5 @@import type { AgentMessage, ThinkingLevel } from "@earendil-works/pi-agent-core";-import type { ImageContent, Transport } from "@earendil-works/pi-ai";+import { getSupportedThinkingLevels, type ImageContent, type Transport } from "@earendil-works/pi-ai";import type { CompactionResult } from "../../core/compaction/index.js";import type { ContextTreeNode } from "../../core/context-tree.js";import type { AgentCronJob, AgentHeartbeatUpdateAction } from "../../core/cron-jobs.js";@@ -189,7 +189,9 @@ export class DeferredAgentConnection implements AgentConnection {cwd: this.seed.cwd,model: this.seed.model,thinkingLevel: this.seed.thinkingLevel,- availableThinkingLevels: [],+ availableThinkingLevels: this.seed.model+ ? (getSupportedThinkingLevels(this.seed.model) as ThinkingLevel[])+ : [],isStreaming: false,isCompacting: false,isBashRunning: false,diff --git a/packages/coding-agent/src/modes/interactive/interactive-mode.ts b/packages/coding-agent/src/modes/interactive/interactive-mode.tsindex c0c354f94b..4e1592cbb1 100644--- a/packages/coding-agent/src/modes/interactive/interactive-mode.ts+++ b/packages/coding-agent/src/modes/interactive/interactive-mode.ts@@ -6,8 +6,16 @@import * as fs from "node:fs";import * as os from "node:os";import * as path from "node:path";-import type { AgentMessage } from "@earendil-works/pi-agent-core";-import type { Api, AssistantMessage, ImageContent, Message, Model, ToolCall } from "@earendil-works/pi-ai";+import type { AgentMessage, ThinkingLevel } from "@earendil-works/pi-agent-core";+import {+ type Api,+ type AssistantMessage,+ getSupportedThinkingLevels,+ type ImageContent,+ type Message,+ type Model,+ type ToolCall,+} from "@earendil-works/pi-ai";import type {AutocompleteItem,AutocompleteProvider,@@ -342,6 +350,15 @@ const MODEL_SELECTOR_ACTIONS: readonly ModelSelectorAction[] = [{ id: "add_provider", label: "Add provider...", description: "subscription or API key" },];+const THINKING_LEVEL_DESCRIPTIONS: Record<ThinkingLevel, string> = {+ off: "No reasoning",+ minimal: "Very brief reasoning",+ low: "Light reasoning",+ medium: "Moderate reasoning",+ high: "Deep reasoning",+ xhigh: "Maximum reasoning",+};+const DEAD_TERMINAL_ERROR_CODES = new Set(["EIO", "EPIPE", "ENOTCONN"]);// Cap on retained pasted-image bytes (base64). Images are resized below the@@ -789,6 +806,16 @@ export class InteractiveMode {};}+ const effortCommand = slashCommands.find((command) => command.name === "effort");+ if (effortCommand) {+ effortCommand.getArgumentCompletions = (prefix: string): AutocompleteItem[] | null =>+ this.getThinkingLevelCompletions(prefix);+ const levels = this.getAvailableThinkingLevels();+ if (levels.length > 0) {+ effortCommand.argumentHint = `[${levels.join("/")}]`;+ }+ }+const connectionCommands = this.connectionCommands;const templateCommands: SlashCommand[] = connectionCommands.filter((cmd) => cmd.source === "prompt")@@ -874,7 +901,7 @@ export class InteractiveMode {hint("app.exit", "to exit (empty)"),hint("app.suspend", "to suspend"),keyHint("tui.editor.deleteToLineEnd", "to delete to end"),- hint("app.thinking.cycle", "to cycle thinking level"),+ rawKeyHint("/effort", "to set thinking level"),hint("app.model.select", "to select model"),hint("app.tools.expand", "to expand tools"),hint("app.thinking.toggle", "to expand thinking"),@@ -3089,7 +3116,6 @@ export class InteractiveMode {this.defaultEditor.onAction("app.interrupt", () => this.handleInterruptKey());this.defaultEditor.onCtrlD = () => this.handleCtrlD();this.defaultEditor.onAction("app.suspend", () => this.handleCtrlZ());- this.defaultEditor.onAction("app.thinking.cycle", () => this.cycleThinkingLevel());// Global debug handler on TUI (works regardless of focus)this.ui.onDebug = () => {@@ -3257,6 +3283,11 @@ export class InteractiveMode {await this.handleModelCommand(searchTerm);return;}+ if (commandName === "effort") {+ this.editor.setText("");+ this.handleEffortCommand(commandArgs);+ return;+ }if (commandName === "export") {await this.handleExportCommand(canonicalCommandText);this.editor.setText("");@@ -5022,24 +5053,6 @@ export class InteractiveMode {this.ui.requestRender();}- private cycleThinkingLevel(): void {- void this.agentConnection- .cycleThinkingLevel()- .then((newLevel) => {- if (newLevel === undefined) {- this.showStatus("Current model does not support thinking");- } else {- this.patchConnectionState({ thinkingLevel: newLevel });- this.footer.invalidate();- this.updateEditorBorderColor();- this.showStatus(`Thinking level: ${newLevel}`);- }- })- .catch((error) => {- this.showError(error instanceof Error ? error.message : String(error));- });- }-private toggleToolOutputExpansion(): void {this.setToolsExpanded(!this.toolOutputExpanded);}@@ -5587,9 +5600,14 @@ export class InteractiveMode {private async applySelectedModel(model: AgentConnectionModel): Promise<void> {await this.agentConnection.setModel(model.provider, model.id);this.settingsManager.setDefaultModelAndProvider(model.provider, model.id);- this.patchConnectionState({ model });+ this.patchConnectionState({+ model,+ availableThinkingLevels: getSupportedThinkingLevels(model) as ThinkingLevel[],+ });this.footer.invalidate();this.updateEditorBorderColor();+ // Rebuild so the /effort argument hint reflects the new model's levels.+ this.setupAutocompleteProvider();}private async getConnectionAvailableModels(): Promise<AgentConnectionModel[]> {@@ -5660,6 +5678,59 @@ export class InteractiveMode {this.showWarning(warning);}+ private getAvailableThinkingLevels(): ThinkingLevel[] {+ const levels = this.connectionState?.availableThinkingLevels ?? [];+ const supportsThinking = levels.length > 0 && !(levels.length === 1 && levels[0] === "off");+ return supportsThinking ? levels : [];+ }++ private getThinkingLevelCompletions(prefix: string): AutocompleteItem[] | null {+ const levels = this.getAvailableThinkingLevels();+ if (levels.length === 0) return null;+ const current = this.connectionState?.thinkingLevel;+ const term = prefix.trim().toLowerCase();+ const matches = term ? levels.filter((level) => level.startsWith(term)) : levels;+ if (matches.length === 0) return null;+ return matches.map((level) => ({+ value: level,+ label: level,+ description:+ level === current ? `${THINKING_LEVEL_DESCRIPTIONS[level]} (current)` : THINKING_LEVEL_DESCRIPTIONS[level],+ }));+ }++ private handleEffortCommand(arg: string): void {+ const levels = this.getAvailableThinkingLevels();+ if (levels.length === 0) {+ this.showStatus("Current model does not support thinking");+ return;+ }+ const requested = arg.trim().toLowerCase();+ if (!requested) {+ this.showStatus(`Thinking level: ${this.connectionState?.thinkingLevel} (type a level: ${levels.join(", ")})`);+ return;+ }+ if (!levels.includes(requested as ThinkingLevel)) {+ this.showError(`Unknown thinking level '${requested}'. Available: ${levels.join(", ")}`);+ return;+ }+ this.applyThinkingLevel(requested as ThinkingLevel);+ }++ private applyThinkingLevel(level: ThinkingLevel): void {+ void this.agentConnection+ .setThinkingLevel(level)+ .then(() => {+ this.patchConnectionState({ thinkingLevel: level });+ this.footer.invalidate();+ this.updateEditorBorderColor();+ this.showStatus(`Thinking level: ${level}`);+ })+ .catch((error) => {+ this.showError(error instanceof Error ? error.message : String(error));+ });+ }+private showModelSelector(initialSearchInput?: string): void {void this.showModelSelectorWithProviderSetup(initialSearchInput);}@@ -6942,7 +7013,6 @@ export class InteractiveMode {const interrupt = this.getAppKeyDisplay("app.interrupt");const exit = this.getAppKeyDisplay("app.exit");const suspend = this.getAppKeyDisplay("app.suspend");- const cycleThinkingLevel = this.getAppKeyDisplay("app.thinking.cycle");const selectModel = this.getAppKeyDisplay("app.model.select");const expandTools = this.getAppKeyDisplay("app.tools.expand");const toggleThinking = this.getAppKeyDisplay("app.thinking.toggle");@@ -6985,7 +7055,6 @@ export class InteractiveMode {| \`${clear}\` | Interrupt current operation (first) / exit (second) |${interrupt ? `| \`${interrupt}\` | Interrupt current operation |\n` : ""}| \`${exit}\` | Exit (when editor is empty) || \`${suspend}\` | Suspend to background |-| \`${cycleThinkingLevel}\` | Cycle thinking level || \`${selectModel}\` | Open model selector || \`${expandTools}\` | Toggle tool output expansion || \`${toggleThinking}\` | Toggle thinking block visibility |diff --git a/packages/coding-agent/test/deferred-agent-connection.test.ts b/packages/coding-agent/test/deferred-agent-connection.test.tsindex 3ade5b8828..8dbb94d941 100644--- a/packages/coding-agent/test/deferred-agent-connection.test.ts+++ b/packages/coding-agent/test/deferred-agent-connection.test.ts@@ -84,6 +84,31 @@ describe("DeferredAgentConnection", () => {expect(conn.created).toBe(false);});+ test("derives available thinking levels from the seed model before a session exists", async () => {+ const reasoningModel = {+ provider: "anthropic",+ id: "claude-opus",+ reasoning: true,+ } as unknown as AgentConnectionModel;+ const { factory } = makeFactory();+ const conn = new DeferredAgentConnection(factory, { ...SEED, model: reasoningModel });++ const state = await conn.getState();++ expect(state.availableThinkingLevels).toContain("high");+ expect(state.availableThinkingLevels.length).toBeGreaterThan(1);+ expect(factory).not.toHaveBeenCalled();+ });++ test("reports no thinking levels for a non-reasoning seed model", async () => {+ const { factory } = makeFactory();+ const conn = new DeferredAgentConnection(factory, SEED);++ const state = await conn.getState();++ expect(state.availableThinkingLevels).toEqual(["off"]);+ });+test("re-evaluates availableModels on each read so login during onboarding shows models", async () => {const { factory } = makeFactory();let models: AgentConnectionModel[] = [];diff --git a/packages/coding-agent/test/interactive-mode-effort-command.test.ts b/packages/coding-agent/test/interactive-mode-effort-command.test.tsnew file mode 100644index 0000000000..8589e497e5--- /dev/null+++ b/packages/coding-agent/test/interactive-mode-effort-command.test.ts@@ -0,0 +1,181 @@+import type { ThinkingLevel } from "@earendil-works/pi-agent-core";+import type { AutocompleteItem } from "@earendil-works/pi-tui";+import { beforeAll, describe, expect, it, vi } from "vitest";+import { InteractiveMode } from "../src/modes/interactive/interactive-mode.js";+import { initTheme } from "../src/modes/interactive/theme/theme.js";++type EffortCommandContext = {+ connectionState?: {+ thinkingLevel: ThinkingLevel;+ availableThinkingLevels: ThinkingLevel[];+ };+ agentConnection: { setThinkingLevel: (level: ThinkingLevel) => Promise<void> };+ footer: { invalidate: () => void };+ showStatus: (message: string) => void;+ showError: (message: string) => void;+ patchConnectionState: (patch: Record<string, unknown>) => void;+ updateEditorBorderColor: () => void;+ getAvailableThinkingLevels: () => ThinkingLevel[];+ applyThinkingLevel: (level: ThinkingLevel) => void;+};++type InteractiveModePrototype = {+ getAvailableThinkingLevels(this: EffortCommandContext): ThinkingLevel[];+ getThinkingLevelCompletions(this: EffortCommandContext, prefix: string): AutocompleteItem[] | null;+ handleEffortCommand(this: EffortCommandContext, arg: string): void;+ applyThinkingLevel(this: EffortCommandContext, level: ThinkingLevel): void;+};++const interactiveModePrototype = InteractiveMode.prototype as unknown as InteractiveModePrototype;++function makeContext(overrides: Partial<EffortCommandContext> = {}): EffortCommandContext {+ const context: EffortCommandContext = {+ connectionState: {+ thinkingLevel: "medium",+ availableThinkingLevels: ["off", "low", "medium", "high"],+ },+ agentConnection: { setThinkingLevel: vi.fn(async () => {}) },+ footer: { invalidate: vi.fn() },+ showStatus: vi.fn(),+ showError: vi.fn(),+ patchConnectionState: vi.fn(),+ updateEditorBorderColor: vi.fn(),+ getAvailableThinkingLevels: () => interactiveModePrototype.getAvailableThinkingLevels.call(context),+ applyThinkingLevel: (level) => interactiveModePrototype.applyThinkingLevel.call(context, level),+ ...overrides,+ };+ return context;+}++describe("InteractiveMode /effort", () => {+ beforeAll(() => {+ initTheme("dark");+ });++ describe("argument autocomplete", () => {+ it("lists every supported level for an empty prefix and marks the current one", () => {+ const context = makeContext();++ const items = interactiveModePrototype.getThinkingLevelCompletions.call(context, "");++ expect(items?.map((item) => item.value)).toEqual(["off", "low", "medium", "high"]);+ expect(items?.find((item) => item.value === "medium")?.description).toContain("(current)");+ });++ it("filters by the typed prefix", () => {+ const context = makeContext();++ const items = interactiveModePrototype.getThinkingLevelCompletions.call(context, "h");++ expect(items?.map((item) => item.value)).toEqual(["high"]);+ });++ it("offers no completions when the model does not support thinking", () => {+ const context = makeContext({+ connectionState: { thinkingLevel: "off", availableThinkingLevels: ["off"] },+ });++ expect(interactiveModePrototype.getThinkingLevelCompletions.call(context, "")).toBeNull();+ });+ });++ describe("command handling", () => {+ it("applies a valid level through the connection and reports it", async () => {+ const setThinkingLevel = vi.fn(async () => {});+ const context = makeContext({ agentConnection: { setThinkingLevel } });++ interactiveModePrototype.handleEffortCommand.call(context, "high");+ await vi.waitFor(() => expect(context.showStatus).toHaveBeenCalledWith("Thinking level: high"));++ expect(setThinkingLevel).toHaveBeenCalledWith("high");+ expect(context.patchConnectionState).toHaveBeenCalledWith({ thinkingLevel: "high" });+ expect(context.footer.invalidate).toHaveBeenCalledWith();+ expect(context.updateEditorBorderColor).toHaveBeenCalledWith();+ expect(context.showError).not.toHaveBeenCalled();+ });++ it("rejects an unknown level without touching the connection", () => {+ const setThinkingLevel = vi.fn(async () => {});+ const context = makeContext({ agentConnection: { setThinkingLevel } });++ interactiveModePrototype.handleEffortCommand.call(context, "bogus");++ expect(setThinkingLevel).not.toHaveBeenCalled();+ expect(context.showError).toHaveBeenCalledWith(+ "Unknown thinking level 'bogus'. Available: off, low, medium, high",+ );+ });++ it("shows the current level and choices when called without an argument", () => {+ const context = makeContext();++ interactiveModePrototype.handleEffortCommand.call(context, "");++ expect(context.agentConnection.setThinkingLevel).not.toHaveBeenCalled();+ expect(context.showStatus).toHaveBeenCalledWith(+ "Thinking level: medium (type a level: off, low, medium, high)",+ );+ });++ it("reports when the model does not support thinking", () => {+ const context = makeContext({+ connectionState: { thinkingLevel: "off", availableThinkingLevels: ["off"] },+ });++ interactiveModePrototype.handleEffortCommand.call(context, "high");++ expect(context.agentConnection.setThinkingLevel).not.toHaveBeenCalled();+ expect(context.showStatus).toHaveBeenCalledWith("Current model does not support thinking");+ });++ it("surfaces an error when applying a level fails", async () => {+ const setThinkingLevel = vi.fn(async () => {+ throw new Error("nope");+ });+ const context = makeContext({ agentConnection: { setThinkingLevel } });++ interactiveModePrototype.handleEffortCommand.call(context, "high");+ await vi.waitFor(() => expect(context.showError).toHaveBeenCalledWith("nope"));++ expect(context.patchConnectionState).not.toHaveBeenCalled();+ });+ });++ describe("model switch refresh", () => {+ it("refreshes availableThinkingLevels from the newly selected model", async () => {+ type ModelContext = {+ agentConnection: { setModel: (provider: string, id: string) => Promise<void> };+ settingsManager: { setDefaultModelAndProvider: (provider: string, id: string) => void };+ patchConnectionState: (patch: Record<string, unknown>) => void;+ footer: { invalidate: () => void };+ updateEditorBorderColor: () => void;+ setupAutocompleteProvider: () => void;+ };+ const applySelectedModel = (+ InteractiveMode.prototype as unknown as {+ applySelectedModel(this: ModelContext, model: unknown): Promise<void>;+ }+ ).applySelectedModel;+ const patchConnectionState = vi.fn();+ const setupAutocompleteProvider = vi.fn();+ const context: ModelContext = {+ agentConnection: { setModel: vi.fn(async () => {}) },+ settingsManager: { setDefaultModelAndProvider: vi.fn() },+ patchConnectionState,+ footer: { invalidate: vi.fn() },+ updateEditorBorderColor: vi.fn(),+ setupAutocompleteProvider,+ };+ const model = { provider: "anthropic", id: "claude-opus", reasoning: true };++ await applySelectedModel.call(context, model);++ const patch = patchConnectionState.mock.calls[0][0];+ expect(patch.model).toBe(model);+ expect(patch.availableThinkingLevels).toContain("high");+ expect(patch.availableThinkingLevels.length).toBeGreaterThan(1);+ // Provider rebuild keeps the /effort argument hint in sync with the model.+ expect(setupAutocompleteProvider).toHaveBeenCalledTimes(1);+ });+ });+});diff --git a/packages/coding-agent/test/interactive-mode-status.test.ts b/packages/coding-agent/test/interactive-mode-status.test.tsindex e8153e6fb0..ce7574a18a 100644--- a/packages/coding-agent/test/interactive-mode-status.test.ts+++ b/packages/coding-agent/test/interactive-mode-status.test.ts@@ -808,6 +808,7 @@ describe("InteractiveMode model selection persistence", () => {applySelectedModel(model: AgentConnectionModel): Promise<void>;handleModelCommand(searchTerm?: string): Promise<void>;completeOnboardingIfCurrentModelReady(): void;+ setupAutocompleteProvider(): void;};const createModel = (provider: string, id: string): AgentConnectionModel =>@@ -836,13 +837,14 @@ describe("InteractiveMode model selection persistence", () => {fakeThis.footer = { invalidate: vi.fn() };fakeThis.patchConnectionState = vi.fn();fakeThis.updateEditorBorderColor = vi.fn();+ fakeThis.setupAutocompleteProvider = vi.fn();await fakeThis.applySelectedModel(model);expect(fakeThis.agentConnection.setModel).toHaveBeenCalledWith("openai", "gpt-5.5");expect(fakeThis.uiServices.settingsManager.setDefaultModelAndProvider).toHaveBeenCalledWith("openai", "gpt-5.5");expect(order).toEqual(["connection", "settings"]);- expect(fakeThis.patchConnectionState).toHaveBeenCalledWith({ model });+ expect(fakeThis.patchConnectionState).toHaveBeenCalledWith({ model, availableThinkingLevels: ["off"] });expect(fakeThis.footer.invalidate).toHaveBeenCalledTimes(1);expect(fakeThis.updateEditorBorderColor).toHaveBeenCalledTimes(1);});@@ -890,12 +892,13 @@ describe("InteractiveMode model selection persistence", () => {fakeThis.maybeWarnAboutAnthropicSubscriptionAuth = vi.fn(async () => {});fakeThis.checkDaxnutsEasterEgg = vi.fn();fakeThis.completeOnboardingIfCurrentModelReady = vi.fn();+ fakeThis.setupAutocompleteProvider = vi.fn();await fakeThis.handleModelCommand("gpt-5.5");expect(fakeThis.agentConnection.setModel).toHaveBeenCalledWith("openai", "gpt-5.5");expect(fakeThis.uiServices.settingsManager.setDefaultModelAndProvider).toHaveBeenCalledWith("openai", "gpt-5.5");- expect(fakeThis.patchConnectionState).toHaveBeenCalledWith({ model });+ expect(fakeThis.patchConnectionState).toHaveBeenCalledWith({ model, availableThinkingLevels: ["off"] });expect(fakeThis.showStatus).toHaveBeenCalledWith("Model: gpt-5.5");expect(fakeThis.showError).not.toHaveBeenCalled();expect(fakeThis.completeOnboardingIfCurrentModelReady).toHaveBeenCalledTimes(1);@@ -909,6 +912,7 @@ describe("InteractiveMode Prime CLI onboarding", () => {handleModelCommand(searchTerm?: string): Promise<void>;runOnboardingFlow(): Promise<boolean>;applySelectedModel(model: AgentConnectionModel): Promise<void>;+ setupAutocompleteProvider(): void;};type OnboardingFake = OnboardingHarness & {connectionState: AgentConnectionState;@@ -1037,6 +1041,7 @@ describe("InteractiveMode Prime CLI onboarding", () => {fakeThis.maybeWarnAboutAnthropicSubscriptionAuth = vi.fn();fakeThis.checkDaxnutsEasterEgg = vi.fn();fakeThis.applySelectedModel = applySelectedModel;+ fakeThis.setupAutocompleteProvider = vi.fn();await handleModelCommand.call(fakeThis, "prime-inference/openai/gpt-5.5");diff --git a/packages/coding-agent/test/slash-commands.test.ts b/packages/coding-agent/test/slash-commands.test.tsindex 2cc9b6df72..9009a7ebd6 100644--- a/packages/coding-agent/test/slash-commands.test.ts+++ b/packages/coding-agent/test/slash-commands.test.ts@@ -14,6 +14,14 @@ describe("built-in slash commands", () => {expect(commandNames).toContain("heartbeat");expect(commandNames).not.toContain("cron");});++ test("exposes /effort for selecting the thinking level", () => {+ expect(BUILTIN_SLASH_COMMANDS.find((command) => command.name === "effort")).toMatchObject({+ description: "Set reasoning/thinking level",+ argumentHint: "[level]",+ aliases: ["thinking"],+ });+ });});describe("slash command aliases", () => {@@ -62,6 +70,19 @@ describe("slash command aliases", () => {});});+ test("resolves /thinking to /effort through the alias path", () => {+ const parsed = parseSlashCommand("/thinking");++ expect(isBuiltinSlashCommandName("thinking")).toBe(true);+ expect(resolveBuiltinSlashCommandName("thinking")).toBe("effort");+ expect(resolveSlashCommand(parsed!)).toEqual({+ name: "effort",+ args: "",+ originalName: "thinking",+ isAlias: true,+ });+ });+test("preserves arguments when resolving aliases", () => {const parsed = parseSlashCommand("/usage latest turn");