Inspiration

I work at a Vietnamese state agency. Every day, staff must find the correct legal basis (laws, decrees, circulars) to answer questions and write official reports. General chatbots are fast, but they can invent articles or cite documents that have been replaced. In public administration that is not acceptable: the staff member signs the report, so the staff member must be able to check every source.

That gave the project one guiding principle: AI assists, humans decide. Evidence RAG does not hand out "the answer". It finds the evidence, shows exactly where each statement comes from, and leaves the judgment to the professional.

What it does

Evidence RAG is a local-first legal lookup assistant for Vietnamese public servants.

  • Analyze → Retrieve → Verify → Explain. Every answer links back to the exact passage in the original document.
  • Pinned sources. Each source file is fingerprinted with SHA-256, so a citation always points to the exact version that was reviewed.
  • Document intake with review. Import PDFs and scanned documents (OCR), correct the recognized text, then send it for approval.
  • Four-eyes control. Roles for admin, curator, reviewer and staff (chuyên viên). No one can approve their own work.
  • Category permissions. The admin decides, per account, which document categories each person can search or confirm as valid.
  • Tamper-evident audit log. Actions are recorded in a hash-chained log.
  • Runs offline. It works fully with a local AI model, which matters for sensitive government data.

How I built it

  • Frontend: React 18 + TypeScript + Vite
  • Backend: FastAPI (Python 3.11+)
  • Storage and search: PostgreSQL + pgvector
  • Desktop: Tauri 2 app for Windows, plus a portable package (~8 GB, including documents and local AI models)
  • AI: a local LLM, or an allow-listed OpenAI-compatible endpoint

In October I only wrote the requirements, plan and a throwaway prototype. The implementation in this repository was built with Kiro from October 30 to November 9, 2026. I used Kiro's agent to generate and refactor code, write and run tests, debug, and upgrade features step by step.

The repository's .kiro folder contains:

  • Steering files (product, tech, structure) that keep the agent aligned with the project's rules.
  • Agent hooks that run Python lint and TypeScript checks when files are saved.
  • Specs (requirements, design, tasks) for the main features. These were reconstructed from the code on November 9 to document the system, and they are labelled as such.

KIRO_WORK_SUMMARY.en.md and KIRO_STATS_APPENDIX.en.md describe what Kiro contributed and how the numbers were counted.

Challenges

  • Scanned documents. Many Vietnamese legal documents exist only as scans. OCR runs in an isolated worker process, and curators can correct recognized text before it becomes searchable.
  • Trust over fluency. A fluent answer with a wrong citation is worse than no answer, so verification and citation pinning took more effort than generation itself.
  • Access control. Combining roles with per-category permissions, and guaranteeing that no one approves their own changes, required careful design and testing.
  • Limited hardware. Everything was built and tested on a personal computer, so the app currently runs on a single machine. The architecture leaves room for database replicas and load balancing in larger deployments.

What I learned

  • In the public sector, auditability is a feature: who imported a document, who approved it, and which version was cited all matter.
  • I deliberately chose not to grade the AI against a "gold" answer set. AI is not the decision-maker. Instead, I test whether search finds the right passages, and professionals review every citation.
  • Steering files and hooks made Kiro far more consistent on a large, rule-heavy codebase than free-form prompting.

What's next

  • Pilot use by staff on real tasks, with feedback on every citation
  • Scaling for larger agencies (database replicas, load balancing, shared document storage)
  • Better OCR for low-quality scans and more document types

Built With

Share this project:

Updates

Submission history