fix: Display day of week in system prompt time section#7435
Closed
binim10 wants to merge 1 commit intoopenclaw:mainfrom
Closed
fix: Display day of week in system prompt time section#7435binim10 wants to merge 1 commit intoopenclaw:mainfrom
binim10 wants to merge 1 commit intoopenclaw:mainfrom
Conversation
The system prompt was generating userTime (with day of week) but not using it in buildTimeSection. This caused the agent to not know which day of the week it is without explicitly running date command. Changes: - Added userTime parameter to buildTimeSection function - Display formatted time with day of week when available - Fallback to session_status tool prompt when userTime not provided This reduces unnecessary tool calls and improves agent context awareness.
Author
|
Closing this PR after discovering it conflicts with OpenClaw's intentional design for prompt cache stability. The test
The preferred solution (per comments in the test) is gateway-level timestamp injection into messages, not the system prompt. I'll explore the message-level timestamp approach instead. Thanks for the automated tests catching this! 🙏 |
Open
4 tasks
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.
Problem
The system prompt was generating
userTime(including day of week) viaformatUserTime()but not using it inbuildTimeSection(). This caused the agent to not know which day of the week it is without explicitly running thedatecommand orsession_statustool.Solution
userTimeparameter tobuildTimeSection()function signatureparams.userTimefrombuildAgentSystemPrompt()tobuildTimeSection()userTimeis availableuserTimenot provided.filter(Boolean)Impact
daterepeatedly)Testing
Tested locally - system prompt now shows:
Previously only showed timezone without the formatted time.
Greptile Overview
Greptile Summary
This change threads
userTimeinto the system prompt “Current Date & Time” section so the prompt can show a preformatted local timestamp (including day-of-week) when available, while keeping the existing session_status guidance as a fallback. The update is localized tosrc/agents/system-prompt.ts, adjustingbuildTimeSection’s signature and the call site inbuildAgentSystemPrompt, and uses.filter(Boolean)to omit empty lines.Confidence Score: 5/5
(2/5) Greptile learns from your feedback when you react with thumbs up/down!