Bug: currentDate in system prompt shows previous day's date after context compression — causes incorrect date-sensitive operations
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
Summary
When a long conversation gets auto-compressed (context summarization) and continues in a new session, the currentDate injected into the system prompt reflects the previous session's date, not the actual current date.
Steps to Reproduce
- Start a Claude Code Desktop App session on Day 1 (e.g., June 25, 2026)
- Have a long conversation until context compression is triggered
- Continue work in a new session on Day 2 (e.g., June 26, 2026)
- Observe: system prompt injects
Today's date is 2026-06-25(yesterday's date) - Verify actual system date via PowerShell: returns
2026년 6월 26일 금요일(correct)
Actual Behavior
currentDate is frozen at the date of the prior session that was compressed, not the actual current date. Claude Code reads the stale date from the compressed context summary and re-injects it into the new session's system prompt.
Expected Behavior
currentDate should always reflect the real system date at session start, regardless of context compression history.
Real-World Impact
Critical severity — any date-sensitive operation (financial due dates, payment schedules, contract deadlines, scheduling) may be processed with an incorrect date, causing downstream errors that are difficult to detect.
Environment
- OS: Windows 11 Pro
- Claude Code: Desktop App (Windows), version 2.1.173
- Model: claude-sonnet-4-6
- Confirmed: PC system clock was correct (June 26). The bug is in how Claude Code injects
currentDateafter context compression in the Desktop App.
What Should Happen?
At session start, currentDate in the system prompt must always reflect the real OS system date — freshly read at initialization, never inherited from a prior compressed context. Context compression should preserve conversation history but must not carry over the currentDate value from the previous session.
Error Messages/Logs
Steps to Reproduce
- Start a Claude Code Desktop App session on Day 1 (e.g., June 25, 2026) and have an extended conversation.
- Allow context compression to trigger (long session).
- Continue the session the next day (e.g., June 26, 2026) — the session summary is loaded.
- Check the system prompt:
currentDateshows2026-06-25(previous day). - Verify PC system date via PowerShell:
[System.TimeZoneInfo]::ConvertTimeBySystemTimeZoneId([DateTime]::UtcNow, 'Korea Standard Time')— returns June 26 (correct).
Note: The bug is reliably reproducible when context compression spans a day boundary. The PC clock was correct; the stale date came from the compressed session metadata.
Claude Model
Sonnet (default)
Is this a regression?
Yes, this worked in a previous version
Last Working Version
_No response_
Claude Code Version
2.1.173 (Claude Code)
Platform
Other
Operating System
Windows
Terminal/Shell
PowerShell
Additional Information
_No response_
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