Status: proposal.
A proposal, not a plan: nothing described here is built, and [grobid]
is not a setting that exists. This document argues a case and records
what it would cost; the decision has not been taken.
Written for someone weighing whether to add the stage. It assumes ARCHITECTURE.md for the four layers and PDF-PARSER.md for why GROBID was removed from this repository, which this proposal has to answer before it can argue anything else.
GROBID was in this repository and was removed. Any proposal to bring it back has to say what is different, so:
What only GROBID offered was parsing a paper's own reference list into structured author/title/year/DOI records, via the
/api/processFulltextDocumentendpoint this repo never called. That serves corpus discovery [...] If corpus-growth-by-snowballing later becomes a real workflow, the case to revisit is for/api/processFulltextDocumentspecifically, not the header endpoint that was here.From PDF-PARSER.md
This proposal is that revisit. The removed integration called
/api/processHeaderDocument for title, authors and abstract, metadata
papers/bibliography.bib already supplies for every document, which is
why it earned nothing. What is proposed here calls
/api/processFulltextDocument for reference lists, which the bib file
does not supply and nothing else in the pipeline can derive.
That is a difference in capability. It does not dispose of the operational objection (a pinned JDK 21, a multi-GB Gradle build, and a long-running service), which is unchanged and is the main cost weighed in What it would cost.
Two layers touch PDFs, and neither produces bibliographic structure:
chitragupta/core/corpus/pdf_text/, via
python -m chitragupta.corpus sync) extracts plain text per citekey to
content/parsed/<citekey>.txt, which BM25 retrieval in
chitragupta/core/draft/retrieval.py reads. It dispatches through
_EXTRACTORS to pdftotext (default) or docling. One file in, one text
file out.chitragupta/core/corpus/enrich/docling_parse.py, via
python -m chitragupta.enrich --stages docling) always uses docling
regardless of [parser].backend, producing
content/docling/<citekey>.md plus a .passages.json sidecar of
reading-ordered, quotable passages. This feeds the embedding and topic
stages.What neither produces is structured bibliographic metadata and a
citation graph. The only metadata source is papers/bibliography.bib
itself, parsed by chitragupta/core/corpus/bib_reader.py: whatever your reference
manager exported. There are no in-text citation contexts, no resolved reference
list per paper, and no way to ask "does paper A cite paper B" within
this corpus.
_EXTRACTORS looks like the seam for a new backend, and it is the wrong
one. It exists to swap what the corpus layer's plain text is made of:
one PDF in, one .txt out. GROBID's TEI is structurally different data
(nested XML with header, body and back sections), and forcing it through
that table would mean either discarding everything but body text
(defeating the point) or making pdf_text/ non-uniform in its return
type. The right precedent is docling_parse.py: a corpus-wide stage
under chitragupta/core/corpus/enrich/, run from chitragupta/cli/enrich.py,
independent of [parser].backend.
Each is purpose-built for something the other is not:
| GROBID | docling | |
|---|---|---|
| Header metadata | Purpose-built (title, authors, affiliations, abstract) | General layout detection, not citation-schema-aware |
| References | Structured TEI records, ~0.87-0.90 F1 | No dedicated citation parser |
| Body text and sections | Adequate; sometimes misses full section isolation | Strong; this repo depends on it for reading order |
| Quotable passages | Not its job | The .passages.json sidecar a claim is quoted from |
| Output | XML/TEI | JSON, Markdown |
GROBID answers "what is this paper and what does it cite"; docling answers "what does this paper say".
The cost argument is favourable. A GROBID call does sequence labelling, not layout or OCR inference, so it is orders of magnitude cheaper per document than a docling parse, which PERFORMANCE.md measures at 55m 30s for a serial 501-PDF pass with OCR off, CPU-bound even on a GPU host (~7% SM utilisation on an A40). GROBID writes to a separate artefact, so it does not compete for the same CPU-bound budget.
The two new modules are shaded. Both read chitragupta/core/corpus/enrich/corpus.py,
which sources the corpus from the ledger and nothing else, so every
document GROBID sees is one a draft is allowed to cite. That is a
deliberate constraint; see AGENTS.md.
chitragupta/core/corpus/enrich/grobid_parse.pyModelled on docling_parse.py: corpus-wide, incremental, self-probing.
It calls GROBID's /api/processFulltextDocument per PDF and writes the
TEI to content/grobid/<citekey>.tei.xml.
It must follow the same three conventions every stage here follows:
GET {url}/api/isalive before running
and report service-unavailable rather than failing hard: the
client/server equivalent of the existing missing-binary.(size, mtime_ns) as
docling_parse.py does, so a second run over an unchanged corpus is
free.[done/total] <citekey>), per
DESIGN.md's concurrency policy.Status vocabulary, matching chitragupta/core/corpus/enrich/stages.py:
| Condition | Report |
|---|---|
[grobid].enabled = false |
skipped |
Service unreachable at [grobid].url |
service-unavailable |
| TEI written | ok |
| GROBID returns malformed or empty TEI for one PDF | partial, with a warning naming the citekey; one bad document does not fail the corpus |
chitragupta/core/corpus/enrich/citation_graph.pyParses each TEI's <listBibl>, extracts each referenced work's
title/DOI, and resolves it against the ledger's existing citekeys.
Output is an edge list of citekey -> [citekeys it cites, restricted to this corpus].
Nothing else in the pipeline can fill this gap. BM25 in
chitragupta/core/draft/retrieval.py and the embedding index in
chitragupta/core/corpus/enrich/embed_index.py both rank on body-text similarity.
Neither can answer "what does this corpus treat as foundational" or
"cluster these papers by citation structure rather than by topic model",
because there is no citation-structure data to answer from.
A new section, following the existing [parser]/[enrich] pattern, each
key overridable by an env var of the same name:
[grobid]
enabled = false # GROBID_ENABLED
url = "http://localhost:8070" # GROBID_URL
timeout_seconds = 120 # GROBID_TIMEOUT_SECONDS
consolidate_citations = 1 # GROBID_CONSOLIDATE_CITATIONS
# 0/1/2 -- GROBID's own levels; higher is
# more accurate, slower, and needs
# external lookups
consolidate_citations needs a flag in the requirements table:
GROBID's consolidation calls CrossRef to resolve incomplete reference
strings, so this stage may need network access per document at parse
time. Everything else here needs the network once, for model downloads,
and never again.
GROBID runs as a long-lived service rather than an in-process import:
docker run --rm -p 8070:8070 grobid/grobid:0.9.0
That fits the existing container story (DOCKER.md) as a
sidecar. Invocation would extend --stages:
.venv-full/bin/python -m chitragupta.enrich --stages grobid,citation_graph
The hard rule is unchanged and this stage does not get an exception.
GROBID's consolidated references routinely resolve to DOIs and titles not
in papers/bibliography.bib. Those become edges to external nodes,
never new citable claims. citation_graph.py may only ever resolve a
reference against an existing ledger citekey; it must never mint one.
Two consequences follow:
citation_graph.json alone: never in the ledger, never in Chroma,
never anywhere a retrieval call can return them.citekey_safety.citekey_problem(). Anything writing
content/grobid/<citekey>.tei.xml builds the name with
citekey_safety.citekey_path() to inherit that guarantee, and must not
construct a path from a GROBID-derived string, which carries no such
guarantee.The operational objection that removed GROBID still stands:
| Cost | Detail |
|---|---|
| A pinned JDK 21 | Its bundled Kotlin compiler cannot parse a JDK 25 version string |
| A multi-GB, multi-minute build | Or accepting the prebuilt Docker image and its footprint |
| A long-running service on port 8070 | The only component here that is not a batch job, a new operational shape |
| Per-document network | With consolidate_citations > 0. New for this pipeline |
| A new artefact in the reproducibility contract | ARCHITECTURE.md is artifact-by-artifact; .tei.xml and citation_graph.json each need a row, and consolidation makes the graph depend on an external service's state, so it is unlikely to be reproducible at all |
The case turns on whether snowballing is a real workflow here. If corpus growth stays "notice a paper, catalogue it in Zotero, re-export", the graph is interesting but unused, and this is a service and a JDK for a feature nobody runs. If it becomes routine, this is the only design that supports it without touching the citekey invariant.
sync, pdf_text/, BM25 retrieval):
untouched.[parser].backend: untouched. GROBID is not a pdf_text/
backend and does not appear in _EXTRACTORS.citation_gate → references → render_output):
untouched. The citation graph is an optional additional input a genre
skill may consult, never a replacement for the gate.content/topics.json either; its readers are the converge stage and
corpus discover. An artefact with no reader at all, at the cost of a
JDK and a service, would be a poor trade. A
concrete consumer (a survey-writer step, a retrieval signal,
corpus discover) should be named before this is built.consolidate_citations = 0 enough? It avoids the per-document
network entirely. Whether unconsolidated reference strings resolve well
enough against the ledger is what the pilot above would answer.