fix(integrations-claude-code): label 'Current time' as UTC in recall context#1568
Open
valda wants to merge 1 commit into
Open
fix(integrations-claude-code): label 'Current time' as UTC in recall context#1568valda wants to merge 1 commit into
valda wants to merge 1 commit into
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.
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 (Claude Code, JST / UTC+9):
2026-05-11 08:55(morning)Current time - 2026-05-10 23:55Fix
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.