
Adaptive Context enriches the structured data the LLM operates on after each interaction. The model itself is not retrained — its input data becomes more specific over time through classification, resolution, and recomputation.
Two-pass architecture: classify intent first, then fetch only the relevant pre-computed analytics. A feedback loop recomputes context after each resolution so subsequent queries operate on fresher, richer data.

Static context selection wastes tokens, ignores user intent, and operates on stale data.
Sending all available data to the LLM wastes tokens and dilutes the signal-to-noise ratio. The model spends capacity processing irrelevant information.
Pre-computed results drift out of date without freshness guarantees. The AI narrates obsolete information, leading to incorrect or misleading responses.
Static context selection ignores user intent, producing irrelevant answers. Every query gets the same generic data regardless of what the user actually needs.
Adaptive Context addresses these by classifying intent first, fetching only relevant analytics, and enforcing freshness checks before every LLM call.
Three-layer determination with progressive fallback — from LLM intelligence to deterministic patterns to safe defaults.
A lightweight, low-temperature LLM call (temp 0.1, max 50 tokens) classifies the user message into a domain category. The classifier sees the last 4 conversation messages for context and returns exactly one category from a constrained enum.
If the result is a specific domain (not "general"), classification is complete — no further layers needed.
Each classified category activates a targeted data pipeline — nothing more, nothing less. Instead of sending all data to the LLM, only relevant pre-computed analytics are fetched.
Determine user intent via the cascade
Pull only relevant pre-computed analytics
Build domain-tuned prompt with valid actions
LLM receives summaries, not raw data
Key insight: The LLM never sees raw data. It only narrates pre-computed, deterministic results. Each category maps to a specific system prompt, context loader, set of valid actions, and token budget. The LLM receives structured, auditable summaries — never raw records.
Pre-computed analytics can drift out of date. The freshness protocol ensures the system always works with current data, not stale snapshots.
Query latest computedAt timestamp from DB
Compare against staleness threshold
Re-run analytics engine with current data
Check DB every 2s for new computedAt
Return fresh data to LLM context
Timeout Safety: If recomputation exceeds the maximum wait window, the system proceeds with the best available data and includes an analytics age note so the AI can transparently communicate data freshness. The system never blocks indefinitely.
Each user interaction drives the system to become more precise through a self-compounding feedback loop. The next query always benefits from richer, fresher analytics.
Natural language response enters the system
Raw signal captured
LLM + Regex cascade determines domain
Classification improves with conversation context
Category activates targeted analytics fetch
Richer context from previous resolutions
If stale, recompute before proceeding
Latest user overrides always reflected
LLM maps intent, code writes side-effects
Permanent classifications applied
Resolution triggers analytics recomputation
Next query gets richer, more precise context
The system builds per-user context profiles across four layers. Output quality improves because input data becomes more specific, not because the model itself changes.
Entity type, ownership, partner definitions
Computed metrics, running averages
Related-party links, payee classifications
Whitelisted entities, confirmed-clean patterns
Trace a concrete interaction through the full adaptive context architecture.
User provides a natural language response (e.g., identifying an entity or confirming a classification).
The pipeline enforces the narration principle at every stage: Stage 1 processing is pure deterministic rules (no LLM). Stage 2 classification and question generation use deterministic templates. Stage 3 resolution constrains the LLM to a closed outcome universe — it can only select from valid actions, never invent new ones. Side-effects are executed by deterministic code, never by the LLM.
Read about the purpose-built DSL, compliance workflows, and production architecture.