Building a Read-Only AI Assistant for Bank Account Spending Analysis: Architecture and Practice
This article describes an architecture for an AI assistant that reads authorized bank and credit card transactions to categorize spending, flag upcoming bills, and answer cash flow questions. It covers the five-layer system design, authorization and data minimization, the transaction analysis workflow, and the engineering and risk controls needed to keep the assistant read-only and explainable.
1. From Bookkeeping Tools to Conversational Financial Analysis
Personal finance management has long faced a conflict. Users want to know where their money went, whether their cash flow will be safe next month, and whether they can afford a large expense. However, traditional bookkeeping tools require manual entry or frequent reconciliation, which makes them hard to adopt and hard to keep using. As smart assistants gain better natural language understanding, data summarization, and explanation abilities, a new general approach is emerging. With the user’s explicit authorization, the assistant connects to bank and credit card accounts through read-only access. It normalizes, categorizes, and aggregates transactions, then answers questions with spending overviews, bill reminders, and cash flow assessments.
The core of this capability is not managing money for the user. It is helping the user understand their money. The system design must therefore build the capability boundaries into the architecture. The assistant has read-only access. It cannot make transfers, invest, or provide investment advice. Every conclusion should be traceable to its data scope and calculation method. For uncertain questions, the assistant should state its assumptions, give ranges, and include risk notes instead of making absolute promises.
2. Capability Boundaries and User Value
From a general capability standpoint, a personal finance assistant typically offers the following value:
- Spending category overview: Summarizes spending by category, such as rent and utilities, shopping, dining, and transportation, so users can quickly identify their main expenses.
- Bill and cash flow reminders: Combines account balances, credit limits, and transaction history to flag bills that may come due before the next payday.
- Affordability analysis: Gives range-based judgments for large purchases such as travel, based on historical income and spending and the current balance.
- Financial term explanations: Explains specialized terms and fee items on statements in plain language.
- Data scope Q&A: Answers questions about account balances, transaction records, credit limits, and related data.
It must be clear, however, that the assistant only sees data within the authorized scope. It does not see the user’s complete financial picture. Category results may depend on the quality of merchant descriptions. Affordability judgments rely on assumptions and cannot replace advice from a licensed professional. In engineering terms, the “no investment advice” rule must be enforced through prompt templates, tool call boundaries, and output constraints.
3. System Architecture Layers
A practical personal finance assistant is typically organized into five layers:
- Session and client layer: Handles natural language questions, authorization prompts, result display, and the entry point for revoking authorization.
- Orchestration layer: Identifies user intent and decides whether to call an account query, transaction aggregation, budget calculation, or term explanation tool.
- Financial data gateway layer: Connects to a general account aggregation service. It handles account discovery, authorization redirects, token management, transaction synchronization, and field standardization.
- Data storage and computation layer: Stores de-identified account metadata, transaction records, categorization results, and audit logs. It supports incremental synchronization and aggregate calculations.
- Security and audit layer: Manages tenant isolation, key management, access control, log redaction, anomaly alerts, and the authorization lifecycle.
The key design principle is that the data gateway and the orchestration layer are decoupled. The AI assistant never handles bank passwords and never holds long-term credentials. It can read standardized data only through controlled tools. The account aggregation service acts as a general bridge layer. It handles authorization and data retrieval with the bank, and the business system receives only the fields it needs.
4. Authorization, Security, and Data Minimization
Read-only access is the security foundation of this approach. The key design points are:
- Passwords are never exposed: Users log in on the authorized provider’s page. The business system never sees bank passwords.
- Standard authorization and tokenization: Account data is accessed with short-lived tokens or controlled credentials. Tokens are stored encrypted and can be revoked.
- Minimum permission scope: The system requests only the fields needed for analysis, such as bank name, account name, account type, the last four digits of the account number, balance, credit limit, and transaction records for a limited time period.
- Read-only, with no fund operations: The system provides no transfer, payment, investment, or account management capabilities.
- Tenant isolation and encryption: Account data is isolated per user. Data is encrypted in transit and at rest. Encryption keys are managed separately from business data.
- Audit and log redaction: The system records who read which data, when, and which tools were called. Logs must never contain full account numbers, passwords, or sensitive credentials.
- Revocable authorization: Users can disconnect at any time. The system must then stop synchronization and clean up or freeze the related data.
At the infrastructure level, object storage, log services, monitoring and alerting, and key management from a general cloud platform can be combined to build an auditable data pipeline. This does not change the principle of minimum permissions on the business side.
5. Data Model and Analysis Workflow
Transaction data should be standardized before it is analyzed. Typical fields include transaction time, amount, currency, direction, account identifier, merchant description, category, original description, data source, and sync batch. The workflow is as follows:
- Incremental sync: Pull transactions by account and time window. Use idempotency keys to prevent duplicate records.
- Cleaning and deduplication: Handle refunds, reversals, and transfers between accounts, which are easy to confuse.
- Category labeling: Categorize transactions based on merchant descriptions, amount patterns, and user feedback. Low-confidence results go to review or manual labeling.
- Aggregate calculation: Generate spending summaries, trends, and budget comparisons by category, time period, and account.
- Question answering: After intent recognition, call data retrieval tools. Calculate first, then explain, and state the data scope and time basis in the output.
- Explainable output: For questions such as affordability, provide assumptions, ranges, and sensitive factors. Avoid absolute conclusions.
Pseudocode example:
function answer_finance_question(user_id, question):intent = classify_intent(question)accounts = fetch_authorized_accounts(user_id)txns = fetch_transactions(accounts, since=two_years_ago, until=today)clean = normalize_and_dedupe(txns)if intent == "spending_summary":data = aggregate_by_category(clean, month=current_month)return explain_with_scope(data, "按已授权账户与本月交易汇总")if intent == "bill_calendar":data = detect_recurring_bills(clean)return explain_with_assumptions(data)if intent == "affordability":cashflow = estimate_cashflow(clean, horizon=next_30_days)return range_based_answer(cashflow, assumptions=...)
6. Engineering Practice and Risk Control
Key engineering considerations include:
- Async processing and rate limiting: Run account synchronization, categorization, and aggregation as asynchronous tasks so they do not block the conversation. Apply rate limits and backoff to calls to the aggregation service.
- Caching and consistency: Cache frequently accessed fields such as balances for a short time. Update transaction summaries by sync batch, and show the data cutoff time in responses.
- Observability: Monitor sync failure rates, category confidence distribution, tool call latency, authorization revocation delay, and abnormal access.
- Gradual rollout and rollback: Test with a small group of paying subscribers in selected regions. Control feature access with switches, and support fast shutdown and data cleanup.
- Evaluation: Measure categorization accuracy, the share of answers that can be traced to source data, sensitive data leakage drills, hallucination rate, and a feedback loop for user corrections.
The main risks are privacy leaks, misleading results caused by categorization errors, hallucinated bills, unauthorized access, and delayed revocation of authorization. For questions such as “Can I afford this trip?”, the assistant should present its answer as an estimate based on the authorized data and historical patterns. It should also note factors not included in the analysis, such as debts, income fluctuations, and unexpected expenses.
Overall, a personal finance assistant combines account aggregation, data governance, intelligent Q&A, and security and compliance. It should stay read-only, use minimum permissions, and provide explainable and revocable results. It should keep understanding finances strictly separate from operating money. If future versions need to support major financial decisions, the better path is to work with licensed professionals and regulated institutions, rather than having a general-purpose assistant give investment advice on its own.
