hindsight icon indicating copy to clipboard operation
hindsight copied to clipboard

coding-agents: per-turn page refresh and search-result crediting re-send the full tool guide and toolGuideExtra every turn

Open jervaise opened this issue 2 weeks ago • 0 comments

Related to #6565 (same area, different turns).

What happens

With the default pageRefreshEveryTurns: 1, every turn from turn 2 on injects a full <hindsight_page_refresh> block. buildRosterRefresh (core/page-injection.ts) re-sends the page-index sentence plus the complete toolGuide(opts), which includes toolGuideExtra. The session-start <hindsight_pages> preamble already delivered the same guide, and the tool descriptions carry it as well, so the same text reaches the model on every turn.

Separately, hindsight_search_pages returns a crediting field (core/page-tools.ts) made of CREDIT_REMINDER plus toolGuideExtra. That repeats toolGuideExtra in every search result, although the tool description already carries it.

Measured

72 hours of real coding sessions (Pi harness, 0.8.x, about 3,000 sessions):

  • <hindsight_page_refresh>: 624 injections at about 5.6 KB each, effectively constant; 3.46 MB in total, about 90% of it guide and toolGuideExtra text the model already had.
  • hindsight_search_pages: 302 results; crediting alone was 0.73 MB.

With a one-line refresh and a reminder-only crediting, one refresh block measured 5,602 B → 177 B and one crediting 2,564 B → 550 B. The session-start preamble was unchanged.

Suggestion

  • After turn 1, make the refresh a short trigger. For example: Search this repo's N Hindsight pages (hindsight_search_pages) before bugs, tests, new work and commits; credit any hit you use. Keep the tag so hosts that parse it still work. Hosts whose only guide delivery is the refresh (no SessionStart preamble, e.g. the antigravity and kimi hooks) would keep the full block.
  • Return crediting: CREDIT_REMINDER in search results, and keep toolGuideExtra in the tool description only.
  • Or put both behind config options, so the 10 → 1 cadence that raised search use can stay while the repeated bytes go.

We currently apply this locally as an exact-anchor patch to the dist bundles and would be glad to drop it once upstream covers it.

jervaise avatar Nov 16 '26 20:11 jervaise