Repository navigation
Description
Summary
Semantic (LLM) extraction silently reads only the first 20,000 characters of every file (_FILE_CHAR_CAP = 20_000 in graphify/llm.py), with no warning and no error. For files well above that size — a long CLAUDE.md, a design doc, a project plan — this means most of the file's content is invisible to the graph, silently.
Environment
- Installed:
graphifyy0.8.31 (pip show graphifyy) - Confirmed still present on
main/ latest release (0.9.66, 2026-09-22):_FILE_CHAR_CAP = 20_000atgraphify/llm.py:30, used unconditionally in_read_files(truncates before building the prompt) and in the token-estimate helpers around line 2090-2134.
Reproduction
- Create/point at any prose file (
.md) larger than 20,000 characters — aCLAUDE.mdaccumulated over months of a real project is a common case. - Run
/graphify --update(orextract_corpus_parallel(...)directly) withGEMINI_API_KEYset. - Compare
len(open(file).read())against the node count graphify produces for that file.
Actual behavior
- The extraction call returns
failed_chunks: 0and a normal-looking result — nothing signals truncation. - Real case: a 229,319-character
CLAUDE.md(project history/decisions) was read up to character 20,000 (8.7% of the file) and produced 11 nodes. Once manually split into <18k-char chunks at heading boundaries and re-extracted, the same file produced 215 nodes — the other 91.3% of the file had simply never reached the model. - Across one real corpus (~430 files), 29 documents exceeded the cap; some plans were seen as low as 8.7%–50% of their actual content, all without any indication in the CLI output.
Expected behavior
At minimum: print a warning (like the existing "extraction warning: N issues" pattern) whenever a file is truncated by _FILE_CHAR_CAP, naming the file and the percentage lost. Ideally: split an oversized file into multiple chunks (the same way the corpus itself is already chunked across files) and extract each chunk, merging nodes back onto the original source_file — this is what we ended up implementing as a workaround.
Workaround we're using
A small script that: audits which files exceed the cap, splits each one into <18k-char tramos (cutting on markdown ## headings, falling back to line breaks for an oversized single section), extracts each tramo with extract_corpus_parallel, and reassigns any node whose source_file the model pointed elsewhere back to the correct original document (by checking which candidate document's text mentions the node's label). Happy to share it if useful, but a native fix (at least the warning) would remove the need for every user to discover this independently.
Related
Not a duplicate of the shrink-guard issues (#3579, #3580, #2229, #2976) — this is upstream of those, in extraction input, not in the merge/write path. No existing issue found for _FILE_CHAR_CAP / truncation / "20000" in search.
Activity
Souptik96 commentedon Sep 26, 2026
Before picking this up I checked it against current
main(0.9.68). I think the case you hit is already fixed:_FILE_CHAR_CAP.extract_corpus_parallelcallsexpand_oversized_files(files, _FILE_CHAR_CAP)before packing (graphify/llm.py:2621), and every slice reports the parent file as itssource_file.DOC_EXTENSIONS(Oversized .qmd/.html/.yaml/.skill documents are silently truncated at 20k chars before the semantic pass — only 5 of 10 document types are sliceable #2900) and to PDFs through their extracted text (An oversized PDF loses everything past 20k characters: slicing reads the container's bytes, so PDFs are excluded from it entirely #2906)..docx/.xlsxare converted to Markdown sidecars first, so they're sliced too.content[:_FILE_CHAR_CAP]in_read_filesonly applies to whole files that aren't splittable text, and code files never reach the semantic pass. I couldn't find a path where a document is still cut silently.As a quick check,
expand_oversized_fileson a synthetic 218,050-characterCLAUDE.mdreturned 11 slices covering all 218,050 characters, none over 20,000.Your repro was on 0.8.31, which predates #1369. Could you re-run on the latest release? If the large
CLAUDE.mdstill comes back with only a fraction of its nodes, I'm happy to dig in and add the truncation warning you suggested. Otherwise this can probably be closed.safishamsi commentedon Sep 29, 2026
Good first issue.
_FILE_CHAR_CAP = 20_000lives ingraphify/llm.pyand is applied in_read_files. The fix is to emit a warning (once per run, to stderr) when a file is truncated, so it is not silent. There is a recent warn-once pattern to mirror ingraphify/detect.py(extract_pdf_text, the_pypdf_missing_warnedflag). Add a test asserting the warning fires when a file exceeds the cap.AK-Lmn commentedon Sep 29, 2026
Hi! I'd like to work on this. I'll implement the warn-once pattern on stderr in _read_files\ mirroring _pypdf_missing_warned\ in \graphify/detect.py\ whenever a file exceeds _FILE_CHAR_CAP, and add unit tests to verify the warning behavior.
fix(llm): warn once when file exceeds _FILE_CHAR_CAP in _read_files (#…
safishamsi commentedon Sep 30, 2026
Fixed in v0.9.73 (now on PyPI) by #3923 — thanks @AK-Lmn.
Release: https://github.com/Graphify-Labs/graphify/releases/tag/v0.9.73
Merge upstream/v8 (graphify 0.9.97, +885 коммитов) в 1C/BSL + ArcadeD…