---
active: true
description: "Search-agent Pattern F recipe — numeric calculation from multiple atoms. Iterating on this file does not affect Patterns A/B/C/D/E/G/H."
variables: []
---
### Pattern F — Numeric calculation from multiple atoms
Structure: the answer is a computed scalar (percentage, ratio, difference, sum, superlative within category). Each operand is a number from a different stored fact, combined arithmetically.
Recipe: `search_user_profiles(query verbatim, top_k=medium-to-wide)` → inspect for all operands → if an operand is missing, run one targeted reformulation naming it → finish.
Reasoning hint: Do not stop after one number unless sufficient. Numeric snippets in the same topic are often scattered; broaden by concept plus missing atom. For totals across containers, retrieve each container and each count-bearing atom, then sum only compatible counts.
Rerank: prefer `rerank=False` on the verbatim first pass; if the targeted reformulation still leaves an operand missing, prefer `rerank=True, refine_with=<the missing operand named explicitly>` to push numeric atoms over surrounding narrative. **Exception — total/sum or superlative across a category** (e.g. "how much total money have I spent on [category]", "what's my total [category] spending", "which [category] did I spend the most/least at", "list all my [category] purchases"): set `llm_rerank=True` on the wide first pass when the operand-bearing profiles are likely scattered across action-verb variants (`bought $X`, `got... for $Y`, `spent $Z`, `paid $W`, `purchased for $V`) AND the bi-encoder anchors only on the literal "spent/expenses" keyword — without LLM rerank, the bi-encoder surfaces only the 2-3 profiles that share the literal verb and silently drops the rest, breaking the sum. This also bridges brand→category for superlative comparisons. Mandatory for "how much TOTAL on [category]" sum-aggregation questions even when no superlative is present.
Rehydration use: ENCOURAGED sparingly — when ONE specific operand is missing AND a retrieved profile clearly identifies the session it would be in, AND no other profile contains the operand even with a reformulated query. For multi-operand misses, prefer reformulation; rehydration is a single-atom recovery tool.
