Building a Read-Only AI Assistant for Personal Finance Analysis: A Technical Practice

    This article presents a general technical approach for building an AI assistant that connects to personal bank accounts in a strictly read-only mode and answers natural-language questions about spending, recurring charges, and interest. It covers a four-layer architecture, read-only credential and field-allowlist design, implementation ideas for spending categorization, anomaly detection, term explanation, and dashboards, as well as trust, compliance, interaction boundaries, and testing checklist. Readers will learn how to deliver explainable and verifiable financial analysis under minimal permissions without adding any write capabilities.

    1. Background and Problem Definition

    A new product pattern has recently emerged in the industry: after obtaining user authorization, an intelligent assistant connects to personal bank accounts in a read-only manner and answers questions in natural language, such as “Where did my money go this month?”, “Are there any duplicate charges?”, and “What does the annual interest rate mean?” A cloud vendor and several platforms are also exploring similar capabilities. Setting aside specific product attributes, this article abstracts the problem into a general technical question: How can we provide explainable and verifiable financial analysis for individual users under strictly read-only and least-privilege conditions?

    The technical difficulty of this kind of feature lies not in the “conversation” but in three things:

    1. Permission boundaries: The assistant must never have write capabilities such as transfers, payments, or investments;
    2. Data minimization: Only the fields necessary to complete the task are retrieved, and their residence time is kept as short as possible;
    3. Trustworthy results: Every statistical conclusion must be traceable to specific transaction details, allowing users to reconcile with their bank.

    2. Overall Architecture: Four Decoupled Layers

    It is recommended to split the system into four layers that communicate through explicit contracts, preventing permission overreach and data spread.

    1. ┌─────────────────────────────────────────┐
    2. │ 1. Conversation layer: intent recognition, clarification, result presentation │
    3. ├─────────────────────────────────────────┤
    4. │ 2. Orchestration layer: task planning, tool selection, result validation │
    5. ├─────────────────────────────────────────┤
    6. │ 3. Capability layer: balance query / transaction aggregation / classification / anomaly detection │
    7. ├─────────────────────────────────────────┤
    8. │ 4. Access layer: read-only credentials, field allowlist, auditing │
    9. └─────────────────────────────────────────┘

    Key constraint: Write capabilities do not enter the capability layer. Credentials issued by the access layer do not support fund transfers at the protocol level, eliminating the possibility of “the model being induced to transfer money” at the architectural level.

    3. Read-Only Permissions and Credential Design

    Read-only is not just a promise; it must be implemented as a verifiable mechanism:

    • Scoped credentials: The authorization scope includes only account information reading and transaction detail reading, and excludes permissions such as payment, direct debit, and card-linking changes;
    • Field allowlist: The interface layer exposes only necessary fields, such as account type, currency, available balance, transaction time, amount, direction, and merchant description, while masking sensitive information such as ID numbers, full card numbers, and CVV;
    • Short-lived and revocable tokens: Tokens have a short validity period, and users can revoke them with one click at any time on the authorization management page;
    • Full-chain auditing: Each data access records the caller, purpose, field scope, and timestamp for later traceability.

    An illustrative policy declaration (pseudocode, expressing only the idea of constraints):

    1. policy: finance-readonly
    2. allow:
    3. - action: account.balance.read
    4. - action: transaction.list.read
    5. deny:
    6. - action: transfer.create
    7. - action: payment.initiate
    8. - action: account.link.write
    9. field_allowlist: [currency, available_balance, posted_at, amount, direction, merchant_label]
    10. retention: session_only

    4. Implementation Ideas for Core Capabilities

    4.1 Spending Classification and Statistics

    When a user asks about “where the money went this month,” the system first determines the time window and the set of accounts, then pulls the transactions, and finally aggregates them by category. Classification can adopt a “rules first, model fallback” strategy: first match merchant description keywords and industry codes to categories such as dining, transportation, housing, and subscriptions; for those that cannot be matched, the model provides candidate categories with a confidence score.

    1. def summarize_spending(txns, start, end):
    2. buckets = defaultdict(decimal.Decimal)
    3. for t in txns:
    4. if t.direction == "out" and start <= t.posted_at < end:
    5. buckets[classify(t)].amount += t.amount
    6. total = sum(buckets.values(), decimal.Decimal(0))
    7. return sorted(buckets.items(), key=lambda kv: kv[1].amount, reverse=True), total

    Implementation notes: amounts must always use a decimal fixed-point type, and floating point is prohibited; classification results must retain the “original merchant description” so users can verify them.

    4.2 Anomalous Bill Detection

    Anomaly detection should focus on problems that are “easily overlooked but can be rule-based,” avoiding unnecessary alarm:

    • Duplicate charges: The same merchant and the same amount appearing multiple times within a short window;
    • Unexplained fees: Very small amounts, descriptions containing words like “fee” or “service charge,” and high frequency;
    • Silent price increases: Recurring subscription charges that keep rising slightly over several cycles;
    • Idle subscriptions: Recurring charges for services that have not been used for a long time.
    1. def detect_anomalies(txns):
    2. alerts = []
    3. # Duplicate charges: same merchant and same amount multiple times within 24 hours
    4. groups = group_by(txns, key=lambda t: (t.merchant_label, t.amount))
    5. for k, g in groups.items():
    6. if len(g) > 1 and within_hours(g, 24):
    7. alerts.append(("duplicate", k, [t.id for t in g]))
    8. # Silent price increase: recurring charge amounts rising consecutively
    9. for sub in recurring(txns):
    10. if strictly_increasing(sub.amounts, window=3):
    11. alerts.append(("price_creep", sub.merchant_label, sub.tx_ids))
    12. return alerts

    Every alert must carry the identifier list of the supporting transactions, which users can expand to view details with one click.

    4.3 Term Explanation and Macro Judgment

    For questions such as “What is an annual interest rate?” and “How much interest did I pay this year?”, the correct order is explain first, then calculate: first use a general definition to explain the meaning of the annualized interest rate and differences in interest calculation methods, then aggregate the annual total based on interest-related transactions in the linked accounts. For “whether spending exceeds income,” the statistical scope should be clarified (whether income includes salary and refunds, and whether spending includes credit card repayments); when the scope is inconsistent, the assistant should proactively seek clarification rather than give a seemingly precise but actually vague conclusion.

    4.4 Visualization and Custom Dashboards

    Charts, bill-due calendars, and custom dashboards are essentially multiple views of the same aggregated result. It is recommended to separate “query—aggregate—render”: the aggregation result is returned as structured data, and the rendering layer supports three forms—bar charts, timelines, and calendars—and allows users to adjust the time granularity and category scope and recalculate immediately.

    5. Trust and Compliance: Engineering Constraints That Cannot Be Omitted

    • Zero ads and zero recommendations: The finance module displays no ads and does no sponsored ranking, avoiding conflicts of interest; the assistant itself does not issue credit cards, provide loans, or operate its own savings accounts, ensuring the neutrality of answers.
    • Explainability first: Every number can be drilled down to transaction details, with the statistical scope and data cutoff time labeled.
    • Manual verification as a fallback: It should be clearly indicated that results may be wrong, and important amounts should be reconciled with bank statements.
    • Data minimization and short residence: Intermediate results are cleared when the session ends and are not used for purposes unrelated to the current task.
    • Failures must be explicit: When data is not synchronized, an account is not linked, or there is no data in the time window, this should be clearly stated rather than filled with zero values or speculation.

    6. Managing Boundaries in Conversational Interaction

    A natural-language entry point can easily create the misunderstanding that “it can make decisions for me,” so the interaction layer needs to enforce three boundaries: it performs no fund operations, gives no buy or sell advice, and represents no financial institution. For requests beyond these boundaries, it should directly state the scope of its capabilities and guide the user back to supported analysis tasks. At the same time, for vague questions, it should seek clarification once rather than repeatedly, reducing interaction cost.

    7. Testing and Acceptance Points

    • Permission testing: Attempt to construct write-operation requests and verify that they are rejected at the access layer;
    • Amount precision testing: Accumulating a large number of small transactions produces no cent-level error;
    • Classification consistency testing: The same transaction is classified stably across multiple queries;
    • Traceability testing: Any statistical conclusion can be restored to the set of details;
    • False-positive assessment for anomalies: Set thresholds for duplicate-charge and price-increase rules to control the false-positive rate.

    8. Conclusion

    The value of read-only personal finance analysis lies not in providing more numbers, but in turning a vague sense of money into verifiable facts. The real engineering moat is restraint in permissions, transparency of statistical scope, and traceability of results. Doing these three things solidly allows an intelligent assistant to be both useful and trustworthy in personal finance scenarios.