<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Jake</title>
    <description>The latest articles on DEV Community by Jake (@janderswag).</description>
    <link>https://dev.to/janderswag</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4027935%2Fed59eb44-6a90-4820-aa6e-ee7ca665e4a2.jpg</url>
      <title>DEV Community: Jake</title>
      <link>https://dev.to/janderswag</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/janderswag"/>
    <language>en</language>
    <item>
      <title>Local-first RAG for privileged legal documents: why citations need verification</title>
      <dc:creator>Jake</dc:creator>
      <pubDate>Tue, 14 Jul 2026 01:47:12 +0000</pubDate>
      <link>https://dev.to/janderswag/local-first-rag-for-privileged-legal-documents-why-citations-need-verification-4936</link>
      <guid>https://dev.to/janderswag/local-first-rag-for-privileged-legal-documents-why-citations-need-verification-4936</guid>
      <description>&lt;p&gt;Lawyers want the same thing everyone else wants from AI: ask a question, get a useful answer, move faster.&lt;/p&gt;

&lt;p&gt;The difference is that legal documents often come with privilege, confidentiality, protective orders, client expectations, and professional responsibility duties. Uploading a contract set, deposition transcript, pleading file, or discovery bundle into a generic cloud chatbot is not a neutral implementation detail. A vendor sits in the data path.&lt;/p&gt;

&lt;p&gt;That is the design problem behind &lt;a href="https://github.com/janderswag/docuchat.app" rel="noopener noreferrer"&gt;DocuChat&lt;/a&gt;: an open-source, local-first document chat app for attorneys.&lt;/p&gt;

&lt;p&gt;The core idea is simple:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Put the AI next to the documents, not the documents next to the AI vendor.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  The architecture
&lt;/h2&gt;

&lt;p&gt;DocuChat is a self-hosted legal document RAG stack:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Local models&lt;/strong&gt; through Ollama&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;FastAPI&lt;/strong&gt; backend bound to loopback&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;LanceDB&lt;/strong&gt; embedded vector store&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;PyMuPDF / Docling / Tesseract&lt;/strong&gt; for PDFs, tables, and OCR&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Matter-scoped retrieval&lt;/strong&gt; so one client/matter cannot bleed into another&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Verified page/span citations&lt;/strong&gt; before answers are displayed&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The query path does not require OpenAI, Anthropic, Google, or any cloud AI API key. After local models are downloaded, the workflow can run offline.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why ordinary citations are not enough
&lt;/h2&gt;

&lt;p&gt;A citation-looking string is easy for an LLM to generate. That does not mean the cited text actually supports the claim.&lt;/p&gt;

&lt;p&gt;DocuChat treats citations as a mechanical verification problem. The model can propose an answer and source quote, but the app checks whether that quote actually appears in the retrieved source text at the claimed page/span. If a claim cannot be verified against the source, it is dropped instead of shown.&lt;/p&gt;

&lt;p&gt;That creates a more useful failure mode for legal work:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Better: “I could not find that in the documents.”&lt;/li&gt;
&lt;li&gt;Worse: a confident answer with a fake or sloppy citation.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What this is not
&lt;/h2&gt;

&lt;p&gt;DocuChat is not an AI lawyer. It does not give legal advice, draw legal conclusions, or act outside the user’s machine.&lt;/p&gt;

&lt;p&gt;It is a cited-retrieval assistant for document-heavy work: contracts, transcripts, scanned PDFs, exhibits, pleadings, and matter files.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why open source matters here
&lt;/h2&gt;

&lt;p&gt;For sensitive workflows, “trust us” is not enough. Legal technologists should be able to inspect the data path, citation logic, storage layer, and model boundaries.&lt;/p&gt;

&lt;p&gt;The repo is here:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/janderswag/docuchat.app" rel="noopener noreferrer"&gt;https://github.com/janderswag/docuchat.app&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you care about local-first AI for private legal documents, a GitHub star/watch helps validate that this is worth building further.&lt;/p&gt;

</description>
      <category>legaltech</category>
      <category>ai</category>
      <category>opensource</category>
      <category>privacy</category>
    </item>
  </channel>
</rss>
