Skip to content

A self-improving RLM agent for coding workflows and long-running autonomous tasks.

Rust

Keep the chat detail level across sessions (#2709)

Sebastian Müller80c51e460f7f
diff --git a/packages/coding-agent/.changes/chat-detail-persist.md b/packages/coding-agent/.changes/chat-detail-persist.md
new file mode 100644
index 0000000000..addb490fea
--- /dev/null
+++ b/packages/coding-agent/.changes/chat-detail-persist.md
@@ -0,0 +1 @@
+- Fixed the conversation detail level resetting to Details every time you open, resume, or attach to a chat: the level you pick with Ctrl+O is now saved as the `chatDetail` setting and reused for every chat until you change it. Chats with no saved choice still start at Details.
diff --git a/packages/coding-agent/docs/extensions.md b/packages/coding-agent/docs/extensions.md
index 0491b984b8..a84f129cdc 100644
--- a/packages/coding-agent/docs/extensions.md
+++ b/packages/coding-agent/docs/extensions.md
@@ -2295,7 +2295,7 @@ ctx.ui.addAutocompleteProvider((current) => ({
},
}));
-// Tool output expansion
+// Tool output expansion (does not change the saved chatDetail setting)
const wasExpanded = ctx.ui.getToolsExpanded();
ctx.ui.setToolsExpanded(true);
ctx.ui.setToolsExpanded(wasExpanded);
diff --git a/packages/coding-agent/docs/keybindings.md b/packages/coding-agent/docs/keybindings.md
index 8e7646b8e9..2bb1cc205a 100644
--- a/packages/coding-agent/docs/keybindings.md
+++ b/packages/coding-agent/docs/keybindings.md
@@ -131,7 +131,7 @@ Models, Providers, and MCP Connections open as separate pickers. Use `escape` to
| `app.message.moveEarlier` | `ctrl+alt+up` | Move the selected pending message one place earlier in its queue |
| `app.message.moveLater` | `ctrl+alt+down` | Move the selected pending message one place later in its queue |
-Ctrl+O changes presentation only: the default hides thinking and collapses tools and diffs; the first press reveals thinking and file diffs; the second expands tool output and full agent-to-agent message bodies; the third returns to the default. Compact sent and received message notices remain visible in every mode. This also works for restored conversations and new streaming content. Ctrl+J, Ctrl+T, and Ctrl+P no longer control conversation expansion.
+Ctrl+O cycles the conversation detail level and saves it as the `chatDetail` setting, so new, resumed, and attached chats open at the level you last picked. It never rewrites messages or the session file. Overview hides thinking and collapses tools and diffs; details (the default) reveals thinking and file diffs; all output expands tool output and full agent-to-agent message bodies; the next press returns to overview. Compact sent and received message notices remain visible in every mode. This also works for restored conversations and new streaming content. Ctrl+J, Ctrl+T, and Ctrl+P no longer control conversation expansion.
### Tree Navigation
diff --git a/packages/coding-agent/docs/settings.md b/packages/coding-agent/docs/settings.md
index 620f4c74ee..784675e76d 100644
--- a/packages/coding-agent/docs/settings.md
+++ b/packages/coding-agent/docs/settings.md
@@ -74,13 +74,14 @@ These are the persisted defaults for the same limits as the `--autonomous-*` CLI
### UI & Display
-Conversation output starts in overview. Ctrl+O cycles through details and all output; the old `hideThinkingBlock` setting no longer controls visibility.
+Conversation output starts at the `chatDetail` level (default `details`). Ctrl+O cycles overview -> details -> all output and saves the choice, so new, resumed, and attached chats open at the level you last picked. The old `hideThinkingBlock` setting no longer controls visibility.
| Setting | Type | Default | Description |
|---------|------|---------|-------------|
| `theme` | string | detected | Theme name (built-ins: `"prime"`, `"dark"`, `"light"`; or custom). Unset uses `"prime"` on dark terminals and `"light"` on light terminals |
| `quietStartup` | boolean | `false` | Hide startup header |
| `treeFilterMode` | string | `"user-only"` | Default filter for `/tree`: `"default"`, `"no-tools"`, `"user-only"`, `"labeled-only"`, `"all"` |
+| `chatDetail` | string | `"details"` | Conversation detail level: `"overview"`, `"details"`, or `"all"`. Ctrl+O updates it |
| `editorPaddingX` | number | `0` | Horizontal padding for input editor (0-3) |
| `autocompleteMaxVisible` | number | `5` | Max visible items in autocomplete dropdown (3-20) |
| `showHardwareCursor` | boolean | `false` | Show terminal cursor |
diff --git a/packages/coding-agent/src/core/settings-manager.ts b/packages/coding-agent/src/core/settings-manager.ts
index 5b343f08a8..51ebd584f8 100644
--- a/packages/coding-agent/src/core/settings-manager.ts
+++ b/packages/coding-agent/src/core/settings-manager.ts
@@ -113,6 +113,8 @@ function resolveAutonomousLimit(value: AutonomousLimitSetting | undefined): numb
export type MermaidRenderingMode = "off" | "final" | "streaming";
+export type ChatDetail = "overview" | "details" | "all";
+
export interface MarkdownSettings {
codeBlockIndent?: string; // default: " "
mermaid?: MermaidRenderingMode; // default: "streaming"
@@ -253,6 +255,7 @@ export interface Settings {
images?: ImageSettings;
enabledModels?: string[]; // Model patterns for cycling (same format as --models CLI flag)
treeFilterMode?: "default" | "no-tools" | "user-only" | "labeled-only" | "all"; // Default: "user-only"
+ chatDetail?: ChatDetail; // Default: "details"
thinkingBudgets?: ThinkingBudgetsSettings; // Custom token budgets for thinking levels
editorPaddingX?: number; // Horizontal padding for input editor (default: 0)
autocompleteMaxVisible?: number; // Max visible items in autocomplete dropdown (default: 5)
@@ -1488,6 +1491,17 @@ export class SettingsManager {
this.save();
}
+ getChatDetail(): ChatDetail {
+ const detail = this.settings.chatDetail;
+ return detail === "overview" || detail === "all" ? detail : "details";
+ }
+
+ setChatDetail(detail: ChatDetail): void {
+ this.globalSettings.chatDetail = detail;
+ this.markModified("chatDetail");
+ this.save();
+ }
+
getWarnings(): WarningSettings {
return { ...(this.settings.warnings ?? {}) };
}
diff --git a/packages/coding-agent/src/modes/interactive/interactive-mode.ts b/packages/coding-agent/src/modes/interactive/interactive-mode.ts
index e9ec23c955..618cadfd7d 100644
--- a/packages/coding-agent/src/modes/interactive/interactive-mode.ts
+++ b/packages/coding-agent/src/modes/interactive/interactive-mode.ts
@@ -163,7 +163,7 @@ import { parseCommandArgs } from "../../core/prompt-templates.js";
import { formatMissingSessionCwdPrompt, MissingSessionCwdError } from "../../core/session-cwd.js";
import { SessionImportFileNotFoundError } from "../../core/session-import-errors.js";
import { resolveSessionPath, SessionSelectorError, SessionSelectorNotFoundError } from "../../core/session-resolver.js";
-import type { McpServerConfig } from "../../core/settings-manager.js";
+import type { ChatDetail, McpServerConfig } from "../../core/settings-manager.js";
import { parseSkillBlock } from "../../core/skill-blocks.js";
import {
BUILTIN_SLASH_COMMANDS,
@@ -1337,10 +1337,10 @@ export class InteractiveMode {
private rlmNodeId: string | undefined;
private rosterBar: { summaries(): SessionSummary[]; dispose(): Promise<void> } | undefined;
- private toolOutputExpanded = false;
- private editDiffsExpanded = true;
+ private toolOutputExpanded!: boolean;
+ private editDiffsExpanded!: boolean;
- private hideThinkingBlock = false;
+ private hideThinkingBlock!: boolean;
private readonly mermaidMarkdownTransform = createMermaidMarkdownTransform({
getMode: () => this.settingsManager.getMermaidRenderingMode(),
theme,
@@ -1477,6 +1477,7 @@ export class InteractiveMode {
throw new Error("InteractiveMode requires uiServices when no localSessionHost is supplied");
}
this.uiServices = uiServices;
+ this.assignChatDetail(this.settingsManager.getChatDetail());
this.agentConnection = options.agentConnection;
this.promptStashStore = options.promptStashStore;
this.promptStashSessionId = options.promptStashSessionId;
@@ -8101,18 +8102,24 @@ export class InteractiveMode {
}
private toggleToolOutputExpansion(): void {
- this.setChatDetail(this.toolOutputExpanded ? "overview" : this.editDiffsExpanded ? "all" : "details");
+ const detail = this.toolOutputExpanded ? "overview" : this.editDiffsExpanded ? "all" : "details";
+ this.settingsManager.setChatDetail(detail);
+ this.setChatDetail(detail);
}
private setToolsExpanded(expanded: boolean): void {
this.setChatDetail(expanded ? "all" : "overview");
}
- /** Presentation only: never rewrite messages, settings, or the session trace. */
- private setChatDetail(detail: "overview" | "details" | "all"): void {
+ private assignChatDetail(detail: ChatDetail): void {
this.toolOutputExpanded = detail === "all";
this.editDiffsExpanded = detail !== "overview";
this.hideThinkingBlock = detail === "overview";
+ }
+
+ /** Applies a detail level to the rendered chat; never rewrites messages or the session trace. */
+ private setChatDetail(detail: ChatDetail): void {
+ this.assignChatDetail(detail);
this.applyChatExpansion();
}
diff --git a/packages/coding-agent/test/conversation-detail-status.test.ts b/packages/coding-agent/test/conversation-detail-status.test.ts
index f2d6ec950e..bc26895e2f 100644
--- a/packages/coding-agent/test/conversation-detail-status.test.ts
+++ b/packages/coding-agent/test/conversation-detail-status.test.ts
@@ -2,6 +2,7 @@ import { setKeybindings, visibleWidth } from "@earendil-works/pi-tui";
import stripAnsi from "strip-ansi";
import { beforeEach, describe, expect, it, vi } from "vitest";
import { KeybindingsManager } from "../src/core/keybindings.js";
+import { SettingsManager } from "../src/core/settings-manager.js";
import { formatConversationDetailStatus } from "../src/modes/interactive/components/keybinding-hints.js";
import { PromptContextLine } from "../src/modes/interactive/components/prompt-context-line.js";
import { SubagentSummaryLine } from "../src/modes/interactive/components/subagent-summary-line.js";
@@ -11,6 +12,7 @@ import { initTheme, theme } from "../src/modes/interactive/theme/theme.js";
interface DetailMode {
toolOutputExpanded: boolean;
editDiffsExpanded: boolean;
+ uiServices: { settingsManager: SettingsManager };
getPromptContextLabel(width: number): string | undefined;
getTrayContextLabel(): string | undefined;
toggleToolOutputExpansion(): void;
@@ -20,6 +22,7 @@ function createMode(): DetailMode {
return Object.assign(Object.create(InteractiveMode.prototype), {
toolOutputExpanded: false,
editDiffsExpanded: false,
+ uiServices: { settingsManager: SettingsManager.inMemory() },
applyChatExpansion: vi.fn(),
isInlinePickerOpen: () => false,
getTrayGoalLabel: () => undefined,
@@ -74,6 +77,7 @@ describe("conversation detail status", () => {
expect(stripAnsi(mode.getPromptContextLabel(120)!)).toBe("Expanded mode (Ctrl+O to collapse)");
mode.setToolsExpanded(false);
expect(stripAnsi(mode.getPromptContextLabel(120)!)).toBe("Collapsed mode (Ctrl+O to expand)");
+ expect(mode.uiServices.settingsManager.getGlobalSettings().chatDetail).toBeUndefined();
});
it("preserves top-row bounds while the lower tray retains model metadata and navigation overrides", () => {
diff --git a/packages/coding-agent/test/suite/regressions/2193-chat-detail-cycle.test.ts b/packages/coding-agent/test/suite/regressions/2193-chat-detail-cycle.test.ts
index 8a2634b971..7eda11806b 100644
--- a/packages/coding-agent/test/suite/regressions/2193-chat-detail-cycle.test.ts
+++ b/packages/coding-agent/test/suite/regressions/2193-chat-detail-cycle.test.ts
@@ -95,7 +95,7 @@ function assertMode(mode: ModeControls, detail: "overview" | "details" | "all"):
expect(text).toContain("Agent message received");
}
describe("conversation detail cycle", () => {
- test("cycles a reopened saved chat without changing messages or JSONL", async () => {
+ test("keeps the chosen detail level for the next chat without changing messages or JSONL", async () => {
harness = await createHarness({
tools,
persistSession: true,
@@ -135,17 +135,19 @@ describe("conversation detail cycle", () => {
assertMode(mode, "details");
cycle(mode);
assertMode(mode, "all");
- cycle(mode);
- assertMode(mode, "overview");
mode.defaultEditor.handleInput("\x10");
- assertMode(mode, "overview");
+ assertMode(mode, "all");
await mode.renderSessionContext(context, { clearChat: true });
- assertMode(mode, "overview");
- cycle(mode);
- assertMode(mode, "details");
+ assertMode(mode, "all");
expect(JSON.stringify(context.messages)).toBe(source);
expect(readFileSync(sessionFile, "utf8")).toBe(savedTrace);
- expect(harness.settingsManager.getGlobalSettings()).toMatchObject({ hideThinkingBlock: false });
+ expect(harness.settingsManager.getGlobalSettings()).toMatchObject({
+ hideThinkingBlock: false,
+ chatDetail: "all",
+ });
+ const next = createMode(harness);
+ await next.renderSessionContext(context);
+ assertMode(next, "all");
});
test("keeps full shell notifications at their arrival position through live and reopened detail cycles", async () => {
const code = "h = bash('printf done')\nh";