<?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: Swarnnim Agnihotri</title>
    <description>The latest articles on DEV Community by Swarnnim Agnihotri (@swarnnim).</description>
    <link>https://dev.to/swarnnim</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%2F4181016%2Fa22e3dab-4eae-47dc-9529-bbeb7822278f.png</url>
      <title>DEV Community: Swarnnim Agnihotri</title>
      <link>https://dev.to/swarnnim</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/swarnnim"/>
    <language>en</language>
    <item>
      <title>LocalLens: private document Q&amp;A that runs 100% on your machine</title>
      <dc:creator>Swarnnim Agnihotri</dc:creator>
      <pubDate>Tue, 13 Oct 2026 05:25:15 +0000</pubDate>
      <link>https://dev.to/swarnnim/locallens-private-document-qa-that-runs-100-on-your-machine-4fb0</link>
      <guid>https://dev.to/swarnnim/locallens-private-document-qa-that-runs-100-on-your-machine-4fb0</guid>
      <description>&lt;h1&gt;
  
  
  LocalLens: private document Q&amp;amp;A that runs 100% on your machine
&lt;/h1&gt;

&lt;p&gt;&lt;em&gt;My entry for the Hacktoberfest Week 2 "Side Hustle" challenge — built with open-weight models, zero API costs, and a business model I'd actually try.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The problem
&lt;/h2&gt;

&lt;p&gt;Last year a freelancer friend was handed a 34-page client contract and asked to "just flag anything weird" before signing. She couldn't paste it into ChatGPT — the contract literally had a confidentiality clause forbidding exactly that. So she read all 34 pages, twice, on a Sunday.&lt;/p&gt;

&lt;p&gt;That's the gap: millions of people handle documents they &lt;strong&gt;legally or ethically can't upload anywhere&lt;/strong&gt; — client contracts, payroll sheets, patient intake forms, HR files. Their choices are manual reading or breaking confidentiality. There is no third option that costs less than a lawyer.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I built
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;LocalLens&lt;/strong&gt; — a command-line tool where you point at a document, ask a question in plain English, and get an answer in seconds. The twist: the AI model, the retrieval, and the inference engine all run on your own machine. No account. No API key. No subscription. Your document never touches a network.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;python3 &lt;span class="nt"&gt;-m&lt;/span&gt; locallens ask &lt;span class="nt"&gt;-f&lt;/span&gt; contract.txt &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-q&lt;/span&gt; &lt;span class="s2"&gt;"What is the notice period for terminating the agreement?"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Real output from the included demo (Qwen2.5-0.5B-Instruct, running on a 2-CPU virtual machine — nothing staged):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Q: What is the notice period for terminating the agreement?

The notice period for terminating the agreement is thirty (30) days.

(answered from sentence(s) [14, 17] of 32 — run with --show-context to see them)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Two things I'm proud of here. First, it &lt;strong&gt;cites its sources&lt;/strong&gt; — every answer tells you which sentences it used, and &lt;code&gt;--show-context&lt;/code&gt; prints them, so you can verify before acting on anything. Second, when the answer isn't in the document, it says so instead of inventing one:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Q: What is the penalty for late payment of invoices?

Not found in the document.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For a tool aimed at contracts, that abstention behavior isn't a nice-to-have. It's the whole product. A hallucinating contract assistant is worse than useless — it's a liability.&lt;/p&gt;

&lt;h2&gt;
  
  
  Who would pay for this, and why
&lt;/h2&gt;

&lt;p&gt;Three personas, all real:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Freelancers and solo consultants&lt;/strong&gt; reviewing client MSAs and SOWs. They already pay $15–30/month for contract tools that upload their data to someone else's cloud. A one-time $29 purchase that keeps everything local is an easy sell — privacy is the feature, not a checkbox.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Small HR and accounting firms&lt;/strong&gt; answering "what does the policy say about X?" fifty times a week from employee handbooks and tax documents they can't share externally.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Clinic and legal admin staff&lt;/strong&gt; triaging intake paperwork and engagement letters under confidentiality obligations.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The business model I'd actually try: open-source core (this repo, MIT), paid packaged apps — a polished desktop build with PDF/DOCX support and multi-document search at a one-time price. The open core builds trust with exactly the audience that cares about where their data goes; the packaging is what they pay for.&lt;/p&gt;

