From bc916dbf355a0b3e8302cd4bc0219dcb94b210ba Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Wed, 24 Dec 2025 00:52:30 +0000 Subject: [PATCH] feat: require final tag format in system prompt --- src/agents/system-prompt.test.ts | 1 + src/agents/system-prompt.ts | 15 +++++++++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/agents/system-prompt.test.ts b/src/agents/system-prompt.test.ts index 9d4e5de44..18d896dc0 100644 --- a/src/agents/system-prompt.test.ts +++ b/src/agents/system-prompt.test.ts @@ -31,5 +31,6 @@ describe("buildAgentSystemPromptAppend", () => { expect(prompt).toContain("## Reasoning Format"); expect(prompt).toContain("..."); + expect(prompt).toContain("..."); }); }); diff --git a/src/agents/system-prompt.ts b/src/agents/system-prompt.ts index d8429eadc..62fc75768 100644 --- a/src/agents/system-prompt.ts +++ b/src/agents/system-prompt.ts @@ -28,7 +28,16 @@ export function buildAgentSystemPromptAppend(params: { ? `Owner numbers: ${ownerNumbers.join(", ")}. Treat messages from these numbers as the user (Peter).` : undefined; const reasoningHint = params.reasoningTagHint - ? "If you must think, put all reasoning inside ... only, and never include analysis outside those tags." + ? [ + "ALL internal reasoning MUST be inside ....", + "Do not output any analysis outside .", + "Format every reply as ... then ..., with no other text.", + "Only the final user-visible reply may appear inside .", + "Only text inside is shown to the user; everything else is discarded and never seen by the user.", + "Example:", + "Short internal reasoning.", + "Hey Peter! What would you like to do next?", + ].join(" ") : undefined; const runtimeInfo = params.runtimeInfo; const runtimeLines: string[] = []; @@ -91,7 +100,5 @@ export function buildAgentSystemPromptAppend(params: { thinkHint, ); - return lines - .filter(Boolean) - .join("\n"); + return lines.filter(Boolean).join("\n"); }