Skip to content

Measure think calls; research in ~5 s at ~$0.90 an hour; write down the budgets - #36

Merged
a-Fig merged 4 commits into
mainfrom
issue-11-latency-cost
Nov 13, 2026
Merged

a-Fig merged 4 commits into
mainfrom
issue-11-latency-cost

Conversation

@DhruvaKanna07

Copy link
Copy Markdown
Collaborator

Closes #11

Why

#11 asks how fast and how cheap a think call must be, and nobody had measured either. In the first real Meet call, research turns took 10 to 13 s, and Tyler called that slow. This PR measures every call, fixes what the measurements turned up, and writes down the two budgets.

Flag for Tyler: this adds a settled decision to docs/VISION.md (the budgets) and changes the default web tools. Spend goes down, not up.

Change

  • think() reports its cost and time. It returns usage (tokens, cache reads and writes, searches, fetches, list-price dollars, summed over pause_turn resumes) and ms. The server logs them on every call. The replay prints cost and latency per kind of tick (quiet, acted, research) and projects an hour of meeting.
  • The prompt cache was working backwards. The only breakpoint was top-level, so it landed on the transcript, which changes every tick. Every tick wrote ~9k tokens of cache at 1.25× and never read any. A breakpoint on the system prompt fixes it: quiet ticks drop from $0.0225 to $0.0025, and the projected hour from $8.40 to $1.29, with the score unchanged.
  • Research uses plain web search, with no sandbox and no fetch (CLAUDE_WEB=search, the new default; dynamic and basic stay selectable). Streaming one research tick showed where the time went: the _20260209 tools have the model write Python that searches in a sandbox (~5 s), then often run a second sandbox step only to print the results (~2.5 s).
  • The replay checks that research quotes can be highlighted. It fetches each page the way /api/page does (fetchReadable moved to page.js) and matches the quotes the way markParagraph() does. With the sandbox tools only 1 of 7 quotes could be marked, because the model quoted its own filtered printout instead of the page.
  • Filler-only ticks are skipped. When every line since the last look is filler ("yeah", "got it"; public/filler.js), the page doesn't call think. The replay mirrors this with SKIP_FILLER=1.
  • Optional small-model gate (CLAUDE_GATE_MODEL, off by default). It was measured and rejected; numbers below.
  • Budgets are written into docs/VISION.md: 8 s from question to answer when Cue is asked by name, 10 s when it steps in on its own, 4 s for other visuals, at most $2 of Claude per hour.

Screenshots

None: no view changed. The research view should now find its highlights more often (1/7 → 6/7 quotes markable in the replay), but there is no screenshot from a real run yet.

Verified

npm run check passes. All runs used Sonnet 5.5, one after another, on 33 ticks unless noted, and every one was billed. Research marks count the quotes the fetched page could highlight.

Variant Score Research median / max Quiet tick Projected hour Research marks
Before (dynamic tools, top-level cache), medium 33/33 18.5 s / 20.4 s $0.0225, 1.5 s $8.40 n/a
+ system-prompt cache breakpoint 33/33 22.7 s / 29.1 s $0.0025, 1.4 s $1.29 1/7 (4 research transcripts)
+ basic search and fetch (4 research transcripts, 2 runs) 16/19, 16/19 7.5–8.2 s / 18.5 s $0.0021 $1.27 7/7, 8/10 (Lisbon became a slide both times)
+ search only (default) 33/33 5.4 s / 5.7 s $0.0019, 1.7 s $0.90 5/6
+ filler skip 33/33 (3 ticks skipped) 5.5 s / 6.0 s $0.0016 $0.79 6/8
+ Haiku 5.5 gate 25/33 (1 missed, 2 annoying) 7.8 s / 7.8 s $0.0003, 0.8 s $0.45 4/7
search only, low effort 31/33 (Lisbon became a slide) 5.3 s / 6.1 s $0.0016 $0.93 6/6

The projected hour assumes 360 ticks, with 10 research and 10 other visuals (TICKS_PER_HOUR, RESEARCH_PER_HOUR, ACTED_PER_HOUR). Replay transcripts are short. A real tick carries up to 4 minutes of transcript, roughly 1k more uncached input tokens, or about $0.7 more per hour on Sonnet.

