feat: add LaTeX (.tex, .bib) to readable and prose extensions - #1901
Conversation
LaTeX source files and BibTeX bibliographies are prose-rich content that benefits from both palace mining and entity detection. Adds the two extensions to the two extension lists most relevant to them, each with a matching test. - ``mempalace/miner.py:READABLE_EXTENSIONS`` — ``.tex`` / ``.bib`` join the mining allowlist (parallel to the Swift/Kotlin PR MemPalace#1368 and the PHP ecosystem PR MemPalace#1819). - ``mempalace/entity_detector.py:PROSE_EXTENSIONS`` — ``.tex`` / ``.bib`` also join the *preferred* entity-detection bucket alongside ``.md`` / ``.rst`` / ``.csv``, NOT the broader code-file fallback. The reason ``PROSE_EXTENSIONS`` exists separately is documented in-code: programming-language files have lots of capitalized identifiers (class names, function names) that produce false-positive person matches. LaTeX/BibTeX don't have that problem — they're typesetting languages for prose documents. ``.bib`` in particular is almost entirely author names, one of the highest real-entity densities of any file type the detector scans. Tests follow the patterns established by the prior extension PRs: ``tests/test_miner.py::test_scan_project_includes_latex_files`` mirrors the Swift/Kotlin scan tests, and ``tests/test_entity_detector.py::test_scan_for_detection_includes_latex_prose`` mirrors ``test_scan_for_detection_finds_prose``. The existing ``test_prose_extensions`` was extended to assert the two new entries. Full env-cleared suite: 3216 passed, 20 skipped. ``ruff check .`` and ``ruff format --check .`` both clean. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KC5Qsknh2zFRtRvVyjXiTA
There was a problem hiding this comment.
Code Review
This pull request adds support for LaTeX (.tex) and BibTeX (.bib) files by classifying them as prose extensions in mempalace/entity_detector.py and mempalace/miner.py, along with corresponding test coverage. The review feedback highlights an inconsistency where these new extensions were not added to READABLE_EXTENSIONS in mempalace/entity_detector.py, despite being added to the equivalent list in mempalace/miner.py.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
What does this PR do?
Adds
.texand.bibto the file-extension allowlists so LaTeX projects are mineable into the palace AND surface correctly during entity detection.mempalace/miner.py:READABLE_EXTENSIONS— both extensions join the mining allowlistmempalace/entity_detector.py:PROSE_EXTENSIONS— both extensions also join the preferred entity-detection bucket (alongside.md,.rst,.csv), not the code-file fallbackWhy touch entity_detector too?
Prior extension PRs (#1368 Swift/Kotlin, #1819 PHP) touched only
miner.py. The reasonPROSE_EXTENSIONSexists separately fromREADABLE_EXTENSIONSinentity_detector.pyis documented in-code: programming-language files have lots of capitalized identifiers (class names, function names) that produce false-positive person matches.LaTeX/BibTeX are different in kind — they're typesetting languages for prose documents:
.texfiles contain abstracts, paragraphs of natural-language content,\author{}declarations, and citations referencing real people..bibfiles are almost entirely author names (oneauthor = {...}per entry, often dozens per file).Without the
entity_detector.pychange, mining LaTeX projects works (post this PR) butmempalace initon a thesis or paper project would either find few prose files and fall back to all-readable, or treat.tex/.bibas part of the code-file fallback bucket alongside any actual code. Putting them inPROSE_EXTENSIONSis the correct placement.How to test
Both new tests + the existing
test_prose_extensions(extended to assert the new entries) pass. Full env-cleared suite: 3216 passed, 20 skipped, 0 failed.ruff check .andruff format --check .both clean.Checklist
uv run pytest tests/ --ignore=tests/benchmarks)uv run ruff check .)uv run ruff format --check .)