A resumed hook firing is a brand-new claude -p process, and Claude Code rebuilds that process's environment preamble from scratch — any drift there (near-certain on a shared checkout) invalidates the finished run's prompt cache entirely. Sampled real transcripts confirm every firing re-creates the whole prior conversation as fresh input tokens rather than reading it from cache, regardless of delay. maxContextK was defaulted to 0 (no cap), so an unbounded conversation meant an unbounded tidy-up bill. Default it to 60k and document why, in both the backend docstring and CLAUDE.md.
20 KiB
20 KiB