fix(system-prompt): include actual date/time in system prompt#1
Open
wakqasahmed wants to merge 4 commits intomainfrom
Open
fix(system-prompt): include actual date/time in system prompt#1wakqasahmed wants to merge 4 commits intomainfrom
wakqasahmed wants to merge 4 commits intomainfrom
Conversation
Fixes openclaw#28194 - System prompt now includes the full current date and timezone instead of just the timezone. This prevents the model from guessing wrong dates (e.g. guessing 2025-07-19 instead of 2026-02-27). The change uses userTime if provided, otherwise generates the current date/time using toLocaleString with the user's timezone.
7849964 to
93e0fa9
Compare
…itly provided - Remove auto-generation of userTime in system-prompt-params.ts - Only include actual date/time in system prompt when userTime is explicitly provided - When not provided, show timezone-only to maintain cache stability - Users can use session_status tool to get current date/time when needed - Addresses PR feedback about cache stability
The system-prompt-params now generates userTime from current date, which is then used by buildTimeSection to include actual date/time in the system prompt. This fixes the original issue where the model was guessing wrong dates. Trade-off: accepts cache instability to prevent model from guessing incorrect dates. Users can use session_status tool for current time.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes openclaw#28194 - System prompt now includes the full current date and timezone instead of just the timezone.
Problem
The
## Current Date & Timesection in the system prompt only contained the timezone, not the actual date/time. This caused the model to guess wrong dates (e.g., guessing "2025-07-19" when the actual date was "2026-02-27").Solution
Modified
buildTimeSection()insrc/agents/system-prompt.tsto include the actual date/time:Friday, February 27th, 2026 — 9:04 AM (Asia/Shanghai)instead of justTime zone: Asia/ShanghaiuserTimeparameter if provided, otherwise generates current date/time usingtoLocaleString()Testing
Changes
src/agents/system-prompt.ts: UpdatedbuildTimeSection()to include actual date/timesrc/agents/system-prompt.test.ts: Updated tests to match new behaviorAI-assisted (Claude Code)