Files
DeepTutor/deeptutor/capabilities/explore_context/prompts
zane-i c04598bfae perf(explore-context): read the source ahead of the per-turn question
The exploring pre-pass re-read the same attached source on every turn -
39,627 characters, byte-identical across six turns - but put the
per-turn question first in the user message, so the longest shared
prefix with the previous request ended a handful of tokens in and the
whole re-read missed cache. That call ran 24,778 prompt tokens for
1,024 cached (4.1%), which is most of the misses in a turn.

Split the message the way the answer loop already splits everything
stable from everything per-turn: mode, manifest and the preloaded
source text go ahead of it and the question becomes the last message,
so the repeatable part is a byte-identical prefix across turns.

The preload stays capped (two sources, 120,000 characters) so a wide
manifest cannot spend the budget on its own; the document digest is
still the primary evidence path.

After both commits, on the same session: the exploration call runs
24,566 prompt tokens for 24,448 cached (99.5%), every call in the turn
reports first_change=append, and the turn reaches 94.0% cached, up
from 54.7%.
2026-10-13 23:47:21 +08:00
..