Back to chatbot

Technical demonstrator

How HAIKU works

HAIKU, the Hawkesbury Artificial Intelligence Knowledge Utility, is a citation-first civic research system that combines local document engineering, hybrid search, validated analytics, and OpenAI reasoning to answer questions about Hawkesbury Council records while keeping the supporting evidence visible.

Video overview

Start here: what HAIKU is and why it was built

Councillor Nathan Zamprogno introduces the Hawkesbury Artificial Intelligence Knowledge Utility before the technical diagrams below unpack its retrieval, data-processing, and answer-generation architecture.

A plain-English introduction to HAIKU’s purpose, capabilities, and approach to making Council records easier to explore.

System shape

Not a generic chatbot wrapped around a search box

Corpus engineering

The system ingests council business papers, minutes, attachments, policies, planning instruments, web-crawled pages, consultation sites, data-portal pages, demographic profiles, legacy PDFs, and recorded meeting debate. Source metadata is preserved so answers can point back to meetings, documents, exact speeches, URLs, dates, and corpus families.

Hybrid retrieval

Documents are converted into Markdown or structured records, chunked, and embedded in Chroma. At question time, semantic matches are combined with exact-word FTS5/BM25 matches, fused and reranked, then reduced to a citation-ready evidence pack rather than asking the model to rely on memory.

Custom executors

Repeatable civic questions are routed to deterministic code paths where possible: CouncilStats comparisons, motion and vote analysis, meeting histories, attendance, finances, planning controls and guidance, consultation feedback, chamber participation, exact speech catalogues, capital projects, rates, roads, grants, and other structured records.

LLM synthesis

The selected OpenAI model is used where language understanding and synthesis matter most: selecting likely sources, interpreting ambiguous questions, resolving constrained planning or statistical terms, and explaining the evidence. Hard-coded validation and retrieval still govern what reaches the answer.

Hybrid answer path

Custom executors first, LLM synthesis where it adds value

This data-flow view shows how the system avoids treating every query as a blank natural-language problem. Structured civic questions are routed through deterministic executors, open-ended questions use fused semantic and lexical retrieval across documents and relevant Hansard speech, and the LLM receives a compact evidence pack for the final explanation.

Data flow diagram showing user questions routed through FastAPI, query planning, custom executors, official documents and Hansard retrieval, OpenAI synthesis, and cited answer rendering.
The main efficiency gain is architectural: the application narrows the problem before invoking the model. The LLM is still central, but it works from curated facts, passages, and citations rather than broad raw context.

Executor route map: how syntax changes the answer path

The planner combines syntax cues such as rank, list all, by year, voted with, can I build, documents mention, or a street address with automatic corpus selection and constrained semantic nominations. Results are then checked against what the question actually asked for before they are accepted.

Infographic showing how HAIKU routes question syntax to validated custom executors or cited hybrid retrieval.
The custom executors act like specialised civic calculators. They are strongest for repeatable records questions such as voting, attendance, recusals, planning controls, financial series, tenders, grants, and topic histories; open-ended synthesis falls back to cited hybrid retrieval and LLM reasoning. Public chat never executes model-generated Python.

Interactive artifacts

Three graph views of the project

These previews open three complementary interactive views: the software itself, the broad evidence library, and the themes discussed in recorded Council meetings.

The code map is generated with Graphify. The two semantic maps use HAIKU's Python graph builders, scikit-learn analysis, corpus metadata and the vis-network browser renderer; the broad document atlas remains unchanged in this refresh.

Admin workflow

A complete evidence production pipeline, not a one-off upload

The admin interface coordinates the local evidence factory behind the chatbot: source discovery, document download, segmentation, Markdown conversion, structured sidecar generation, vector and lexical indexing, citation previews, quality checks, and deployment sync all sit in one workflow.

Admin Council Web Crawler page showing synced meeting-year folders and downloaded Council documents.
Council Web Crawler: tracks yearly meeting documents and downloads new or changed source files.
Admin Semantic Chunker page showing Markdown files selected for vector embedding.
Semantic Chunker: segments converted Markdown into context-aware chunks for vector embeddings.
Admin LLM and database management page showing vector database statistics, local models, and cloud model options.
LLM and DB Management: monitors vector-store size, the selected cloud model, and token costs.

The workflow starts by scraping configured source websites, including Council meeting repositories, Council web corpuses, consultation and data sites, and Councillor Zamprogno's site. New and changed files are downloaded, catalogued, and checked against prior metadata so repeat runs can skip unchanged material.

Meeting papers are then split into item-level records: agendas and minutes are segmented, attachments are distributed to their parent items, page-number provenance is correlated, and PDF material is converted into Markdown. Those Markdown files are chunked and embedded into sharded Chroma vector stores.

In parallel, preprocessing compiles JSON sidecars and global indexes for factual executors: votes, attendance, conflicts, keywords, financial tables, rates, capital works, road-network subtotals, procurement, grants, CouncilStats, and other recurring civic statistics. A generated SQLite FTS5 index mirrors the searchable Chroma chunks, while preview workflows create safe first-page or website snapshots for citations. Cloud synchronisation then compares and transfers the tested serving assets to the Oracle deployment.

