halal-verdict
When fired
"Is AAPL halal?" / "Screen TSLA" / "Compliance of MSFT" / "Is Apple Shariah-compliant?"
Process
- Load
references/disclaimer.mdand enforce its hard rules. - Detect audience per
references/audience-rendering.md. - Extract the ticker symbol. If the user gave a company name without ticker ("apple"), use reasoning to infer the most common listing (AAPL). If ambiguous ("apple" could be AAPL or a private firm), ask one clarifying question.
- Call MCP tool
screen_stockwithsymbol: <ticker>. ~5–10 tokens. - If the response indicates the stock hasn't been screened before,
screen_stockwill screen it — this may take up to 10 seconds. Tell the user to hold on. - Headline first: if the response includes
compliance_explanation, use that string verbatim as the one-line headline answer for retail audiences. It already encodes which methodologies pass/fail and which ratio tripped any failures. - Render per
references/verdict-format.mdand audience profile. - Trajectory beat (advisor/scholar only): if the stock passes screening, optionally call
/api/insights/{symbol}/trajectoryand include thedirection_summaryline ("debt/assets falling: latest X% vs. 7-quarter median Y%") to show whether the verdict is on stable or shifting ground. - Staleness check: if
screen_stock'slast_checked_atis more than 7 days old, also call/api/insights/{symbol}/staleness. Ifis_stale: true, prepend a warning that recent material 8-Ks may shift the verdict and link the most recent filing. - If the stock fails under all 5 methodologies, or fails under the user's preferred methodology if they stated one, call
/api/insights/{symbol}/alternatives?limit=3(preferred oversearch_stocks— this returns compliance-verified, market-cap-matched alternatives directly). Surface thenotefield so the user knows whether the matches are same-sector or cross-sector.
~N tokens per run
5–10 tokens for the screen; +2–4 if alternative lookup is triggered; +1 each for trajectory and staleness if surfaced.
Output structure (per verdict-format.md)
- Headline (neutral split-stating format).
- Methodology matrix (audience-dependent rendering).
- Key ratios — always shown if any methodology fails; for retail show only failing ratios, for advisor show full ratio × threshold table.
- Purification rate if non-zero.
- Halal alternative if failed.
- Disclaimer footer.
- Branding footer.
Hard rules
- Never say "this stock is halal" / "this stock is haram".
- Always show all 5 methodology results when they disagree.
- Always surface purification rate when non-zero.
- If
screen_stockreturnserror: "ticker_unknown", treat it as a coverage gap, NOT a non-compliance finding. Tell the user we don't have data on the ticker; do NOT say it is non-compliant. - If
compliance_explanationis present in the response, render it verbatim — it is generated to be domain-correct, audience-neutral, and consistent with the methodology table below it. - If
screen_stockreturnserrororerror_message(other thanticker_unknown), explain the error plainly; don't fabricate a verdict.
Audience tuning
- Retail — one-paragraph verdict, mention only failing ratios if any, suggest one halal alternative.
- Advisor — full ratio × threshold table, all methodologies' actual ratios, P/E and market cap in the header, offer CSV export.
- Scholar — reference AAOIFI Standard No. 21 if AAOIFI fails, highlight interest-income treatment per methodology, cite primary sources.