feat(system-prompt): add formatted date with day of week

Fixes #1897

The system prompt now includes the full formatted date (e.g.,
"Sunday, January 25th, 2026 — 12:40 PM") above the timezone,
so agents no longer have to guess what day it is.

🤖 AI-assisted: Generated with Claude Opus 4.5
📋 Testing: Lightly tested (lint passes, manual review)
 I understand what this code does
This commit is contained in:
Trenton Sadrakula 2026-01-25 13:15:11 -06:00
parent c8063bdcd8
commit a1af1bd996

View File

@ -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(params.userTime);
}
lines.push(`Time zone: ${params.userTimezone}`, "");
return lines;
}
function buildReplyTagsSection(isMinimal: boolean) {
@ -297,6 +302,7 @@ export function buildAgentSystemPrompt(params: {
: undefined;
const reasoningLevel = params.reasoningLevel ?? "off";
const userTimezone = params.userTimezone?.trim();
const userTime = params.userTime?.trim();
const skillsPrompt = params.skillsPrompt?.trim();
const heartbeatPrompt = params.heartbeatPrompt?.trim();
const heartbeatPromptLine = heartbeatPrompt
@ -459,6 +465,7 @@ export function buildAgentSystemPrompt(params: {
...buildUserIdentitySection(ownerLine, isMinimal),
...buildTimeSection({
userTimezone,
userTime,
}),
"## Workspace Files (injected)",
"These user-editable files are loaded by Clawdbot and included below in Project Context.",