Skip to content

Conversation

@NoRain211
Copy link

Summary

Adds a timestamp-context plugin that injects the current local time (ISO 8601 with timezone offset) into conversation context on every message via a UserPromptSubmit hook.

Motivation

Claude Code includes the date in its system prompt but not the time or timezone. This has been requested multiple times:

Until this is built into core, a plugin provides an easy opt-in solution.

What it does

A UserPromptSubmit hook runs a Node.js one-liner that outputs the local time. Since UserPromptSubmit stdout is injected as context, Claude sees the timestamp on every message.

Example context injected:

The current local time is: 2026-02-06T04:39:00-07:00. This is the latest source of truth for time; do not attempt to get the time any other way.

Details

  • Zero dependencies — uses only Node.js (already required by Claude Code)
  • Auto-detects timezone — uses system locale, no user configuration needed
  • Negligible cost — ~120 characters per message

Test plan

  • Enable plugin and start a new session
  • Send a message and verify Claude receives the timestamp in context
  • Confirm timezone offset matches the local system timezone

🤖 Generated with Claude Code

Adds a lightweight plugin that injects the current local time (ISO 8601
with timezone offset) into conversation context via a UserPromptSubmit
hook. Addresses a repeatedly requested feature (anthropics#1164, anthropics#2618, anthropics#23655).

Co-Authored-By: Claude Opus 4.6 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants