@@ -350,7 +350,7 @@ describe("buildAgentSystemPrompt", () => {
350350 expect ( prompt ) . toContain ( "Reminder: commit your changes in this workspace after edits." ) ;
351351 } ) ;
352352
353- it ( "shows timezone section for 12h, 24h, and timezone-only modes " , ( ) => {
353+ it ( "shows current date/time when available, with timezone-only fallback " , ( ) => {
354354 const cases = [
355355 {
356356 name : "12-hour" ,
@@ -360,6 +360,7 @@ describe("buildAgentSystemPrompt", () => {
360360 userTime : "Monday, January 5th, 2026 — 3:26 PM" ,
361361 userTimeFormat : "12" as const ,
362362 } ,
363+ expectedLine : "Monday, January 5th, 2026 — 3:26 PM (America/Chicago)" ,
363364 } ,
364365 {
365366 name : "24-hour" ,
@@ -369,6 +370,7 @@ describe("buildAgentSystemPrompt", () => {
369370 userTime : "Monday, January 5th, 2026 — 15:26" ,
370371 userTimeFormat : "24" as const ,
371372 } ,
373+ expectedLine : "Monday, January 5th, 2026 — 15:26 (America/Chicago)" ,
372374 } ,
373375 {
374376 name : "timezone-only" ,
@@ -377,13 +379,14 @@ describe("buildAgentSystemPrompt", () => {
377379 userTimezone : "America/Chicago" ,
378380 userTimeFormat : "24" as const ,
379381 } ,
382+ expectedLine : "Time zone: America/Chicago" ,
380383 } ,
381384 ] as const ;
382385
383386 for ( const testCase of cases ) {
384387 const prompt = buildAgentSystemPrompt ( testCase . params ) ;
385388 expect ( prompt , testCase . name ) . toContain ( "## Current Date & Time" ) ;
386- expect ( prompt , testCase . name ) . toContain ( "Time zone: America/Chicago" ) ;
389+ expect ( prompt , testCase . name ) . toContain ( testCase . expectedLine ) ;
387390 }
388391 } ) ;
389392
@@ -397,29 +400,15 @@ describe("buildAgentSystemPrompt", () => {
397400 expect ( prompt ) . toContain ( "current date" ) ;
398401 } ) ;
399402
400- // The system prompt intentionally does NOT include the current date/time.
401- // Only the timezone is included, to keep the prompt stable for caching.
402- // See: https://github.com/moltbot/moltbot/commit/66eec295b894bce8333886cfbca3b960c57c4946
403- // Agents should use session_status or message timestamps to determine the date/time.
404- // Related: https://github.com/moltbot/moltbot/issues/1897
405- // https://github.com/moltbot/moltbot/issues/3658
406- it ( "does NOT include a date or time in the system prompt (cache stability)" , ( ) => {
403+ it ( "includes provided date/time in the system prompt" , ( ) => {
407404 const prompt = buildAgentSystemPrompt ( {
408405 workspaceDir : "/tmp/clawd" ,
409406 userTimezone : "America/Chicago" ,
410407 userTime : "Monday, January 5th, 2026 — 3:26 PM" ,
411408 userTimeFormat : "12" ,
412409 } ) ;
413410
414- // The prompt should contain the timezone but NOT the formatted date/time string.
415- // This is intentional for prompt cache stability — the date/time was removed in
416- // commit 66eec295b. If you're here because you want to add it back, please see
417- // https://github.com/moltbot/moltbot/issues/3658 for the preferred approach:
418- // gateway-level timestamp injection into messages, not the system prompt.
419- expect ( prompt ) . toContain ( "Time zone: America/Chicago" ) ;
420- expect ( prompt ) . not . toContain ( "Monday, January 5th, 2026" ) ;
421- expect ( prompt ) . not . toContain ( "3:26 PM" ) ;
422- expect ( prompt ) . not . toContain ( "15:26" ) ;
411+ expect ( prompt ) . toContain ( "Monday, January 5th, 2026 — 3:26 PM (America/Chicago)" ) ;
423412 } ) ;
424413
425414 it ( "includes model alias guidance when aliases are provided" , ( ) => {
0 commit comments