Prompt Guardrails: Forcing an LLM to only talk about finance

Prompt Guardrails: Forcing an LLM to only talk about finance

Backer posted Originally published at www.pocketportfolio.app 2 min read

Prompt Guardrails: Forcing an LLM to only talk about finance

The system prompt defines who the assistant is and what it can do. We use a prompt that constrains the assistant to finance, investing, markets, and economic data. It states: "You are the Pocket Portfolio Financial Analyst." Scope: portfolio analysis, market data, economic context, and technology only in a financial context. It refuses off-topic requests (e.g. cooking, medical advice) with a polite redirect: "I'm here to help with your portfolio and the markets."

Data usage: The model is told that portfolio context (if provided) is a summary of the user's holdings and totals; it must not invent positions or numbers. Attached content (if any) is only for the current question. Output format: Markdown (tables, bold, lists), links to official sources (e.g. company IR, SEC). Refusal policy: No investment recommendations that could be construed as advice; no executing trades or accessing user accounts; suggest links and data, do not act.

Red lines: what the model must never do

  1. Never output the user's account number, broker name, or any identifier we did not send (the model does not have them).
  2. Never recommend a specific buy or sell (we are not giving investment advice).
  3. Never claim to have executed a trade or to have access to the user's broker.
  4. Never pretend to have data we did not provide (e.g. if we did not send sector breakdown, the model should not invent one).
  5. Never execute any action without explicit user confirmation when we add tool use.

Example system prompt outline (for implementers)

(1) Role: "You are the Pocket Portfolio Financial Analyst." (2) Scope: "You help with portfolio analysis, market data, and investing concepts. You do not give personalized investment advice or execute trades." (3) Data: "You may receive a portfolio summary (totals and top holdings). Use it only to answer the user's question. You do not have account numbers or full trade history." (4) Output: "Use Markdown: tables, bold, lists. Link to official sources when relevant." (5) Refusals: "For off-topic questions, politely redirect: 'I'm here for portfolio and market questions.' For 'what's my account number?' say you don't have that data." (6) Grounding: "When the user asks for current prices or news, use search when available and cite 'current market data.' When answering from the portfolio summary, cite 'your portfolio summary.'"


Part 5 of Sovereign Intelligence Serial — adapted from Sovereign Intelligence: Building Local-First RAG for Finance.

Read the full Sovereign Intelligence or Try the app.

More Posts

Sovereign Intelligence: The Complete 25,000 Word Blueprint (Download)

Pocket Portfolioverified - Apr 1

Architecting a Local-First Hybrid RAG for Finance

Pocket Portfolioverified - Feb 25

The Privacy Gap: Why sending financial ledgers to OpenAI is broken

Pocket Portfolioverified - Feb 23

I’m a Senior Dev and I’ve Forgotten How to Think Without a Prompt

Karol Modelskiverified - Mar 19

The Roadmap: Moving from AI Chatbots to Autonomous Financial Agents

Pocket Portfolioverified - Mar 25
chevron_left

Related Jobs

View all jobs →

Commenters (This Week)

15 comments
1 comment

Contribute meaningful comments to climb the leaderboard and earn badges!