# Competitor Price Check

Run scheduled price and stock checks on named competitor pages and report deltas versus your own catalog.

## When to use

- You want a recurring watch on named competitor product pages for price or stock changes.
- You need a delta report comparing competitor prices against your catalog, not a one-off manual lookup.
- You want alerts routed to a human when a change implies an action above an approval threshold.
- You need the check to run unattended on a schedule (daily, hourly) without a person kicking it off each time.

## Tools

- `browser-navigate`
- `browser-extract`
- `http-get`
- `shell-execute`
- `schedule-task`

## Playbook

1. Set up the recurring job first with `schedule-task` (for example, run daily at 07:00 in the org's timezone) so the check happens without manual triggering.
2. For each named competitor URL, use `browser-navigate` to open the product page.
3. Use `browser-extract` on the loaded page to pull the current listed price, currency, and stock/availability status.
4. Pull your own catalog price for the matching SKU with `http-get` against the org's catalog API, for example `GET https://api.example.com/v1/products/{sku}`. Auth is injected by the org's Integration row for this host — never ask for, echo, or hardcode credentials. On 401/403 or a missing Integration, stop and use `send-message` to notify a human, naming the service and the scopes needed.
5. Use `shell-execute` to run a small script that computes the delta (absolute and percentage difference) between the competitor price and your catalog price for each SKU checked in this run.
6. Append the run's results (competitor, SKU, your price, their price, delta, stock status, timestamp) to a persistent log file with `shell-execute`, so trends are visible across runs.
7. If any delta implies a price change or refund action above the org-set threshold, do not apply it — create a `create-task` approval request describing the SKU, the suggested change, and the size of the delta, and route it to a human for sign-off.
8. If a delta is small and within the org's auto-notify range (below the approval threshold), summarize the findings in a plain report of "competitor, SKU, price then vs now, stock status."
9. If a competitor page structure has changed and `browser-extract` cannot find a price or stock field, do not guess a value — flag that page as unreadable in the report and suggest a human review the selector.

## Failure modes

- A competitor page redesigns its layout, so `browser-extract` returns no price or the wrong field, producing a false "price drop" or "price increase."
- The catalog API call via `http-get` returns 401/403 because the org's Integration for that host has expired or was never configured, silently skipping catalog comparison for that SKU.
- A competitor site blocks automated navigation (bot detection, CAPTCHA, geo-block), so `browser-navigate` loads an error or interstitial page instead of the real listing.
- A large detected delta gets treated as routine and reported only, instead of being escalated through `create-task`, because the threshold check was skipped or misconfigured.

## Done when

- Every named competitor URL for this run has been checked, with either a price/stock delta recorded or an explicit "unreadable" flag.
- All deltas above the org-set threshold have a corresponding `create-task` approval request awaiting human sign-off, and none were auto-applied.
- The run's results are logged and the `schedule-task` recurrence is confirmed so the next check happens automatically.