diff --git a/src/agents/pi-embedded-runner.ts b/src/agents/pi-embedded-runner.ts
index c0360c139..2939ed78a 100644
--- a/src/agents/pi-embedded-runner.ts
+++ b/src/agents/pi-embedded-runner.ts
@@ -333,12 +333,15 @@ export async function runEmbeddedPiAgent(params: {
node: process.version,
model: `${provider}/${modelId}`,
};
+ const reasoningTagHint =
+ provider === "lmstudio" || provider === "ollama";
const systemPrompt = buildSystemPrompt({
appendPrompt: buildAgentSystemPromptAppend({
workspaceDir: resolvedWorkspace,
defaultThinkLevel: params.thinkLevel,
extraSystemPrompt: params.extraSystemPrompt,
ownerNumbers: params.ownerNumbers,
+ reasoningTagHint,
runtimeInfo,
}),
contextFiles,
diff --git a/src/agents/system-prompt.test.ts b/src/agents/system-prompt.test.ts
index aa0ddcf51..9d4e5de44 100644
--- a/src/agents/system-prompt.test.ts
+++ b/src/agents/system-prompt.test.ts
@@ -22,4 +22,14 @@ describe("buildAgentSystemPromptAppend", () => {
expect(prompt).not.toContain("## User Identity");
expect(prompt).not.toContain("Owner numbers:");
});
+
+ it("adds reasoning tag hint when enabled", () => {
+ const prompt = buildAgentSystemPromptAppend({
+ workspaceDir: "/tmp/clawd",
+ reasoningTagHint: true,
+ });
+
+ expect(prompt).toContain("## Reasoning Format");
+ expect(prompt).toContain("...");
+ });
});
diff --git a/src/agents/system-prompt.ts b/src/agents/system-prompt.ts
index 683d77ef2..d8429eadc 100644
--- a/src/agents/system-prompt.ts
+++ b/src/agents/system-prompt.ts
@@ -5,6 +5,7 @@ export function buildAgentSystemPromptAppend(params: {
defaultThinkLevel?: ThinkLevel;
extraSystemPrompt?: string;
ownerNumbers?: string[];
+ reasoningTagHint?: boolean;
runtimeInfo?: {
host?: string;
os?: string;
@@ -26,6 +27,9 @@ export function buildAgentSystemPromptAppend(params: {
ownerNumbers.length > 0
? `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."
+ : undefined;
const runtimeInfo = params.runtimeInfo;
const runtimeLines: string[] = [];
if (runtimeInfo?.host) runtimeLines.push(`Host: ${runtimeInfo.host}`);
@@ -72,6 +76,9 @@ export function buildAgentSystemPromptAppend(params: {
if (extraSystemPrompt) {
lines.push("## Group Chat Context", extraSystemPrompt, "");
}
+ if (reasoningHint) {
+ lines.push("## Reasoning Format", reasoningHint, "");
+ }
lines.push(
"## Heartbeats",