Tell the model what documents exist; price the prompt
A plainly worded question ("the lease", "my client's email") got zero tool
calls and "I don't have access to your Beaver Library in this session".
The same question naming the files got five tool calls and correct answers.
The prompt already said "Use library_list before claiming a Library
document is unavailable" -- it is one sentence inside a 20-sentence block
with no line breaks, and it was ignored. Knowing the tools exist is not the
same as knowing the matter exists.
libraryInventory.ts names the in-scope documents and their ids in the
system prompt. ~20 tokens per document, and it removes the library_list
discovery round trip since the ids the tools need are already there.
Structure stays on demand: this is an inventory, not an outline.
scripts/prompt-budget.ts prices the fixed overhead, because the first
instinct (mine) was to blame the prose and that was wrong:
tool schemas 6,964 tok (params 4,147 / descriptions 2,248)
system prose 1,059 tok (largest block 928 tok, 20 sentences, 0 breaks)
and prices leaner encodings of the same information, for the routes where
we own the wire format:
V0 JSON Schema (today) 6,964
V1 JSON, param descriptions dropped 4,574 -34%
V3 signature + full descriptions 2,913 -58%
V5 index only 1,070 -85%
V3 keeps every word of every tool description; the saving is JSON Schema
structure plus per-parameter prose. Not shipped -- dropping parameter
descriptions is exactly where argument correctness could break, so it needs
an A/B first.
MIKE_TOOL_RESULT_CAP, MIKE_READ_DEFAULT_CHARS and MIKE_LIBRARY_INVENTORY
make the three thrift changes togglable so one binary runs both arms.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018bhP89cYSdEEjHNPnxacns
| Repository | eliziff/Beaver |
|---|---|
| Author | Eli Ziff <eliasziff@gmail.com> |
| Authored | |
| Parents | fda59230 |
| Stats | 5 files changed , +263 , -20 |
| Part of | Chat backend features and prompt/context-budget management |
Capture this commit into my fork
Download a Markdown prompt that tells Claude how to port this
exact commit into your working tree. Run it via
claude -p < capture-commit-4199ff59.md
from inside the repo you want the change in.