DEV Community

Tabiq
Tabiq

Posted on

HAQ

Haq (حق) — Making Legal Information Accessible with Local AI

This is a submission for the Hacktoberfest Open-Source AI Challenge Week 4: Ghost in the Machine.

What I Built

I built Haq Guide (حق گائیڈ), a privacy-focused legal information assistant designed to help people understand their rights, legal notices, agreements, and available options in plain language.

The idea behind Haq is simple: legal information shouldn't be difficult to access or understand.

Users can describe their situation or upload a legal document, such as a notice or agreement. Haq helps break down the information, identify important details, explain relevant rights and options, and point users towards official resources and legal aid.

I interpreted the Ghost in the Machine theme through the idea of AI working quietly in the background to make something complicated more accessible, without requiring users to send their personal documents to an external AI service.

The project supports English and Hindi, with Urdu as an additional language direction.

Demo

The application currently runs locally.

A demo video or walkthrough can be added here.

Code

GitHub Repository: Haq Guide – GitHub

The project is released under the MIT License.

How I Built It

Haq is built using:

  • Python – Core application logic.
  • Gradio – Web interface.
  • scikit-learn / TF-IDF – Retrieval of relevant legal information.
  • Ollama – Local model inference.
  • Gemma 4 (gemma4:e2b) – Local AI integration.
  • PyPDF / python-docx – Document processing.
  • pytest – Automated testing.

Instead of relying entirely on a hosted AI API, Haq uses a local-first architecture.

It retrieves relevant information from a curated collection of official legal resources and uses those sources to ground its guidance. The local AI integration can generate explanations based on retrieved material, with source citations.

The application also includes safeguards against unsupported legal conclusions and clearly communicates that its output is informational, not a substitute for professional legal advice.

Why Does Open Innovation Matter?

Open innovation made it possible to experiment with AI without depending on expensive hosted APIs or proprietary infrastructure.

Using open-weight models and local inference gives developers more control over how AI is deployed, what information is processed, and how applications can be adapted.

For a project dealing with sensitive legal documents, this matters particularly.

It also means that other developers can inspect the implementation, contribute improvements, expand the legal resource collection, and adapt the project for their own communities.

I wanted Haq to be something people could build upon rather than another closed application.

The Spirit of It

Legal information can be intimidating, especially when someone doesn't know where to start or what a document actually means.

I wanted to build something that could make that first step easier.

Haq is still an evolving project, but the goal is to make understanding your rights a little less intimidating and a little more accessible.

Know your rights and your options. Privately, in plain language.

Top comments (0)