Skip to content

Commit 1a0ca55

Browse files
feat: render currentDate in system prompt time section
1 parent 66cfc1e commit 1a0ca55

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/agents/system-prompt.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,11 +94,17 @@ function buildOwnerIdentityLine(
9494
return `Authorized senders: ${displayOwnerNumbers.join(", ")}. These senders are allowlisted; do not assume they are the owner.`;
9595
}
9696

97-
function buildTimeSection(params: { userTimezone?: string }) {
97+
function buildTimeSection(params: { userTimezone?: string; currentDate?: string }) {
9898
if (!params.userTimezone) {
9999
return [];
100100
}
101-
return ["## Current Date & Time", `Time zone: ${params.userTimezone}`, ""];
101+
const lines = ["## Current Date & Time"];
102+
if (params.currentDate) {
103+
lines.push(params.currentDate);
104+
}
105+
lines.push(`Time zone: ${params.userTimezone}`);
106+
lines.push("");
107+
return lines;
102108
}
103109

104110
function buildReplyTagsSection(isMinimal: boolean) {
@@ -564,6 +570,7 @@ export function buildAgentSystemPrompt(params: {
564570
...buildUserIdentitySection(ownerLine, isMinimal),
565571
...buildTimeSection({
566572
userTimezone,
573+
currentDate: params.currentDate,
567574
}),
568575
"## Workspace Files (injected)",
569576
"These user-editable files are loaded by OpenClaw and included below in Project Context.",

0 commit comments

Comments
 (0)