Architecture teardowns, real bugs caught during evaluations, and practical
engineering patterns from building multi-tenant AI, voice, and document systems.
Context & Guardrails
8 min read
The Model Is a Router, Never a Data Store
How an Assistant Data Layer keeps customer rows out of LLM context, why worked examples in
prompts trigger hallucinations, and how we lifted a live 87-question eval from 69% to 91%.
- Reference Handles
- ReplyGuard
- Evals
Voice AI Systems
9 min read
The Model Recommends, The Server Authorizes
Designing a three-plane outbound voice fleet with atomic contact leases, swappable realtime
lanes, reward-hacking scanners, plus a 100% local Moonshine + DeepSeek-R1 + Kokoro tutor.
- Three Planes
- Atomic Leases
- Local Voice
Document AI & Data
9 min read
Provable Extraction & Database Boundaries
Coordinate-anchored PDF extraction, integer minor-unit billing, duplicate-charge boundary
gates, 191 PostgreSQL RLS policies, and cutting AI agent token spend 7.3x with AST graphs.
- Anchored PDF
- Postgres RLS
- AST Graphs
TIP 01 · PROMPT HYGIENE
Ban real-looking numbers from few-shot examples
In TiDonna's live eval, the LLM copied numbers out of a worked system-prompt example instead
of calling a tool.
Rule: Use placeholders in prompt examples and assert in CI that zero real
domain figures appear in cached prefixes.
TIP 02 · EXFILTRATION
Never return signed download URLs to the model
Returning a signed CSV link inside a tool response leaks that URL into third-party LLM
provider logs (caught as LEAK-02).
Rule: Return an opaque export_id to the model; mint the
owner-scoped signed URL only when the UI clicks.
TIP 03 · TRANSFER SAFETY
Have voice agents emit reasons, not phone numbers
If an AI voice model outputs a destination number or agent ID, prompt injection from the
callee can hijack call transfers.
Rule: Constrain the tool output to a typed reason enum; resolve the target
server-side via an allow-listed registry.
TIP 04 · REWARD HACKING
Separate model sentiment from verified outcomes
Counting sales claimed by an LLM optimizing for conversion creates an inflated scoreboard and
unstable feedback loops.
Rule: Keep append-only ledgers, count only QC-reviewed sales, and run a
static scanner blocking model scores on paid surfaces.
TIP 05 · IDEMPOTENCY
Treat ambiguous email/API timeouts as unknown
Marking an ambiguous SES timeout as "failed" invites automated retries that bill or invoice
the same customer twice.
Rule: Record ambiguous outcomes as unknown, gate dispatch in the
email boundary, and bind approvals to content hashes.
TIP 06 · REAL TESTS
Never test RLS or gateway guards as an admin/mock
Fake controllers hid tenant leaks in TiDonna, and owner DB roles silently bypass every
PostgreSQL row-level security policy.
Rule: Run gateway isolation tests through real controllers with canaries,
and connect tests as the non-bypass app_user role.