Skip to content
LLM application engineering Core 28 min read

Case study: how Jarvis is built

Jarvis is the assistant in Finny's app that explains a member's own retirement (FIRE) plan. Every applied idea in this track shows up in it: a bounded router instead of a free agent, code that computes every figure while the model only chooses and phrases, a deterministic gate on every number, per-role models picked by evals, speculative execution for latency, and a layered eval stack. So do the failures, which teach as much as the design.

10,000 ft

Most LLM products are a model wrapped in prompts. Jarvis is the opposite pattern: a deterministic system that uses language models at exactly two points, to understand the question and to write the answer, and checks the second with code. It exists because in personal finance one wrong rupee figure destroys trust, and language models restate numbers unreliably. The design choices map onto this track's pages: structured outputs and tools (the model picks from a menu), RAG and context engineering (it retrieves named slices of structured data, not text chunks), agents (it deliberately is not one on its default path), evals, guardrails and shipping. Everything here is drawn from the Jarvis engineering handbook as of October 2026 (see the Document hub in admin); numbers are the handbook's own measurements, dated where they move.

2,000 ft

A turn makes three model calls, with code doing everything that must be right.

One Jarvis turn: models choose and phrase, code fetches, computes and checks
One Jarvis turn: models choose and phrase, code fetches, computes and checks. Member's question via the Finny backend, 1. Classify plan question or not?, 2. Select named chunks + one utility, 3. Fetch and compute plan data, today's money, on-track verdict, totals, Fact table labelled figures, 4. Narrate write from the facts, 5. Number gate every figure traced?, Answer + cards verdict, trace, startOne Jarvis turn: models choose and phrase, code fetches, computes and checks. Member's question via the Finny backend, 1. Classify plan question or not?, 2. Select named chunks + one utility, 3. Fetch and compute plan data, today's money, on-track verdict, totals, Fact table labelled figures, 4. Narrate write from the facts, 5. Number gate every figure traced?, Answer + cards verdict, trace, start

  1. Classify: a model decides whether the question is about the member's plan.
  2. Select: a second model names which slices of the plan ("chunks") the question needs and one deterministic operation ("utility") to run over them. In production this starts at once, in parallel with classification.
  3. Fetch and compute: code reads the plan from Finny's backend, projects the chunks, runs the utility, and works out derived figures (today's-money values, whether the member is on track, list totals).
  4. Narrate: a model writes the reply from a labelled fact table.
  5. Gate: code checks every number in the reply against the computed data; a failing reply is repaired once, then trimmed, then honestly refused.
  6. Respond: code attaches cards (a stat, a table, a chart) built from the same facts, and stores a verdict and a trace for the turn.

Ground level

The problem, and why it shaped everything

Finny runs a simulation of each member's finances: when they can reach financial independence under four ambition levels (Basic, Secure, Aspire, Dream), in two guidance modes, year by year, with goals, loans and assumptions. Members ask questions like "When can I retire?", "What's my FIRE number?", "Which loan is biggest?", "Mera FIRE score kya hai?" or "What will my net worth be in 2035?". Each answer is a figure the member may act on.

Three facts about the domain drove the design:

  • The data is structured and large. A simulation is deeply nested: per type, per mode, per year. Giving a model the whole JSON produced wrong leaves and invented totals.
  • The numbers must be exact and traceable. "About ₹1 crore" for 1.25 crore is wrong; a Secure-plan age quoted for Dream is wrong; a figure the model computed itself is unverifiable.
  • Users type like people. Terse ("loans"), misspelt ("wen can i retier"), in Hinglish, as follow-ups ("and for my spouse?"). Every question family is tested in several of these styles.

The founding decision record (June 2026) states the response in one sentence: code computes, the model narrates, and a gate checks every figure, accepting some false refusals and that faithful is not the same as correct. The rest of the system follows from taking that seriously.

A bounded registry instead of a free agent

