Expose message timestamps to the model in Claude Code sessions

Resolved 💬 7 comments Opened Apr 13, 2026 by andrija83 Closed May 29, 2026

Problem

Claude Code sessions don't expose message timestamps to the model. Claude sees the
content of previous messages but has no idea when they were sent. This creates
several real bugs in long-running sessions:

Concrete scenarios where this breaks

  1. "Good night" → 10 seconds → "Good morning"

Tested this live: said "good night" at end of a session, typed "good morning" 10
seconds later, and Claude enthusiastically summarized "where we left off last
night" and offered a new-day action list. It had no way to know less than a
minute had passed.

  1. Background task status checks

When a run_in_background task is kicked off, Claude can't tell whether it's
been running for 2 seconds or 20 minutes without calling tail on the log.
Timestamps would make "should I check again now?" trivial.

  1. Re-grounding after idle

Claude has no way to distinguish "user paused for 30 seconds to read" from
"user left 3 hours ago and is now back." After 3 hours, a full re-ground
(read handoff, check git status) is appropriate. After 30 seconds, it's noise.

  1. Avoiding repeated status updates

If Claude just posted a 10-line status update 20 seconds ago and the user says
"ok", there's no reason to re-post the status. But without timestamps, Claude
can't tell a rapid back-and-forth from a stale resume.

  1. Session continuity vs new day

Currently I rely on greeting keywords ("good morning") and context to guess
whether it's a new session. This is trivially fooled, as demonstrated in (1).

Proposed solution

Inject a timestamp into each user message as a hidden system annotation, e.g.:

\\\
<message timestamp=\"2026-04-13T03:47:12Z\">
user content here
</message>
\
\\

Or as a separate metadata field in the message envelope — the exact format is less
important than the fact that the model can read it. Tool results already have
metadata (the environment-info block at session start), so there's precedent.

Why this matters more than it sounds

For one-shot \"write me a function\" prompts, timestamps are irrelevant. But
Claude Code sessions routinely run for hours with mixed idle/active periods —
debugging, waiting for builds, running background tasks, pausing to test in the
browser. The model currently has to guess conversation timing from
content alone, which is unreliable and occasionally embarrassing.

Workarounds today

None that the user doesn't have to remember. I can ask the user what time it is,
but that's asking them to compensate for a gap in the tooling.

View original on GitHub ↗

This issue has 7 comments on GitHub. Read the full discussion on GitHub ↗