With `item_artifacts` + `extract/tei.py` landed (commit e2b7342), we have structured references for every paper with a `grobid_tei` artifact. The schema already has `cites` / `cited_by` in the `item_relations` CHECK vocabulary — they've just never been written to.
Plan
- New CLI subcommand: `grimoire citations build [--force] [--limit N]`.
- For each item with a `grobid_tei` artifact:
- Idempotent via the `INSERT OR IGNORE` on the relations table.
Unlocks
- MCP `list_related(item_id, kind='citations')` already has the code path for this relation; it just returns nothing today.
- Queries like "papers in my library that cite X" and "what does paper Y cite that I have" become one SQL hop.
- Claude Code can ask "trace the citation chain forward/backward from this paper" via repeated `list_related` calls.
Acceptance
Caveats
- GROBID reference-section parsing quality drops on chapter-in-edited-book style references — expect some noise.
- DOI-matching is exact; consider a normalization pass (strip `https://doi.org/\`, lowercase) to avoid missing hits.
- Bibliography entries without DOIs are genuinely unrecoverable from TEI alone — surface them in the "suggested" queue, don't try to fuzzy-match.
With `item_artifacts` + `extract/tei.py` landed (commit e2b7342), we have structured references for every paper with a `grobid_tei` artifact. The schema already has `cites` / `cited_by` in the `item_relations` CHECK vocabulary — they've just never been written to.
Plan
Unlocks
Acceptance
Caveats