Architecting Eunice: Zero-Trust Municipal Auditing & Dual-Tone AI Personas
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:
- Pass 1 (Gemini 3.1 Flash-Lite Scout): Ingests the user's prompt and parses intent into a strict, ~100-token
StructuralInstructionJSON payload. If confidence is below 0.85, the pipeline immediately short-circuits with aconfidence_too_lowstatus. - 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. - 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_test2throughsmoke_test_adversarial). - $0 Web Read Overhead: A GCP Cloud Scheduler cron job executes
POST /generate-gazettebi-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-coreRust binary alongside FastAPI in Python 3.12, utilizing GCP Secret Manager forGEMINI_API_KEYsecurity.