A UserPromptSubmit hook for Claude Code that
injects the current local date, time, and timezone into context on every
message you send.
Claude Code doesn't track the passage of time within a session. Leave a session open overnight, type a message the next morning, and it has no idea hours have passed — to it, idle-for-a-minute and idle-for-twelve-hours look identical.
A SessionStart hook doesn't fix this: it only fires on launch/resume/clear/
compact, so its timestamp freezes at session start. UserPromptSubmit fires on
every prompt, so the clock refreshes each turn no matter how long the session sat idle.
Merge the block below into ~/.claude/settings.json (global, all projects). If
you already have a hooks key, add UserPromptSubmit alongside the existing
entries rather than replacing them.
Takes effect on your next prompt — no restart needed. If it doesn't kick in,
open /hooks once to force a settings reload.
Requires date and jq (both standard on macOS/Linux).
jq '.hooks.UserPromptSubmit' ~/.claude/settings.json