Read-Only Architecture and Privacy Design for AI Assistants with Personal Financial Data
This article explains how to connect an LLM assistant to personal financial data under a read-only, minimized, and explainable design. It covers a four-layer architecture, user authorization and token management, data minimization and de-identification, natural-language query planning over deterministic calculations, and anomaly detection for duplicate charges.
Read-Only Architecture and Privacy Design for AI Assistants with Personal Financial Data
I. Scenario Background and Problem Definition
Personal finance applications have long faced the same problem: funds are spread across multiple banks, credit cards, and payment accounts, and users must switch between several apps to answer simple questions such as “Where did my money go this month?” or “How much is left before the next payday?” The data already exists. What is missing is the ability to aggregate dispersed data, explain it, and respond in natural language.
Introducing a large language model into this scenario can be broken down technically into three tasks: securely obtaining account data authorized by the user; converting the data into a structured, computable form; and returning evidence-based conclusions through conversation. If any of these three links fails, it can cause misleading answers or data leakage. This article therefore discusses the design layer by layer in the order of the data flow.
This scenario has three core constraints. First, read-only: the system can only read data and cannot move funds. Second, minimization: the system only obtains the fields and time ranges necessary to answer the question. Third, explainability: every conclusion can be traced back to the original transaction records.
II. Overall Architecture Design
A practical personal financial query system usually contains four layers:
- Access layer: completes authorization and data retrieval through account aggregation services or open banking APIs, and is responsible for credential management and token refresh.
- Data layer: standardizes retrieved account and transaction data, unifying amount units, transaction direction, time zones, and merchant names.
- Analysis layer: performs deterministic calculations such as classification, aggregation, and anomaly detection. The model does not perform arithmetic directly; it calls the results of this layer.
- Interaction layer: receives natural-language questions, generates query plans, organizes structured results into answers, and attaches evidence and notices.
The benefit of this layered design is that the model is only responsible for understanding intent and organizing language, while numbers always come from deterministic code. When the model hallucinates or misinterprets something, the error is confined to the presentation layer and does not directly become an incorrect amount.
III. Authorization and Account Access
1. User-initiated authorization
The authorization flow should require the user to complete identity verification on the account institution’s page. The application should not touch bank login passwords. The authorization result is a scoped, time-limited access token, and the token permission should be explicitly marked as read-only.
2. Credential management
Access tokens and refresh tokens are highly sensitive credentials. They should be stored in a key management service or encrypted storage, and must not be written to logs or appear in front-end code or error stacks. When a token expires, it should be refreshed silently. If refresh fails, the user should be prompted to reauthorize.
3. Authorization scope and revocation
Each account should be authorized separately, and users should be able to connect only some accounts. The system should provide an entry point for revocation at any time. After revocation, the system must immediately stop calling the service and delete local caches according to the data retention policy. The revocation action itself should be recorded in an audit log for later review.
The flow can be illustrated as follows:
User initiates connection-> Redirect to authorization page (user verifies on institution page)-> Return read-only token and account identifier-> Server encrypts and stores token-> Fetch data by account-> User revokes -> Revoke token and clear cache
IV. Data Scope and Minimization Principles
Data minimization is the foundation of privacy design. In a personal finance scenario, fields can be divided by purpose:
- Display fields: institution name, account name, account type, and last four digits of the account number, used to distinguish accounts in the interface.
- Calculation fields: balance, credit limit, transaction amount, transaction time, transaction description, and merchant category.
- Sensitive fields: full account number, identity information, and contact information. These fields are usually unnecessary in this scenario and should be discarded directly at the access layer.
The time window should also be limited. Most analysis needs are measured in months or quarters. Transactions going back more than two years are mostly used for annual reports or anomaly baseline modeling. If the system supports a longer history, it should retrieve data in segments based on need rather than importing everything at once.
De-identification should be completed before data enters the model context. For example, merchant descriptions may contain phone numbers or order numbers. Rules should be used to replace them first, and then the text should be passed to the generation stage.
V. Implementation Path for Natural Language Queries
When a user asks “Where did my money go this month?”, the system generally goes through the following steps:
- Intent recognition: determine whether the question is a summary, comparison, prediction, or explanation.
- Parameter extraction: determine the time range (this month), account scope (all authorized accounts), and statistical dimension (spending category).
- Query plan generation: map natural language to predefined query templates rather than letting the model directly assemble arbitrary query statements.
- Execution and aggregation: execute parameterized queries on a read-only data copy.
- Result organization: the model generates a textual explanation based on structured results and lists the sources of key numbers.
An illustrative pseudocode example is as follows:
function answer_spending_question(user_id, period):accounts = get_authorized_accounts(user_id)txns = fetch_transactions(accounts, period, read_only=true)txns = normalize(txns) # unify currency, direction, time zonetxns = exclude_transfers(txns) # internal transfers are not spendingsummary = group_by_category(txns, sum_field="amount")total = sum(summary.values())return {"period": period,"total": total,"breakdown": summary,"sources": [t.id for t in txns]}
There are two details worth noting in this pseudocode. First, internal transfers must be excluded; otherwise, when the same funds move between two accounts, they will be counted twice as spending. Second, transaction IDs are retained in the return structure so that the answer can be traced back. When users verify the answer, they can directly locate the original records.
VI. Anomaly Transaction Detection
Anomalies in personal finance usually fall into three categories: duplicate charges, unexpected fees, and recurring bills that keep rising. The detection methods for the three categories are different and should be designed separately.
1. Duplicate charges
The judgment rule can be based on three conditions: the same amount, the same merchant, and a short time interval. The rule itself needs to be carefully defined.
