A programmatic AI platform for enterprise documents — grounded, cited answers over contracts and filings, model-agnostic by design, with a per-question dial between engineer-authored and model-authored control flow.
PythonFastAPIHybrid retrievalCorrective RAGQdrantvLLMDockerEval harness
Retrieval-augmented generation the way you’d actually deploy it inside an organization: API-first, every model slot swappable by environment variable, security enforced at the tool call, and an evaluation harness with the authority to block a feature from shipping.
The usual framing — “agentic or not?” — turned out to be the wrong question, and the measurements kept refusing to support it. The fixed pipeline already rewrites the query, classifies it, grades its own evidence, and issues new retrievals on a coverage gap. That is an agent. What actually varies is who writes the sequence:
| Mode | Control flow is | Right for |
|---|---|---|
classic | Engineer-authored — fixed topology; the model fills in decisions at predetermined points | Lookups, definitions, single-document questions |
agentic | Model-authored — a bounded loop over allowlisted read-only tools; the topology emerges per question | Comparisons, corpus-wide synthesis |
auto | An intent router picks, per question | The default |
All three call the same retrieval engine, so they’re comparable in evaluation and one retrieval improvement lifts every mode at once. The agent itself is roughly a page of explicit code — no framework — and its tools are read-only by contract, so the blast radius of a successful prompt injection is a bad answer, not a mutated corpus.

Every question runs ten independently-configurable stages: input guard → memory rewrite → semantic cache → intent router → hybrid retrieval (dense + BM25 fused with Reciprocal Rank Fusion, then cross-encoder rerank) → passage guard → corrective grade (“do these passages actually answer it?”) → decompose and re-retrieve on gaps → adaptive top-k with citations → grounded generation with PII scrubbing on the stream. Graceful degradation is a property, not a hope: lose the reranker and retrieval still returns; lose the cache and the answer is only slower.
Structure where similarity fails. Some questions are GROUP BYs, not searches — “what
is the governing law of each contract, and do they agree?” No ranked retriever answers
that at any top_k. So ingestion extracts a structured facts layer (parties, dates,
governing law, liability caps, survival clauses), every field backed by a verbatim quote
verified against the source — a field that can’t be quoted is stored NULL, never
guessed. Corpus-wide comparison becomes one table read, and every cell carries its evidence.
Flat-text extraction destroys tables — and with them every numeric question a reader actually asks. Extraction is therefore treated as the most consequential decision in the pipeline: three rungs (Docling parse → olmOCR vision-language OCR → hosted agentic extraction) behind one pluggable seam, routed per document and escalated on low confidence.
A capability ships when it wins its eval, not when its code compiles. The structured facts layer shipped because it won its pre-registered comparison at lower latency. A knowledge graph was cancelled when a sixty-line aggregate cleared the same bar first. And a single-run result was publicly retracted once repeat runs showed the judge’s variance was the size of the effect being claimed — the initial “−46% latency” headline was corrected to the real per-stage number (56.9 s → 47.8 s mean across 91 traces).
Fully containerized; the default profile runs on a laptop with zero cloud keys (open weights in every slot — the only posture that can be fully air-gapped), and the same compose files scale to a GPU-backed or hosted-API deployment by changing environment variables. The same retrieval harness powers the document-intelligence surface of San Juan Watershed Riparian Watch.
The platform’s source is private; the quartzose-platform repo is its public design record: architecture, model strategy, evaluation method, the security contract, and a design provenance doc that records the experiments behind each decision — including the ones that failed.