You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
user-prompt-hook's per-turn timestamp defeats prompt prefix caching — add a toggle or drop the clock #301
scripts/user-prompt-hook.sh prints [$(date '+%H:%M %Z') — $(whoami)] (or the — ${CTX_PCT}% variant) to stdout on every UserPromptSubmit — currently lines ~156-158 at HEAD:
Claude Code injects hook stdout into the model prompt as UserPromptSubmit hook success: [13:05 EDT — jack.neil]. Prompt prefix caches — Anthropic's server-side prompt caching and self-hosted gateways alike — match byte-for-byte from the front, so a wall-clock stamp inside the prompt forces re-prefill of everything positioned after it whenever the minute ticks over between turns or sessions.
Measured impact (2026-08-03, self-hosted DeepSeek-V4 gateway, ~62K-token Claude Code openers): this line was one of two volatile byte sources capping cross-session prefix reuse; on large local models the re-prefill it triggers costs real minutes per day. Because there's no config toggle, gateway operators end up regex-rewriting the line in flight, which is fragile for everyone.
Request
Any of these would fix it cleanly:
A config toggle to suppress the stamp entirely, or
Emit it without the clock — [$(whoami)] and the context-percentage warning are the useful parts and are byte-stable between turns (the CTX_PCT warning could stay threshold-gated as today, so it only appears when it changes behavior anyway), or
Emit the clock only when it materially changes (e.g. hour granularity).
Happy to PR whichever shape you prefer.
Related: #227 touches the same hook for spawn-cost reasons; if that lands a rewrite, this would be a natural rider.
Activity
feat(prompt-hook): prompt_stamp — make the injected line the user's c…
test: assert every shipped shell script parses, under the bash actual…
test: assert every shipped shell script parses, under the bash actual…
release: 0.15.0 — What the check actually saw (#308)