He Stopped Telling Claude Code to Stop Making Up Timestamps—and Made It Impossible with a PreToolUse Hook

Grimmoner · reddit · 2026-10-18

A Claude Code user found the model kept writing fabricated timestamps in logs—rounded guesses, placeholders like 16:4x, even a time 16 minutes in the future—despite being told not to.

His fix: stop telling, start enforcing. A PreToolUse hook runs a small Python script before every Bash command, file write, edit, or message, blocking calls that would introduce a guessed time pattern and instructing the model to read the clock inline with T=$(date '+%H:%M') instead.

Key engineering details:

The hook caught Claude within two hours of deployment. Known limits: round guesses like 06:00 slip through, and plain chat replies aren't visible. His lesson: if you've told an agent the same thing three times, make the wrong thing impossible.

Original post →

More from coding & agent

coding & agent channel →