Inspiration

Important legislative changes are often spread across long PDFs, committee reports, and successive parliamentary prints. Citizens and professionals must manually locate the current version, compare it with earlier documents, and work out who is responsible for the process. A fluent AI summary without evidence does not solve that trust problem.

SejmWatch was built to make legislative change understandable without separating an answer from its official source.

What it does

SejmWatch reads live metadata from the official Sejm API and imports official parliamentary PDFs page by page. Documents belonging to the same legislative case are linked and compared deterministically at article level.

The public demonstration follows the Polish government bill on artificial intelligence systems through official prints 2443 and 2614. Users can inspect detected changes, explore a keyboard-accessible 3D change tree, see official responsibility data, ask evidence-backed questions, generate thematic reports, and use a Polish or English interface while official legal text remains in its source language.

The evidence validator rejects an AI answer when it has no citation, points to a page that does not exist, or contains a quotation that cannot be found on that page.

How we built it

  • FastAPI and Jinja2 provide a lightweight server-rendered application.
  • The official Sejm API supplies prints, processes, interpellations, committees, and member data.
  • PyMuPDF extracts official PDFs while preserving page boundaries.
  • SQLite and FTS5 provide explainable lexical retrieval.
  • A deterministic article-aware diff identifies textual changes.
  • Pydantic defines the answer and evidence contract.
  • An OpenAI-compatible model performs grounded synthesis; deterministic code independently validates its evidence.
  • A single web process checks recent print metadata every six hours without a separate scheduler or managed database.
  • Docker Compose and pytest provide a reproducible local path.

Evidence-first design

The model is not the source of truth. Retrieval, case scoping, document version linkage, article comparison, and quote validation are deterministic. The model explains retrieved material, while the application verifies that the evidence exists before displaying the answer.

How Codex and GPT-5.6 were used

SejmWatch was created entirely through Codex sessions using GPT-5.6. There was no separately developed application or pre-existing implementation outside this workflow.

GPT-5.6 was the reasoning model inside Codex throughout creation. It meaningfully contributed to translating product requirements into the architecture, implementing official Sejm API integration, designing the evidence contract, connecting page-scoped retrieval with deterministic quote validation, removing mock data, developing the bilingual interface and keyboard-accessible 3D tree, writing tests, diagnosing failures, deploying the app, verifying the live result, and preparing this submission.

Codex was also used to inspect official sources, operate the browser for interaction checks, manage GitHub and Heroku deployments, audit product claims against the code, and keep the submission truthful. The repository contains a chronological CODEX_BUILD_LOG.md tied to the Git history.

The human made the product decisions: choosing the Health & MedTech scenario, requiring official sources, refusing invented attribution of amendments, prioritising a no-add-on deployment, and keeping official legal text untranslated unless an official translation exists.

The distinction between build-time and runtime use is explicit. GPT-5.6 and Codex were used to build, test, and ship the project. The public application's runtime inference currently uses the free-tier gpt-oss-120b model so the public demo does not create additional model charges. We do not misrepresent that runtime as GPT-5.6.

Challenges

The central challenge was preventing a fluent answer from outrunning its evidence. Page identity must survive extraction, retrieval, generation, and display. We store one record per PDF page and treat citations as typed data that is validated after generation.

Another challenge was attribution. Official metadata can identify a committee or rapporteur, but does not attribute every textual difference to a particular MP. SejmWatch presents the available responsibility data and explicitly refuses to guess authorship.

Accomplishments

  • Real official documents instead of mock legislative data.
  • Page-preserving PDF ingestion and SHA-256 identity.
  • Deterministic article-level comparisons.
  • Case-scoped RAG with exact-quote validation.
  • A reusable thematic report generator.
  • Keyboard-accessible simple and full 3D navigation.
  • Polish and English UI with source-language safeguards.
  • Live Sejm metadata monitoring without paid add-ons.
  • A public working deployment and automated core tests.

What we learned

Reliable public-interest AI needs a clear boundary between probabilistic explanation and deterministic verification. Keeping provenance at page level makes answers more trustworthy and makes failures visible instead of hiding them behind confident prose.

What's next

Next steps are persistent storage, automatic import of selected new PDFs, topic subscriptions, outbound alerts, OCR for scanned documents, Senate and Government Legislation Centre sources, voting links, and structured amendment authorship where official data supports it.

Test it

Open the live demo, select the AI systems bill, inspect the deterministic change list or 3D tree, and ask a question. Each accepted answer shows an exact quotation, page, and official PDF. No credentials are required. Use /en for the English interface.

Built With

Share this project:

Updates