Vertical preprocessing workflow showing admin stages from source scraping through item folders, Markdown conversion, embeddings, sidecar and JSON compilation, validation, cloud synchronisation, and public chatbot serving.
The preparation path is deliberately staged: scrape first, preserve page and item provenance, convert to searchable Markdown, build vectors and structured JSON, then sync the tested local build to the cloud.

Recorded meeting workflow

Scrape, transcribe, identify, review and publish

Meeting audio follows its own evidence pipeline. The media archive is linked to stable meeting and item IDs; glossary-assisted transcription preserves the authoritative words; local timing, diarisation and voice comparison add reviewable speaker evidence; and only a complete, validated release reaches the public Hansard. Expensive stages are durable and resumable, while later text or identity corrections use overlays so the source recording never has to be altered.

Eight-stage Hansard workflow from meeting media discovery through transcription, speaker identification, review, validated release assembly and publication.
Dashboard 31 can orchestrate the publication stages, but each prerequisite keeps its own manifest, checkpoint and validation boundary so a failed or interrupted run does not silently publish partial work.

Meeting Hansard

Turning public meeting audio into searchable chamber debate

HAIKU treats speaker-labelled transcripts as a fifth, first-class evidence corpus. It preserves the difference between what was said, what staff recommended, and what Council formally resolved, while making exact contributions discoverable from the chatbot and the public Hansard.

Transcribe and identify

Meeting recordings are archived with yt-dlp and FFmpeg, transcribed in resumable chunks, timed with MLX Whisper, separated into turns by pyannote Community-1, and compared with quality-filtered WeSpeaker voice profiles. Unknown speakers remain explicit instead of being forced to a name.

Link debate to business

SoundCloud item tracks inherit agenda-item links directly. Whole webcasts are divided into broad, reviewable chapters using the complete transcript and correlated minutes. Public Forum topics can link to a later formal item while retaining their own proceeding, speaker, chronology, and evidentiary role.

Compile once, serve quickly

A validated release precompiles authoritative SQLite, compressed JSONL, SQLite FTS5, year-sharded Chroma vectors, statistics, static pages, and content-addressed AAC speech clips. The interactive reader hydrates current identity and citation data by stable speech ID, while static pages provide the crawlable search-engine surface.

Answer with the right distinction

Exact item questions can combine official papers and decisions, formal Councillor and staff debate, and separately labelled Public Forum contributions. Participation rankings come from deterministic statistics; broad topic and speaker questions use hybrid lexical/vector retrieval with deep links to the exact speech.

222speaker-matched meetings in the active release
57,255coalesced displayed speech turns
4.28 millionpublished transcript words
474.3 hourstimed speech with playable clips

Retrieval strategy

How a question becomes an answer

1

Parse intent

The backend resolves dates and Council terms, classifies the request, selects likely corpuses, and may nominate a compatible executor with typed, grounded slots. Lexical route matches retain priority.

2

Select evidence

The public chat defaults to automatic source selection. Ordinary search runs Chroma semantic retrieval and SQLite FTS5/BM25 retrieval in parallel across official documents and, when relevant, the validated Chamber Debate release, then combines their ranked results with reciprocal-rank fusion.

3

Route to tools

If a deterministic executor is a better fit, the dispatcher runs it and validates the result against the question's obligations. Useful but incomplete results can be supplemented with focused retrieval.

4

Synthesise with citations

Retrieved passages and executor outputs are assembled into a prompt for the LLM. The answer is rendered with visible citations, grouped meeting-item sources, optional previews, activated-corpus disclosure, and guardrails against unsupported claims.

Tooling

What each layer contributes

FastAPI backend Authentication, chat APIs, streaming responses, corpus routing, executor dispatch, and admin workflows.
Vite frontend Public chat, interactive Hansard, saved sessions, source controls, account overlay, and this technical graph page.
Chroma + SQLite FTS5 Parallel semantic and exact-word retrieval, fused across meeting documents, policies, web corpuses, and speaker-labelled chamber debate.
FFmpeg + meeting-media tools Resumable SoundCloud/webcast capture, audio validation, silence-aware chunking, normalized playback clips, and content-addressed public speech audio.
MLX Whisper + pyannote + WeSpeaker Local Apple-silicon word timing, anonymous speaker boundaries, and quality-gated voice comparison. Acoustic support remains a ranking proxy for human review, not a probability.
OpenAI models Question interpretation, answer synthesis, constrained metadata extraction, and glossary-assisted raw transcription where language understanding is required.
Graphify and graph builders Repository structure visualisation plus bespoke semantic atlases for document themes, corpus relationships, and Hansard agenda-item discussions.
Custom executors Deterministic, validated answers for repeatable civic-information tasks where document retrieval alone is too noisy or incomplete.

