diff --git a/src/cli/helpers/conversationSwitchAlert.ts b/src/cli/helpers/conversationSwitchAlert.ts index 8a18fe6..9064813 100644 --- a/src/cli/helpers/conversationSwitchAlert.ts +++ b/src/cli/helpers/conversationSwitchAlert.ts @@ -1,7 +1,5 @@ import type { Message } from "@letta-ai/letta-client/resources/agents/messages"; - -const SYSTEM_ALERT_OPEN = ""; -const SYSTEM_ALERT_CLOSE = ""; +import { SYSTEM_REMINDER_CLOSE, SYSTEM_REMINDER_OPEN } from "../../constants"; const MAX_HISTORY_MESSAGES = 8; const MAX_MESSAGE_CHARS = 500; @@ -83,7 +81,7 @@ export function buildConversationSwitchAlert( parts.push("Review the in-context messages for full conversation history."); } - return `${SYSTEM_ALERT_OPEN}\n${parts.join("\n")}\n${SYSTEM_ALERT_CLOSE}\n\n`; + return `${SYSTEM_REMINDER_OPEN}\n${parts.join("\n")}\n${SYSTEM_REMINDER_CLOSE}\n\n`; } function pushConversationMeta( diff --git a/src/settings-manager.ts b/src/settings-manager.ts index df464e5..c0328c8 100644 --- a/src/settings-manager.ts +++ b/src/settings-manager.ts @@ -59,7 +59,7 @@ export interface Settings { reflectionTrigger: "off" | "step-count" | "compaction-event"; reflectionBehavior: "reminder" | "auto-launch"; reflectionStepCount: number; - conversationSwitchAlertEnabled: boolean; // Send system-alert when switching conversations/agents + conversationSwitchAlertEnabled: boolean; // Send system-reminder when switching conversations/agents globalSharedBlockIds: Record; // DEPRECATED: kept for backwards compat profiles?: Record; // DEPRECATED: old format, kept for migration pinnedAgents?: string[]; // DEPRECATED: kept for backwards compat, use pinnedAgentsByServer diff --git a/src/tests/cli/conversationSwitchAlert.test.ts b/src/tests/cli/conversationSwitchAlert.test.ts new file mode 100644 index 0000000..eb2b3d6 --- /dev/null +++ b/src/tests/cli/conversationSwitchAlert.test.ts @@ -0,0 +1,22 @@ +import { describe, expect, test } from "bun:test"; +import { buildConversationSwitchAlert } from "../../cli/helpers/conversationSwitchAlert"; +import { SYSTEM_REMINDER_CLOSE, SYSTEM_REMINDER_OPEN } from "../../constants"; + +describe("conversationSwitchAlert", () => { + test("wraps conversation switch context in system-reminder tags", () => { + const alert = buildConversationSwitchAlert({ + origin: "resume-selector", + conversationId: "conv-123", + isDefault: false, + messageCount: 14, + summary: "Bugfix thread", + }); + + expect(alert).toContain(SYSTEM_REMINDER_OPEN); + expect(alert).toContain(SYSTEM_REMINDER_CLOSE); + expect(alert).not.toContain(""); + expect(alert).not.toContain(""); + expect(alert).toContain("Conversation resumed via /resume selector."); + expect(alert).toContain("Conversation: conv-123 (14 messages)"); + }); +});