openclaw - 💡(How to fix) Fix [Bug]: System prompt timestamp injection breaks Anthropic prompt cache (always cache_creation, never cache_read) [1 comments, 1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#63071Fetched 2026-04-09 07:58:55
View on GitHub
Comments
1
Participants
1
Timeline
4
Reactions
0
Author
Participants
Timeline (top)
labeled ×2commented ×1cross-referenced ×1

Root Cause

The ## Current Date & Time block is injected into the system prompt on every request, before the cache_control boundary. Because the timestamp changes each turn, the cache key is always invalidated — resulting in cache_creation on every call instead of cache_read.

RAW_BUFFERClick to expand / collapse

Bug type

Regression (worked before, now fails)

Beta release blocker

No

Summary

Problem

The ## Current Date & Time block is injected into the system prompt on every request, before the cache_control boundary. Because the timestamp changes each turn, the cache key is always invalidated — resulting in cache_creation on every call instead of cache_read.

Expected behavior

Static or rarely-changing content should be placed before the cache boundary. Dynamic content like timestamps should either be:

  • injected after the last cache checkpoint, or
  • made optional via config (e.g. injectTimestamp: false)

Environment

  • OpenClaw version: x.x.x
  • Model: claude-sonnet-4.x (Anthropic)
  • Channel: Discord

Impact

Prompt cache is effectively disabled for all sessions using Anthropic models, leading to unnecessary token costs on every request.

Steps to reproduce

  1. start openclaw 2026.3.28

Expected behavior

should read cahce

Actual behavior

only createa caceh, 0% read prompt cache

OpenClaw version

2026.3.28

Operating system

mac os

Install method

npmn

Model

claude opus 4.6

Provider / routing chain

openclaw -> claude

Additional provider/model setup details

No response

Logs, screenshots, and evidence

Impact and severity

No response

Additional information

No response

extent analysis

TL;DR

Move the Current Date & Time block injection after the cache_control boundary or make it optional via configuration to prevent cache invalidation.

Guidance

  • Identify the code responsible for injecting the Current Date & Time block and modify it to inject after the cache_control boundary.
  • Consider adding a configuration option (e.g., injectTimestamp: false) to make the timestamp injection optional.
  • Verify the cache behavior by checking the cache hit rate after applying the changes.
  • Review the OpenClaw documentation to see if there are any existing configuration options or settings that can be used to control the injection of dynamic content.

Example

No code snippet is provided as the issue does not contain sufficient code details.

Notes

The solution assumes that the Current Date & Time block is being injected by the OpenClaw system and that modifying this behavior is feasible. Additional details about the OpenClaw codebase and configuration options may be necessary to provide a more specific solution.

Recommendation

Apply workaround: Move the Current Date & Time block injection after the cache_control boundary or make it optional via configuration, as this is a more feasible and immediate solution to prevent cache invalidation and reduce unnecessary token costs.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

should read cahce

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING