Keep external papers independently of any manuscript.
The global literature library stores each source's own metadata, local reading files, and completed Markdown analysis without assigning the paper to an authored manuscript.
A separate kind of paper#
papers.json is the registry of manuscripts the operator authors. The literature library is for external work being read and is not attached to one manuscript, bibliography, or citation-harvest directory.
Adding a library paper therefore does not choose a manuscript or alter any manuscript repository. If the paper later becomes evidence for a manuscript, its bibliography and citation harvest remain that manuscript's own record.
Any published source#
Literature is not only arXiv, so a record is identified by its source's own identifier: paper_id with source_kind beside it. An arXiv paper is keyed on its arXiv id, anything that publishes a DOI on that DOI, and a page that publishes neither on its host/path. A proceedings URL and its DOI are therefore one record, not two.
Metadata comes from the source's own publisher. A DOI is resolved through the DOI system's registered record rather than through the page it redirects to, because a registrant may serve a storefront whose site description would otherwise be stored as the paper's abstract. A page is read through its Highwire citation_* tags, then Open Graph, then the document title.
Re-reading a work fills gaps and never blanks a field the record already had: the DOI agency holds the authors and the venue, the article page holds the PDF. The original added_at and any saved analysis are preserved.
lem-cli library add 2602.02385
lem-cli library add 10.52202/079017-2387
lem-cli library add https://simplex.pub/nonergodic-geometry/Add and inspect#
A source is an arXiv id or arxiv.org URL, a DOI or doi.org URL, or the http(s) URL of the page that published the work; show also accepts a page record's host/path identity. --pdf and --text may seed local assets; Lem extracts text from the PDF first and uses supplied text when PDF extraction is unavailable.
Reading assets follow the source: the publisher's PDF when there is one, otherwise the page's own text with MathML and SVG dropped and TeX annotations kept. What a source did not publish — no PDF link, no authors, no date — is recorded in acquisition_notes instead of leaving a field silently empty.
lem-cli library add <source> [--pdf <path>] [--text <path>]
lem-cli library
lem-cli library show <source>Save analysis#
analyze stores the supplied non-empty Markdown and an analyzed_at timestamp on an existing library record. It does not call a model or infer which manuscript should use the analysis.
The same add, inspect, and analysis fields are available in Lem Desktop, which shows the source kind and identifier beside each title. The MCP server exposes read-only list and show tools, and lem_show_literature_paper takes paper_id or a title substring.
lem-cli library analyze <source> --file <analysis.md>State and files#
The manifest lives at ~/.lem/literature.json by default. PDFs live under ~/.lem/literature/pdfs/ and extracted text under ~/.lem/literature/text/. LEM_LITERATURE_PATH moves the manifest; its sibling asset directory uses the manifest filename without .json. Asset file names slug the identifier, so 10.52202/079017-2387 is kept as 10.52202_079017-2387.pdf.
Each record includes paper_id, source_kind, title, authors, abstract, categories, doi and venue when published, source and PDF URLs, publication timestamps, local asset paths, text_status, acquisition notes, and optional analysis. A manifest written before source kinds existed decodes with its arxiv_id as the identity and is rewritten in the current shape on the next add.