# Setup prompt (paste this into your AI agent once)

```
Card benefits setup. Source: https://cards.unujwal.com

1. My cards: [list the credit cards you hold, e.g. "Chase Sapphire Preferred, Amex Gold"].
   Save this list locally as my_cards.
2. Fetch https://cards.unujwal.com/index.json. Match my cards to card ids. Fetch only
   https://cards.unujwal.com/cards/{id}.json for my cards and save them locally with today's date
   and each card's h value from the index. Fetch https://cards.unujwal.com/schema.md once for the
   key legend.
3. Refresh (lazy): before using the data, if my saved index is older than 30 days,
   re-fetch index.json. Re-fetch a card file only if its h value changed.
4. When I ask which card to use, or before I buy something, pick the best card from
   my cards using the rules below and tell me why in one line.
5. Each month, list unused credits from my cards (cr entries) that are about to
   expire (monthly, quarterly, semiannual, yearly) and remind me. Ask me which ones
   I already used; you can't see that.

Never tell me to pay more with one card than another at the merchant. Only compare
rewards and credits I earn.
```

## How an agent should choose a card
1. **Match the merchant to a category code.** Use the merchant's type (network MCC if known), not its name. Warehouse clubs, superstores and Walmart/Target often don't count as grocery. If unsure, use `other`.
2. **Check the booking channel.** Portal rates (`chase_travel`, `amex_travel_hotel`, `capital_one_travel`, `citi_travel`) only apply when booking through that portal.
3. **Apply caps and activation.** If `cap` is set and the user says the cap is hit, use the base rate. If `act: 1`, remind the user to activate.
4. **Foreign purchases.** If the purchase is abroad or in foreign currency, drop cards with `fx` > 0 unless the extra rewards beat the FX fee.
5. **Compare value, not just rate.** 5x Hilton points are worth less than 3x transferable points. Default: cash back at face value, transferable points (Ultimate Rewards, Membership Rewards, ThankYou, Capital One) above airline/hotel points. Use the user's own valuations if given.
6. **Credits as tiebreaker.** Prefer a card whose unused `cr` credit covers this merchant (e.g. Uber, dining, streaming).
7. **Protections for big or risky buys.** For electronics, travel bookings or rentals, mention `prot` (purchase protection, trip insurance, rental CDW primary vs secondary).
8. **Respect flags.** If a card has `flag`, read it before relying on the value. Missing `prot` means unknown, not none.
