| name | sg-manage-cart |
| description | Manage Sweetgreen carts using the local `sg` CLI. Use when asked to find restaurants, inspect menu data, resolve product or ingredient IDs, add/update/remove cart items, check auth/cart state, or troubleshoot Sweetgreen CLI cart operations. |
SG Manage Cart
Use this skill to operate Sweetgreen cart flows through sg on the local machine.
Workflow
- Verify CLI availability and auth state.
- Resolve restaurant and menu information.
- Apply cart mutations.
- Re-check cart state and report exact outcomes.
Step 1: Verify CLI and Session
Run:
command -v sg
sg auth status
Prefer browser-cookie mode when cart changes should match the web checkout session:
sg auth import-browser-cookies --domain sweetgreen.com
Use OTP mode when browser import is unavailable:
sg auth login --email <email>
Interpreting sg auth status
- In browser mode (
"auth_mode": "browser"), the fields has_session_id,
session_id_preview, email, and the refresh/authorization token fields
belong to local OTP auth and are expected to be null/false. Do not treat
them as a sign the user is logged out.
- Browser auth is healthy when
browser_session_logged_in is true. This is
a live check against the Sweetgreen API using the imported cookies.
- Only ask the user to log into sweetgreen.com in their browser (and re-run
sg auth import-browser-cookies) when browser_session_logged_in is
false, or a cart command fails with "browser session is not logged in".
Step 2: Resolve IDs and Menu Details
Find restaurant IDs:
sg menu restaurants --query "<city|neighborhood|zip|name>"
Inspect products and ingredients:
sg menu products --restaurant-id <id> --search "<text>" --include-ingredients
sg menu product --restaurant-id <id> --name "<product name>"
sg menu ingredient --restaurant-id <id> --name "<ingredient name>"
Step 3: Mutate Cart
Prefer name-based cart edits:
sg cart add-by-name --product-name "<product>" --custom-name "<user>'s <base item name>" --additions "<ingredient>" --removals "<ingredient>"
Use ID-based add/update when explicit IDs are provided:
sg cart add --product-id <product_id> --quantity 1 --custom-name "<user>'s <base item name>" --additions <ingredient_id>
sg cart update --line-item-id <line_item_id> --product-id <product_id> --quantity <n> --custom-name "<user>'s <base item name>"
sg cart remove --line-item-id <line_item_id>
sg cart clear
Step 4: Verify and Report
Always verify final cart state:
sg cart view
sg cart count
Summarize:
- Matched restaurant/product/ingredient IDs
- Actions completed
- Final cart line items. Include totals only when explicitly requested by the user.
Owner-Aware Naming
- When an item belongs to a specific person, set
--custom-name to <user>'s <base item name>.
- Keep the original base item name in the custom name (for example,
davide's harvest bowl).
- Do not include modifications (add/remove/substitute details) in the custom name.
- For follow-up requests like "update mine", match the sender to their custom-named line item first.
Guardrails
- Confirm destructive actions (
remove, clear) when user intent is ambiguous.
- Do not claim checkout is complete; this CLI manages cart state only.
- Do not place or submit orders, and do not offer to place orders.
- On failures, include debug report paths from
~/.sweetgreen/debug/.
Reference
Use references/command-recipes.md for common task-to-command mappings.