fix(integrations-claude-code): label 'Current time' as UTC in recall context#1568
Merged
nicoloboschi merged 1 commit intoMay 25, 2026
Merged
Conversation
…context The recall hook injects "Current time - <ts>" into <hindsight_memories> without a timezone label, while the value is computed in UTC. Client LLMs running in non-UTC timezones often misread this as local time — e.g. a 2026-05-10 23:55 UTC stamp prompts a Claude Code session in JST (local 2026-05-11 08:55) to remark "sounds like a good place to wrap up for the day." The opencode integration already labels its equivalent line with " UTC" (hindsight-integrations/opencode/src/hooks.ts:117). Aligning claude-code with that convention removes the foot-gun.
453d87f to
22527e9
Compare
5 tasks
2 tasks
nicoloboschi
added a commit
that referenced
this pull request
May 28, 2026
Append ` UTC` to the `Current time -` header injected above recalled memories. Without the label the LLM read the timestamp as local time and made wrong recency judgments. This is the same fix that landed for the Claude Code integration in #1568 — the OpenClaw integration was overlooked. Closes #1789
nicoloboschi
added a commit
that referenced
this pull request
May 28, 2026
#1804) Append ` UTC` to the `Current time -` header injected above recalled memories. Without the label the LLM read the timestamp as local time and made wrong recency judgments. This is the same fix that landed for the Claude Code integration in #1568 — the OpenClaw integration was overlooked. Closes #1789
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The Hindsight recall hook injects
Current time - <ts>into the<hindsight_memories>block on everyUserPromptSubmit, but the timestamp is rendered as UTC with no timezone label. Client-side LLMs running in non-UTC timezones routinely misread the value as local time.Concrete repro #1 (Claude Code, JST / UTC+9):
2026-05-11 08:55(morning)Current time - 2026-05-10 23:55Concrete repro #2 — much worse, observed since the original report:
Current time - <ts>line still sitting in its scrolled-back context (UTC value).Fix
format_current_time()now returns2026-05-10 23:55 UTC. TheUTCsuffix matches the convention already used by theopencodeintegration:https://github.com/vectorize-io/hindsight/blob/main/hindsight-integrations/opencode/src/hooks.ts#L117
so this is parity rather than novelty.
Scope
hindsight-integrations/claude-code/scripts/lib/content.py— the actual change (4 lines)hindsight-integrations/claude-code/tests/test_content.py— regression tests (suffix + format-shape)The same
format_current_time()shape exists in thecodexandopenclawintegrations and is theoretically affected by the same issue. This PR intentionally leaves them out:hindsight-integrations/codex/scripts/lib/content.pycarries pre-existing ruff-format drift in unrelated regions, so editing the same file would either (a) failverify-generated-filesCI or (b) require reformatting ~120 unrelated lines — out of scope for this fix.Happy to open follow-up PRs for
codex/openclawif you want the parity extended.Test plan
pytest hindsight-integrations/claude-code/tests/test_content.py— 57 passed, including the two new tests.ruff check --config ./ruff.toml hindsight-integrations/claude-code/scripts/lib/content.py— clean.ruff format --config ./ruff.toml --check hindsight-integrations/claude-code/scripts/lib/content.py— already formatted.Rebase note
Rebased onto
8b10231b Release v0.6.2to stay current with the v0.6.2 release line.