Not checked: a real Recall call with these changes (end-to-end time, including Recall's transcript delay and the page fetch), and the filler skip in the browser beyond the page loading filler.js.

Review

Needs an Opus review (it changes agent.js and server.js). Commits 17662a1..210d6c6: pending, I'll update this section when it's done.

🤖 Generated with Claude Code

DhruvaKanna07 and others added 4 commits November 13, 2026 13:18
#11 asks what a think call may cost, and nothing measured it. think() now
returns the tokens, searches and fetches of every request it made, priced
at list, and how long it took. The replay prints cost and latency by kind
of tick (quiet, acted, research) and projects an hour of meeting from them.

The first measurement found the cache working backwards: the only
breakpoint was top-level, so it landed on the transcript, which changes
every tick. Each tick wrote ~9k tokens to cache at 1.25x and none was ever
read. A breakpoint on the system prompt caches tools + system, which are
the same every tick. Sonnet 5.5 medium, 33 ticks, same 33/33 score:
quiet ticks $0.0225 -> $0.0025, projected hour $8.40 -> $1.29.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…11

Research was the slow part: 10-13 s in the first real call, 14-29 s in
the replay. A streamed research tick showed where it went: the
_20260209 web tools have the model write Python that runs the search in a
sandbox (~5 s), then often a second sandbox step only to print results
(~2.5 s), and a page fetch on top.

The replay now checks what research is for: it fetches each page as
/api/page does and counts the quotes the page can mark (fetchReadable
moved to page.js so both use it). That showed the sandbox tools were
failing quietly too: 1 of 7 quotes could be marked, because the model
quoted its filtered printout rather than the page.

The four research transcripts, Sonnet 5.5 medium, by CLAUDE_WEB:
dynamic 14.5 s median, 1/7 marked; basic (search + fetch) 7.5 s, quotes
marked, but a failed fetch turned one answer into a slide; search only
5.4 s median, 5.7 s max, quotes marked. Search only, the new default,
scores 33/33 on the full replay, and its smaller tool list makes quiet
ticks cheaper too ($0.0019).

Two other levers were measured:
- Skipping ticks whose new lines are all filler (public/filler.js, used by
  the page and by the replay with SKIP_FILLER=1): 3 of 33 replay ticks
  skipped, still 33/33. On in the page.
- A small model as a gate (CLAUDE_GATE_MODEL, off by default): Haiku 5.5
  in front halves the projected hour ($0.90 -> $0.45) but adds ~2.5 s to
  every tick that acts and scored 25/33 (a missed diagram, two needless
  slides). Latency is the main target, so it stays off.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
#11 is settled when the budgets are written down and a measured call fits
them. These are proposed from the replay numbers in the previous commits;
merging accepts them.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
DhruvaKanna07 added a commit that referenced this pull request Nov 13, 2026
…mise

On #36's search-only tools, "Keep slides to what was said, not who said
it" made Cue put up a slide for "escape room sounds fun" in 2 of 2 runs,
against 0 of 2 without it. Mentioning slides seems to prime one. Whether
slides attribute points to speakers is still open on #14, so the line
waits for that decision.

video-unasked said Figma's keynote was "last week"; Cue rightly found it
was in June and declined to play a guessed clip. It now asks for a
well-known video, so a miss means the gate or the prompt.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@a-Fig
a-Fig merged commit 129daab into main Nov 13, 2026
1 check passed
@a-Fig
a-Fig deleted the issue-11-latency-cost branch November 13, 2026 21:42
DhruvaKanna07 added a commit that referenced this pull request Nov 13, 2026
…mise

On #36's search-only tools, "Keep slides to what was said, not who said
it" made Cue put up a slide for "escape room sounds fun" in 2 of 2 runs,
against 0 of 2 without it. Mentioning slides seems to prime one. Whether
slides attribute points to speakers is still open on #14, so the line
waits for that decision.

video-unasked said Figma's keynote was "last week"; Cue rightly found it
was in June and declined to play a guessed clip. It now asks for a
well-known video, so a miss means the gate or the prompt.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.

How fast and how cheap does a think call need to be?

2 participants