From 3a2f1801f89ed3bbbc467d55b6042f08762a7e44 Mon Sep 17 00:00:00 2001 From: Kaya Date: Mon, 26 Jan 2026 10:44:16 +0300 Subject: [PATCH] feat: include full date with day of week in system prompt MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes #2108 The system prompt now includes the full current date and time (e.g., 'Current: Monday, January 5th, 2026 — 3:26 PM') in addition to the timezone. This prevents the agent from incorrectly guessing the day of week. --- src/agents/system-prompt.test.ts | 2 ++ src/agents/system-prompt.ts | 10 ++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/agents/system-prompt.test.ts b/src/agents/system-prompt.test.ts index 14f643e55..fdf290972 100644 --- a/src/agents/system-prompt.test.ts +++ b/src/agents/system-prompt.test.ts @@ -145,6 +145,7 @@ describe("buildAgentSystemPrompt", () => { }); expect(prompt).toContain("## Current Date & Time"); + expect(prompt).toContain("Current: Monday, January 5th, 2026 — 3:26 PM"); expect(prompt).toContain("Time zone: America/Chicago"); }); @@ -157,6 +158,7 @@ describe("buildAgentSystemPrompt", () => { }); expect(prompt).toContain("## Current Date & Time"); + expect(prompt).toContain("Current: Monday, January 5th, 2026 — 15:26"); expect(prompt).toContain("Time zone: America/Chicago"); }); diff --git a/src/agents/system-prompt.ts b/src/agents/system-prompt.ts index 41ec9a7d5..69d5d1135 100644 --- a/src/agents/system-prompt.ts +++ b/src/agents/system-prompt.ts @@ -49,9 +49,14 @@ function buildUserIdentitySection(ownerLine: string | undefined, isMinimal: bool return ["## User Identity", ownerLine, ""]; } -function buildTimeSection(params: { userTimezone?: string }) { +function buildTimeSection(params: { userTimezone?: string; userTime?: string }) { if (!params.userTimezone) return []; - return ["## Current Date & Time", `Time zone: ${params.userTimezone}`, ""]; + const lines = ["## Current Date & Time"]; + if (params.userTime) { + lines.push(`Current: ${params.userTime}`); + } + lines.push(`Time zone: ${params.userTimezone}`, ""); + return lines; } function buildReplyTagsSection(isMinimal: boolean) { @@ -459,6 +464,7 @@ export function buildAgentSystemPrompt(params: { ...buildUserIdentitySection(ownerLine, isMinimal), ...buildTimeSection({ userTimezone, + userTime: params.userTime, }), "## Workspace Files (injected)", "These user-editable files are loaded by Clawdbot and included below in Project Context.",