From c5c4687dc459bf409977d915453b2a1693d8697c Mon Sep 17 00:00:00 2001 From: cthomas Date: Fri, 27 Feb 2026 15:48:02 -0800 Subject: [PATCH] fix: skip agents.messages.reset in /clear for named conversations (#1209) Co-authored-by: Claude Sonnet 4.6 --- src/cli/App.tsx | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/cli/App.tsx b/src/cli/App.tsx index 93c595f..87cec61 100644 --- a/src/cli/App.tsx +++ b/src/cli/App.tsx @@ -7736,12 +7736,16 @@ export default function App({ try { const client = await getClient(); - // Reset all messages on the agent (destructive operation) - await client.agents.messages.reset(agentId, { - add_default_initial_messages: false, - }); + // Reset all messages on the agent only when in the default conversation. + // For named conversations, clearing just means starting a new conversation — + // there is no reason to wipe the agent's entire message history. + if (conversationIdRef.current === "default") { + await client.agents.messages.reset(agentId, { + add_default_initial_messages: false, + }); + } - // Also create a new conversation since messages were cleared + // Create a new conversation const conversation = await client.conversations.create({ agent_id: agentId, isolated_block_labels: [...ISOLATED_BLOCK_LABELS],