Technical Architecture · August 2026
The architecture of a presenter that
answers for itself.
§ docs/architecture-mvp.md · Decisions D1–D7
System Overview
Ports are non-default on purpose — 5432, 6379 and 8080–8083 belong to other local stacks. The client never supplies tenant_id; every identifier is re-resolved server-side.
§ docs/ports-and-endpoints.md · Port map + call flow · docs/architecture-mvp.md §1
Ingestion Pipeline · Live
never held open:
a DB transaction across
a network call.
embeddings happen outside
any transaction; results
land in a short tx after.
that is the deadlock rule,
written down once.
§ docs/rag-ingestion-spec.md · Concurrency safety · TODO.md · Ingestion pipeline live (d956e0b)
Chunking & Embeddings
search_document: / search_query:Mandatory. Enforced in the gateway, not left to callers — omitting them degrades quality with no error.§ docs/rag-ingestion-spec.md · Tokenization · Chunking · Embedding
Hybrid Retrieval
"How does the GCS talk to drones without internet?"
Keyword arm: zero hits. No chunk contains that phrasing. Semantic arm carried it alone — "without internet" and "air-gapped" are neighbors in 768-dimension meaning space[2].
known sharp edge:
HNSW with a restrictive
WHERE can under-return.
mitigations, in order:
iterative index scan,
raise hnsw.ef_search,
partial indexes per tenant.
stated honestly, tested
with two seeded tenants.
§ ai-service/README.md · Grounded Q&A · docs/architecture-mvp.md §8 · RAG Pipeline
Agentic Retrieval · Next
the latency lesson,
learned the hard way:
first live Q&A returned
an empty answer at full
token spend — the local
model "thought" through
its whole budget before
writing a word.
one reasoning_effort
control later:
35s → 1.5s.
know where your
tokens go.
§ blogs/2026-08-02-agentic-retrieval-and-what-im-learning.md · Agentic retrieval
Grounded Generation
"I could not find enough information in the approved sources to answer that confidently."
One fixed string, byte for byte. A refusal is a 200 with grounded: false, confidence: 0.0, and no citations — a refusal dressed up with citations is the exact failure the requirement names.§ ai-service/README.md · Grounded Q&A pipeline · ai-prompt.md · Core Trust Principle
The Confidence Bar, Explained
A librarian, three questions. "What does TR-002 say?" — she finds the exact page; it matches your words. High closeness. "What is this whole library about?" — six books from six sections, each only loosely similar, together perfect. Low closeness, great answer. "Is this library only for lawyers?" — a page saying open to everyone, which refutes rather than resembles. Low closeness, great answer.
confidence = (mean cosine of cited chunks − 0.35) ÷ 0.5 Below 0.35 = no evidence, Maria refuses. 0.45–0.60 related · 0.60–0.75 strong · above 0.75 your question nearly quotes the document. Chunks the vector arm never saw count 0.0 — measured similarity only.
the roadmap replaces
closeness with two
better ingredients:
faithfulness — a judge
scoring how well the
evidence supports
each claim.
calibration — refit until
80% means right four
times out of five.
only then does a
"minimum confidence"
policy make sense.
| You see | It means |
|---|---|
| Refusal (0%) | Nothing cleared the evidence bar. Maria working, not failing. |
| ~35–50% | Evidence found by synthesis or refutation — judge the citation spread: many documents agreeing = strong answer. |
| ~50–70% | Direct, on-topic evidence. Typical for good factual answers. |
| 70%+ | The sources nearly contain your question verbatim. |
The bar never lies high — it only lies low. That direction was chosen on purpose.
§ docs/confidence-explained.md · The library analogy · How to read the bar today
Workflow State Machine · Human-in-the-Loop
POST /outline:approve {versionNo} returns 409 Conflict if that version is not current. You must re-read what changed before you approve. Python has no PATCH /presentations capability of its own — it calls a narrow internal callback and Java validates the transition, which is what keeps the orchestrator genuinely in control.
non-bypassable by design:
outline approval
final deck approval
tool writes
external sharing
live Q&A is gated by
verification + refusal
instead — and logged
for review.
§ docs/architecture-mvp.md §7 · Generation Workflow · ai-prompt.md · Human-in-the-Loop Requirements
Security Guardrails
threat-modeled against:
OWASP Top 10
OWASP LLM Top 10
OWASP ASVS
NIST AI RMF
invariants that no
config key can disable:
isolation · citations
refusal · audit
write approvals
injection defenses
a test asserts the union
of writable keys and
reserved keys is empty.
§ ai-prompt.md · Security Requirements · docs/architecture-mvp.md §1 · Trust boundaries · §9 · Invariants are code, not config
Evaluation Harness · Queued
The 33%-confidence bug was caught by one user asking one question. The harness is that same scrutiny, automated, on every change, forever.
§ blogs/2026-08-02-evaluating-maria-ragas-plus-constitution.md · TODO.md · Eval harness: RAGAS + Narra constitution
Free-First Engineering
| Stage | Bound by | What that means |
|---|---|---|
| Parse + chunk | CPU, single-core per doc | <1% of job time for markdown/text |
| Embedding | GPU (VRAM + compute) | The dominant cost — ~14 chunks/s warm on RTX 5070; CPU-only is 5–10× slower |
| Chat generation | GPU VRAM, or an external API | 4B ≈ 4GB · 14B ≈ 10GB — 14B and embeddings is tight on 12GB; claude-cli offloads it entirely |
| pgvector writes + HNSW | CPU + disk | Trivial until 100k+ chunks |
| Worker orchestration, Redis | I/O | Never the bottleneck — which is why worker language doesn't affect throughput |
| Maria's voice | Client device | Zero server cost by design |
Buy VRAM for chat models, not embeddings — nomic-embed-text needs under 1GB. And before any hardware spend, the free lever is the claude-cli provider: a subscription driving claude -p headless, no API key, moving the biggest VRAM consumer off the GPU.
§ docs/rag-ingestion-spec.md · Bottleneck map & hardware requirements · ai-prompt.md · Free-First Provider Strategy
Roadmap
§ TODO.md · Next + Phase 5 · Localization (flagship) · STATUS.md · Next Actions