Cap tool results at 20KB; restore full vault text on disk with grep-first steering#27
Merged
Merged
Conversation
…ault text on disk Production forensics on the incident behind the 10K vault-text cap (#22) showed the context ballooning came through the pi read tool — its limit is denominated in LINES, and 200-300 lines of legal text returned 40-50K chars per result, nine times, on BOTH the vault text and the agent's own drafts. The on-disk file was never the cost: disk is outside model context, and grep over the complete text is what makes large-document analysis work (a 23M-char production document becomes unsearchable past page ~3 under a 10K file cap). - DEFAULT_MAX_BYTES 50KB -> 20KB: bounds what any single read/find/ grep result can drag into billed context; offset pagination and the existing truncation notices handle continuation - readCaseDevVaultObjectText writes the FULL text to disk again; the result note and tool descriptions now steer grep-first ("locate with grep -n, read narrow ranges, never page the full text") - tests updated accordingly (1427 passing) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
| label: "vault_read_text", | ||
| description: | ||
| "Write up to the first 10,000 characters of an ingested matter document's extracted text into the workspace as a .txt file. Use targeted vault searches for additional context.", | ||
| "Write the full extracted text of an ingested matter document into the workspace as a .txt file, page-numbered when the source is paginated. The right tool for comprehensively analyzing document content at any size: locate content with grep -n and read only narrow line ranges around matches; never page the full text into the conversation.", |
maxsonderby
approved these changes
Jul 13, 2026
dantedanelian
approved these changes
Jul 13, 2026
This was referenced Jul 13, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why revisit #22
Session-log forensics on the incident (
linc_sess_a40eptlm7ebo59u50kl23m62, the customer usage burn):readtool: itslimitis in lines, and 200–300 lines of legal text returned 40–50K chars per result — capped by the existing 50KB byte limit, i.e. nine maxed-out reads ≈ 450K chars into context → 190K-token context re-billed across 103 model calls.grepover the complete text returns a few lines. The verified large-document flow (23M-char production doc → grep → page-cited answer in 5.5 min) requires the complete file — under the 10K cap that document is unsearchable past page ~3, which regresses the CD-1282/1284 capability shipping in casedotdev-mono #1977.Changes
DEFAULT_MAX_BYTES50KB → 20KB (core/tools/truncate.ts) — bounds what any single read/find/grep result can pull into billed context, for every file, agent-authored drafts included. Offset pagination + the existing truncation notices already guide continuation.readCaseDevVaultObjectTextwrites the full text to disk again; the result note and both tool descriptions steer grep-first: "locate content withgrep -n, read narrow line ranges, never page the full text."Not in this PR (follow-ups being ticketed)
Tests: full coding-agent suite 1,427 passed / 0 failed.
Counterpart casedotdev-mono PR (baked helper + templates + 0.79.6 pin) follows once this releases.
🤖 Generated with Claude Code