The selector model does not see the plan. It sees a registry: a list of named chunks (FIRE_AGE, CURRENT_NET_WORTH, goal lists, the year-by-year projection, scores and their factors, about 62 families in all) and seven deterministic utilities (a summariser, a lister, a filter, a comparator, an explainer and so on). It returns a small JSON object: which chunks, which utility, which arguments. Code validates the pick, adds companion chunks an answer needs to explain itself (a "why is my score low?" question pulls in the score's sections and factors), and runs the utility.

Why this rather than a tool-calling agent over raw data? The decision record names the three options and the reason:

Option Problem
Whole JSON in the prompt Wrong leaves, invented totals, an unbounded set of figures to check
One micro-API per fact Hundreds of tools; the model picks the wrong one
A registry of named chunks plus a few utilities A choice space small enough to evaluate exhaustively and check deterministically

That last property is the point. Routing becomes a classification problem with a finite label set, so it can be graded case by case (did the pick cover an accepted set of chunks?). It is the action-selector pattern from the security literature, adopted for correctness rather than security, and it gets the security benefit for free: injected text can at worst change which of the member's own slices are read. The price, accepted explicitly, is that compound and what-if questions need more machinery (below).

Code computes, the model explains

After fetching, code renders a fact table: one labelled line per figure, with the type and guidance mode in words ("Basic FIRE, on your own: 44"), money in lakh and crore with the exact value alongside, negative values stated as negative, "not achievable on the current plan" instead of a blank. Derived facts that a model might otherwise compute are computed in code and appear as their own lines:

  • Today's money beside every future amount, at each plan type's own inflation.
  • The on-track verdict ("On track", "Not on track yet", "Reachable with Finny", "Not reachable"), decided by code and given to the narrator as a line it must agree with.
  • List totals for assets, loans and goals, so the narrator never adds.
  • Years to FIRE, net debt, monthly savings, the shortfall of an unreachable plan.

The narrator's prompt then forbids arithmetic: no sums, differences, averages or conversions; use the data's own totals and deltas. Each rule in that prompt exists because a live eval caught the model doing the forbidden thing. A related principle governs the cards: every value in a card is filled by code from the same facts as the prose, so a chart can never disagree with its caption, and numbers in cards never pass through model tokens at all.

The division of labour

The model is good at two things code is bad at: understanding a messy question and writing a clear answer. Code is good at the things models are bad at: exact arithmetic, consistent lookup and saying no. Jarvis gives each side only the jobs it is good at, and puts a check between them.

The number gate

The narrator is still a language model, so it can mistype, round dishonestly or invent. The number gate is plain code, no model, that reads every number in the draft and looks for it in this turn's computed data.

The gate saves an answer before it refuses one
The gate saves an answer before it refuses one. Draft reply, Number gate every figure traced to this turn's data?, Repair once model told which figures failed, Trim drop failing sentences, Send (with a 'left it out' note if trimmed), Refuse honestly 'couldn't confirm the figures', all traced, first failure, re-check, still failing, 4+ words left and they pass, otherwiseThe gate saves an answer before it refuses one. Draft reply, Number gate every figure traced to this turn's data?, Repair once model told which figures failed, Trim drop failing sentences, Send (with a 'left it out' note if trimmed), Refuse honestly 'couldn't confirm the figures', all traced, first failure, re-check, still failing, 4+ words left and they pass, otherwise

Its rules are a compact lesson in what "the same number" means:

Rule Behaviour
Extraction Reads ₹/Rs/INR, Indian and western digit grouping, k/lakh/crore, %
Written precision A figure may differ from the data by the precision it is written in: "₹1.2 crore" allows ±0.1 crore; capped at 10%, so "₹1 crore" never passes for 1.25 crore
Headline exactness Ages, years and scores must match exactly ("2045" never passes for 2044)
Label binding A figure stated for one plan type that belongs to a sibling type is misattributed and fails
Materiality Money, percentages, numbers ≥ 1000 and headline figures are checked; small counts are only logged, unless stated as a leftover ("8 still pending" is a subtraction and must be in the data)
Sign A minus touching the figure makes it negative; "underwater", "net debt", Hinglish "karz" let a positive magnitude match a negative value
A word is not a unit In "2050 ke baad", "ke" is a Hindi word, not "k" for thousand
Other sources Figures from earlier answers, durations between two years the reply states, the user's own figures (as "echoes", never headlines), and glossary concepts like the 4% rule only beside the concept

The gate's intended behaviour is pinned by gate probes: 74 fixed sentences in 11 categories, each with the verdict the gate must give. They run in CI on every change with a 100% floor and zero tolerated false passes. On release they passed 74 of 74. The handbook is equally clear about what the gate cannot catch: qualitative errors ("you are on track" when code said otherwise), a true figure in a wrong frame, and an omission. Those are what the live evals and the judge are for.

A true figure in the wrong frame

A member asks "If I save ₹20,000 more a month, when could I retire?". The default path does not simulate what-ifs, so the right answer declines and may state the current plan's figure. In one release the narrator wrote "…you can retire at age 50 in 2050": every number traced to the plan, so the gate passed it, but it reads as the what-if's outcome. The fix was a prompt rule ("your current plan reaches FIRE in 2050", never "still") plus a live-eval check on the wording. It was the single failing turn of 157 in that release's suite.

Answers as prose plus cards

Each answer leads with the one figure that answers the question, then two to four sentences, then up to three cards from a fixed catalogue of about ten types (stat, table, timeline chart, goal list…) whose values code fills. Prose stays mandatory, so a client that ignores cards loses nothing. Future amounts show their value in today's money beside them, computed in code, because a "₹15 crore in 2044" means little without it. This is the structured output idea applied to the UI: the model never formats a table of numbers, which is exactly where figures used to drift.

One model per role, chosen by evals

A turn has several model jobs with different difficulty and volume, so each has its own model setting, and a model is promoted only by winning that job's eval on quality and cost together. As recorded on 30 September 2026, over 431 production turns:

Step Job Model (as of Oct 2026) Cost per turn
Classify Is this about the plan? gpt-5.4-mini USD 0.0011
Route Which chunks and utility? gpt-6-luna USD 0.0008
Narrate Write from the facts gpt-5.4 USD 0.0038
Total ≈ USD 0.0057 (about half a rupee)

Two decisions show the method. Moving routing from the mini model to the cheaper routing model kept routing accuracy (178 of 181 cases in the routing eval) and cut the turn from about USD 0.0099 to 0.0057. Moving narration to the cheap model as well would have cost only about USD 0.0014 a turn, but on the same 86 turns it passed the code checks on 81 and the judge on 73, against 84 and 84 for the larger model: rejected. Cost lives where the words are written, and that is where quality is judged. This is routing done statically, per role, rather than per request.

Latency: speculation, prefetching, caching and streaming

The sequential pipeline took 5.2 s at the median and 9.1 s at p95 on the stressed test plan. Four changes, each from shipping AI products, brought it down:

  • Speculative routing. Most questions are about the plan, so the selector call and the plan reads start at turn start, alongside classification, and are discarded if the classifier disagrees. The critical path became roughly \(\max(\text{classify}, \text{route}) + \text{narrate}\). Median 3.6 s, p95 5.8 s, for one wasted routing call on the 9–12% of turns that are not about the plan: about 1.2–1.6% more spend per average turn.
  • Prefetching. The two plan endpoints every turn needs are read at turn start; heavier ones are cached per simulation run, keyed by a fingerprint of the run so a cache entry can never outlive the plan it came from.
  • Prompt caching. Static text goes first (the narrator's system prompt and glossary, about 4,000 tokens; the selector's registry, about 7,000 tokens, split into its own system message). On warm turns 77–86% of prompt tokens came from the provider's cache, against about 30% before the selector's prompt was split. The classifier prompt, at about 640 static tokens, is below the provider's caching floor and gets no benefit.
  • Streaming through the gate. A streamed variant sends the cards as soon as code has built them, then releases each sentence only once the gate's check passes on everything released so far. On 16 test turns: cards at 1.6 s, first sentence at 2.7 s, whole answer at 3.0 s. If a later repair or refusal changes text already shown, a replace event corrects it.

Evals: five layers, cheapest first

Five eval layers, cheapest first; code decides, the judge advises
Five eval layers, cheapest first; code decides, the judge advises. Unit + integration tests code paths, real payload fixtures free, in CI, Gate probes fixed sentences + expected verdict free, in CI, 100% floor, Binding grader right figure on the right label free, in CI, Routing grader live selector picks the right chunks, Live conversations multi-turn, real test account, code checks per turn, LLM Five eval layers, cheapest first; code decides, the judge advises. Unit + integration tests code paths, real payload fixtures free, in CI, Gate probes fixed sentences + expected verdict free, in CI, 100% floor, Binding grader right figure on the right label free, in CI, Routing grader live selector picks the right chunks, Live conversations multi-turn, real test account, code checks per turn, LLM
Suite What it proves Size (Oct 2026) Cost per run
Unit + integration Code paths; the backend's wire contract against captured real payloads ~2,900 tests Free
Gate probes The gate passes and refuses the right sentences 74 sentences Free
Binding grader Given the right chunks, every figure binds to the right label 97 cases Free
Routing grader The live selector covers an accepted chunk set 183 cases ≈ USD 0.16
Live eval Whole conversations on a real test account, including ten personas 59 conversations, 216 turns ≈ USD 1.20 + judge

Several practices from evals in practice are visible here:

  • Point at the truth. A live-eval expectation names where the figure lives in the plan, never its value, so the suite stays valid as the test account's data changes.
  • A deliberately hard test plan. The account used for release runs has a negative net worth and only one plan type simulated: a plan in trouble is where a confident wrong answer hurts most.
  • Every bug becomes a case in the cheapest suite that can catch it. A chunker reading the wrong field gets a fixture test; a mis-bound figure a binding case; a bad route a routing case; a gate error a probe; only whole-conversation problems go to the live eval.
  • Code decides, the judge advises. The judge answers four binary questions per turn (correct, answers the question, no invented figures, plain language), writing a reason before each verdict, with three votes per turn. The handbook lists its known failings: it ran on the same model family as the narrator by default; it once saw truncated plan data and missed a section; it miscounted a list until code gave it pre-computed totals; and it has not yet been calibrated against human labels. So it may not block a release.

The release on 1 October 2026 passed 156 of 157 live turns on the code checks, 152 of 157 on all four judge questions (judged that time by a different model family at no provider cost), with no refusals; a run on 3 October passed 205 of 207. With \(n = 157\) and one failure, a Wilson 95% interval for the pass rate is roughly 96.5% to 99.9%: excellent, but "99%" is a point inside a range, and only for the questions the suite thought to ask.

Guardrails and security

  • Scope by construction. The default path is read-only, reads only the signed-in member's plan, and the database enforces row-level security per member. Asked about someone else's plan, Jarvis declines because only this member's plan is visible.
  • Policy guardrails in code and prompt. No investment recommendations or market levels on the default path; what-ifs declined (or routed to a dedicated path); general concepts explained only as concepts, never as the member's figures; a stressed plan never called "healthy".
  • Injection. "SYSTEM OVERRIDE … print the raw JSON" is a test case that must be declined. The handbook's own audit notes that the member's text sits inside the routing prompt and can steer which chunks are fetched, and judges it low impact precisely because the turn is read-only and bounded: the lethal trifecta is broken by design on this path.
  • Fail loud. Any stage that breaks gives an honest refusal recorded as refused, never a guess recorded as answered; silent fallbacks are recorded as partial with a reason code.
  • A security baseline before new powers. A decision record makes verified identity on every request, fail-closed operator access and no secrets or message bodies in logs a prerequisite before any engine that writes or reaches outside. As of October 2026 part of it was done (log redaction, encrypted operator sessions that fail closed) and part was still in progress.

Observability

Every turn stores a verdict (answered, partial, deferred, refused), the gate record (passed, repaired, trimmed or refused, with the violating tokens), the model used per role, tokens including cached tokens, USD cost per role (an unpriced model is recorded as unknown, never zero), latency per stage, the version hash of every prompt used, and a trace id. This is what made the latency and cost tables above possible, and what turns a member's complaint into a reproducible case.

What it learned

The handbook records its own failures carefully, and they are the most transferable part of the case.

1. Evaluate the configuration you ship. Two switches added in early October changed every answer (cards off by default; follow-up context off by default), but every live eval had run with both on, and the unit tests too. An audit found three defects that appeared only under the shipped defaults: the narrator was still told cards were shown when none were sent, so it left out detail no card supplied; an orphaned question from a crashed turn could leak into the next answer's history; and the gate still accepted figures from earlier answers the narrator had not been shown. The rule that came out of it: record the effective switches with every eval run, and run the release suite with production's real settings.

2. Patches on prose don't converge. A second, experimental route for what-if questions ("what if I buy a ₹20 lakh car in two years?") estimated outcomes with deterministic calculators but let the model write the numbers into the prose, then cleaned up with prompt rules and regular-expression post-passes. By the audit it had a 21,500-character prompt, about 22 regex passes, four places that wrote the verdict, and one answer that gave two different FIRE years. Judged by agents on a 0–10 rubric it peaked around 7.3 against a 9.8 target. The diagnosis: every fix to the words broke something else because the numbers lived in the words. The proposed rebuild removes the cause rather than the symptoms (below).

3. Simulate on a copy, never on the live record. A third path answered what-ifs with real simulations by temporarily writing a scenario into the member's Dream plan, running the plan, and resetting. On 4 October 2026 a backend change it did not know about (a run that skipped the Dream type unless explicitly asked) left a plan stranded in a cleanup-failed state that needed a person to recover. The agent was paused. The lesson matches how planning products generally work: run scenarios against a read-only simulation of a copy, so a failure cannot touch the member's data.

4. Grounding can be too generous. The gate grounds figures against the whole computed payload, including strings. An offline probe showed that the digits of an internal simulation id inside the payload's provenance could make an invented figure "grounded", and long year-by-year series make it likelier that a rounded invention lands near some real value. The proposed fix narrows grounding to projected figures and the years asked about. The general lesson: a checker is only as strict as the set it checks against.

5. Shared quotas are shared fate. Evals billed the same provider account as production. On 30 September and 1 October the balance ran out and every member's question was refused until it was topped up. Since then the turn records llm_quota_exhausted, a health endpoint and an alert fire on the first such error, live evals stop at the first quota error, only one model-based eval runs at a time, and evals can bill a separate key.

6. Write decisions down. The handbook keeps 25 architecture decision records, each opening with one sentence ("in the context of…, facing…, we decided for… and against…, to achieve…, accepting…"), with a status (accepted, diverged, proposed, superseded). When an October reassessment of an agent SDK contradicted an earlier rejection, the record shows both and why, which is exactly what a newcomer, or a future self, needs (Nygard, 2011).

Where it is heading (proposed, not built)

The October rebuild plan and decision records point at one change underneath all the others: numbers should never pass through model tokens at all.

Proposed direction: one router, one fact set, figures by reference
Proposed direction: one router, one fact set, figures by reference. Message, Router one strict-schema call: intent, slots, clarify, refuse, Form ask for missing inputs, Compute plan reads, real simulation, no model involved, Fact set every number has id, value, display, source, basis, Composer writes figures as references, never digits, Cards bound to fact ids, Compliance gate typed checks, missinProposed direction: one router, one fact set, figures by reference. Message, Router one strict-schema call: intent, slots, clarify, refuse, Form ask for missing inputs, Compute plan reads, real simulation, no model involved, Fact set every number has id, value, display, source, basis, Composer writes figures as references, never digits, Cards bound to fact ids, Compliance gate typed checks, missin
  • One routing call with a strict schema that can also clarify or refuse, replacing the separate classify and select calls (built behind a switch, off).
  • Slot narration: the model writes {{fact_id}} placeholders and code renders each figure, so the gate's job shrinks to "every slot resolves, no stray digits" (built behind a switch, off).
  • A single fact set as the only place a number exists, shared by prose and cards, so they cannot contradict each other.
  • What-ifs through a read-only simulation endpoint on the real engine, instead of Python approximations or writes to the live plan.
  • A bounded, read-only agent fallback for compound questions, chaining a few registry steps through the same facts and gate, never a free agent over raw data.

First principles

Reliability is a product of stages, so remove stages from the model's hands. If an answer needs the model to pick the right data, compute correctly, bind each figure to its label and phrase it, and each succeeds 97% of the time, the whole succeeds about \(0.97^4 \approx 88\%\). Jarvis moves computing and binding into code (≈100%) and checks the phrasing, leaving the model one job it is good at (picking from a menu, 98% in the routing eval) and one that a gate verifies.

Constrain the action space until it is testable. A free agent over raw JSON has an unbounded output space; nobody can enumerate what to test. A registry of named chunks and seven utilities has a finite one; each question family maps to an accepted set, and coverage can be counted. This is the same move as constraining decoding to a schema, applied one level up.

Faithful is not correct, and the design says so. The gate guarantees that figures came from the plan, not that the plan is right, nor that the sentence frames them correctly. Naming what a check does not guarantee is what tells you which other check you need: here, live evals for framing and a judge for tone, each with its own known blind spots.

Honest failure beats confident error in a trust product. Each fallback (repair, trim, refuse) trades completeness for correctness, and each is visible to the member ("I couldn't confirm one of the figures, so I've left it out") and to engineers (a verdict code). A finance assistant that is occasionally incomplete keeps users; one that is occasionally wrong loses them.

The maths

The precision rule

Let a reply state a figure \(\hat x\) written with its last significant digit in place value \(u\) (for "₹1.2 crore", \(u = 0.1\) crore; for "₹3 crore", \(u = 1\) crore). The gate accepts a grounded value \(x\) when

\[ |\hat x - x| \le \min(\tau(u),\ 0.10\,|x|) , \]

with \(\tau(u) = u\) for a decimal and \(\tfrac12 u\) for a whole number, and exact equality for headline ages, years and scores. "₹1.2 crore" passes for 1.25 crore (\(|1.2 - 1.25| = 0.05 \le 0.1\)); "₹1 crore" does not (\(0.25 > \min(0.5, 0.125)\)). The 10% cap is what stops a one-significant-figure rounding from passing for anything nearby.

Cost per turn

With per-million-token prices \(p_\text{in}, p_\text{cached}, p_\text{out}\) per role \(r\),

\[ C_\text{turn} = \sum_{r \in \{\text{classify, route, narrate}\}} \frac{n^{\text{in}}_{r} p^{\text{in}}_{r} + n^{\text{cached}}_{r} p^{\text{cached}}_{r} + n^{\text{out}}_{r} p^{\text{out}}_{r}}{10^6} \;+\; \mathbb 1[\text{repair}]\, C_\text{repair} . \]

The measured split (0.0011 + 0.0008 + 0.0038 USD) shows narration as two-thirds of the cost: it has the largest model and all of the output tokens. A 216-turn eval is \(216 \times 0.0057 \approx\) USD 1.2 before judging; with three judge calls per turn on the narrator's model, judging costs several times the answers.

Latency of the speculative turn

Sequential: \(T = T_c + T_s + T_f + T_n\). Speculative: \(T = \max(T_c,\ T_s + T_f) + T_n\), plus nothing on the 88–91% of turns where the classifier agrees. With the measured medians (classify 1.3 s, select 1.7 s, fetch ≈ 0, narrate 1.7 s) the critical path is about \(1.7 + 1.7 \approx 3.4\) s, against a measured median of 3.6 s.

Build it

A toy version of the number gate in about 45 lines of Python: extract figures with Indian units, apply the precision rule and the 10% cap, require headline ages and years to match exactly and to bind to the plan type the sentence names, then trim failing sentences or refuse. The facts are illustrative, not any member's data.

import re

# Figures code computed for this turn (illustrative values), keyed by label.
FACTS = {"basic age": 44, "secure age": 52, "basic year": 2044, "corpus 2044": 15.49e7,
         "net worth 2030": 3.05e7, "net worth today": -482_610}
HEADLINE = [v for v in FACTS.values() if not isinstance(v, float)] + \
           [int(w) for k in FACTS for w in k.split() if w.isdigit()]            # years in series keys
UNIT = {"lakh": 1e5, "crore": 1e7}
NUM = re.compile(r"(?P<neg>[−-])?(?P<cur>₹)?(?P<num>\d[\d,]*(?:\.\d+)?)\s*(?P<unit>lakh|crore)?")

def tolerance(raw: str, scale: float, value: float) -> float:
    """One unit of the last written decimal; half a unit of the last non-zero digit for whole numbers; capped at 10%."""
    digits = raw.replace(",", "")
    if "." in digits:
        tol = 10 ** -len(digits.split(".")[1]) * scale
    else:
        trailing = len(digits) - len(digits.rstrip("0"))
        tol = 0.5 * 10 ** trailing * scale
    return min(tol, 0.10 * abs(value))

def check(sentence: str) -> list[str]:
    bad = []
    named = [k for k in FACTS if k.split()[0] in sentence.lower()]          # labels the sentence names
    for m in NUM.finditer(sentence):
        scale = UNIT.get(m["unit"], 1)
        value = float(m["num"].replace(",", "")) * scale * (-1 if m["neg"] else 1)
        is_money = bool(m["cur"] or m["unit"])
        if not is_money and value < 3000:                                   # ages and years: exact
            pool = [FACTS[k] for k in named if not isinstance(FACTS[k], float)] or HEADLINE
            ok = value in pool
        else:
            ok = any(abs(value - v) <= tolerance(m["num"], scale, v) for v in FACTS.values())
        if not ok:
            bad.append(m.group(0).strip())
    return bad

draft = ("On your own you reach Basic FIRE at 44, in 2044. Your corpus grows to about ₹15.5 crore by then. "
         "By 2030 you would have about ₹3 crore. Your net worth today is −₹4,82,610. "
         "Secure FIRE comes later, at 44. That is about ₹1 crore of growth a year.")
kept = []
for s in re.split(r"(?<=\.)\s+", draft):
    bad = check(s)
    print(("PASS " if not bad else "FAIL ") + s + (f"   <- untraced: {bad}" if bad else ""))
    if not bad:
        kept.append(s)
answer = " ".join(kept)
print("\nSENT:", answer if len(answer.split()) >= 4 else "REFUSED: couldn't confirm the figures")

Output:

PASS On your own you reach Basic FIRE at 44, in 2044.
PASS Your corpus grows to about ₹15.5 crore by then.
PASS By 2030 you would have about ₹3 crore.
PASS Your net worth today is −₹4,82,610.
FAIL Secure FIRE comes later, at 44.   <- untraced: ['44']
FAIL That is about ₹1 crore of growth a year.   <- untraced: ['₹1 crore']

SENT: On your own you reach Basic FIRE at 44, in 2044. Your corpus grows to about ₹15.5 crore by then. By 2030 you would have about ₹3 crore. Your net worth today is −₹4,82,610.

"₹15.5 crore" passes for 15.49 (written to 0.1 crore); "₹3 crore" passes for 3.05 (half a crore, capped at 0.305 crore by the 10% rule). "Secure FIRE … at 44" fails although 44 is in the data, because 44 is Basic's age and the sentence names Secure: a misattribution. "₹1 crore of growth a year" fails because nobody computed it: the model did arithmetic. The real gate adds a repair pass before trimming, clause-level binding, materiality, negative words, prior-turn figures and durations, and 74 probes to pin all of it.

Things to try

  • Add a probe list: ten sentences with the verdict each should get, and a loop that reports any disagreement. That is a gate-probe suite.
  • Add the "leftover count" rule: a small number followed by "pending" or "remaining" must be grounded even though it is under 1,000.
  • Put a string field "provenance": "sim-48213" into FACTS and scan strings for digits the way a careless grounding walk would. Show that "Your corpus is 48,213." now passes, then fix it.
  • Replace typed figures with slots: render each fact as {{A}}, {{B}}… in a fact table, have the "model" write slots, and fill them in code after checking. What does the gate still need to check?

Check yourself

Why does Jarvis give the selector a registry of named chunks instead of the plan's JSON or a set of tools?

The whole JSON produced wrong leaves and invented totals and an unbounded set of figures to check; hundreds of fine-grained tools made the model pick the wrong one. A short menu of named chunks and seven utilities makes routing a finite classification problem that can be graded case by case, and limits what injected text could make it read.

What does the number gate guarantee, and what does it explicitly not?

That every material figure in the reply traces to this turn's computed data (or an allowed source) within its written precision, with ages, years and scores exact and labels bound. It does not guarantee that the plan is right, that a true figure is framed correctly (a current figure worded as a what-if outcome), that qualitative claims match, or that nothing important was omitted.

Why was narration kept on the more expensive model when routing moved to a cheaper one?

Each role was evaluated separately. The cheap model routed as well (178/181) at about a sixth of the cost, but as narrator it passed 81/86 code checks and 73/86 judge checks against 84 and 84. Narration is where users judge quality, so the saving was not worth it.

How did speculative routing cut median latency, and what does it cost?

The selector call and plan reads start at turn start in parallel with classification, so the critical path becomes max(classify, route) + narrate rather than their sum: 5.2 s → 3.6 s at the median. On the 9–12% of turns that are not about the plan, one routing call is wasted, about 1.2–1.6% more spend per average turn.

Why is the LLM judge advisory rather than blocking?

It has not been calibrated against human labels, it ran on the same model family as the narrator by default (self-preference risk), and it has made specific errors (truncated data, miscounting). Code checks are exact and decide; the judge's failures are prompts to read.

Hard: the default switches shipped differently from the evaluated configuration. Which general principle failed, and how would you enforce it mechanically?

"Evaluate the configuration you ship." Enforce it by recording the effective configuration (switches, model ids, prompt hashes) in every eval run and every trace, refusing to mark a release as evaluated unless a run exists with an identical configuration, and running the unit suite under the shipped defaults as well as the overrides.

Hard: the what-if route stalled around 7.3/10 despite many fixes. Explain the root cause in terms of this track's ideas.

Numbers were generated as free text by the model and then policed by prompt rules and regex post-passes. Each fix to the words could break another sentence, and different code paths computed the same quantity differently, so text, cards and verdicts contradicted each other. The structural fix is the one the default path already uses: compute in code into a single fact set, have the model refer to facts by id, and render figures in code.

Go deeper

Papers and essays behind the design

Articles

Docs

  • Prompt caching — OpenAI docs. The prefix rule behind ordering static text first.
  • The C4 model — Simon Brown. The context/container/component diagrams the handbook's architecture pages use.

The Jarvis handbook itself, with every decision record, the turn pipeline, the gate's full rule set, the eval guides and the October audit, is in the Document hub in admin.

Where this leads