Know what the bill really says.
Lawglass is an open-source RAG pipeline that reads legislation so people do not have to read all of it. Paste a link and it returns a plain-English summary, then answers questions in your own words. Every claim cites the section and line it came from, and each citation is checked against the bill text before you see it.
- RAG pipeline
- Hybrid retrieval
- Citation verification
- Retrieval evaluation
- Prompt-injection defense
How it works
01
Fetch and parse
It fetches the bill behind an SSRF guard and parses its structure, including strikethrough and insertions in PDFs.
02
Hybrid index
Each bill gets a dense embedding index and a BM25 index. Results from both are merged with reciprocal rank fusion, and a cross-encoder reranks the top passages.
03
Answer from excerpts only
The model sees escaped excerpts, nothing else, and must cite them or decline in a fixed sentence.
04
Check every citation
Citations are validated against the passages the model was shown. An answer that cites nothing is flagged.
Who it is for
Government affairs and compliance
Teams that track legislation and need to know what changed in a new version, with the exact text behind every claim.
Newsrooms
Reporters who need a fast, checkable read of a bill on deadline, without trusting a summary they cannot verify.
Civic organizations
Groups that explain legislation to their members in plain language and cannot afford to get it wrong.
More than a summary
A summary on open
The official title first, then a plain-language summary of what the bill does, with citations.
Questions in your own words
Ask "Does this raise my taxes?" and get an answer with citations, or a plain decline when the bill does not say.
Every citation opens the text
Click one to see the source passage next to the answer, down to the page and line for PDFs.
Federal and Ohio history
Legislative history and sponsors for federal bills through GovInfo, and for Ohio bills.
Your choice of model
Anthropic, OpenAI, Google or any OpenAI-compatible endpoint, with keys stored locally.
Local or managed retrieval
Runs fully local with transformers.js models, or on Pinecone.
- bills in the frozen retrieval eval, 21 to 28 questions each
- 5
- bills in the frozen retrieval eval, 21 to 28 questions each
- Source
- recall@5 per bill, hybrid retrieval with reranking (local backend)
- 0.85–1.00
- recall@5 per bill, hybrid retrieval with reranking (local backend)
- Source
- per question with retrieval, against $1.87 with the whole bill in the prompt (uncached, list price)
- ~$0.01
- per question with retrieval, against $1.87 with the whole bill in the prompt (uncached, list price)
- Source
Run it yourself.
Download the tarball from the v1.0.1 GitHub release. npm publishing is pending, so the release is the install path for now.
init stores your provider keys in a local file (mode 0600). Lawglass explains what a bill says. It is not legal advice.
# From the folder where you saved lawglass-1.0.1.tgznpx --package ./lawglass-1.0.1.tgz lawglass initnpx --package ./lawglass-1.0.1.tgz lawglass <bill-url>Engineering notes
The decisions behind it, and what they cost.
Retrieval earns its keep on cost
On a small sample, putting the whole bill in the prompt was at least as accurate. Retrieval wins on cost: about a cent per question against $1.87 uncached. The README publishes that comparison, including where retrieval lost.
Bill text is hostile input
Excerpts and questions are XML-escaped so neither can close an excerpt tag or forge a source, which closes the obvious prompt-injection path. Fetching sits behind an SSRF guard with a pinned IP.
Evaluated in the open
Five golden sets are frozen in the repository. Every change to retrieval is judged on recall@5 and MRR per bill, and the reranker fixes came from what the eval caught.
A decline is a feature
When the excerpts do not answer the question, the model must say so in one fixed sentence. In the answer eval, 13 of 15 unanswerable questions got exactly that sentence.
Questions, answered
What is Lawglass?
Lawglass is an open-source RAG pipeline that explains a bill in plain English. Paste a link and it returns a summary and answers where every point cites the section and line it came from, checked against the bill text before you see it.
Is Lawglass legal advice?
No. Lawglass helps you read a bill and answers only from its text, with checked citations. A citation shows where an answer came from, not that it is right. For a decision that affects you or your organization, talk to a lawyer.
Which bills does it work with?
Paste a link to a bill, or point the CLI at a local file. Legislative history and sponsors are supported for federal bills, through GovInfo, and for Ohio bills.
How accurate is it?
Retrieval quality is evaluated on five frozen golden sets and published per bill. With hybrid retrieval and reranking, recall@5 ranges from 0.85 to 1.00 on the local backend. The full tables, including misses, are in the repository.
More on Lawglass
Lawglass is on GitHub.
Issues and pull requests are welcome. For anything else, LinkedIn reaches me fastest.