July 15, 2026•6 min read•...

Architecting Eunice: Zero-Trust Municipal Auditing & Dual-Tone AI Personas

PythonRustGeminiMCPData Science

Architectural Context & The Persona Problem

Auditing municipal finances and legislative records requires absolute mathematical precision. Traditional Large Language Models (LLMs) frequently hallucinate numerical figures or lose structural context when processing multi-page municipal ledgers.

As part of the Vancouver Transparency Agent (VTA) ecosystem, we engineered Eunice, a specialized forensic municipal auditor AI. The primary mandate of Eunice is to ingest official City of Vancouver financial reports, isolate municipal spending patterns, and present forensic audit reports with 100% mathematical fidelity.

However, presenting raw municipal audit data to the general public faces a severe user engagement bottleneck: municipal finance is dry and difficult for laypeople to digest. To solve this, we wanted to inject an engaging personality without sacrificing factual integrity.


The 3-Step Hybrid Python/Rust Architecture

To resolve this challenge, Eunice decouples numerical reasoning from text generation using a 3-step, two-pass hybrid pipeline:

  1. Pass 1 (Gemini 3.1 Flash-Lite Scout): Ingests the user's prompt and parses intent into a strict, ~100-token StructuralInstruction JSON payload. If confidence is below 0.85, the pipeline immediately short-circuits with a confidence_too_low status.
  2. Deterministic Rust Core (eunice-core): Python pipe-streams the JSON payload via STDIN to a compiled, zero-dependency Rust binary (eunice-core). Rust performs alias canonicalization and executes all 64-bit integer arithmetic over pre-compiled CSV ledgers extracted from 19 official municipal PDF reports (e.g. City_of_Vancouver_Budget_2025_2026_Official.csv, Vancouver_WA_CIP_Projects_2025_2030_Official.csv) in < 1ms.
  3. Pass 2 (Presentation Layer & Sociolinguistic Bible): Gemini 3.1 Flash-Lite formats the Rust calculation outputs into two distinct payloads: an objective quantitative summary with document citations, and a narrative memo penned in authentic 1940s Vancouver, WA working-class vernacular ("spendy", "warsh", "The Gut", Allen's Crosley Lanes, Kiggins Theatre).

Zero-Trust Short-Circuit Security & Cloud Architecture

Eunice completely eliminates LLM financial hallucinations by stripping mathematical reasoning away from neural networks:

  • Short-Circuit Thresholds: Unclear prompts trigger Pass 1 short-circuits (confidence_too_low), while invalid entity queries trigger Rust out-of-bounds rejections (unrecognized_query), achieving a 100% pass rate across testing suites (smoke_test2 through smoke_test_adversarial).
  • $0 Web Read Overhead: A GCP Cloud Scheduler cron job executes POST /generate-gazette bi-weekly to pre-render articles directly into Google Firestore (gazette_articles). Web visitors read pre-computed articles at $0 LLM cost, while live query execution averages a negligible ~$0.00004 per query.
  • Container Parity: Multi-stage Docker builds isolate the compiled eunice-core Rust binary alongside FastAPI in Python 3.12, utilizing GCP Secret Manager for GEMINI_API_KEY security.
Thanks for reading! Support our development efforts.
Support AIYoda on Ko-fi