Skip to content

arthurkatcher/agent-clock

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

2 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ• Agent Clock

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.

Claude Code Codex License: MIT Hooks


The problem

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.

The fix

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.


Install

Claude Code

/plugin marketplace add arthurkatcher/agent-clock
/plugin install agent-clock@agent-clock

Then /reload-plugins (or restart). That's it β€” no config required.

Codex

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).


How it works

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.

What it does not do

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.


Configuration

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", …

Repository layout

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)

Requirements

  • A POSIX shell with date (every Linux/macOS install has this).
  • Claude Code, or Codex with hooks enabled.

License

MIT Β© Arthur Katcher

About

πŸ• Give your coding agent an accurate clock β€” inject the real current date/time into context on every prompt. Dual-target plugin for Claude Code & Codex.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages