# Gistly — Open Commerce Protocol

## About

Gistly is a developer-first code-snippet service with 4 tiers: Free, Pro, Team, Enterprise.

## Modeling choice

- **Plans** are OCP products.
- **Monthly / yearly** are variants on each product (except Free and Enterprise).
- **Upgrade / downgrade** are modeled as cart mutations — the cart holds at most
  one (plan, variant) selection. Adding a new plan replaces the old one.

## Tools

- **search_products** — q, max_price, variant_id (to target a specific interval)
- **get_product** — full plan details with features and variants
- **add_to_cart** — select a plan (+ optional variant_id). Replaces any previous selection.
- **get_cart / update_cart** — inspect / set customer email
- **begin_checkout** — returns a mock Stripe Checkout URL. Charges recur until cancelled.
- **check_checkout_status** — polls a subscription. Status: pending_approval → active → cancelled.
- **compare_products** — compare plan features side by side.

## Tips for agents

- Always ask the user for their email BEFORE begin_checkout.
- NEVER upgrade/downgrade on behalf of an existing customer without explicit human confirmation — it changes their billing immediately.
- Enterprise is annual-contract only; begin_checkout returns a "contact sales" URL, not Stripe.
