Repository navigation
Let the assistant find and read documents in the library - #56
Merged
Merged
Conversation
GAM keeps the text of every document it can read (gam#78 reads it on upload and makes it searchable, naming the page a hit is on). The assistant could search only video, image and audio, and had no way to read a document's words, so asking it to work from a report in the library got a guess. - search_assets takes type "document", and a hit inside one carries its page. - read_document reads a document part by part, each headed [n] and its label, in 30k-character pages that say where to carry on; start/end take the n a search hit names. It tells an unknown asset from a GAM too old to give text, and a document with no text yet from one it says nothing about. - The prompt says to read a document before writing from it and to quote it as written. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01V1geD4DSV4uaESBMUTTuRu
davior
marked this pull request as ready for review
November 20, 2026 13:49
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.
If you asked the assistant to work from a report or brief in GAM, it couldn't.
search_assetsonly searched video, image and audio, and there was no tool for reading a document's words.Companion to davior/gam#78, which reads a document's text when it's uploaded, makes that text searchable, and names the page each hit is on. Recorded as GAM-13 in the plan.
What changes
search_assetsacceptstype: "document". A hit inside a document carriespage(e.g. "Page 3") andpage_number.read_document(gam_id, start?, end?)is a new read-only tool built on GAM'sGET /api/assets/{id}/text(GamClient.document_text). It returns the document part by part, each headed[n] Label.nis the page number where the format has pages and the part's position otherwise, so a hit'spage_numberis thestartto pass. Output comes in 30k-character pages, each ending with where to carry on. A single part longer than that (a big sheet) is cut and marked as cut. Each document is fetched from GAM once per turn.read_transcriptget_assetalso flags documents as readable.It never writes to GAM or changes the video.
Testing
pytest -q: 850 passed. The fake GAM gains a/textroute. New tests cover search with page, numbering by page and by part, paging, cutting an over-long part, the no-text, wrong-type and old-GAM cases, and a full scripted turn that searches, reads the page the hit named, and makes no edits.Generated by Claude Code