diff --git a/src/agents/pi-embedded-runner.ts b/src/agents/pi-embedded-runner.ts index 2dce46231..d153a5802 100644 --- a/src/agents/pi-embedded-runner.ts +++ b/src/agents/pi-embedded-runner.ts @@ -213,6 +213,7 @@ function formatUserTime(date: Date, timeZone: string): string | undefined { try { const parts = new Intl.DateTimeFormat("en-CA", { timeZone, + weekday: "long", year: "numeric", month: "2-digit", day: "2-digit", @@ -224,10 +225,17 @@ function formatUserTime(date: Date, timeZone: string): string | undefined { for (const part of parts) { if (part.type !== "literal") map[part.type] = part.value; } - if (!map.year || !map.month || !map.day || !map.hour || !map.minute) { + if ( + !map.weekday || + !map.year || + !map.month || + !map.day || + !map.hour || + !map.minute + ) { return undefined; } - return `${map.year}-${map.month}-${map.day} ${map.hour}:${map.minute}`; + return `${map.weekday} ${map.year}-${map.month}-${map.day} ${map.hour}:${map.minute}`; } catch { return undefined; } diff --git a/src/agents/system-prompt.test.ts b/src/agents/system-prompt.test.ts index 65a09e4d5..5c8f85360 100644 --- a/src/agents/system-prompt.test.ts +++ b/src/agents/system-prompt.test.ts @@ -50,12 +50,12 @@ describe("buildAgentSystemPromptAppend", () => { const prompt = buildAgentSystemPromptAppend({ workspaceDir: "/tmp/clawd", userTimezone: "America/Chicago", - userTime: "2026-01-05 15:26", + userTime: "Monday 2026-01-05 15:26", }); expect(prompt).toContain("## Time"); expect(prompt).toContain("User timezone: America/Chicago"); - expect(prompt).toContain("Current user time: 2026-01-05 15:26"); + expect(prompt).toContain("Current user time: Monday 2026-01-05 15:26"); }); it("includes model alias guidance when aliases are provided", () => {