Goldcrest is a household financial planning tool that replaces spreadsheet forms with a conversational interface. You answer short questions in a chat. The agent extracts income, expenses, asset values, and timeline assumptions, then feeds them into a Monte Carlo simulation that projects your financial trajectory across thousands of market paths.
The interesting plumbing is the boundary between the LLM-driven conversation layer and the deterministic financial engine. The agent must maintain dialogue state across multiple turns, validate inputs, resolve ambiguity, and serialize a complete parameter set without letting the LLM touch arithmetic or generate advice.
Architecture: Conversation State to Simulation Parameters
The system splits into three layers:
- Conversational agent: Asks questions, parses natural language responses, maintains dialogue context.
- Parameter store: Holds structured financial data (income streams, expense categories, asset balances, tax rates) on the server.
- Monte Carlo engine: Runs deterministic simulations using the parameter store as input.
The agent never performs calculations. It extracts values and categories from user responses, writes them to the parameter store, and hands off to the engine. The engine produces every number in the projection.
Data Flow
User input (natural language) ↓ LLM extracts structured fields ↓ Validation layer (type checks, range constraints, consistency rules) ↓ Parameter store (server-side, pseudonymized for LLM calls) ↓ Monte Carlo engine (deterministic, no LLM involvement) ↓ Year-by-year projections + probability distributions The LLM sees pseudonymized data when it needs context for follow-up questions. Actual dollar amounts and identifiable details stay on the server. The model receives tokens like <income_source_1> or <expense_category_2> instead of "salary from Acme Corp" or "mortgage payment."
Dialogue State Management
The agent tracks which parameters it has collected and which are still missing. A typical rent-vs-buy scenario requires:
- Current income (gross, net, frequency)
- Expected income changes (raises, bonuses, career shifts)
- Monthly expenses (housing, utilities, groceries, discretionary)
- Savings and investment balances
- Debt obligations (student loans, car payments)
- Home purchase details (price, down payment, mortgage rate, closing costs)
- Rental costs (monthly rent, expected increases)
- Timeline (years until retirement, life expectancy assumptions)
- Risk tolerance (asset allocation, withdrawal strategy)
The agent maintains a checklist. After each user response, it updates the parameter store and decides whether to ask a clarifying question, move to the next category, or declare the parameter set complete.
Handling Ambiguity
When a user says "I make around 80k," the agent must resolve:
- Gross or net?
- Annual, monthly, or biweekly?
- Single income or household total?
- Expected to change?
The system uses a two-pass approach. First pass: extract the stated value and write it to the parameter store with a confidence flag. Second pass: ask targeted follow-up questions only for low-confidence fields. This avoids the "20 questions" problem where every input triggers a cascade of clarifications.
If the user provides conflicting information across turns (e.g., "I spend $3k a month" followed later by "my rent is $2k and other expenses are $1.5k"), the agent flags the inconsistency and asks which figure to trust.
Validation and Constraint Logic
The parameter store enforces constraints before allowing a simulation run:
- Income must be positive.
- Expenses cannot exceed income by more than available savings.
- Asset allocations must sum to 100%.
- Mortgage terms must match standard products (15, 20, 30 years).
- Tax rates must fall within plausible ranges for the jurisdiction.
The validation layer runs after each parameter update. If a constraint fails, the agent asks a corrective question rather than proceeding with invalid inputs.
Example Validation Table
| Parameter | Constraint | Failure Behavior |
|---|---|---|
| Annual income | > 0, < $10M | Reject, ask for correction |
| Monthly expenses | > 0, < income + savings drawdown | Warn, allow override |
| Down payment | 0-100% of home price | Reject if outside range |
| Mortgage rate | 0.1%-20% | Reject, flag as likely error |
| Asset allocation | Sum to 100% ± 0.01% | Reject, show current total |
| Retirement age | 50-80 | Warn if < 60 or > 75 |
The system allows overrides for warnings but hard-blocks on constraint violations that would break the simulation.
Serialization and Handoff to the Engine
Once the parameter set passes validation, the system serializes it into a JSON structure:
{ "income_streams": [ {"source": "salary", "amount": 80000, "frequency": "annual", "growth_rate": 0.03} ], "expenses": [ {"category": "housing", "amount": 2000, "frequency": "monthly", "inflation_adjust": true}, {"category": "discretionary", "amount": 1500, "frequency": "monthly", "inflation_adjust": true} ], "assets": [ {"type": "checking", "balance": 15000}, {"type": "retirement", "balance": 120000, "allocation": {"stocks": 0.7, "bonds": 0.3}} ], "scenarios": [ {"name": "rent", "housing_cost": 2000, "housing_type": "rent"}, {"name": "buy", "housing_cost": 2500, "housing_type": "own", "home_price": 500000, "down_payment": 100000, "mortgage_rate": 0.065, "term_years": 30} ], "timeline": {"current_age": 32, "retirement_age": 65, "life_expectancy": 90}, "simulation_params": {"iterations": 10000, "inflation_mean": 0.025, "market_return_mean": 0.07, "market_volatility": 0.15} } The Monte Carlo engine reads this JSON, runs 10,000 iterations with randomized market returns and inflation rates, and produces:
- Year-by-year net worth projections (median, 25th percentile, 75th percentile)
- Probability of meeting retirement goals
- Sensitivity analysis (which parameters have the largest impact)
The engine writes results back to the parameter store. The frontend fetches them and renders charts.
Security and Data Handling
The system pseudonymizes data before sending context to the LLM. The LLM never sees:
- Actual dollar amounts
- Account numbers
- Employer names
- Addresses
Instead, it receives abstract tokens and category labels. When the LLM generates a follow-up question, the server substitutes real values back in before displaying to the user.
This limits exposure if the LLM provider logs requests or if a prompt injection attack tries to exfiltrate data. The worst an attacker can extract is the structure of the conversation, not the financial details.
Prompt Injection Mitigation
The agent uses a strict output schema. Every LLM response must be valid JSON with predefined fields:
{ "next_question": "string", "extracted_values": {"field_name": "value"}, "confidence": "high | medium | low", "needs_clarification": ["field_name"] } If the LLM returns anything outside this schema, the system rejects it and retries with a stricter prompt. This prevents the LLM from injecting arbitrary text or attempting to execute commands.
Failure Modes
Incomplete parameter sets: If the user abandons the conversation halfway through, the parameter store is incomplete. The system blocks simulation runs until all required fields are populated. The agent can resume from the last saved state.
Garbage inputs: If the user provides nonsensical values ("I make negative $50k a year"), the validation layer catches it. But if they provide plausible but wrong values ("I spend $500 a month" when they actually spend $5000), the simulation runs with bad data. The system relies on the user to review and correct extracted values before finalizing.
LLM hallucination: The LLM might misinterpret a response and extract the wrong value. The system shows every extracted parameter to the user for confirmation. The user can edit any field before the simulation runs.
Market assumption drift: The Monte Carlo engine uses historical return and volatility distributions. If future market behavior diverges significantly, projections will be wrong. This is a modeling limitation, not a plumbing failure.
Technical Verdict
Use Goldcrest's pattern when:
- You need to gather structured data from users who hate forms.
- The downstream process (simulation, calculation, workflow) requires deterministic inputs.
- You can clearly separate the conversational layer from the execution layer.
- You have well-defined validation rules and can enforce them before handoff.
Avoid this pattern when:
- The parameter space is too large or too ambiguous for multi-turn dialogue.
- Users need to see all fields at once to understand dependencies.
- Real-time feedback on intermediate results is critical (forms with live calculations work better).
- You cannot tolerate the latency of LLM calls for every user input.
The key insight is treating the LLM as a data extraction tool, not a reasoning engine. The agent asks questions and parses answers. The deterministic engine does the math. This keeps the system auditable and prevents the LLM from generating financial advice or performing calculations it will get wrong.
