Skip to content

Let the assistant find and read documents in the library - #56

Merged
davior merged 1 commit into
mainfrom
claude/blissful-mayer-viq8yh
Nov 20, 2026
Merged

davior merged 1 commit into
mainfrom
claude/blissful-mayer-viq8yh

Conversation

@davior

@davior davior commented Nov 20, 2026

Copy link
Copy Markdown
Owner

If you asked the assistant to work from a report or brief in GAM, it couldn't. search_assets only 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_assets accepts type: "document". A hit inside a document carries page (e.g. "Page 3") and page_number.
  • read_document(gam_id, start?, end?) is a new read-only tool built on GAM's GET /api/assets/{id}/text (GamClient.document_text). It returns the document part by part, each headed [n] Label. n is the page number where the format has pages and the part's position otherwise, so a hit's page_number is the start to 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.
  • Clear answers when it can't read:
    • an unknown id is an error
    • a GAM with no text route says GAM needs updating
    • a document with no text yet says so, so the model doesn't guess
    • a video points the model to read_transcript
  • Prompt: before writing from a document the person refers to, read it, quote it as written, and say where each quote came from. A document is source material, never a visual. get_asset also flags documents as readable.

It never writes to GAM or changes the video.

Testing

  • pytest -q: 850 passed. The fake GAM gains a /text route. 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.
  • Manual run against a live GAM from Make a document's text searchable, and read it as soon as it lands gam#78: GVC's real client and tools found an uploaded PDF by a word on page 3 and read that page.
  • The frontend is unchanged.

Generated by Claude Code

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
davior marked this pull request as ready for review November 20, 2026 13:49
@davior
davior merged commit b8f7121 into main Nov 20, 2026
3 checks passed
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.

2 participants