Give your coding agent an accurate clock.
Agent Clock injects the real current date and time into your agent's context on every prompt β and again at session start / resume β so it never reasons from a timestamp frozen when the session began.
AI coding agents have no live clock. They learn the time once β usually at session start β and then carry that stale value for the rest of the session.
Leave a session open overnight and come back in the morning, and the agent still thinks it's last night. Ask it to log a timestamp, schedule something, calculate "how long ago," or reason about a deadline, and it quietly uses the wrong time.
Agent Clock is a tiny lifecycle hook that runs date on your machine and feeds
the result back into the model's context right before it reads your message β
on every single turn. The agent always sees the real wall-clock time.
You type a message
β [UserPromptSubmit fires] β runs `date` on your machine
β "Current real-world date and time, refreshed this turn: Sunday, June 21, 2026 β¦"
β injected into context
β the agent answers using the correct time, every turn
Because it re-fires on every submission (and on session resume), the overnight-staleness problem is structurally impossible.
/plugin marketplace add arthurkatcher/agent-clock
/plugin install agent-clock@agent-clock
Then /reload-plugins (or restart). That's it β no config required.
codex plugin marketplace add arthurkatcher/agent-clock
Then run codex, open /plugins, find agent-clock, and install it. Codex
will ask you to trust the hook on first run (review it via /hooks) β approve
it, then start a new thread.
Codex hooks require
[features] hooks = true(the default in recent versions).
Agent Clock registers on the only two lifecycle events that make sense for a clock β both of which let a hook inject context the model can read:
| Event | When it fires | Why it's here |
|---|---|---|
UserPromptSubmit |
Every time you send a message | The core fix β re-stamps the time on every turn, so it's never stale |
SessionStart |
On startup, resume, clear, compact |
Re-stamps the time the moment you reopen a session (the overnight case) |
Both Claude Code and Codex inject a hook's stdout into the model's context for these events. Agent Clock simply prints a one-line, unambiguous timestamp:
Current real-world date and time, refreshed this turn:
Sunday, June 21, 2026 at 13:14:07 CEST (UTC 2026-06-21T11:14:07Z, Unix 1781954047).
It includes the local time and UTC and the Unix epoch, so the agent can reason about timezones and durations without guessing.
Prompt-submission hooks in both Claude Code and Codex are append-only β they add context alongside your message; they cannot rewrite the text you typed. Agent Clock never touches your prompt. It adds a timestamp line and nothing else.
Zero config by default β it uses your machine's local timezone.
To pin a specific timezone regardless of machine settings, set an environment variable before launching your agent:
export AGENT_CLOCK_TZ="Europe/Belgrade" # or "UTC", "America/New_York", β¦A single shared script drives both harnesses. Everything tool-specific lives in thin wrapper files β the script itself is never duplicated.
agent-clock/
βββ .claude-plugin/marketplace.json # Claude Code marketplace catalog
βββ .agents/plugins/marketplace.json # Codex marketplace catalog
βββ plugins/agent-clock/
βββ .claude-plugin/plugin.json # Claude Code manifest
βββ .codex-plugin/plugin.json # Codex manifest (+ interface)
βββ hooks/
β βββ hooks.json # Claude Code hook config
β βββ hooks-codex.json # Codex hook config
βββ scripts/
βββ run-hook.sh # The shared hook script (date β context)
- A POSIX shell with
date(every Linux/macOS install has this). - Claude Code, or Codex with hooks enabled.
MIT Β© Arthur Katcher