Why the hybrid approach matters

Lower token costs, better reliability

A retrieval-only chatbot can find plausible passages, but it often spends tokens rediscovering structure the application already knows: meetings have dates, agenda items have identifiers, votes have named participants, and policies have stable document families. Encoding that knowledge in custom executors reduces the amount of context sent to the model and improves answer repeatability.

The LLM remains essential, but it is used as a reasoning and explanation layer. The lower layers narrow the question, fuse semantic and exact-word evidence, validate structured results, preserve source metadata, and produce compact intermediate results. That creates a more interrogable system: people can inspect the corpus, route, executor output, citations, previews, and the visual graphs that explain the project structure.

Cybersecurity

Standard protections built into the system

The HAIKU public chatbot and admin dashboard use separate access controls, and the cloud deployment blocks local-only maintenance workflows that should remain on the workstation.

Authentication and sessions

  • Separate public-user and administrator authentication flows.
  • Google and Apple sign-in plus email registration with confirmation links.
  • BCrypt password hashing and tokenised password-reset flows for email accounts.
  • Signed JWT sessions with role and token-type checks before protected actions.

Access control

  • Admin APIs and the admin chat endpoint require admin JWTs.
  • Cloud mode blocks local ingestion, crawler, database, LLM, and pipeline maintenance endpoints.
  • Configurable CORS origins restrict browser API access to approved frontend hosts.
  • Secrets, environment files, local databases, logs, virtual environments, and cache folders are excluded from cloud code sync targets.

Abuse and cost controls

  • IP and user rate limits on login, registration, password reset, Google auth, and public chat.
  • Rolling public-chat quotas by query count, with optional token and estimated-cost quotas.
  • Maximum query length enforcement before expensive retrieval or model calls.
  • Administrator controls for custom user quotas and account suspension.
  • Generated Python is disabled for public chat and cloud serving; the optional constrained runner is local-admin only.

Auditability

  • Security audit events record authentication failures, rate limits, blocked access, quota blocks, and admin actions.
  • Audit metadata includes request path, method, IP address, user agent, actor type, user ID, and status code where available.
  • Admin dashboards expose user activity, question history, quota state, cloud usage, and moderation controls.
  • Source citations, page links, executor methodology notes, and structured sidecars help trace answer provenance.

Project scale audit

What the system is built on

Counts separate application code, semantic document records, vector-search chunks, and structured extractor records so the project size is visible at more than one level. This audit was refreshed on 31 August 2026; the Code graph and Hansard map were regenerated while the broad Semantic Document Atlas was left unchanged.

Evidence base 1,189 actual dated meetings

Council meeting coverage runs from 10 February 1981 through the latest available 2026 Council, HLPP, and committee material. The published 1981-2006 archive contributes 558 meeting folders to the searchable evidence base.

381,824 source lines of application, tests, and tooling code
94,468 document cards mapped in the semantic atlas
1,089,824 active embedded retrieval records across three corpuses
2,618 validated global division-vote records

Codebase

Python
283,083 lines
HTML
16,289 lines
JavaScript
59,404 lines
CSS
18,273 lines
Swift
4,186 lines
Shell
589 lines

Counted with tools/count_project_lines.py. Excludes generated frontend bundles, corpuses, virtual environments, vector databases, logs, and runtime data.

Vector-store footprint

Sharded serving store
33 GB
Active retrieval records
1,089,824
Active manifest shards
68
Hansard speech vectors
60,292
Serving path
chroma_shards

Physical disk usage for backend/database/chroma_shards, excluding legacy fallback Chroma folders outside the serving shard layout.

Semantic document atlas

Document cards
94,468
Canonical families
16,238
Themes / subthemes
28 / 136
Source families
10

The public atlas renders 1,800 representative document families while counting restricted titles without exposing them as individual nodes.

Meeting coverage

Council meetings
1,103 actual
Cancelled placeholders
1
HLPP meetings
50
Committee meetings
36 actual
Oldest Council record
10 Feb 1981

The 1981-2006 contribution is counted from meeting folders in Distributed_Corpus_1981-2006. Pre-2007 records are document-level; structured voting and attendance detail is strongest from 2007 onward. Committee agendas and minutes remain under the same Council-meetings search selection.

Broad-atlas snapshot by source

Chamber Debate speech turns73,017
Council meetings7,445
Your Hawkesbury Your Say4,738
Profile.ID demographics3,783
Legacy PDF archive2,480
HCC website2,268
Policy and planning documents318
Open Data Portal213
Council committee papers165
Companion Animal Shelter41

These are the deliberately unchanged document-atlas snapshot counts, not the active retrieval-release inventory above. The atlas retains an earlier, broader speech-card representation for visual comparison.

Compiled knowledge

Financial table data points322,479
Agenda/minutes item records7,445
Issue tracker entries7,445
CouncilStats rows5,228
Capital works project records4,738
Vote records2,618
Conflict-of-interest entries578
Grant, rates, and procurement records725