&lt;p&gt;Bonus-points honesty: I have &lt;strong&gt;no first user yet&lt;/strong&gt; — this was built for the challenge this week. The demo above is real output from the actual tool, and the limitations section below is real too.&lt;/p&gt;

&lt;h2&gt;
  
  
  How it works
&lt;/h2&gt;

&lt;p&gt;Deliberately boring architecture, because boring ships:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Retrieval&lt;/strong&gt; (stdlib only): the document is split into sentences and ranked by keyword overlap with the question — stopword-filtered, with naive stemming and a tight-span tie-break so the most &lt;em&gt;focused&lt;/em&gt; sentence wins. No embeddings, no dependencies, runs anywhere.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Generation&lt;/strong&gt;: the top sentences go into a prompt for &lt;strong&gt;Qwen2.5-0.5B-Instruct&lt;/strong&gt; (Apache 2.0 open weights, Q4_K_M quantized), run through the &lt;strong&gt;llama.cpp&lt;/strong&gt; binary (MIT). Total footprint: ~400 MB, ~20 tokens/sec on two CPU cores.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The whole Python project has zero third-party dependencies.&lt;/strong&gt; If you have Python 3.8 and the two downloaded files, it runs.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Two setup scripts fetch the binary and the model — both free, no accounts. From zero to first answer takes about five minutes, most of it downloading.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why open weights made this possible
&lt;/h2&gt;

&lt;p&gt;This product &lt;strong&gt;cannot exist&lt;/strong&gt; on a closed API. The entire value proposition — "your document never leaves your machine" — is only credible because every layer is inspectable: the model weights are public (Qwen2.5, Apache 2.0), the inference engine is open source (llama.cpp, MIT), and my own code is MIT. A privacy tool built on a black-box API is a contradiction; built on open weights, it's a verifiable claim. Anyone can audit exactly what runs. That auditability &lt;em&gt;is&lt;/em&gt; the moat — and it's only available because the weights are open.&lt;/p&gt;

&lt;h2&gt;
  
  
  Honest limitations
&lt;/h2&gt;

&lt;p&gt;I'd rather tell you than have you discover them:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The bundled model is &lt;strong&gt;0.5 billion parameters&lt;/strong&gt; — tiny on purpose, so it runs on any laptop CPU. It's reliable at lookup questions and honest abstention, but convoluted phrasing can stump it, and questions needing synthesis across distant clauses want a bigger model. Any GGUF drops in via &lt;code&gt;--model&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Retrieval is keyword-based, so pure paraphrases can be missed.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;.txt&lt;/code&gt; input only in v0.1 — PDF/DOCX parsing is roadmap, not reality.&lt;/li&gt;
&lt;li&gt;Prototype, not a hardened product. Verify answers against the cited sentences before acting on them.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Try it
&lt;/h2&gt;

&lt;p&gt;Repo: &lt;a href="https://github.com/swarnnim/locallens" rel="noopener noreferrer"&gt;https://github.com/swarnnim/locallens&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;./scripts/download-llamacpp.sh
./scripts/download-model.sh
python3 &lt;span class="nt"&gt;-m&lt;/span&gt; locallens ask &lt;span class="nt"&gt;-f&lt;/span&gt; sample_docs/freelance-nda.txt &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-q&lt;/span&gt; &lt;span class="s2"&gt;"How long do confidentiality obligations survive?"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you handle sensitive documents for a living, I'd genuinely like to know: what's the one document you wish you could ask questions about but can't upload anywhere? That's the roadmap.&lt;/p&gt;

</description>
      <category>hf26challenge</category>
      <category>hacktoberfest</category>
      <category>opensource</category>
      <category>ai</category>
    </item>
  </channel>
</rss>
