⚡️ perf(sarathi): page jobs run on Sonnet with only their tools (#659)
sarathi page ran each job's claude -p session with Claude Code's whole tool list (32 tools) on the inherited Opus, because --allowedTools only approves tools. claudeArgs now passes --model sonnet, --tools Read,Artifact or --tools Artifact, and denies ArtifactData (and ArtifactComments where the job answers no comments).
Measured on 2026-11-27:
| Run | Model | Tools | First request | Cost |
|---|---|---|---|---|
| trivial run, today's flags | Opus | 32 | 38,492 | $0.31 |
trivial run, --tools Artifact | Opus | 3 | 28,236 | $0.23 |
trivial run, + ArtifactData denied (read) | Opus | 1 | 20,362 | $0.16 |
| trivial publish, this PR's flags | Sonnet | 2 | 21,000 | $0.08 |
real --read of one page, released sarathi | Opus | — | 38,509 | — |
real --read of the same page, this build | Sonnet | — | 20,300 | — |
With no tools at all a session starts at 5,053 tokens, so the CLI's Artifact tool alone is about 15,000 and a page job cannot start much below 20,000.
Ran for real on this build (terminal, desktop entrypoint): publish of a scratch page, --read, --comments, and the guarded --url update after a read. Not run: --reply (no page had a comment thread) and the cloud (remote) entrypoint, where --tools and Sonnet are untested.
The README's "about 11,000 tokens" becomes the measured size of the desktop claude-artifacts server's seven eager tools (22,800 characters, roughly 6,000 tokens a request). The lesson that a deny leaves desktop-injected definitions in place is re-checked in three probe sessions (deny in settings.local.json, in settings.json, and with Artifact denied beside it): each still received all seven.
No version bump: #660 releases sarathi 0.8.15; this needs a later release and a pin bump before sessions run it.
Slice: #659
🤖 Generated with Claude Code
Summary by cubic
Speeds up sarathi page jobs by running each claude -p session on Sonnet with only the tools the job needs, instead of Claude Code's full tool list on the inherited Opus. First-request size drops from about 38,000 tokens to about 20,000, and a trivial run costs about a quarter of what it did (measured 2026-11-27).
claudeArgsnow passes--model sonnetand--tools Read,Artifact(orArtifactalone for jobs that read no file);--allowedToolspreviously only approved tools, so the whole list stayed loaded.- Every job denies
ArtifactData; jobs that do not answer comments also denyArtifactComments.Artifactis still never denied by name. - Each job is a few mechanical calls checked by
outcome, so Sonnet's output quality is not a concern. - The README's token estimates and the Claude Code lesson about desktop tool definitions are updated with measured values.
--reply and the cloud (remote) entrypoint are untested on this build. This needs a release and a pin bump after #660 before sessions run it.