Building a Read-Only AI Assistant for Personal Finance: A Technical Practice
This article examines how to add a read-only personal finance analysis module to a conversational AI assistant. It covers the four-layer read-only permission architecture, the natural-language-to-structured-query pipeline, expense analysis and anomaly detection, explainability, declarative visualization, and staged rollout with compliance guardrails. The key takeaway is to treat the model as an explanation layer and deterministic logic as the fact layer, backed by least privilege and full auditing.
1. From Q&A to Analysis: Positioning the Capability
A conversational AI platform recently announced a personal finance analysis module, rolled out gradually to higher-tier subscribers in select regions. The module is not designed to manage money on the user’s behalf. Instead, it combines natural language interaction with read-only account data to help users understand their own cash flow structure.
Technically, this is a natural-language-to-structured-query pipeline: the user asks in everyday language, and the system performs intent recognition, entity extraction, query orchestration, result aggregation, and explanation generation. The value is not in making investment decisions but in lowering the barrier to understanding financial data.
The product deliberately enforces strict permission boundaries: read-only access only, with no ability to move funds, manage accounts, or invest on the user’s behalf; no advertising and no sponsored recommendations; no credit card issuance, no lending, and no proprietary savings accounts. These constraints are both compliance requirements and a practical application of the principle of least privilege.
2. Read-Only Permission Architecture: Controlling Risk by Design
In personal finance, security boundaries must come before feature design. A read-only architecture typically has four layers of control:
- Credential isolation: The AI service never holds the user’s bank credentials. Authorization is completed through a standardized open banking authorization flow, and tokens are issued with minimal scope.
- API allowlist: Only read-only endpoints such as balance lookup and transaction detail queries are exposed; write endpoints are rejected at the gateway layer.
- Data minimization: Only the fields and time windows required to answer the question are fetched, avoiding full synchronization.
- End-to-end auditing: Every query records the calling identity, timestamp, data scope, and purpose, making it traceable.
An illustrative policy configuration looks like this:
policy:role: finance-readonlyallow:- account.balance.read- transaction.list.readdeny:- transfer.create- payment.initiate- account.writescope: user_consent_ttl_90daudit: full
The critical point is that even if the model’s output is inaccurate, it cannot cause irreversible financial consequences. Risk is confined to “information misunderstanding,” which is manageable.
3. Natural Language to Structured Query: Engineering the Intent Layer
User questions are often colloquial and omit the subject, for example, “Where did my money go this month?” The system needs three conversion steps:
- Intent classification: Determine whether the request is a balance query, spending summary, anomaly detection, terminology explanation, or chart generation.
- Slot filling: Fill in the time range, account set, category dimension, and aggregation method.
- Query orchestration: Translate the slots into concurrent calls to read-only endpoints and perform aggregation on the server side.
A simplified intermediate representation:
{"intent": "expense_summary","time_range": "current_month","accounts": "all_linked","group_by": "category","output": ["table", "chart"]}
The recommended engineering split is to put computation in a deterministic service layer and leave expression to the model layer. Statistics and aggregation are done by code; the model only rewrites the results into language the user can understand. This division significantly reduces the probability of numerical hallucination.
4. Expense Analysis and Anomaly Detection
Expense analysis typically outputs category shares and month-over-month changes. Implementation depends on normalizing transaction records: mapping raw descriptions from different institutions to a unified taxonomy, then handling edge cases such as refunds, installments, and cross-month posting.
Anomaly detection relies more on combining rules with statistics:
- Duplicate charges: The same merchant, a similar amount, appearing multiple times within a short interval.
- Hidden fees: Small amounts, vague descriptions, recurring periodically.
- Quiet bill increases: Year-over-year and month-over-month comparison of recurring subscriptions, flagging items whose increase exceeds a threshold.
- Sleeping subscriptions: Recurring charges that have gone unused for a long time.
if merchant == prev.merchant and abs(amount - prev.amount) < 0.01and interval_hours < 48: flag("duplicate_charge")if recurring and yoy_increase > 0.15: flag("price_creep")
Rules deliver high precision, statistics deliver recall, and the combined output is handed to the model to generate explanatory text. This is a fairly robust combination.
5. Terminology and Explainability: Define First, Then Compute
For terms such as annual percentage rate, interest calculation methods, and compounding periods, the correct order is to explain the concept first and then provide the number. This requires decoupling the terminology library from the calculation engine: the library supplies standard definitions, and the engine computes the current interest or total fees from actual transaction records.
Explainability should also support drill-down at every level: any aggregated figure can be expanded into the corresponding list of transactions so the user can verify it. For key amounts, the product explicitly prompts the user to cross-check against bank records, which is an honest handling of model uncertainty.
6. Visualization and Custom Dashboards
Charts, bill-due calendars, and custom dashboards are essentially a lightweight presentation configuration layer. A declarative description is recommended, so the model generates configuration rather than plotting code directly:
{"widget": "bar","dimension": "category","metric": "amount","range": "last_30_days","refresh": "on_demand"}
The benefit is that output is controllable, verifiable, and adjustable at any time, while avoiding the security risk of generating arbitrary executable code.
7. Staged Rollout, Evaluation, and Compliance Guardrails
This kind of capability is well suited to a staged rollout: open to a small group first, collect failure samples, build an evaluation set covering numerical accuracy, terminology explanation quality, and anomaly recall, and define refusal and human-handoff policies. On compliance, it must not provide investment advice, must not funnel users to financial products, must not display sponsored content, and must clearly state capability boundaries in the interface.
The reusable lesson for developers is to treat the model as the “explanation layer” and deterministic logic as the “fact layer,” with least privilege and full auditing as the safety net. To support foundational capabilities such as bill parsing, log auditing, and monitoring alerts, a general-purpose combination of object storage, message queues, container platforms, and logging services is sufficient, with no dependency on any proprietary interface. Baidu AI Cloud also offers mature solutions on this kind of general cloud infrastructure and can serve as a reference foundation for building such a read-only analysis pipeline.
