Headless graphify extract reads images as garbage text instead of seeing them
Fix proposed in #1110.
What happens
Run graphify extract on a folder that has images in it and every image comes out broken. With --backend claude-cli the run fails outright:
[graphify] chunk 1/1 failed: claude -p exited 1:
[graphify] WARNING: 1/1 semantic chunk(s) failed
[graphify extract] error: all semantic chunks failed for backend 'claude-cli'
With the API backends (claude, openai, gemini, bedrock, ...) it doesn't crash, but the image nodes are meaningless: the model never actually saw the picture, so the labels are guessed from the filename at best.
Why
extract_files_direct builds the prompt with _read_files, which does path.read_text(encoding="utf-8", errors="replace") on every semantic file. For a PNG/JPG/WEBP that turns the binary into replacement-character garbage. So:
- claude-cli gets a prompt full of invalid text and the CLI exits 1.
- the API backends get noise and emit a few hollow nodes.
The schema already has a file_type: "image" slot, and the extract command explicitly routes images into the semantic pass (semantic_files = doc_files + paper_files + image_files), but no backend ever puts the actual image in front of a vision model. Images are classified, then read as if they were text.
Repro
mkdir -p /tmp/imgtest && cp any-logo.png /tmp/imgtest/
graphify extract /tmp/imgtest --backend claude-cli
Expected
Raster images should be sent as real visual input to vision-capable backends, so the graph captures what each image depicts instead of garbage. Backends whose selected model has no vision should degrade to a plain reference node rather than crashing or emitting noise.
Related: #450 (per-image chunking on the skill path) and #181 (images inside PDFs not parsed) are downstream of the same gap on the headless extraction path.
Update: this also covers PDFs. They went through the same _read_files path and got read as raw bytes, so the fix in #1110 now routes them through pypdf and the text extracts properly.
Video and audio are still open. graphify extract doesn't run those through the semantic pass at all yet, so that one is a separate follow-up rather than part of this fix.