Skip to content

fix(integrations-claude-code): label 'Current time' as UTC in recall context#1568

Open
valda wants to merge 1 commit into
vectorize-io:mainfrom
valda:fix/recall-current-time-utc-label-py
Open

fix(integrations-claude-code): label 'Current time' as UTC in recall context#1568
valda wants to merge 1 commit into
vectorize-io:mainfrom
valda:fix/recall-current-time-utc-label-py

Conversation

@valda
Copy link
Copy Markdown

@valda valda commented May 11, 2026

Problem

The Hindsight recall hook injects Current time - <ts> into the <hindsight_memories> block on every UserPromptSubmit, 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):

  • Local wall clock: 2026-05-11 08:55 (morning)
  • Injected line: Current time - 2026-05-10 23:55
  • Result: the model reasons that it is late evening and replies things like "sounds like a good place to wrap up for the day" even though it is morning in the user's actual timezone.

Fix

format_current_time() now returns 2026-05-10 23:55 UTC. The UTC suffix matches the convention already used by the opencode integration:

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 the codex and openclaw integrations and is theoretically affected by the same issue. This PR intentionally leaves them out:

  • The misreading behaviour has only been observed and confirmed against Claude Code by the reporter.
  • hindsight-integrations/codex/scripts/lib/content.py carries pre-existing ruff-format drift in unrelated regions, so editing the same file would either (a) fail verify-generated-files CI or (b) require reformatting ~120 unrelated lines — out of scope for this fix.

Happy to open follow-up PRs for codex / openclaw if 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.

…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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant