DEV Community

Aashish H
Aashish H

Posted on • Edited on

How I accidentally built a local AI writing app

I never intended to create an AI platform. Really, it all started much simpler. It began with what felt like a tiny, but frustrating, scratch: I just needed a simple grammar and spellcheck that ran locally and didn't require sending my drafts to a cloud server or paying monthly.

This wasn’t even my first rodeo. In fact, I'd already attempted and ditched this exact premise twice already.

To be honest, my first two attempts at this were... pretty lacking:

  • Attempt 1: A barebones single-file Python script (Grammar Checker.py) that barely did more than basic string checks.
  • Attempt 2: A lightweight grammar_checker.py script using TextBlob—better, but still extremely limited, brittle, and stuck inside a terminal harness.

After dismissing the first early prototypes, I figured that I may as well give it one more shot. I managed to whip up a proper React + TipTap frontend, tied in a local LanguageTool engine and this time I had it working well for my offline needs.

Having got a fast local pipeline running on my machine I also thought, why stop there? Text transformation is the obvious next level.

What started as a modest grammar checker accidentally evolved into Lexicon—a full-fledged, local-first writing assistant with 15 AI tools running entirely on-device via quantized local models.

Here is what it does now, and the technical landmines I had to solve to ship it as a single native installer.


What It Does Now

  • 100% Offline Grammar & Spellcheck: Fast, rule-based checking powered by LanguageTool (no LLM latency or non-deterministic hallucinations for simple typos).
  • 15 On-Device AI Tools: Rewrite, Concise, 9 distinct tone adjustments (Academic, Casual, Professional, etc.), Summaries, Key Points, Lists, and Tables—all running through a small quantized model (llama.cpp) directly on your machine.
  • Zero Cloud Calls: No accounts, no subscriptions, and zero text ever leaves your device.
  • Ollama Auto-Detection: If you already run an Ollama server locally, Lexicon auto-detects and hooks into it; otherwise, it uses its own bundled runtime.

Prompt Engineering for 1B–3B Local Models

Small quantized local models (I'm using Qwen 2.5 GGUF quants in the 1B–3B parameter range) need much more explicit prompting than frontier models.

  1. Strict Formatting Guarantees: Without explicit instructions like Output ONLY the transformed text. Do not include preamble, quotes, or introductory notes., small models love to wrap outputs in polite chatter ("Here is your rewritten sentence:").
  2. Behavioral vs. Adjective Prompting: Simply swapping adjectives ("Rewrite this to sound [Formal/Academic]") causes tone outputs to blur together. Small models need concrete syntactic rules—like explicitly telling the model to expand contractions, shorten sentence length, or switch to passive voice.

Where It's At & Open Source

Third time was finally the charm! Lexicon is open-source (MIT licensed) with installers available for Windows (.exe) and macOS (.dmg for Intel + Apple Silicon).

GitHub Repository: github.com/AashishH15/Lexicon
Website: https://lexicon-writer.pages.dev/

I'd love to hear feedback!

Top comments (0)