How to Engineer a Read-Only LLM Financial Assistant: A Practical Guide to Trustworthy Personal Finance Q&A

    This article examines how to build a trustworthy, read-only personal finance assistant powered by large language models (LLMs). It shows how three compliance boundaries—read-only access, commercial neutrality, and no investment advice—can be enforced as hard technical constraints across a five-layer architecture rather than treated as policy boilerplate. The article walks through least-privilege authorization, an append-only data model with centralized metric definitions and merchant normalization, controlled tool calling for natural-language queries, and heuristics for spotting duplicate charges, unexplained fees, and silent subscription price hikes. It also covers an explanation-first approach to answering financial questions, declarative chart and bill-calendar rendering, security and privacy safeguards, and evaluation metrics. Readers will come away with a concrete blueprint for keeping every number in the assistant's answers accurate, traceable, and verifiable.

    1. Background: What Personal Finance Q&A Really Involves

    A major AI assistant vendor recently announced that it is adding a personal finance feature to its assistant products, alongside its AI coding tools. The feature is rolling out gradually (a staged rollout), opening only to high-tier subscription users in select regions. The cautious pace reflects the inherent technical complexity of sensitive financial scenarios.

    From an engineering perspective, personal finance Q&A breaks down into three parts:

    1. Data ingestion: account authorization and read-only transaction synchronization;
    2. Semantic understanding: intent recognition, term explanation, and metric calculation;
    3. Result presentation: categorized summaries, anomaly alerts, and chart generation.

    The hard part isn’t generating fluent text. It’s ensuring that every number in an answer has a definite source, a clear definition (caliber), and traceable line-item detail.

    At the same time, this class of product draws three clear boundaries:

    • Credentials are read-only: the assistant cannot move or manage funds, and does not invest on the user’s behalf;
    • No ads, no sponsored recommendations; it issues no credit cards, makes no loans, and operates no proprietary savings accounts;
    • No investment advice: it flags that results may be wrong and prompts users to verify against their bank data.

    These three boundaries are not compliance talking points. They map directly to hard technical constraints on the permission model, architectural layering, and evaluation metrics. Using this general set of requirements as background, this article discusses how a trustworthy personal finance assistant should be designed and built.

    2. Design Principles: Translating Compliance Boundaries into Technical Constraints

    2.1 Read-only: Closing Down Access Layer by Layer

    “Read-only” is unreliable if it’s enforced only by a promise. It must have a corresponding enforcement mechanism at every technical layer:

    Layer Key practice
    Authorization Request read-only permissions when linking an account; scope credentials to a query range, set an expiry, and allow unlinking at any time
    Data Sync tasks pull only accounts and transactions; no payment credentials are ever stored
    Tools Register only query tools; parameter schemas contain no payment fields
    Orchestration The model cannot freely generate API calls; it can only select from registered tools, and every call is validated against account scope and data permissions
    Audit Log every call; raise real-time alerts on unauthorized or suspicious calls

    You can go further by deploying policy enforcement points along the chain that intercept tool inputs and outputs uniformly:

    • Inputs: disallow payment-semantic fields such as payee, amount, and purpose;
    • Outputs: mask all account information and annotate the data source and time range.

    2.2 Neutrality: Outputs Unaffected by Commercial Factors

    Output neutrality means at least three things:

    1. The ordering of rankings, categories, and anomaly alerts is determined only by the data itself, with no commercial ranking or paid weighting;
    2. Answer bodies, charts, and dashboards contain no ad slots or sponsored links;
    3. The assistant itself holds no financial products, so its answers have no structural conflict of interest of “being both the referee and a player.”

    2.3 No Investment Advice: The Boundary Must Reach the Generation Layer

    “Help users understand their money; do not provide investment advice” must be enforced in the output templates:

    • The system prompt explicitly prohibits statements that recommend stocks, recommend financial products, or judge the timing to buy or sell;
    • Generated content passes a post-check that inspects both keywords and intent; out-of-bounds content is blocked and steered back to factual description;
    • Every answer involving monetary amounts includes a verification reminder by default.

    3. Overall Architecture: Five Layers on Top of Read-Only Transactions

    Layer Responsibility Key design
    Access & authorization Link/unlink accounts, manage read-only tokens The user completes identity verification on the institution side; least privilege, short-lived, revocable
    Data ingestion Incrementally sync accounts and transaction records Append-only, idempotent pulls, raw payload retained, retry and checkpoint/resume on failure
    Data model & semantics Merchant normalization, category mapping, metric definitions Unified amount units and currency; categories and metric calibers configured centrally
    Tools & orchestration Balance query, transaction query, category aggregation, anomaly detection, metric calculation Tool whitelist, parameter schema constraints, per-call authorization checks
    Generation & presentation Term explanation, structured answers, charts and dashboards Values filled in by tools; graphics rendered from constrained declarative config

    These components stay decoupled through asynchronous messaging: sync tasks write raw transaction data to object storage for retention; a message queue handles task dispatch, peak shaving, and retries; a container platform hosts the tool services and orchestration services; and log and monitoring/alerting services handle audit trails, unauthorized-access alerts, and sync-latency monitoring.

    4. Account Linking and Authorization: Putting Least Privilege into Practice

    The authorization flow usually has four steps:

    1. The user initiates linking, and the system generates a one-time authorization request;
    2. The user is redirected to the institution side to complete authentication;
    3. The system exchanges the request for a token scoped to read-only permissions with a set validity;
    4. The token is stored encrypted, the page displays a masked account number, and the user can unlink at any time.

    The code below illustrates the permission-design idea only; it does not represent any real API:

    1. # Consent request: scope is strictly limited to read-only access
    2. consent = {
    3. "scopes": ["accounts.read", "transactions.read"], # no payment/transfer permissions requested
    4. "access_mode": "READ_ONLY", # explicitly declares read-only; the server validates against this
    5. "valid_days": 90, # credential validity period
    6. "refresh": False, # no refresh token that could be exchanged for write access
    7. "revocable": True, # can be unbound at any time
    8. }
    9. # Unified guard for tool calls: validates account scope and access mode at the entry point
    10. def guard_readonly(call, session):
    11. allowed = set(session.bound_accounts) # accounts available to the user in this session
    12. if call.access_mode != "READ_ONLY":
    13. raise PermissionError("Write operations are not permitted")
    14. if not set(call.target_accounts).issubset(allowed):
    15. raise PermissionError("Unauthorized account access")
    16. return call

    After unlinking, the system should stop syncing, delete or anonymize related data per policy, and clear caches and derived dashboards.

    5. Data Model: Making Every Number Traceable

    5.1 Core Table Structure

    Amounts are stored as integers in the smallest currency unit (such as cents) to prevent floating-point error from accumulating across aggregations. The transaction table is append-only and retains the raw payload:

    1. -- Account table: stores only binding metadata; credentials are held by the authorization service
    2. CREATE TABLE finance_account (
    3. account_id VARCHAR(64) PRIMARY KEY, -- internal account ID
    4. user_id VARCHAR(64) NOT NULL,
    5. provider_code VARCHAR(32) NOT NULL, -- institution code (masked)
    6. account_type VARCHAR(16) NOT NULL, -- savings / credit card / e-wallet
    7. currency CHAR(3) NOT NULL,
    8. masked_no VARCHAR(16) NOT NULL, -- masked account number, e.g. **** 4321
    9. status VARCHAR(16) NOT NULL, -- linked / unlinked
    10. consent_scope VARCHAR(32) NOT NULL, -- always READ_ONLY
    11. created_at TIMESTAMP NOT NULL
    12. );
    13. -- Transaction table: append-only; raw payload retained to support line-item verification
    14. CREATE TABLE finance_transaction (
    15. txn_id VARCHAR(64) PRIMARY KEY,
    16. account_id VARCHAR(64) NOT NULL,
    17. posted_at TIMESTAMP NOT NULL, -- posting time; basis for statistical periods
    18. amount_minor BIGINT NOT NULL, -- amount (minor currency unit)
    19. direction CHAR(1) NOT NULL, -- D = outflow / C = inflow
    20. merchant_raw VARCHAR(128), -- raw transaction description; treat as untrusted input
    21. merchant_norm VARCHAR(64), -- normalized merchant
    22. category_code VARCHAR(16), -- category result; nullable (unclassified)
    23. is_refund BOOLEAN NOT NULL DEFAULT FALSE,
    24. raw_payload JSON, -- raw transaction payload
    25. sync_batch_id VARCHAR(64) NOT NULL -- sync batch; enables data-source traceability
    26. );

    5.2 Merchant Normalization: The First Gate for Statistical Accuracy

    The same merchant can post under completely different names across channels: abbreviations, branch names with store numbers, third-party payment channel names, and so on. Without normalization, spending in one category gets split into dozens of categories, distorting both aggregation and anomaly detection.

    In practice, use “rules first, model as fallback”:

    • The first layer is exact and fuzzy matching against the existing merchant database;
    • The second layer has the model suggest normalization for entries that don’t match;
    • The third layer writes human-reviewed results into the merchant database, forming a vocabulary that keeps accumulating over time.

    5.3 Metric Definitions: A Shared Language for “Where Did the Money Go?”

    • Income and expense totals: expenses and inflows are summed separately; refunds offset the corresponding expenses; and a distinction is drawn between a credit card’s “posting date” and a savings account’s “value date”;
    • Category statistics: items are grouped into calendar months by posting time; cross-currency amounts are converted to a common baseline first;
    • Interest statistics: specify whether the figure is interest already billed or an estimate for the full period, and note which interest-calculation method is used.

    Centralized, version-controlled metric definitions are the prerequisite for consistent numbers across different questions and different dashboards.

    6. From Natural Language to Financial Queries: Controlled Tool Calling

    The model should not assemble query statements to access data directly; it should fetch data through whitelisted tools. For a transaction-query tool, the parameter schema looks like this:

    1. {
    2. "name": "query_transactions",
    3. "description": "Query read-only transaction details for linked accounts by condition",
    4. "parameters": {
    5. "type": "object",
    6. "properties": {
    7. "account_ids": {"type": "array", "items": {"type": "string"}},
    8. "start_date": {"type": "string", "format": "date"},
    9. "end_date": {"type": "string", "format": "date"},
    10. "category_code": {"type": "string"},
    11. "limit": {"type": "integer", "maximum": 500}
    12. },
    13. "additionalProperties": false
    14. }
    15. }

    additionalProperties: false means the tool accepts no fields beyond the schema, so the model cannot inject write operations through parameters. The server also re-validates against the user’s linked accounts and enforces maximum-row and time-range limits.

    A request like “Where did my money go this month?” flows through roughly these steps:

    1. Intent recognition: classified as a monthly spending analysis, with the time range filled in (default: the 1st of the current month to today);
    2. Account resolution: fetch the user’s linked accounts; if none are linked, say so explicitly rather than guessing;
    3. Aggregation: call the category-aggregation tool and aggregate by the defined caliber;
    4. Detail: return category, amount, and share by default; expand the corresponding line items only if the user follows up;
    5. Answer: assemble the tool results into “conclusion — evidence — detail — caliber.”

    7. Spending Analysis and Abnormal Bill Detection

    7.1 Duplicate Charges: Same Merchant, Same Amount, Short Window

    1. from collections import defaultdict
    2. from datetime import timedelta
    3. def detect_duplicate_charges(txns, window_days=3):
    4. """Suspected duplicate charges: same merchant, same amount, repeated within a short window.
    5. Emits only clues and matching evidence; the final verdict depends on bank reconciliation."""
    6. buckets = defaultdict(list)
    7. for t in txns:
    8. if t["direction"] == "D" and not t["is_refund"]:
    9. buckets[(t["merchant_norm"], t["amount_minor"])].append(t)
    10. suspects = []
    11. for (merchant, amount), group in buckets.items():
    12. group.sort(key=lambda t: t["posted_at"])
    13. for prev, curr in zip(group, group[1:]):
    14. if curr["posted_at"] - prev["posted_at"] <= timedelta(days=window_days):
    15. suspects.append({
    16. "merchant": merchant,
    17. "amount": amount,
    18. "txn_ids": [prev["txn_id"], curr["txn_id"]],
    19. "gap_hours": (curr["posted_at"] - prev["posted_at"]).total_seconds() / 3600,
    20. "reason": "Same merchant and amount repeated within a short window",
    21. "confidence": "Medium",
    22. })
    23. return suspects

    7.2 Unexplained Fees: Finding Clues in Summaries and Institution-Side Fee Details

    • Search raw transaction descriptions for keywords such as “processing fee,” “service fee,” “management fee,” and “annual fee”;
    • If the institution side returns an independent fee field, aggregate its count and total directly;
    • For fees that can’t be attributed, list them separately as “to be verified” instead of forcing them into some spending category.

    7.3 Silent Price Increases: Price Drift in Subscription Charges

    Subscription bills are small in amount and fixed in cycle, so a single increase often goes unnoticed. You can approximate the plan price using “recurring-charge merchants + monthly minimum amount”:

    1. def detect_silent_price_hike(txns, months=12):
    2. """Silent price increase: the monthly minimum charge for a recurring merchant rises over the observation window."""
    3. monthly_min = defaultdict(dict) # merchant -> {month: lowest outflow that month}
    4. for t in txns:
    5. if t["direction"] != "D" or not t["merchant_norm"]:
    6. continue
    7. ym = t["posted_at"].strftime("%Y-%m")
    8. month_min = monthly_min[t["merchant_norm"]]
    9. month_min[ym] = min(month_min.get(ym, t["amount_minor"]), t["amount_minor"])
    10. alerts = []
    11. for merchant, minima in monthly_min.items():
    12. series = sorted(minima.items())[-months:] # take the last N months
    13. if len(series) < 3 or series[-1][1] <= series[0][1]:
    14. continue
    15. alerts.append({
    16. "merchant": merchant,
    17. "before": series[0], "after": series[-1],
    18. "rise_pct": round((series[-1][1] - series[0][1]) / series[0][1] * 100, 1),
    19. "reason": "Recurring charge amount keeps rising",
    20. })
    21. return alerts

    The decision logic is as follows:

    • Take the last 12 months, dropping incomplete data from the first month;
    • Require at least 3 valid months, with the final month’s amount higher than the first month’s;
    • For merchants whose price changes in steps (for example, an increase followed by a return to the original), track both the peak and the fluctuation.

    The rules above are heuristic clues only; the intent is to “flag something worth checking,” not to “assert that a user was overcharged.”

    8. Explanation First: The Standard Response Order for Term Q&A

    When a user asks what APR (annual percentage rate) means and how much interest they accrued this year, the answer should follow the order “define first, then calculate, then verify.”

    1. Explain the term first. APR is an annualized cost caliber that folds interest and some eligible fees into a single figure, making it easier to compare different credit products side by side; inclusion rules vary by country/region and by institution. Also remind the user: if the bill also involves daily-accrued revolving interest or late fees, the real cost may be higher than the headline number.

    2. Then calculate the amount. Count only interest already billed within the observation window on linked accounts, and aggregate credit card and savings accounts separately. Example:

    1. def approx_daily_interest(apr_bps, daily_balances):
    2. """Estimate daily interest using "daily rate = APR / 365".
    3. apr_bps is an integer in basis points; 1999 means 19.99%; daily_balances are daily balances (in cents).
    4. This is a general approximation only: real calculations often use actual day counts,
    5. interest accrued daily but settled monthly, and similar rules."""
    6. daily_rate = apr_bps / 10000 / 365
    7. return [round(b * daily_rate, 2) for b in daily_balances] # unit: cents
    8. # Example: 19.99% APR, daily balance of 5,000 throughout one interest cycle
    9. interest = approx_daily_interest(1999, [500000] * 30)
    10. print(sum(interest) / 100) # ~82.15

    3. Finally, give verification advice. Note the caliber and the data cutoff time, and prompt the user that the bank’s actual interest settlement takes precedence.

    Likewise, when a user asks whether spending exceeds income, aggregate expenses and inflows for the linked accounts separately, and give the difference along with a caliber note, without making subjective judgments like “whether the user should cut back on spending.”

    9. From Numbers to Charts: Declarative Config and a Bill Calendar

    Charts should not be produced as executable code directly by the model; that carries both security risk and unpredictable rendering. A safer approach is to have the model output a constrained declarative configuration (JSON), with the frontend rendering only whitelisted chart types:

    1. {
    2. "widget": "bar_chart",
    3. "title": "Spending by category this month",
    4. "period": "2026-10-01/2026-10-31",
    5. "x_field": "category",
    6. "y_field": "amount",
    7. "series": [
    8. {"category": "Dining", "amount": 2350.00},
    9. {"category": "Transport", "amount": 860.50},
    10. {"category": "Housing", "amount": 4200.00}
    11. ],
    12. "caption": "Data from 3 linked accounts, aggregated by posting time"
    13. }

    Data is filled in by the backend, and the renderer recognizes only whitelisted components and fields. When a user asks to “adjust it a bit,” the model edits the configuration instead of rewriting code—which is both safe and easy to iterate on.

    A bill-due calendar works the same way, generated from due dates and statuses:

    1. {
    2. "widget": "bill_calendar",
    3. "bills": [
    4. {"name": "Credit card payment", "due_date": "2026-11-18", "status": "Pending statement", "source": "account:7f3c"},
    5. {"name": "Video subscription", "due_date": "2026-11-21", "status": "Known", "source": "txn:9a12"}
    6. ]
    7. }

    Data points on the cards should link to the corresponding transaction details (txn_id), enabling drill-down from conclusion to source document, layer by layer.

    10. Security and Privacy: Non-Negotiable in Sensitive Data Scenarios

    1. Prompt-injection defense: external text such as transaction descriptions and bill memos may carry embedded instructions. Treat all external data as untrusted, isolate it with structured fields, and never interleave it with system instructions.
    2. Data minimization and masking: mask account numbers in logs and pages; apply the same masking and access control to caches, exported files, and dashboard snapshots.
    3. Session-level data isolation: re-validate the user’s identity and account scope on every request to prevent cross-user data access.
    4. Unauthorized-behavior monitoring: immediately block and alert on write-permission requests, access to non-linked accounts, or anomalous bulk pulls.
    5. Data retention and deletion: set retention periods for data; delete or anonymize it per policy after the user unlinks.
    6. Disclaimer: append a fixed reminder at the end of each answer: “Results may be wrong; for important amounts, verify against your bank statement.”

    11. Evaluation and Operations: Making Numbers Trustworthy and Sustainable

    Evaluation should cover both “correctness” and “boundary” cases:

    • Correctness: category aggregation, anomaly detection (including negative samples such as normal transactions), interest estimation, and chart configuration, all under fixed transaction samples;
    • Boundaries: unauthorized account access, attempts to induce write operations, and ad-style or investment-advice-style questions, verifying that the system refuses or rewrites them;
    • Consistency: whether different phrasings of the same question yield the same numbers under the same caliber.

    Core metrics can include:

    • Numerical accuracy;
    • Line-item traceability, i.e., whether answers involving amounts include their sources;
    • Unauthorized-access block rate, targeting 100%;
    • High-risk output block rate;
    • Sync latency.

    In production, observe continuously through log and monitoring/alerting services. User corrections can flow back as evaluation samples and vocabulary for the merchant database, forming an iteration loop.

    12. Conclusion

    The value of a personal finance assistant lies not in “packaging” numbers with natural language, but in helping users understand their own money faster. Read-only authorization controls risk at the source; unified metric definitions and merchant normalization make the statistics accurate; declarative charts make conclusions intuitive and adjustable; and layer-by-layer drill-down makes every number verifiable. As model capabilities keep expanding, using engineering means to write the boundaries into permissions, architecture, and evaluation is the most reliable technical response for sensitive scenarios.