DEV Community

Neel Ijner
Neel Ijner

Posted on AI-assisted

I built a contract reviewer that runs on your laptop, because you can't upload a client's contract to an AI chatbot

Hacktoberfest Open-Source AI Challenge Week 2: Side Hustle Submission πŸ’Έ

A submission for the Hacktoberfest Open-Source AI Challenge β€” Week 2: Side Hustle. Tag: #hf26challenge.

What I Built

Redline finds the risky clauses in a freelance contract before you sign it.

You paste in a client agreement. Redline gives you back an overall risk level, a list of the clauses that are unfair to you, the exact words that triggered each one, why it matters in business terms, and the wording to ask for instead. If you want, it drafts the short, friendly email that raises them with the client.

The person who pays for this is a freelancer. They get contracts with the traps buried in clause 9, they can't justify a lawyer at \$300 an hour for a \$2,000 job, and β€” this is the important part β€” they cannot paste a client's confidential agreement into a cloud AI. That last constraint is not a feature request. It decides the whole architecture.

So Redline runs a local open-weight model. Nothing is uploaded. No account, no API key, no per-token bill.

Demo

Run it against the example contract in the repo, with no model and no network at all:

$ redline samples/unfair-contract.txt --offline

# Redline report

**Overall risk: HIGH** (9 high, 4 medium, 1 low)

Found 14 clauses worth a second look.

## 1. πŸ”΄ Broad IP assignment / work for hire  _(high Β· IP)_

> …ion. 4. INTELLECTUAL PROPERTY All work shall be considered work for hire and Designer assigns all right, title, and interest in all…

**Why it matters:** Transferring everything can stop you reusing your own tools, templates, and style.
**Ask for:** Assign only the final deliverables; keep ownership of your pre-existing tools and methods.

## 5. πŸ”΄ Payment tied to the client getting paid  _(high Β· Payment)_

> …of $2,000 net 90 days from the date of invoice. 3. PAYMENT Payment is contingent upon Client's receipt of payment from its own customers. Cl…

**Why it matters:** Your invoice should not depend on a deal you are not part of.
**Ask for:** Delete it. You are paid for the work, not the client's cash flow.

…12 more findings, covering uncapped liability, approval at the client's sole discretion,
net-90 payment terms, non-compete, extra work at no extra cost, and unlimited revisions.
Enter fullscreen mode Exit fullscreen mode

With a local model loaded it also writes the plain-English overview and picks up risks the patterns
miss β€” the screenshot below is that run, in the browser, with Gemma answering over 127.0.0.1.

The interface shows you the contract itself rather than a list of cards: every finding is written in
the margin beside the clause that triggered it, and the exact words are underlined the way you would
mark up a printed page. It is set in system fonts and loads nothing from a CDN, because a tool that
promises your contract never leaves the machine should not phone a font server on load.

samples/fair-contract.txt is a reasonable agreement, and Redline returns LOW β€” a single low
finding, the governing-law clause. I care about that as much as the scary output: a tool that flags
everything is a tool nobody trusts.

Code

Repo: https://github.com/itzneel05/redline

How I Built It

Redline is deliberately hybrid, because "paste text into an LLM and hope" is not a tool.

  1. A deterministic rules engine. redline/rules.py is a small library of checks for the classic freelance traps: unlimited revisions, work-for-hire, net-90, pay-when-paid, approval-at-sole-discretion, indemnities, uncapped liability, non-competes, auto-renewal, and more. It is plain Python, fully tested, and works with no model at all β€” the demo above is running nothing but this.
  2. A local open-weight model. The model reads the whole contract, catches risks the patterns miss, and writes the plain-English why and ask-for. I ask it for strict JSON and then validate, normalise, and cap the output before it is ever shown (redline/analyze.py). If the model is unavailable or returns nonsense, Redline degrades to the rules engine and says so, rather than crashing or inventing clauses.
  3. No runtime dependencies. The whole thing is the Python standard library, including the web UI (one page, one JSON endpoint, http.server). That is why pip install is instant and why it runs fine on a bleeding-edge Python.

The model backend is one small interface (redline/llm.py), so the rest of the code never knows
which model is loaded. Point it at different Ollama models and the tool just works.

The open-source AI is not a garnish here β€” it is the reason the product can exist:

  • It keeps the contract private. Running the model locally is the only way this is ethical to use on real client documents.
  • It costs nothing per run. Open weights mean a freelancer can actually afford to check every contract instead of only the scary ones.
  • It can be swapped or fine-tuned. Gemma today, Qwen or Llama tomorrow; later, fine-tune on a person's own clause history.

AI disclosure: I used an AI coding agent (the GitHub Copilot CLI) to help write significant parts
of this project, including tests and documentation. The design decisions, the clause library, and
the prompts are mine, and every line was reviewed and run.

Why Does Open Innovation Matter?

Because the feature is privacy, and you cannot buy that from a closed API.

If Redline called a hosted model, its first instruction would have to be "please don't paste
anything confidential" β€” which is exactly the instruction a freelancer cannot follow, because the
whole document is confidential. A local open-weight model turns that constraint from a blocker
into the selling point.

Openness also sets the price. The commercial contract-AI tools are aimed at law firms and priced
accordingly. An open model running on a laptop has no marginal cost, so the tool can be free to
run and still be a real business for whoever wants to sell support, templates, or a hosted version
later.

And it is honest about its limits. The model is asked to explain and extend a set of checks a human
wrote, not to be an oracle β€” which is why Redline can tell you why it flagged a clause, and can
run with the model switched off.

Prize Categories

  • Best Use of Gemma β€” Redline's analysis runs on Gemma 3 (gemma3:4b by default) through Ollama, with the smaller gemma3:1b as a lighter option on modest machines.

(Not legal advice. Redline flags clauses worth a conversation with the client; it is not a lawyer.)

Top comments (0)